Handle _NET_CLOSE_WINDOW client message requests

> Pagers wanting to close a window MUST send a _NET_CLOSE_WINDOW client
> message request to the root window.

We interpret this message as a request to close the con for the given
window.

See: http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472668896

fixes #1396
This commit is contained in:
Tony Crisci
2014-11-16 21:10:48 -05:00
committed by Michael Stapelberg
parent bb1f857b00
commit 8d031bfbf8
4 changed files with 69 additions and 1 deletions

View File

@ -838,6 +838,24 @@ static void handle_client_message(xcb_client_message_event_t *event) {
++idx;
}
}
} else if (event->type == A__NET_CLOSE_WINDOW) {
/*
* Pagers wanting to close a window MUST send a _NET_CLOSE_WINDOW
* client message request to the root window.
* http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472668896
*/
Con *con = con_by_window_id(event->window);
if (con) {
DLOG("Handling _NET_CLOSE_WINDOW request (con = %p)\n", con);
if (event->data.data32[0])
last_timestamp = event->data.data32[0];
tree_close(con, KILL_WINDOW, false, false);
tree_render();
} else {
DLOG("Couldn't find con for _NET_CLOSE_WINDOW request. (window = %d)\n", event->window);
}
} else {
DLOG("unhandled clientmessage\n");
return;