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 <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-08-11 11:54:30 +02:00
parent ac2ff7f7a7
commit 9ab8cd4039
1 changed files with 23 additions and 16 deletions

View File

@ -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);