From fc109ea8f72e662ed58ef45329b6ca9e91d61d3b Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Sun, 19 Aug 2007 18:39:54 +0200 Subject: fixed misappearance of iconified windows on SIGKILL --- main.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index b56e333d..79b301d0 100644 --- a/main.c +++ b/main.c @@ -111,6 +111,24 @@ initfont(const char *fontstr) { dc.font.height = dc.font.ascent + dc.font.descent; } +static long +getstate(Window w) { + int format, status; + long result = -1; + unsigned char *p = NULL; + unsigned long n, extra; + Atom real; + + status = XGetWindowProperty(dpy, w, wmatom[WMState], 0L, 2L, False, wmatom[WMState], + &real, &format, &n, &extra, (unsigned char **)&p); + if(status != Success) + return -1; + if(n != 0) + result = *p; + XFree(p); + return result; +} + static void scan(void) { unsigned int i, num; @@ -123,7 +141,14 @@ scan(void) { if(!XGetWindowAttributes(dpy, wins[i], &wa) || wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1)) continue; - if(wa.map_state == IsViewable) + if(wa.map_state == IsViewable || getstate(wins[i]) == IconicState) + manage(wins[i], &wa); + } + for(i = 0; i < num; i++) { /* now the transients */ + if(!XGetWindowAttributes(dpy, wins[i], &wa)) + continue; + if(XGetTransientForHint(dpy, wins[i], &d1) + && (wa.map_state == IsViewable || getstate(wins[i]) == IconicState)) manage(wins[i], &wa); } } -- cgit v1.2.3