JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Fix keyboard not getting focus after quitting gimp.
authorMarco Peereboom <marco@conformal.com>
Thu, 14 Oct 2010 17:40:52 +0000 (17:40 +0000)
committerMarco Peereboom <marco@conformal.com>
Thu, 14 Oct 2010 17:40:52 +0000 (17:40 +0000)
from Henri Kemppainen <duclare@guu.fi>

scrotwm.c

index b7f37fd..1a4dedb 100644 (file)
--- a/scrotwm.c
+++ b/scrotwm.c
@@ -4439,9 +4439,15 @@ unmanage_window(struct ws_win *win)
                        parent->child_trans = NULL;
        }
 
-       /* work around for mplayer going full screen */
-       if (!win->floating)
-               focus_prev(win);
+       if (count_win(win->ws, 0) > 1) {
+               /* work around for mplayer going full screen */
+               if (!win->floating)
+                       focus_prev(win);
+       } else
+               /* the last window is getting nuked, so make sure
+                  the keyboard isn't left without focus */
+               XSetInputFocus(display, PointerRoot,
+                   PointerRoot, CurrentTime);
 
        TAILQ_REMOVE(&win->ws->winlist, win, entry);
        TAILQ_INSERT_TAIL(&win->ws->unmanagedlist, win, entry);