diff --git a/awesome.c b/awesome.c index 2121b7a8f..08eb9cdf6 100644 --- a/awesome.c +++ b/awesome.c @@ -394,6 +394,16 @@ main(int argc, char *argv[]) XNextEvent(dpy, &ev); if(handler[ev.type]) handler[ev.type](&ev); /* call handler */ + + /* drop events requested to */ + if(globalconf.drop_events) + { + /* need to resync */ + XSync(dpy, False); + while(XCheckMaskEvent(dpy, globalconf.drop_events, &ev)); + globalconf.drop_events = NoEventMask; + } + /* need to resync */ XSync(dpy, False); } diff --git a/client.c b/client.c index b550bd509..3cce8888e 100644 --- a/client.c +++ b/client.c @@ -217,6 +217,7 @@ focus(Client *c, Bool selscreen, int screen) RevertToPointerRoot, CurrentTime); ewmh_update_net_active_window(phys_screen); + globalconf.drop_events |= EnterWindowMask; } /** Manage a new client diff --git a/event.c b/event.c index ade35c46b..81cd70b99 100644 --- a/event.c +++ b/event.c @@ -275,7 +275,6 @@ handle_event_keypress(XEvent * e) XKeyEvent *ev = &e->xkey; Window dummy; Key *k; - XEvent event; keysym = XKeycodeToKeysym(e->xany.display, (KeyCode) ev->keycode, 0); @@ -299,7 +298,6 @@ handle_event_keypress(XEvent * e) k->func(screen, k->arg); break; } - while(XCheckMaskEvent(globalconf.display, EnterWindowMask, &event)); } void @@ -333,7 +331,6 @@ handle_event_maprequest(XEvent *e) int screen, x, y, d; unsigned int m; Window dummy; - XEvent event; if(!XGetWindowAttributes(e->xany.display, ev->window, &wa)) return; @@ -346,8 +343,6 @@ handle_event_maprequest(XEvent *e) &dummy, &dummy, &x, &y, &d, &d, &m)) screen = get_screen_bycoord(x, y); client_manage(ev->window, &wa, screen); - /* do this to keep focused client */ - while(XCheckMaskEvent(globalconf.display, EnterWindowMask, &event)); } } @@ -387,14 +382,11 @@ handle_event_unmapnotify(XEvent * e) { Client *c; XUnmapEvent *ev = &e->xunmap; - XEvent event; if((c = get_client_bywin(globalconf.clients, ev->window)) && ev->event == RootWindow(e->xany.display, get_phys_screen(c->screen)) && ev->send_event && window_getstate(c->win) == NormalState) client_unmanage(c); - /* do this to keep focused client */ - while(XCheckMaskEvent(globalconf.display, EnterWindowMask, &event)); } void diff --git a/screen.c b/screen.c index fac25a8ab..aa514a964 100644 --- a/screen.c +++ b/screen.c @@ -329,7 +329,6 @@ uicb_client_movetoscreen(int screen __attribute__ ((unused)), char *arg) { int new_screen, prev_screen; Client *sel = globalconf.focus->client; - XEvent event; if(!sel || !XineramaIsActive(globalconf.display)) return; @@ -348,7 +347,5 @@ uicb_client_movetoscreen(int screen __attribute__ ((unused)), char *arg) move_client_to_screen(sel, new_screen, True); move_mouse_pointer_to_screen(new_screen); focus(sel, True, sel->screen); - /* drop EnterWindow event to keep focus */ - XCheckMaskEvent(globalconf.display, EnterWindowMask, &event); } // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/structs.h b/structs.h index ecef9d8ea..bd0a8044a 100644 --- a/structs.h +++ b/structs.h @@ -324,6 +324,8 @@ struct AwesomeConf tag_client_node_t *tclink; /** Command line passed to awesome */ char *argv; + /** EventMask to drop before each XEvent treatement */ + long drop_events; }; #endif