[hackers] [dwm] fixed tagmon, re-using detach/detachstack and attach/attachstack || Anselm R Garbe

From: <hg_AT_suckless.org>
Date: Tue, 23 Jun 2009 19:48:36 +0000 (UTC)

changeset: 1409:ed5530a91efe
user: Anselm R Garbe <anselm_AT_garbe.us>
date: Tue Jun 23 17:34:20 2009 +0100
files: config.mk dwm.c
description:
fixed tagmon, re-using detach/detachstack and attach/attachstack

diff -r 2215f7f11dd9 -r ed5530a91efe config.mk
--- a/config.mk Tue Jun 23 17:20:33 2009 +0100
+++ b/config.mk Tue Jun 23 17:34:20 2009 +0100
@@ -11,8 +11,8 @@
 X11LIB = /usr/X11R6/lib
 
 # Xinerama, un-comment if you want it
-#XINERAMALIBS = -L${X11LIB} -lXinerama
-#XINERAMAFLAGS = -DXINERAMA
+XINERAMALIBS = -L${X11LIB} -lXinerama
+XINERAMAFLAGS = -DXINERAMA
 
 # includes and libs
 INCS = -I. -I/usr/include -I${X11INC}
diff -r 2215f7f11dd9 -r ed5530a91efe dwm.c
--- a/dwm.c Tue Jun 23 17:20:33 2009 +0100
+++ b/dwm.c Tue Jun 23 17:34:20 2009 +0100
@@ -375,14 +375,14 @@
 
 void
 attach(Client *c) {
- c->next = selmon->clients;
- selmon->clients = c;
+ c->next = c->mon->clients;
+ c->mon->clients = c;
 }
 
 void
 attachstack(Client *c) {
- c->snext = selmon->stack;
- selmon->stack = c;
+ c->snext = c->mon->stack;
+ c->mon->stack = c;
 }
 
 void
@@ -1475,11 +1475,20 @@
 void
 tagmon(const Arg *arg) {
         unsigned int i;
+ Client *c;
         Monitor *m;
 
+ if(!(c = selmon->sel))
+ return;
         for(i = 0, m = mons; m; m = m->next, i++)
                 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();
                         break;
                 }
@@ -1695,7 +1704,7 @@
                 for(tm = mons; tm; tm = tm->next)
                         if(tm->screen_number == m->screen_number) {
                                 m->clients = tm->clients;
- m->stack = tm->stack;
+ m->sel = m->stack = tm->stack;
                                 tm->clients = NULL;
                                 tm->stack = NULL;
                                 for(c = m->clients; c; c = c->next)
@@ -1715,7 +1724,7 @@
                 while(tm->stack) {
                         c = tm->stack->snext;
                         tm->stack->snext = newmons->stack;
- newmons->stack = tm->stack;
+ newmons->sel = newmons->stack = tm->stack;
                         tm->stack = c;
                 }
         }
Received on Tue Jun 23 2009 - 19:48:36 UTC

This archive was generated by hypermail 2.2.0 : Tue Jun 23 2009 - 20:00:09 UTC