X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=dwm.c;h=1909d4baa85ee7df9f4e532753e927a81835e041;hp=4ff4f9d92879d977dfb2c06241df740ae25a67b3;hb=5c4913e9838534e880a1334ddc76c80810019f62;hpb=54dc0d542cbc8eada2250fe80d161a272f30ddac diff --git a/dwm.c b/dwm.c index 4ff4f9d..1909d4b 100644 --- a/dwm.c +++ b/dwm.c @@ -1,3 +1,4 @@ +#define XINULATOR /* debug, simulates dual head */ /* See LICENSE file for copyright and license details. * * dynamic window manager is designed like any other X client as well. It is @@ -1044,8 +1045,8 @@ manage(Window w, XWindowAttributes *wa) { c->y = sy + sh - HEIGHT(c); c->x = MAX(c->x, sx); /* only fix client y-offset, if the client center might cover the bar */ - c->y = MAX(c->y, ((selmon->by == 0) && (c->x + (c->w / 2) >= selmon->wx) - && (c->x + (c->w / 2) < selmon->wx + selmon->ww)) ? bh : sy); + c->y = MAX(c->y, ((c->mon->by == 0) && (c->x + (c->w / 2) >= c->mon->wx) + && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : sy); c->bw = borderpx; } @@ -1158,7 +1159,6 @@ movemouse(const Arg *arg) { Client * nexttiled(Client *c) { - // TODO: m handling for(; c && (c->isfloating || !ISVISIBLE(c)); c = c->next); return c; } @@ -1271,10 +1271,10 @@ restack(Monitor *m) { XWindowChanges wc; drawbars(); - if(!selmon->sel) + if(!m->sel) return; - if(m == selmon && (selmon->sel->isfloating || !lt[m->sellt]->arrange)) - XRaiseWindow(dpy, selmon->sel->win); + if(m->sel->isfloating || !lt[m->sellt]->arrange) + XRaiseWindow(dpy, m->sel->win); if(lt[m->sellt]->arrange) { wc.stack_mode = Below; wc.sibling = m->barwin; @@ -1593,8 +1593,10 @@ unmanage(Client *c) { XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */ detach(c); detachstack(c); - if(selmon->sel == c) + if(c->mon->sel == c) { + c->mon->sel = c->mon->stack; focus(NULL); + } XUngrabButton(dpy, AnyButton, AnyModifier, c->win); setclientstate(c, WithdrawnState); free(c); @@ -1651,7 +1653,9 @@ updategeom(void) { Client *c; Monitor *newmons = NULL, *m, *tm; -#ifdef XINERAMA +#ifdef XINULATOR + n = 2; +#elif defined(XINERAMA) XineramaScreenInfo *info = NULL; if(XineramaIsActive(dpy)) @@ -1665,7 +1669,23 @@ updategeom(void) { } /* initialise monitor(s) */ -#ifdef XINERAMA +#ifdef XINULATOR + if(1) { + m = newmons; + m->screen_number = 0; + m->wx = sx; + m->my = m->wy = sy; + m->ww = sw; + m->mh = m->wh = sh / 2; + m = newmons->next; + m->screen_number = 1; + m->wx = sx; + m->my = m->wy = sy + sh / 2; + m->ww = sw; + m->mh = m->wh = sh / 2; + } + else +#elif defined(XINERAMA) if(XineramaIsActive(dpy)) { for(i = 0, m = newmons; m; m = m->next, i++) { m->screen_number = info[i].screen_number; @@ -1714,18 +1734,12 @@ updategeom(void) { /* reassign left over clients of disappeared monitors */ for(tm = mons; tm; tm = tm->next) { - while(tm->clients) { - c = tm->clients->next; - tm->clients->next = newmons->clients; - tm->clients->mon = newmons; - newmons->clients = tm->clients; - tm->clients = c; - } - while(tm->stack) { - c = tm->stack->snext; - tm->stack->snext = newmons->stack; - newmons->sel = newmons->stack = tm->stack; - tm->stack = c; + while((c = tm->clients)) { + detach(c); + detachstack(c); + c->mon = newmons; + attach(c); + attachstack(c); } }