From a28c052af2dc4e719a971dac3c6fde3cb94aa568 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 11 Jan 2008 16:48:11 +0100 Subject: [PATCH] drop EnterWindow events to keep focus --- event.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/event.c b/event.c index 68ea8bf29..530ada138 100644 --- a/event.c +++ b/event.c @@ -319,7 +319,7 @@ handle_event_leavenotify(XEvent * e) } void -handle_event_mappingnotify(XEvent * e) +handle_event_mappingnotify(XEvent *e) { XMappingEvent *ev = &e->xmapping; int screen; @@ -331,13 +331,14 @@ handle_event_mappingnotify(XEvent * e) } void -handle_event_maprequest(XEvent * e) +handle_event_maprequest(XEvent *e) { static XWindowAttributes wa; XMapRequestEvent *ev = &e->xmaprequest; int screen, x, y, d; unsigned int m; Window dummy; + XEvent event; if(!XGetWindowAttributes(e->xany.display, ev->window, &wa)) return; @@ -350,6 +351,8 @@ 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)); } } @@ -388,11 +391,14 @@ 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