From 4a1720ddcaf29a52f3628a47e330ecd72b9827e0 Mon Sep 17 00:00:00 2001 From: Arnaud Fontaine Date: Sat, 22 Mar 2008 17:47:13 +0000 Subject: [PATCH] Remove useless x_select_input() which leaded to useless requests --- awesome.c | 10 +++++----- client.c | 7 ++++++- common/swindow.c | 2 -- common/xutil.c | 12 ------------ common/xutil.h | 1 - 5 files changed, 11 insertions(+), 21 deletions(-) diff --git a/awesome.c b/awesome.c index 84619ada..846a2b1e 100644 --- a/awesome.c +++ b/awesome.c @@ -384,14 +384,17 @@ main(int argc, char *argv[]) globalconf.evenths = xcb_alloc_event_handlers(conn); xcb_set_error_handler_catch_all(globalconf.evenths, xerrorstart, NULL); + const uint32_t select_input_val = XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT; + for(screen_nbr = 0; screen_nbr < xcb_setup_roots_length(xcb_get_setup(conn)); screen_nbr++) { /* this causes an error if some other window manager is * running */ - x_select_input(conn, root_window(conn, screen_nbr), - XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT); + xcb_change_window_attributes(conn, + root_window(conn, screen_nbr), + XCB_CW_EVENT_MASK, &select_input_val); } /* need to xcb_flush to validate error handler */ @@ -455,9 +458,6 @@ main(int argc, char *argv[]) root_window(globalconf.connection, screen_nbr), XCB_CW_EVENT_MASK | XCB_CW_CURSOR, change_win_vals); - x_select_input(globalconf.connection, - root_window(globalconf.connection, screen_nbr), - change_win_vals[0]); ewmh_set_supported_hints(screen_nbr); /* call this to at least grab root window clicks */ window_root_grabbuttons(screen_nbr); diff --git a/client.c b/client.c index 1b22a44d..253f211b 100644 --- a/client.c +++ b/client.c @@ -410,7 +410,12 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int screen) /* update titlebar with real floating info now */ titlebar_update_geometry_floating(c); - x_select_input(globalconf.connection, w, XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_PROPERTY_CHANGE | XCB_EVENT_MASK_ENTER_WINDOW); + const uint32_t select_input_val[] = { + XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_PROPERTY_CHANGE | + XCB_EVENT_MASK_ENTER_WINDOW }; + + xcb_change_window_attributes(globalconf.connection, w, XCB_CW_EVENT_MASK, + select_input_val); /* handle xshape */ if(globalconf.have_shape) diff --git a/common/swindow.c b/common/swindow.c index 4e334534..1883222a 100644 --- a/common/swindow.c +++ b/common/swindow.c @@ -69,8 +69,6 @@ simplewindow_new(xcb_connection_t *conn, int phys_screen, int x, int y, XCB_CW_BACK_PIXMAP | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK, create_win_val); - x_select_input(conn, sw->window, create_win_val[2]); - sw->drawable = xcb_generate_id(conn); xcb_create_pixmap(conn, s->root_depth, sw->drawable, root_window(conn, phys_screen), w, h); diff --git a/common/xutil.c b/common/xutil.c index cfb4c159..2071056b 100644 --- a/common/xutil.c +++ b/common/xutil.c @@ -94,18 +94,6 @@ xgetnumlockmask(xcb_connection_t *conn) return mask; } -/** 'XSelectInput' from Xlib is only a function around - * 'ChangeWindowAttributes' which set the value mask to 'CWEventMask' - * \param c X connection - */ -void -x_select_input(xcb_connection_t *c, xcb_window_t w, - uint32_t event_mask) -{ - const uint32_t config_win_val[] = { event_mask }; - xcb_change_window_attributes(c, w, XCB_CW_EVENT_MASK, config_win_val); -} - /** Equivalent to 'XGetTransientForHint' which is actually a * 'XGetWindowProperty' which gets the WM_TRANSIENT_FOR property of * the specified window diff --git a/common/xutil.h b/common/xutil.h index fd80a374..3f5ad99e 100644 --- a/common/xutil.h +++ b/common/xutil.h @@ -76,7 +76,6 @@ unsigned int xgetnumlockmask(xcb_connection_t *); /* End of macros not defined in XCB */ /* Common function defined in Xlib but not in XCB */ -void x_select_input(xcb_connection_t *, xcb_window_t, uint32_t); bool x_get_transient_for_hint(xcb_connection_t *, xcb_window_t, xcb_window_t *); bool xinerama_is_active(xcb_connection_t *); xcb_window_t root_window(xcb_connection_t *, int); -- 2.11.4.GIT