++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;
return;
}
+/*
+ * Handles the WM_CLASS property for assignments and criteria selection.
+ *
+ */
+static bool handle_class_change(void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window,
+ xcb_atom_t name, xcb_get_property_reply_t *prop) {
+ Con *con;
+ if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
+ return false;
+
+ if (prop == NULL) {
+ prop = xcb_get_property_reply(conn, xcb_get_property_unchecked(conn,
+ false, window, XCB_ATOM_WM_CLASS, XCB_ATOM_STRING, 0, 32),
+ NULL);
+
+ if (prop == NULL)
+ return false;
+ }
+
+ window_update_class(con->window, prop, false);
+
+ return true;
+}
+
/* Returns false if the event could not be processed (e.g. the window could not
* be found), true otherwise */
typedef bool (*cb_property_handler_t)(void *data, xcb_connection_t *c, uint8_t state, xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *property);
{0, UINT_MAX, handle_normal_hints},
{0, UINT_MAX, handle_clientleader_change},
{0, UINT_MAX, handle_transient_for},
- {0, 128, handle_windowrole_change}};
+ {0, 128, handle_windowrole_change},
+ {0, 128, handle_class_change}};
#define NUM_HANDLERS (sizeof(property_handlers) / sizeof(struct property_handler_t))
/*
property_handlers[4].atom = A_WM_CLIENT_LEADER;
property_handlers[5].atom = XCB_ATOM_WM_TRANSIENT_FOR;
property_handlers[6].atom = A_WM_WINDOW_ROLE;
+ property_handlers[7].atom = XCB_ATOM_WM_CLASS;
}
static void property_notify(uint8_t state, xcb_window_t window, xcb_atom_t atom) {