"Handle" events during startup (FS#877)
awesome.c contains this comment: There can be no events yet, so if his function returns something, it must be an error. Sadly, this wasn't true. It seems like something managed to generate MappingNotify events (no idea how). Fix this by discarding all pending events after our GrabServer, but before we ask for SubstructureRedirect on the root window. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
6c6e3a22f8
commit
12c1b0ce52
21
awesome.c
21
awesome.c
|
@ -295,6 +295,7 @@ main(int argc, char **argv)
|
|||
xcolor_init_request_t colors_reqs[2];
|
||||
ssize_t cmdlen = 1;
|
||||
xdgHandle xdg;
|
||||
xcb_generic_event_t *event;
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{ "help", 0, NULL, 'h' },
|
||||
|
@ -402,10 +403,6 @@ main(int argc, char **argv)
|
|||
/* initialize dbus */
|
||||
a_dbus_init();
|
||||
|
||||
/* Grab server */
|
||||
xcb_grab_server(globalconf.connection);
|
||||
xcb_flush(globalconf.connection);
|
||||
|
||||
/* Get the file descriptor corresponding to the X connection */
|
||||
xfd = xcb_get_file_descriptor(globalconf.connection);
|
||||
ev_io_init(&xio, &a_xcb_io_cb, xfd, EV_READ);
|
||||
|
@ -417,6 +414,22 @@ main(int argc, char **argv)
|
|||
ev_prepare_start(globalconf.loop, &a_refresh);
|
||||
ev_unref(globalconf.loop);
|
||||
|
||||
/* Grab server */
|
||||
xcb_grab_server(globalconf.connection);
|
||||
|
||||
/* Make sure there are no pending events. Since we didn't really do anything
|
||||
* at all yet, we will just discard all events which we received so far.
|
||||
* The above GrabServer should make sure no new events are generated. */
|
||||
xcb_aux_sync(globalconf.connection);
|
||||
while ((event = xcb_poll_for_event(globalconf.connection)) != NULL)
|
||||
{
|
||||
/* Make sure errors are printed */
|
||||
uint8_t response_type = XCB_EVENT_RESPONSE_TYPE(event);
|
||||
if(response_type == 0)
|
||||
event_handle(event);
|
||||
p_delete(&event);
|
||||
}
|
||||
|
||||
for(screen_nbr = 0;
|
||||
screen_nbr < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||
screen_nbr++)
|
||||
|
|
Loading…
Reference in New Issue