X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=dwm.c;h=37df864d77e9e86c8c10669dc0a43f0049540b2b;hb=234b12eb73f5c6de3da4eb93cac2159e73647529;hp=504b78b0dcaa7ed40c19e2714b0bbe1e71532e78;hpb=71365a524f67235024de7db277c63f8ac4f46569;p=dwm.git diff --git a/dwm.c b/dwm.c index 504b78b..37df864 100644 --- a/dwm.c +++ b/dwm.c @@ -39,6 +39,9 @@ #include #include #include +#ifdef XINERAMA +#include +#endif /* macros */ #define MAX(a, b) ((a) > (b) ? (a) : (b)) @@ -955,12 +958,12 @@ manage(Window w, XWindowAttributes *wa) { c->bw = wa->border_width; } else { - if(c->x + c->w + 2 * c->bw > wx + ww) - c->x = wx + ww - c->w - 2 * c->bw; - if(c->y + c->h + 2 * c->bw > wy + wh) - c->y = wy + wh - c->h - 2 * c->bw; - c->x = MAX(c->x, wx); - c->y = MAX(c->y, wy); + if(c->x + c->w + 2 * c->bw > sx + sw) + c->x = sx + sw - c->w - 2 * c->bw; + if(c->y + c->h + 2 * c->bw > sy + sh) + c->y = sy + sh - c->h - 2 * c->bw; + c->x = MAX(c->x, sx); + c->y = MAX(c->y, sy); c->bw = borderpx; } @@ -1579,22 +1582,32 @@ updatebar(void) { void updategeom(void) { - unsigned int i; - -#ifdef CUSTOMGEOM /* define your own if you are Xinerama user */ - CUSTOMGEOM -#else - /* bar geometry*/ - bx = 0; - by = showbar ? (topbar ? 0 : sh - bh) : -bh; - bw = sw; + int i; +#ifdef XINERAMA + XineramaScreenInfo *info = NULL; /* window area geometry */ - wx = sx; - wy = showbar && topbar ? sy + bh : sy; - ww = sw; - wh = showbar ? sh - bh : sh; + if(XineramaIsActive(dpy)) { + info = XineramaQueryScreens(dpy, &i); + wx = info[0].x_org; + wy = showbar && topbar ? info[0].y_org + bh : info[0].y_org; + ww = info[0].width; + wh = showbar ? info[0].height - bh : info[0].height; + XFree(info); + } + else #endif + { + wx = sx; + wy = showbar && topbar ? sy + bh : sy; + ww = sw; + wh = showbar ? sh - bh : sh; + } + + /* bar geometry*/ + bx = wx; + by = showbar ? (topbar ? 0 : wy + wh) : -bh; + bw = ww; /* update layout geometries */ for(i = 0; i < LENGTH(layouts); i++)