diff options
| author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-04-30 17:28:45 +0300 |
|---|---|---|
| committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-04-30 17:28:45 +0300 |
| commit | 0a581dbe5bf4cd8ae37e7d1b6b1646354be48c1a (patch) | |
| tree | 18bb0cafe450bc4dab896a704e7c85f0b3e16e20 /monsterwm.c | |
| parent | e938debc53d525ea301265df20aed8c45dfcc243 (diff) | |
fix for clients explicitly stealing focus
Diffstat (limited to 'monsterwm.c')
| -rw-r--r-- | monsterwm.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/monsterwm.c b/monsterwm.c index 4ec5946..212917b 100644 --- a/monsterwm.c +++ b/monsterwm.c @@ -112,6 +112,7 @@ static void deletewindow(Window w); static void desktopinfo(void); static void destroynotify(XEvent *e); static void enternotify(XEvent *e); +static void focusin(XEvent *e); static unsigned long getcolor(const char* color); static void grabbuttons(client *c); static void grabkeys(void); @@ -166,7 +167,7 @@ static void (*events[LASTEvent])(XEvent *e) = { [MapRequest] = maprequest, [ClientMessage] = clientmessage, [ButtonPress] = buttonpress, [DestroyNotify] = destroynotify, [UnmapNotify] = unmapnotify, [PropertyNotify] = propertynotify, - [ConfigureRequest] = configurerequest, + [ConfigureRequest] = configurerequest, [FocusIn] = focusin, }; /* layout array - given the current layout mode, tile the windows @@ -186,7 +187,7 @@ client* addwindow(Window w) { else if (!ATTACH_ASIDE) { c->next = head; head = c; } else if (t) t->next = c; else head->next = c; - XSelectInput(dis, (c->win = w), PropertyChangeMask|(FOLLOW_MOUSE?EnterWindowMask:0)); + XSelectInput(dis, (c->win = w), PropertyChangeMask|FocusChangeMask|(FOLLOW_MOUSE?EnterWindowMask:0)); return c; } @@ -235,7 +236,6 @@ void cleanup(void) { for (unsigned int i = 0; i<nchildren; i++) deletewindow(children[i]); if (children) XFree(children); XSync(dis, False); - XSetInputFocus(dis, PointerRoot, RevertToPointerRoot, CurrentTime); } /* move a client to another desktop @@ -350,6 +350,15 @@ void enternotify(XEvent *e) { && e->xcrossing.detail != NotifyInferior) update_current(c); } +/* dont give focus to any client except current + * some apps explicitly call XSetInputFocus suchs + * as tabbed and chromium, resulting in loss of + * input (mouse/kbd) focus from the current and + * highlighted client - this gives focus back */ +void focusin(XEvent *e) { + if (current && current->win != e->xfocus.window) update_current(current); +} + /* get a pixel with the requested color * to fill some window area - borders */ unsigned long getcolor(const char* color) { |
