JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Oops do some focus magic just as before. Note this is still hosed due to
authorMarco Peereboom <marco@conformal.com>
Tue, 3 Feb 2009 00:54:35 +0000 (00:54 +0000)
committerMarco Peereboom <marco@conformal.com>
Tue, 3 Feb 2009 00:54:35 +0000 (00:54 +0000)
enternotify but that is an older issue.

scrotwm.c

index c5a225b..43ce724 100644 (file)
--- a/scrotwm.c
+++ b/scrotwm.c
@@ -2128,11 +2128,25 @@ manage_window(Window id)
 void
 unmanage_window(struct ws_win *win)
 {
+       struct workspace        *ws;
+
        if (win == NULL)
                return;
 
        DNPRINTF(SWM_D_MISC, "unmanage_window:  %lu\n", win->id);
 
+       ws = win->ws;
+       /* find a window to focus */
+       if (ws->focus == win)
+               ws->focus = TAILQ_PREV(win, ws_win_list, entry);
+       if (ws->focus == NULL)
+               ws->focus = TAILQ_FIRST(&ws->winlist);
+       if (ws->focus == NULL || ws->focus == win) {
+               ws->focus = NULL;
+               unfocus_all();
+       } else
+               focus_win(ws->focus);
+
        TAILQ_REMOVE(&win->ws->winlist, win, entry);
        set_win_state(win, WithdrawnState);
        if (win->ch.res_class)
@@ -2213,22 +2227,10 @@ destroynotify(XEvent *e)
 {
        struct ws_win           *win;
        XDestroyWindowEvent     *ev = &e->xdestroywindow;
-       struct workspace        *ws;
 
        DNPRINTF(SWM_D_EVENT, "destroynotify: window %lu\n", ev->window);
 
        if ((win = find_window(ev->window)) != NULL) {
-               ws = win->ws;
-               /* find a window to focus */
-               if (ws->focus == win)
-                       ws->focus = TAILQ_PREV(win, ws_win_list, entry);
-               if (ws->focus == NULL)
-                       ws->focus = TAILQ_FIRST(&ws->winlist);
-               if (ws->focus == NULL || ws->focus == win) {
-                       ws->focus = NULL;
-                       unfocus_all();
-               } else
-                       focus_win(ws->focus);
                unmanage_window(win);
                stack();
        }