/** Update the WM hints of a client. * \param c The client. */ void property_update_wm_hints(client_t *c, xcb_get_property_reply_t *reply) { xcb_wm_hints_t wmh; if(reply) { if(!xcb_get_wm_hints_from_reply(&wmh, reply)) return; } else { if(!xcb_get_wm_hints_reply(globalconf.connection, xcb_get_wm_hints_unchecked(globalconf.connection, c->win), &wmh, NULL)) return; } bool isurgent = xcb_wm_hints_get_urgency(&wmh); if(isurgent != c->isurgent) { c->isurgent = isurgent; /* execute hook */ hooks_property(c, "urgent"); } if(wmh.flags & XCB_WM_HINT_STATE && wmh.initial_state == XCB_WM_STATE_WITHDRAWN) client_setborder(c, 0); if(wmh.flags & XCB_WM_HINT_INPUT) c->nofocus = !wmh.input; }
static PyObject * _set_hints(PyObject *self, PyObject *args) { xcb_connection_t *connection; xcb_window_t window; int x, y, w, h; xcb_wm_hints_t hints; xcb_size_hints_t normal_hints; //xcb_generic_error_t *e; if (!PyArg_ParseTuple(args, "lIiiii", &connection, &window, &x, &y, &w, &h)) return NULL; /* this is now done on the python side data[0] = 0xffffffff; xcb_change_property(connection, XCB_PROP_MODE_REPLACE, window, atoms[_NET_WM_DESKTOP], CARDINAL, 32, 1, data); data[0] = atoms[_NET_WM_WINDOW_TYPE_DOCK]; xcb_change_property(connection, XCB_PROP_MODE_REPLACE, window, atoms[_NET_WM_WINDOW_TYPE], ATOM, 32, 1, data); */ // send requests xcb_get_property_cookie_t hint_c = xcb_get_wm_hints(connection, window); xcb_get_property_cookie_t normal_hints_c = xcb_get_wm_normal_hints(connection, window); // set wm hints xcb_get_wm_hints_reply(connection, hint_c, &hints, 0); xcb_wm_hints_set_input(&hints, 0); xcb_wm_hints_set_normal(&hints); xcb_set_wm_hints(connection, window, &hints); // set the normal hints xcb_get_wm_normal_hints_reply(connection, normal_hints_c, &normal_hints, 0); //printf("w: %d, h: %d\n", w, h); normal_hints.flags = XCB_SIZE_HINT_P_POSITION; xcb_size_hints_set_position(&normal_hints, 0, x, y); xcb_size_hints_set_min_size(&normal_hints, w, h); xcb_size_hints_set_max_size(&normal_hints, w, h); xcb_set_wm_normal_hints(connection, window, &normal_hints); /* data[0] = atoms[_NET_WM_STATE_SKIP_TASKBAR]; data[1] = atoms[_NET_WM_STATE_SKIP_PAGER]; data[2] = atoms[_NET_WM_STATE_STICKY]; data[3] = atoms[_NET_WM_STATE_ABOVE]; xcb_change_property(connection, XCB_PROP_MODE_REPLACE, window, atoms[_NET_WM_STATE], ATOM, 32, 4, data); */ Py_RETURN_NONE; }