Commits

Anonymous committed cc88093

fix possible problems in swapfocus and zoomswap patches

  • Participants
  • Parent commits d2609df

Comments (0)

Files changed (3)

File single_tagset_all.patch

 
 Please be aware that this patch probably breaks any other patch!
 
-diff -r f0a2bc8a23e4 dwm.c
---- a/dwm.c	Mon Apr 02 20:41:19 2012 +0200
-+++ b/dwm.c	Mon Apr 02 20:42:07 2012 +0200
+diff -r 7abc3c51664a dwm.c
+--- a/dwm.c	Wed Apr 04 22:05:54 2012 +0200
++++ b/dwm.c	Wed Apr 04 22:08:01 2012 +0200
 @@ -45,7 +45,7 @@
  #define CLEANMASK(mask)         (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
  #define INTERSECT(x,y,w,h,m)    (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
  					c = i;
  	}
  	if(c) {
-@@ -1260,12 +1306,12 @@
+@@ -1255,12 +1301,12 @@
  	unsigned int n = 0, r = 0;
  	Client *c;
  
  		/* remove border when in monocle layout */
  		if(c->bw) {
  			c->oldbw = c->bw;
-@@ -1353,8 +1399,8 @@
+@@ -1348,8 +1394,8 @@
  }
  
  Client *
  	return c;
  }
  
-@@ -1507,8 +1553,8 @@
+@@ -1502,8 +1548,8 @@
  	if(m->lt[m->sellt]->arrange) {
  		wc.stack_mode = Below;
  		wc.sibling = m->barwin;
  				XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
  				wc.sibling = c->win;
  			}
-@@ -1558,11 +1604,9 @@
+@@ -1553,11 +1599,9 @@
  	if(c->mon == m)
  		return;
  	unfocus(c, True);
  	attachstack(c);
  	focus(NULL);
  	arrange(NULL);
-@@ -1683,6 +1727,8 @@
+@@ -1678,6 +1722,8 @@
  	sw = DisplayWidth(dpy, screen);
  	sh = DisplayHeight(dpy, screen);
  	bh = dc.h = dc.font.height + 2;
  	updategeom();
  	/* init atoms */
  	wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
-@@ -1735,7 +1781,7 @@
+@@ -1730,7 +1776,7 @@
  showhide(Client *c) {
  	if(!c)
  		return;
  		XMoveWindow(dpy, c->win, c->x, c->y);
  		if((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
  			resize(c, c->x, c->y, c->w, c->h, False);
-@@ -1769,7 +1815,22 @@
+@@ -1765,14 +1811,29 @@
+ void
+ swapfocus(){
+ 	Client *c;
+-	for(c = selmon->clients; c && c != prevclient; c = c->next) ;
++	for(c = selmon->cl->clients; c && c != prevclient; c = c->next) ;
+ 	if(c == prevclient)
+ 		focus(prevclient);
+ }
  
  void
  tag(const Arg *arg) {
  		selmon->sel->tags = arg->ui & TAGMASK;
  		focus(NULL);
  		arrange(selmon);
-@@ -1799,7 +1860,7 @@
+@@ -1802,7 +1863,7 @@
  	unsigned int i, n, h, mw, my, ty, r;
  	Client *c;
  
  	if(n == 0)
  		return;
  
-@@ -1807,7 +1868,7 @@
+@@ -1810,7 +1871,7 @@
  		mw = m->nmaster ? m->ww * m->mfact : 0;
  	else
  		mw = m->ww;
  		if(n == 1) {
  			if (c->bw) {
  				/* remove border when only one window is on the current tag */
-@@ -1880,12 +1941,17 @@
+@@ -1883,12 +1944,17 @@
  
  void
  toggletag(const Arg *arg) {
  		selmon->sel->tags = newtags;
  		focus(NULL);
  		arrange(selmon);
-@@ -1894,10 +1960,15 @@
+@@ -1897,10 +1963,15 @@
  
  void
  toggleview(const Arg *arg) {
  		if(newtagset == ~0) {
  			selmon->pertag->prevtag = selmon->pertag->curtag;
  			selmon->pertag->curtag = 0;
-@@ -1916,6 +1987,7 @@
+@@ -1919,6 +1990,7 @@
  		selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
  		selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
  		selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
  		if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
  			togglebar(NULL);
  		focus(NULL);
-@@ -2016,7 +2088,7 @@
+@@ -2019,7 +2091,7 @@
  
  	XDeleteProperty(dpy, root, netatom[NetClientList]);
  	for(m = mons; m; m = m->next)
  			XChangeProperty(dpy, root, netatom[NetClientList],
  			                XA_WINDOW, 32, PropModeAppend,
  			                (unsigned char *) &(c->win), 1);
-@@ -2046,8 +2118,10 @@
+@@ -2049,8 +2121,10 @@
  		if(n <= nn) {
  			for(i = 0; i < (nn - n); i++) { /* new monitors available */
  				for(m = mons; m && m->next; m = m->next);
  				else
  					mons = createmon();
  			}
-@@ -2068,17 +2142,13 @@
+@@ -2071,17 +2145,13 @@
  		else { /* less monitors available nn < n */
  			for(i = nn; i < n; i++) {
  				for(m = mons; m && m->next; m = m->next);
  				cleanupmon(m);
  			}
  		}
-@@ -2218,11 +2288,30 @@
+@@ -2221,11 +2291,30 @@
  
  void
  view(const Arg *arg) {
  	selmon->seltags ^= 1; /* toggle sel tagset */
  	if(arg->ui & TAGMASK) {
  		selmon->pertag->prevtag = selmon->pertag->curtag;
-@@ -2243,6 +2332,7 @@
+@@ -2246,6 +2335,7 @@
  	selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
  	selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
  	selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
  	if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
  		togglebar(NULL);
  	focus(NULL);
-@@ -2255,7 +2345,7 @@
+@@ -2258,7 +2348,7 @@
  	Monitor *m;
  
  	for(m = mons; m; m = m->next)
  			if(c->win == w)
  				return c;
  	return NULL;
-@@ -2313,19 +2403,19 @@
+@@ -2316,23 +2406,23 @@
  void
  zoom(const Arg *arg) {
  	Client *c = selmon->sel;
  	if(!selmon->lt[selmon->sellt]->arrange
  	|| (selmon->sel && selmon->sel->isfloating))
  		return;
--	if(c == nexttiled(selmon->clients))
+-	if(c == nexttiled(selmon->clients)) {
+-		for(tmp = selmon->clients; tmp && tmp != prevzoom; tmp = tmp->next) ;
++	if(c == nexttiled(selmon->cl->clients, selmon)) {
++		for(tmp = selmon->cl->clients; tmp && tmp != prevzoom; tmp = tmp->next) ;
+ 		if(tmp != prevzoom)
+ 			prevzoom = NULL;
 -		if(!c || !(c = nexttiled(prevzoom))) {
-+	if(c == nexttiled(selmon->cl->clients, selmon))
 +		if(!c || !(c = nexttiled(prevzoom, selmon))) {
  			c = selmon->sel;
 -			if(!c || !(c = nexttiled(c->next)))
 +			if(!c || !(c = nexttiled(c->next, selmon)))
  				return;
  		}
+ 	}
 -	for(at = selmon->clients; at && at->next && at != c && at->next != c; at = nexttiled(at->next)) ;
 +	for(at = selmon->cl->clients; at && at->next && at != c && at->next != c; at = nexttiled(at->next, selmon)) ;
  	pop(c);
  	/* swap windows instead of pushing the previous one down */
  	if(at && at != c) {
-diff -r f0a2bc8a23e4 focusmaster.c
---- a/focusmaster.c	Mon Apr 02 20:41:19 2012 +0200
-+++ b/focusmaster.c	Mon Apr 02 20:42:07 2012 +0200
+diff -r 7abc3c51664a focusmaster.c
+--- a/focusmaster.c	Wed Apr 04 22:05:54 2012 +0200
++++ b/focusmaster.c	Wed Apr 04 22:08:01 2012 +0200
 @@ -1,4 +1,4 @@
  static void
  focusmaster(const Arg *arg) {
 -	focus(selmon->clients);
 +	focus(selmon->cl->clients);
  }
-diff -r f0a2bc8a23e4 push.c
---- a/push.c	Mon Apr 02 20:41:19 2012 +0200
-+++ b/push.c	Mon Apr 02 20:42:07 2012 +0200
+diff -r 7abc3c51664a push.c
+--- a/push.c	Wed Apr 04 22:05:54 2012 +0200
++++ b/push.c	Wed Apr 04 22:08:01 2012 +0200
 @@ -2,8 +2,8 @@
  prevtiled(Client *c) {
  	Client *p, *r;
  		/* attach after c */
  		detach(sel);
  		sel->next = c->next;
-diff -r f0a2bc8a23e4 tagall.c
---- a/tagall.c	Mon Apr 02 20:41:19 2012 +0200
-+++ b/tagall.c	Mon Apr 02 20:42:07 2012 +0200
+diff -r 7abc3c51664a tagall.c
+--- a/tagall.c	Wed Apr 04 22:05:54 2012 +0200
++++ b/tagall.c	Wed Apr 04 22:08:01 2012 +0200
 @@ -1,6 +1,6 @@
  void
  tagall(const Arg *arg) {

File swapfocus.patch

 instead of having to think if you should use alt-j or alt-k for reaching the
 last used window.
 
-diff -r dd87e55313da dwm.c
---- a/dwm.c	Sun Feb 12 08:39:44 2012 +0100
-+++ b/dwm.c	Sun Feb 12 08:54:45 2012 +0100
+diff -r f306d51682fb dwm.c
+--- a/dwm.c	Wed Apr 04 21:47:32 2012 +0200
++++ b/dwm.c	Wed Apr 04 21:56:45 2012 +0200
 @@ -228,6 +228,7 @@
  static void showhide(Client *c);
  static void sigchld(int unused);
  static void tag(const Arg *arg);
  static void tagmon(const Arg *arg);
  static int textnw(const char *text, unsigned int len);
-@@ -257,6 +258,7 @@
+@@ -258,6 +259,7 @@
  static void zoom(const Arg *arg);
  
  /* variables */
  static const char broken[] = "broken";
  static char stext[256];
  static int screen;
-@@ -970,6 +972,11 @@
- 	return atom;
+@@ -1760,6 +1762,14 @@
  }
  
-+void
+ void
 +swapfocus(){
-+	focus(prevclient);
++	Client *c;
++	for(c = selmon->clients; c && c != prevclient; c = c->next) ;
++	if(c == prevclient)
++		focus(prevclient);
 +}
 +
- unsigned long
- getcolor(const char *colstr) {
- 	Colormap cmap = DefaultColormap(dpy, screen);
-@@ -1898,6 +1905,7 @@
++void
+ tag(const Arg *arg) {
+ 	if(selmon->sel && arg->ui & TAGMASK) {
+ 		selmon->sel->tags = arg->ui & TAGMASK;
+@@ -1919,6 +1929,7 @@
  unfocus(Client *c, Bool setfocus) {
  	if(!c)
  		return;
  	grabbuttons(c, False);
  	if(c->isfloating)
  		XSetWindowBorder(dpy, c->win, dc.norm[ColBorderFloat]);
-@@ -2266,6 +2274,7 @@
+@@ -2304,6 +2315,7 @@
  void
  zoom(const Arg *arg) {
  	Client *c = selmon->sel;

File zoomswap.patch

 URL: http://dwm.suckless.org/patches/zoomswap
 This patch swaps the current window with the previous master when zooming.
 
-diff -r 7657716d12e3 dwm.c
---- a/dwm.c	Tue Feb 14 06:33:11 2012 +0100
-+++ b/dwm.c	Tue Feb 14 07:04:22 2012 +0100
-@@ -259,6 +259,7 @@
+diff -r 1fffcdf75b68 dwm.c
+--- a/dwm.c	Wed Apr 04 21:57:05 2012 +0200
++++ b/dwm.c	Wed Apr 04 22:02:55 2012 +0200
+@@ -260,6 +260,7 @@
  
  /* variables */
  static Client *prevclient = NULL;
  static const char broken[] = "broken";
  static char stext[256];
  static int screen;
-@@ -2275,14 +2276,32 @@
+@@ -2316,14 +2317,36 @@
  zoom(const Arg *arg) {
  	Client *c = selmon->sel;
  	prevclient = selmon->clients;
  	if(!selmon->lt[selmon->sellt]->arrange
  	|| (selmon->sel && selmon->sel->isfloating))
  		return;
- 	if(c == nexttiled(selmon->clients))
+-	if(c == nexttiled(selmon->clients))
 -		if(!c || !(c = nexttiled(c->next)))
 -			return;
++	if(c == nexttiled(selmon->clients)) {
++		for(tmp = selmon->clients; tmp && tmp != prevzoom; tmp = tmp->next) ;
++		if(tmp != prevzoom)
++			prevzoom = NULL;
 +		if(!c || !(c = nexttiled(prevzoom))) {
 +			c = selmon->sel;
 +			if(!c || !(c = nexttiled(c->next)))
 +				return;
 +		}
++	}
 +	for(at = selmon->clients; at && at->next && at != c && at->next != c; at = nexttiled(at->next)) ;
  	pop(c);
 +	/* swap windows instead of pushing the previous one down */