fixed tagmon, re-using detach/detachstack and attach/attachstack

new_dwm
Anselm R Garbe 16 years ago
parent 913333f518
commit 54dc0d542c

@ -11,8 +11,8 @@ X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib X11LIB = /usr/X11R6/lib
# Xinerama, un-comment if you want it # Xinerama, un-comment if you want it
#XINERAMALIBS = -L${X11LIB} -lXinerama XINERAMALIBS = -L${X11LIB} -lXinerama
#XINERAMAFLAGS = -DXINERAMA XINERAMAFLAGS = -DXINERAMA
# includes and libs # includes and libs
INCS = -I. -I/usr/include -I${X11INC} INCS = -I. -I/usr/include -I${X11INC}

23
dwm.c

@ -375,14 +375,14 @@ arrange(void) {
void void
attach(Client *c) { attach(Client *c) {
c->next = selmon->clients; c->next = c->mon->clients;
selmon->clients = c; c->mon->clients = c;
} }
void void
attachstack(Client *c) { attachstack(Client *c) {
c->snext = selmon->stack; c->snext = c->mon->stack;
selmon->stack = c; c->mon->stack = c;
} }
void void
@ -1475,11 +1475,20 @@ tag(const Arg *arg) {
void void
tagmon(const Arg *arg) { tagmon(const Arg *arg) {
unsigned int i; unsigned int i;
Client *c;
Monitor *m; Monitor *m;
if(!(c = selmon->sel))
return;
for(i = 0, m = mons; m; m = m->next, i++) for(i = 0, m = mons; m; m = m->next, i++)
if(i == arg->ui) { if(i == arg->ui) {
selmon->sel->m = m; detach(c);
detachstack(c);
c->mon = m;
attach(c);
attachstack(c);
selmon->sel = selmon->stack;
m->sel = c;
arrange(); arrange();
break; break;
} }
@ -1695,7 +1704,7 @@ updategeom(void) {
for(tm = mons; tm; tm = tm->next) for(tm = mons; tm; tm = tm->next)
if(tm->screen_number == m->screen_number) { if(tm->screen_number == m->screen_number) {
m->clients = tm->clients; m->clients = tm->clients;
m->stack = tm->stack; m->sel = m->stack = tm->stack;
tm->clients = NULL; tm->clients = NULL;
tm->stack = NULL; tm->stack = NULL;
for(c = m->clients; c; c = c->next) for(c = m->clients; c; c = c->next)
@ -1715,7 +1724,7 @@ updategeom(void) {
while(tm->stack) { while(tm->stack) {
c = tm->stack->snext; c = tm->stack->snext;
tm->stack->snext = newmons->stack; tm->stack->snext = newmons->stack;
newmons->stack = tm->stack; newmons->sel = newmons->stack = tm->stack;
tm->stack = c; tm->stack = c;
} }
} }

Loading…
Cancel
Save