From 9ab8cd4039f21118a0f15fbcf768a518269a1d4c Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 11 Aug 2010 11:54:30 +0200 Subject: [PATCH] Set our event mask on the root window later This moves the setting of the event mask after scan() so that we won't receive any events from scan()'s activity (especially no UnmapNotifies which would cause us to lose clients). Signed-off-by: Uli Schlachter --- awesome.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/awesome.c b/awesome.c index 571bcc47..0649c649 100644 --- a/awesome.c +++ b/awesome.c @@ -469,22 +469,6 @@ main(int argc, char **argv) screen_nbr < xcb_setup_roots_length(xcb_get_setup(globalconf.connection)); screen_nbr++) { - /* select for events */ - const uint32_t change_win_vals[] = - { - XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY - | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW - | XCB_EVENT_MASK_STRUCTURE_NOTIFY - | XCB_EVENT_MASK_PROPERTY_CHANGE - | XCB_EVENT_MASK_BUTTON_PRESS - | XCB_EVENT_MASK_BUTTON_RELEASE - | XCB_EVENT_MASK_FOCUS_CHANGE - }; - - xcb_change_window_attributes(globalconf.connection, - xutil_screen_get(globalconf.connection, screen_nbr)->root, - XCB_CW_EVENT_MASK, - change_win_vals); ewmh_init(screen_nbr); systray_init(screen_nbr); } @@ -503,6 +487,29 @@ main(int argc, char **argv) /* scan existing windows */ scan(); + /* do this only for real screen */ + for(screen_nbr = 0; + screen_nbr < xcb_setup_roots_length(xcb_get_setup(globalconf.connection)); + screen_nbr++) + { + /* select for events */ + const uint32_t change_win_vals[] = + { + XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY + | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW + | XCB_EVENT_MASK_STRUCTURE_NOTIFY + | XCB_EVENT_MASK_PROPERTY_CHANGE + | XCB_EVENT_MASK_BUTTON_PRESS + | XCB_EVENT_MASK_BUTTON_RELEASE + | XCB_EVENT_MASK_FOCUS_CHANGE + }; + + xcb_change_window_attributes(globalconf.connection, + xutil_screen_get(globalconf.connection, screen_nbr)->root, + XCB_CW_EVENT_MASK, + change_win_vals); + } + /* we will receive events, stop grabbing server */ xcb_ungrab_server(globalconf.connection); xcb_flush(globalconf.connection);