JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
hack to work around crap like xpdf that doesn't destroy transient
authorMarco Peereboom <marco@conformal.com>
Thu, 9 Jun 2011 16:31:58 +0000 (16:31 +0000)
committerMarco Peereboom <marco@conformal.com>
Thu, 9 Jun 2011 16:31:58 +0000 (16:31 +0000)
windows.

Makefile
scrotwm.c

index 4aa16f9..0f5e7b5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@
 PREFIX?=/usr/local
 
 BINDIR=${PREFIX}/bin
-SUBDIR= lib
+SUBDIR= lib unicon
 
 PROG=scrotwm
 MAN=scrotwm.1 scrotwm_es.1 scrotwm_it.1 scrotwm_pt.1 scrotwm_ru.1
index 307e004..a2997cc 100644 (file)
--- a/scrotwm.c
+++ b/scrotwm.c
@@ -100,7 +100,6 @@ static const char   *cvstag = "$scrotwm$";
 #endif
 #endif
 
-#define SWM_DEBUG
 /*#define SWM_DEBUG*/
 #ifdef SWM_DEBUG
 #define DPRINTF(x...)          do { if (swm_debug) fprintf(stderr, x); } while (0)
@@ -1519,7 +1518,7 @@ unmap_window(struct ws_win *win)
        if (getstate(win->id) == IconicState)
                return;
 
-       set_win_state(win, InactiveState);
+       set_win_state(win, IconicState);
 
        XUnmapWindow(display, win->id);
        XSetWindowBorder(display, win->id,
@@ -4778,10 +4777,6 @@ manage_window(Window id)
 
        XSelectInput(display, id, EnterWindowMask | FocusChangeMask |
            PropertyChangeMask | StructureNotifyMask);
-       if (win->iconic)
-               set_win_state(win, IconicState);
-       else
-               set_win_state(win, NormalState);
 
        /* floaters need to be mapped if they are in the current workspace */
        if ((win->floating || win->transient) && (ws->idx == r->ws->idx))
@@ -5279,6 +5274,21 @@ unmapnotify(XEvent *e)
        if (getstate(e->xunmap.window) == NormalState) {
                unmanage_window(win);
                stack();
+
+               /* giant hack for apps that don't destroy transient windows */
+               /* eat a bunch of events to prevent remanaging the window */
+               XEvent                  cne;
+               while (XCheckWindowEvent(display, e->xunmap.window,
+                   EnterWindowMask, &cne))
+                       ;
+               while (XCheckWindowEvent(display, e->xunmap.window,
+                   StructureNotifyMask, &cne))
+                       ;
+               while (XCheckWindowEvent(display, e->xunmap.window,
+                   SubstructureNotifyMask, &cne))
+                       ;
+               /* resend unmap because we ated it */
+               XUnmapWindow(display, e->xunmap.window);
        }
 }
 
@@ -5565,7 +5575,7 @@ grab_windows(void)
                                continue;
 
                        state = getstate(wins[j]);
-                       manage = state == IconicState || InactiveState;
+                       manage = state == IconicState;
                        if (wa.map_state == IsViewable || manage)
                                manage_window(wins[j]);
                }
@@ -5576,7 +5586,7 @@ grab_windows(void)
                                continue;
 
                        state = getstate(wins[j]);
-                       manage = state == IconicState || InactiveState;
+                       manage = state == IconicState;
                        if (XGetTransientForHint(display, wins[j], &d1) &&
                            manage)
                                manage_window(wins[j]);