X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fxcb.c;h=630c68f9cf6ccb847aa236a57378342948354e92;hb=f62eb9f533a32622fa1cfe13526c33e4e35eb872;hp=f98115f5c80ce25049e081d9ea303636acc180bd;hpb=5775147d37aa85efb5138facba59ce87762c82a2;p=i3%2Fi3 diff --git a/src/xcb.c b/src/xcb.c index f98115f5..630c68f9 100644 --- a/src/xcb.c +++ b/src/xcb.c @@ -175,7 +175,8 @@ xcb_atom_t xcb_get_preferred_window_type(xcb_get_property_reply_t *reply) { atoms[i] == A__NET_WM_WINDOW_TYPE_MENU || atoms[i] == A__NET_WM_WINDOW_TYPE_DROPDOWN_MENU || atoms[i] == A__NET_WM_WINDOW_TYPE_POPUP_MENU || - atoms[i] == A__NET_WM_WINDOW_TYPE_TOOLTIP) { + atoms[i] == A__NET_WM_WINDOW_TYPE_TOOLTIP || + atoms[i] == A__NET_WM_WINDOW_TYPE_NOTIFICATION) { return atoms[i]; } } @@ -253,6 +254,27 @@ uint16_t get_visual_depth(xcb_visualid_t visual_id) { return 0; } +/* + * Get visual type specified by visualid + * + */ +xcb_visualtype_t *get_visualtype_by_id(xcb_visualid_t visual_id) { + xcb_depth_iterator_t depth_iter; + + depth_iter = xcb_screen_allowed_depths_iterator(root_screen); + for (; depth_iter.rem; xcb_depth_next(&depth_iter)) { + xcb_visualtype_iterator_t visual_iter; + + visual_iter = xcb_depth_visuals_iterator(depth_iter.data); + for (; visual_iter.rem; xcb_visualtype_next(&visual_iter)) { + if (visual_id == visual_iter.data->visual_id) { + return visual_iter.data; + } + } + } + return 0; +} + /* * Get visualid with specified depth * @@ -319,3 +341,17 @@ release_grab: FREE(reply); xcb_ungrab_server(conn); } + +/* + * Grab the specified buttons on a window when managing it. + * + */ +void xcb_grab_buttons(xcb_connection_t *conn, xcb_window_t window, int *buttons) { + int i = 0; + while (buttons[i] > 0) { + xcb_grab_button(conn, false, window, XCB_EVENT_MASK_BUTTON_PRESS, XCB_GRAB_MODE_SYNC, + XCB_GRAB_MODE_ASYNC, root, XCB_NONE, buttons[i], XCB_BUTTON_MASK_ANY); + + i++; + } +}