Hi, I have a new tentative patch, which seems to be working correctly. Would you mind dropping it in debian/patches and checking whether the bug still applies?
Be aware that the patch is against the recently-released 0.9.6 version of scrotwm; you can grab the source tree for an updated Debian package from the usual location on bzr.debian.org. Let me know how it goes. -- Andrea Bolognani <[email protected]> Resistance is futile, you will be garbage collected.
Index: scrotwm/scrotwm.c
===================================================================
--- scrotwm.orig/scrotwm.c 2009-09-21 22:02:06.000000000 +0200
+++ scrotwm/scrotwm.c 2009-09-21 23:27:37.000000000 +0200
@@ -787,6 +787,36 @@
XSendEvent(display, win->id, False, StructureNotifyMask, (XEvent *)&ce);
}
+void
+set_win_state(Window w, long state)
+{
+ long data[] = {state, None};
+
+ DNPRINTF(SWM_D_EVENT, "set_win_state: window: %lu\n", w);
+
+ XChangeProperty(display, w, astate, astate, 32, PropModeReplace,
+ (unsigned char *)data, 2);
+}
+
+long
+get_win_state(Window w)
+{
+ int format, status;
+ long result = -1;
+ unsigned char *p = NULL;
+ unsigned long n, extra;
+ Atom real;
+
+ status = XGetWindowProperty(display, w, astate, 0L, 2L, False, astate,
+ &real, &format, &n, &extra, (unsigned char **)&p);
+ if (status != Success)
+ return (-1);
+ if (n != 0)
+ result = *((long *)p);
+ XFree(p);
+ return (result);
+}
+
int
count_win(struct workspace *ws, int count_transient)
{
@@ -1527,6 +1557,7 @@
adjust_font(win);
mask = CWX | CWY | CWWidth | CWHeight | CWBorderWidth;
XConfigureWindow(display, win->id, mask, &wc);
+ set_win_state(win->id, NormalState);
XMapRaised(display, win->id);
last_h = win_g.h;
@@ -1541,6 +1572,7 @@
continue;
stack_floater(win, ws->r);
+ set_win_state(win->id, NormalState);
XMapRaised(display, win->id);
}
@@ -1679,8 +1711,10 @@
if (win == ws->focus) {
XMapRaised(display, win->id);
- } else
+ } else {
+ set_win_state(win->id, IconicState);
XUnmapWindow(display, win->id);
+ }
}
}
@@ -2628,17 +2662,6 @@
buttons[i].func(win, &buttons[i].args);
}
-void
-set_win_state(struct ws_win *win, long state)
-{
- long data[] = {state, None};
-
- DNPRINTF(SWM_D_EVENT, "set_win_state: window: %lu\n", win->id);
-
- XChangeProperty(display, win->id, astate, astate, 32, PropModeReplace,
- (unsigned char *)data, 2);
-}
-
const char *quirkname[] = {
"NONE", /* config string for "no value" */
"FLOAT",
@@ -3139,7 +3162,7 @@
XSelectInput(display, id, EnterWindowMask | FocusChangeMask |
PropertyChangeMask | StructureNotifyMask);
- set_win_state(win, NormalState);
+ set_win_state(win->id, NormalState);
/* floaters need to be mapped if they are in the current workspace */
if (win->floating && (ws->idx == r->ws->idx))
@@ -3180,7 +3203,7 @@
ws->focus_prev = NULL;
TAILQ_REMOVE(&win->ws->winlist, win, entry);
- set_win_state(win, WithdrawnState);
+ set_win_state(win->id, WithdrawnState);
if (win->ch.res_class)
XFree(win->ch.res_class);
if (win->ch.res_name)
@@ -3353,6 +3376,7 @@
return;
if (wa.override_redirect)
return;
+ set_win_state(e->xmaprequest.window, NormalState);
manage_window(e->xmaprequest.window);
stack();
@@ -3402,8 +3426,10 @@
DNPRINTF(SWM_D_EVENT, "unmapnotify: window: %lu\n", e->xunmap.window);
if ((win = find_window(ev->window)) != NULL)
- if (win->transient)
+ if (get_win_state(win->id) != IconicState)
unmanage_window(win);
+
+ stack();
}
void
@@ -3453,25 +3479,6 @@
return (0);
}
-long
-getstate(Window w)
-{
- int format, status;
- long result = -1;
- unsigned char *p = NULL;
- unsigned long n, extra;
- Atom real;
-
- status = XGetWindowProperty(display, w, astate, 0L, 2L, False, astate,
- &real, &format, &n, &extra, (unsigned char **)&p);
- if (status != Success)
- return (-1);
- if (n != 0)
- result = *((long *)p);
- XFree(p);
- return (result);
-}
-
void
new_region(struct swm_screen *s, int x, int y, int w, int h)
{
@@ -3709,7 +3716,7 @@
continue;
if (wa.map_state == IsViewable ||
- getstate(wins[j]) == NormalState)
+ get_win_state(wins[j]) == NormalState)
manage_window(wins[j]);
}
/* transient windows */
@@ -3718,7 +3725,7 @@
continue;
if (XGetTransientForHint(display, wins[j], &d1) &&
- (wa.map_state == IsViewable || getstate(wins[j]) ==
+ (wa.map_state == IsViewable || get_win_state(wins[j]) ==
NormalState))
manage_window(wins[j]);
}
signature.asc
Description: Digital signature

