/** Update the WM hints of a client. * \param c The client. * \param cookie Cookie returned by property_get_wm_hints. */ void property_update_wm_hints(client_t *c, xcb_get_property_cookie_t cookie) { xcb_icccm_wm_hints_t wmh; if(!xcb_icccm_get_wm_hints_reply(globalconf.connection, cookie, &wmh, NULL)) return; luaA_object_push(globalconf.L, c); client_set_urgent(globalconf.L, -1, xcb_icccm_wm_hints_get_urgency(&wmh)); if(wmh.flags & XCB_ICCCM_WM_HINT_INPUT) c->nofocus = !wmh.input; if(wmh.flags & XCB_ICCCM_WM_HINT_WINDOW_GROUP) client_set_group_window(globalconf.L, -1, wmh.window_group); if(!c->have_ewmh_icon) { if(wmh.flags & XCB_ICCCM_WM_HINT_ICON_PIXMAP) { if(wmh.flags & XCB_ICCCM_WM_HINT_ICON_MASK) client_set_icon_from_pixmaps(c, wmh.icon_pixmap, wmh.icon_mask); else client_set_icon_from_pixmaps(c, wmh.icon_pixmap, XCB_NONE); } else client_set_icon(c, NULL); } lua_pop(globalconf.L, 1); }
/* * Updates the WM_HINTS (we only care about the input focus handling part). * */ void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop, bool *urgency_hint) { if (urgency_hint != NULL) *urgency_hint = false; if (prop == NULL || xcb_get_property_value_length(prop) == 0) { DLOG("WM_HINTS not set.\n"); FREE(prop); return; } xcb_icccm_wm_hints_t hints; if (!xcb_icccm_get_wm_hints_from_reply(&hints, prop)) { DLOG("Could not get WM_HINTS\n"); free(prop); return; } win->doesnt_accept_focus = !hints.input; LOG("WM_HINTS.input changed to \"%d\"\n", hints.input); if (urgency_hint != NULL) *urgency_hint = (xcb_icccm_wm_hints_get_urgency(&hints) != 0); free(prop); }
/** Update the WM hints of a client. * \param c The client. * \param reply (Optional) An existing reply. */ void property_update_wm_hints(client_t *c, xcb_get_property_reply_t *reply) { xcb_icccm_wm_hints_t wmh; if(reply) { if(!xcb_icccm_get_wm_hints_from_reply(&wmh, reply)) return; } else { if(!xcb_icccm_get_wm_hints_reply(globalconf.connection, xcb_icccm_get_wm_hints_unchecked(globalconf.connection, c->window), &wmh, NULL)) return; } luaA_object_push(globalconf.L, c); client_set_urgent(globalconf.L, -1, xcb_icccm_wm_hints_get_urgency(&wmh)); if(wmh.flags & XCB_ICCCM_WM_HINT_STATE && wmh.initial_state == XCB_ICCCM_WM_STATE_WITHDRAWN) client_set_border_width(globalconf.L, -1, 0); if(wmh.flags & XCB_ICCCM_WM_HINT_INPUT) c->nofocus = !wmh.input; if(wmh.flags & XCB_ICCCM_WM_HINT_WINDOW_GROUP) client_set_group_window(globalconf.L, -1, wmh.window_group); #ifdef LAB126 /* pop client */ lua_pop(globalconf.L, 1); #endif }
/** Update the WM hints of a client. * \param c The client. * \param cookie Cookie returned by property_get_wm_hints. */ void property_update_wm_hints(client_t *c, xcb_get_property_cookie_t cookie) { xcb_icccm_wm_hints_t wmh; if(!xcb_icccm_get_wm_hints_reply(globalconf.connection, cookie, &wmh, NULL)) return; luaA_object_push(globalconf.L, c); client_set_urgent(globalconf.L, -1, xcb_icccm_wm_hints_get_urgency(&wmh)); if(wmh.flags & XCB_ICCCM_WM_HINT_INPUT) c->nofocus = !wmh.input; if(wmh.flags & XCB_ICCCM_WM_HINT_WINDOW_GROUP) client_set_group_window(globalconf.L, -1, wmh.window_group); lua_pop(globalconf.L, 1); }
void property_notify(xcb_generic_event_t *evt) { xcb_property_notify_event_t *e = (xcb_property_notify_event_t *) evt; /* PRINTF("property notify %X\n", e->window); */ if (e->atom != XCB_ATOM_WM_HINTS && e->atom != XCB_ATOM_WM_NORMAL_HINTS) return; coordinates_t loc; if (!locate_window(e->window, &loc)) return; if (e->atom == XCB_ATOM_WM_HINTS) { xcb_icccm_wm_hints_t hints; if (xcb_icccm_get_wm_hints_reply(dpy, xcb_icccm_get_wm_hints(dpy, e->window), &hints, NULL) == 1 && (hints.flags & XCB_ICCCM_WM_HINT_X_URGENCY)) set_urgency(loc.monitor, loc.desktop, loc.node, xcb_icccm_wm_hints_get_urgency(&hints)); } else if (e->atom == XCB_ATOM_WM_NORMAL_HINTS) { client_t *c = loc.node->client; xcb_size_hints_t size_hints; if (xcb_icccm_get_wm_normal_hints_reply(dpy, xcb_icccm_get_wm_normal_hints(dpy, e->window), &size_hints, NULL) == 1 && (size_hints.flags & (XCB_ICCCM_SIZE_HINT_P_MIN_SIZE | XCB_ICCCM_SIZE_HINT_P_MAX_SIZE))) { c->min_width = size_hints.min_width; c->max_width = size_hints.max_width; c->min_height = size_hints.min_height; c->max_height = size_hints.max_height; int w = c->floating_rectangle.width; int h = c->floating_rectangle.height; restrain_floating_size(c, &w, &h); c->floating_rectangle.width = w; c->floating_rectangle.height = h; arrange(loc.monitor, loc.desktop); } } }