/** Update WM_CLASS of a client. * \param c The client. * \param reply The reply to get property request, or NULL if none. */ void property_update_wm_class(client_t *c, xcb_get_property_reply_t *reply) { xcb_icccm_get_wm_class_reply_t hint; if(reply) { if(!xcb_icccm_get_wm_class_from_reply(&hint, reply)) return; } else { if(!xcb_icccm_get_wm_class_reply(globalconf.connection, xcb_icccm_get_wm_class_unchecked(globalconf.connection, c->window), &hint, NULL)) return; } luaA_object_push(globalconf.L, c); client_set_class_instance(globalconf.L, -1, hint.class_name, hint.instance_name); lua_pop(globalconf.L, 1); /* only delete reply if we get it ourselves */ if(!reply) xcb_icccm_get_wm_class_reply_wipe(&hint); }
void x_client_name::update_wm_class(void) { m_class_name.clear(); m_instance_name.clear(); xcb_generic_error_t * error; xcb_get_property_cookie_t c = xcb_icccm_get_wm_class(m_c(), m_x_client.window()); xcb_get_property_reply_t * r = xcb_get_property_reply(m_c(), c, &error); if (error) { delete error; } else { xcb_icccm_get_wm_class_reply_t wm_class; if (xcb_icccm_get_wm_class_from_reply(&wm_class, r)) { m_class_name = wm_class.class_name; m_instance_name = wm_class.instance_name; xcb_icccm_get_wm_class_reply_wipe(&wm_class); r = NULL; } } if (r) delete r; }