Can not find any reference on how to close application by the "X" button. I'm programming using XCB and want to close the program by the "X" button. I looked and can't find anything about it. I know how to close by pressing a button. Also, by pressing the "X" button the window looks like it closes but doesn't.
Disable the Close button (X) of selected windows. - Press Ctrl+1 to Enable or Disable the Close button of the active window. - Press Ctrl+2 to Add a rule. - Automatic enabling and disabling of close buttons on program start and stop, and on window creation. - Change hotkeys and automation options.
Instead, it calls xcb_disconnect to terminate the connection to the X server. If XCB is installed on the development system, the source file can be compiled with the following command: Unless the user clicks the window's close button, the window will stay open for five seconds because of the sleep function.
In XCB, the function to use is xcb_connect: The first argument identifies the X server's display name. If this is set to NULL, the function will use the value of the DISPLAY environment variable. The second argument points to a number for the screen that should be connected.
Note that xcb-proto exists only to install header files, so typing 'make' or 'make all' will produce the message "Nothing to be done for 'all'". That's normal. Compiling XCB-based programs requires linking them with the XCB library. This is easily done thanks to pkgconfig: An X program first needs to open the connection to the X server.
I struggled on this topic some time ago as well.
Look at http://marc.info/?l=freedesktop-xcb&m=129381953404497 .
The key is to store the cookie for the 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 the client_message with the cookie2
case XCB_CLIENT_MESSAGE:
{
if((*(xcb_client_message_event_t*)event).data.data32[0] == (*reply2).atom) ...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With