X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=main.c;h=79b301d06c3648dc2e242c40279392ffc2c6f89c;hb=fc109ea8f72e662ed58ef45329b6ca9e91d61d3b;hp=9127d163abb27b6cf2994c679be0d1ca1b6c85ec;hpb=96d7fe16eaf6b656800f08da3156bacd75ca3b08;p=dwm.git diff --git a/main.c b/main.c index 9127d16..79b301d 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); } } @@ -206,7 +231,7 @@ setup(void) { XSetFont(dpy, dc.gc, dc.font.xfont->fid); /* multihead support */ selscreen = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask); - loaddwmprops(); + getdwmprops(); } /* @@ -253,32 +278,6 @@ quit(const char *arg) { readin = running = False; } -void -updatebarpos(void) { - XEvent ev; - - wax = sx; - way = sy; - wah = sh; - waw = sw; - switch(bpos) { - default: - wah -= bh; - way += bh; - XMoveWindow(dpy, barwin, sx, sy); - break; - case BarBot: - wah -= bh; - XMoveWindow(dpy, barwin, sx, sy + wah); - break; - case BarOff: - XMoveWindow(dpy, barwin, sx, sy - bh); - break; - } - XSync(dpy, False); - while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); -} - /* There's no way to check accesses to destroyed windows, thus those cases are * ignored (especially on UnmapNotify's). Other types of errors call Xlibs * default error handler, which may call exit.