diff options
Diffstat (limited to '')
| -rw-r--r-- | main.c | 27 |
1 files changed, 26 insertions, 1 deletions
| @@ -111,6 +111,24 @@ initfont(const char *fontstr) { | |||
| 111 | dc.font.height = dc.font.ascent + dc.font.descent; | 111 | dc.font.height = dc.font.ascent + dc.font.descent; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | static long | ||
| 115 | getstate(Window w) { | ||
| 116 | int format, status; | ||
| 117 | long result = -1; | ||
| 118 | unsigned char *p = NULL; | ||
| 119 | unsigned long n, extra; | ||
| 120 | Atom real; | ||
| 121 | |||
| 122 | status = XGetWindowProperty(dpy, w, wmatom[WMState], 0L, 2L, False, wmatom[WMState], | ||
| 123 | &real, &format, &n, &extra, (unsigned char **)&p); | ||
| 124 | if(status != Success) | ||
| 125 | return -1; | ||
| 126 | if(n != 0) | ||
| 127 | result = *p; | ||
| 128 | XFree(p); | ||
| 129 | return result; | ||
| 130 | } | ||
| 131 | |||
| 114 | static void | 132 | static void |
| 115 | scan(void) { | 133 | scan(void) { |
| 116 | unsigned int i, num; | 134 | unsigned int i, num; |
| @@ -123,7 +141,14 @@ scan(void) { | |||
| 123 | if(!XGetWindowAttributes(dpy, wins[i], &wa) | 141 | if(!XGetWindowAttributes(dpy, wins[i], &wa) |
| 124 | || wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1)) | 142 | || wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1)) |
| 125 | continue; | 143 | continue; |
| 126 | if(wa.map_state == IsViewable) | 144 | if(wa.map_state == IsViewable || getstate(wins[i]) == IconicState) |
| 145 | manage(wins[i], &wa); | ||
| 146 | } | ||
| 147 | for(i = 0; i < num; i++) { /* now the transients */ | ||
| 148 | if(!XGetWindowAttributes(dpy, wins[i], &wa)) | ||
| 149 | continue; | ||
| 150 | if(XGetTransientForHint(dpy, wins[i], &d1) | ||
| 151 | && (wa.map_state == IsViewable || getstate(wins[i]) == IconicState)) | ||
| 127 | manage(wins[i], &wa); | 152 | manage(wins[i], &wa); |
| 128 | } | 153 | } |
| 129 | } | 154 | } |
