# HG changeset patch # User Anselm R. Garbe # Date 1187541594 -7200 # Node ID 50fb50842dbcd5ad546de5a236b95d449222b50e # Parent ce9a5452ac8c72f93a365f9b8ba38c01ec94eee8 fixed misappearance of iconified windows on SIGKILL diff -r ce9a5452ac8c -r 50fb50842dbc main.c --- a/main.c Sun Aug 19 11:00:47 2007 +0200 +++ b/main.c Sun Aug 19 18:39:54 2007 +0200 @@ -111,6 +111,24 @@ 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 @@ 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); } } diff -r ce9a5452ac8c -r 50fb50842dbc screen.c --- a/screen.c Sun Aug 19 11:00:47 2007 +0200 +++ b/screen.c Sun Aug 19 18:39:54 2007 +0200 @@ -60,7 +60,7 @@ for(i = 0; i < ntags && i < sizeof prop - 1; i++) prop[i] = seltags[i] ? '1' : '0'; if(i < sizeof prop - 1) - prop[i++] = (char)ltidx; + prop[i++] = (char)ltidx + '0'; prop[i] = '\0'; XChangeProperty(dpy, root, dwmprops, XA_STRING, 8, PropModeReplace, (unsigned char *)prop, i); @@ -223,8 +223,8 @@ for(i = 0; i < ntags && i < sizeof prop - 1 && prop[i] != '\0'; i++) seltags[i] = prop[i] == '1'; if(i < sizeof prop - 1 && prop[i] != '\0') { - if(prop[i] < nlayouts) - ltidx = prop[i]; + if((unsigned int)(prop[i] - '0') < nlayouts) + ltidx = prop[i] - '0'; } } }