X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fxcb.c;h=3da1081dd0548ae8463533821fcc0c5f2baee35e;hb=f10a3d9b7571eb4e87e59609a062a9bb20e2b198;hp=1fd677b720aaa203023923f7ed150cf90d458e6b;hpb=c145f7e5297ef06aaf84689762a736d5bc8cbb83;p=i3%2Fi3 diff --git a/src/xcb.c b/src/xcb.c index 1fd677b7..3da1081d 100644 --- a/src/xcb.c +++ b/src/xcb.c @@ -318,10 +318,33 @@ int predict_text_width(xcb_connection_t *conn, const char *font_pattern, char *t * */ void xcb_set_window_rect(xcb_connection_t *conn, xcb_window_t window, Rect r) { - xcb_configure_window(conn, window, + xcb_void_cookie_t cookie; + cookie = xcb_configure_window(conn, window, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, &(r.x)); + /* ignore events which are generated because we configured a window */ + add_ignore_event(cookie.sequence); +} + +/* + * Returns true if the given reply contains the given atom. + * + */ +bool xcb_reply_contains_atom(xcb_get_property_reply_t *prop, xcb_atom_t atom) { + if (prop == NULL || xcb_get_property_value_length(prop) == 0) + return false; + + xcb_atom_t *atoms; + if ((atoms = xcb_get_property_value(prop)) == NULL) + return false; + + for (int i = 0; i < xcb_get_property_value_length(prop); i++) + if (atoms[i] == atom) + return true; + + return false; + }