How to exit the program using the close button in XCB

Unable to find a link to how to close the application with the "X" button. I program with XCB and want to close the program with the "X" button. I looked and could not find anything about it. I know how to close by clicking a button. In addition, by pressing the "X" button, the window looks as if it is closing, but does not.

+4
source share
1 answer

I struggled with this topic a while ago.

Take a look at http://marc.info/?l=freedesktop-xcb&m=129381953404497 .

The key is to store the cookie for WM_DELETE_WINDOW in a separate cookie ...

xcb_intern_atom_cookie_t cookie2 = xcb_intern_atom(c, 0, 16, "WM_DELETE_WINDOW"); xcb_intern_atom_reply_t* reply2 = xcb_intern_atom_reply(c, cookie2, 0); 

and in the event loop compare client_message with cookie2

 case XCB_CLIENT_MESSAGE: { if((*(xcb_client_message_event_t*)event).data.data32[0] == (*reply2).atom) ... } 
+14
source

Source: https://habr.com/ru/post/1389878/


All Articles