drop EnterWindow events to keep focus

This commit is contained in:
Julien Danjou 2008-01-11 16:48:11 +01:00
parent 93e137eaab
commit a28c052af2
1 changed files with 8 additions and 2 deletions

10
event.c
View File

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