Commits

Anonymous committed ddddc12

fix issue when focussing the master window from within a floating window

Comments (0)

Files changed (2)

focusmaster.patch

 URL: no URL yet
 Straight forward patch to focus the master window with a keybinding.
 
-diff -r b2b314826d28 focusmaster.c
+diff -r e8fde3004349 focusmaster.c
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/focusmaster.c	Tue Feb 14 22:14:17 2012 +0100
++++ b/focusmaster.c	Sun Aug 05 20:40:13 2012 +0200
 @@ -0,0 +1,4 @@
 +static void
 +focusmaster(const Arg *arg) {
-+	focus(selmon->clients);
++	focus(nexttiled(selmon->clients));
 +}

single_tagset_all.patch

 
 Please be aware that this patch probably breaks any other patch!
 
-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 @@
+diff -r 004645a03fb9 dwm.c
+--- a/dwm.c	Sun Aug 05 20:41:01 2012 +0200
++++ b/dwm.c	Sun Aug 05 20:42:13 2012 +0200
+@@ -46,7 +46,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)) \
                                 * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
  #define LENGTH(X)               (sizeof X / sizeof X[0])
  #define MAX(A, B)               ((A) > (B) ? (A) : (B))
  #define MIN(A, B)               ((A) < (B) ? (A) : (B))
-@@ -126,6 +126,7 @@
+@@ -127,6 +127,7 @@
  } Layout;
  
  typedef struct Pertag Pertag;
  struct Monitor {
  	char ltsymbol[16];
  	float mfact;
-@@ -139,9 +140,8 @@
+@@ -140,9 +141,8 @@
  	unsigned int tagset[2];
  	Bool showbar;
  	Bool topbar;
  	Monitor *next;
  	Window barwin;
  	const Layout *lt[2];
-@@ -157,6 +157,11 @@
+@@ -158,6 +158,11 @@
  	int monitor;
  } Rule;
  
  /* function declarations */
  static void applyrules(Client *c);
  static Bool applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool interact);
-@@ -164,6 +169,7 @@
+@@ -165,6 +170,7 @@
  static void arrangemon(Monitor *m);
  static void attach(Client *c);
  static void attachabove(Client *c);
  static void attachstack(Client *c);
  static void buttonpress(XEvent *e);
  static void checkotherwm(void);
-@@ -206,7 +212,7 @@
+@@ -207,7 +213,7 @@
  static void monocle(Monitor *m);
  static void motionnotify(XEvent *e);
  static void movemouse(const Arg *arg);
  static void pop(Client *);
  static void propertynotify(XEvent *e);
  static void quit(const Arg *arg);
-@@ -291,6 +297,7 @@
+@@ -292,6 +298,7 @@
  static DC dc;
  static Monitor *mons = NULL, *selmon = NULL;
  static Window root;
  
  /* configuration, allows nested code to access above variables */
  #include "config.h"
-@@ -330,7 +337,7 @@
+@@ -331,7 +338,7 @@
  		{
  			c->isfloating = r->isfloating;
  			c->tags |= r->tags;
  			if(m)
  				c->mon = m;
  		}
-@@ -411,9 +418,9 @@
+@@ -412,9 +419,9 @@
  void
  arrange(Monitor *m) {
  	if(m)
  	if(m) {
  		arrangemon(m);
  		restack(m);
-@@ -430,27 +437,60 @@
+@@ -431,27 +438,60 @@
  
  void
  attach(Client *c) {
  }
  
  void
-@@ -513,8 +553,8 @@
+@@ -514,8 +554,8 @@
  	view(&a);
  	selmon->lt[selmon->sellt] = &foo;
  	for(m = mons; m; m = m->next)
  	if(dc.font.set)
  		XFreeFontSet(dpy, dc.font.set);
  	else
-@@ -572,7 +612,7 @@
+@@ -573,7 +613,7 @@
  			              || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
  	}
  	else if(cme->message_type == netatom[NetActiveWindow]) {
  			c->mon->seltags ^= 1;
  			c->mon->tagset[c->mon->seltags] = c->tags;
  		}
-@@ -655,7 +695,7 @@
+@@ -657,7 +697,7 @@
  				c->y = m->my + (m->mh / 2 - HEIGHT(c) / 2); /* center in y direction */
  			if((ev->value_mask & (CWX|CWY)) && !(ev->value_mask & (CWWidth|CWHeight)))
  				configure(c);
  				XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
  		}
  		else
-@@ -676,12 +716,18 @@
+@@ -678,12 +718,18 @@
  
  Monitor *
  createmon(void) {
  	m->mfact = mfact;
  	m->nmaster = nmaster;
  	m->showbar = showbar;
-@@ -723,7 +769,7 @@
+@@ -725,7 +771,7 @@
  detach(Client *c) {
  	Client **tc;
  
  	*tc = c->next;
  }
  
-@@ -731,11 +777,11 @@
+@@ -733,11 +779,11 @@
  detachstack(Client *c) {
  	Client **tc, *t;
  
  		c->mon->sel = t;
  	}
  }
-@@ -772,7 +818,7 @@
+@@ -774,7 +820,7 @@
  	unsigned long *col;
  	Client *c;
  
  		occ |= c->tags;
  		if(c->isurgent)
  			urg |= c->tags;
-@@ -888,8 +934,8 @@
+@@ -890,8 +936,8 @@
  
  void
  focus(Client *c) {
  	/* was if(selmon->sel) */
  	if(selmon->sel && selmon->sel != c)
  		unfocus(selmon->sel, False);
-@@ -943,17 +989,17 @@
+@@ -946,17 +992,17 @@
  	if(!selmon->sel)
  		return;
  	if(arg->i > 0) {
  					c = i;
  	}
  	if(c) {
-@@ -1255,12 +1301,12 @@
+@@ -1258,12 +1304,12 @@
  	unsigned int n = 0, r = 0;
  	Client *c;
  
  		/* remove border when in monocle layout */
  		if(c->bw) {
  			c->oldbw = c->bw;
-@@ -1348,8 +1394,8 @@
+@@ -1350,8 +1396,8 @@
  }
  
  Client *
  	return c;
  }
  
-@@ -1502,8 +1548,8 @@
+@@ -1503,8 +1549,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;
  			}
-@@ -1553,11 +1599,9 @@
+@@ -1554,11 +1600,9 @@
  	if(c->mon == m)
  		return;
  	unfocus(c, True);
  	attachstack(c);
  	focus(NULL);
  	arrange(NULL);
-@@ -1678,6 +1722,8 @@
+@@ -1679,6 +1723,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);
-@@ -1730,7 +1776,7 @@
+@@ -1731,7 +1777,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);
-@@ -1765,14 +1811,29 @@
+@@ -1766,14 +1812,29 @@
  void
  swapfocus(){
  	Client *c;
  		selmon->sel->tags = arg->ui & TAGMASK;
  		focus(NULL);
  		arrange(selmon);
-@@ -1802,7 +1863,7 @@
+@@ -1803,7 +1864,7 @@
  	unsigned int i, n, h, mw, my, ty, r;
  	Client *c;
  
  	if(n == 0)
  		return;
  
-@@ -1810,7 +1871,7 @@
+@@ -1811,7 +1872,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 */
-@@ -1883,12 +1944,17 @@
+@@ -1884,12 +1945,17 @@
  
  void
  toggletag(const Arg *arg) {
  		selmon->sel->tags = newtags;
  		focus(NULL);
  		arrange(selmon);
-@@ -1897,10 +1963,15 @@
+@@ -1898,10 +1964,15 @@
  
  void
  toggleview(const Arg *arg) {
  		if(newtagset == ~0) {
  			selmon->pertag->prevtag = selmon->pertag->curtag;
  			selmon->pertag->curtag = 0;
-@@ -1919,6 +1990,7 @@
+@@ -1920,6 +1991,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);
-@@ -2019,7 +2091,7 @@
+@@ -2020,7 +2092,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);
-@@ -2049,8 +2121,10 @@
+@@ -2050,8 +2122,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();
  			}
-@@ -2071,17 +2145,13 @@
+@@ -2072,17 +2146,13 @@
  		else { /* less monitors available nn < n */
  			for(i = nn; i < n; i++) {
  				for(m = mons; m && m->next; m = m->next);
  				cleanupmon(m);
  			}
  		}
-@@ -2221,11 +2291,30 @@
+@@ -2222,11 +2292,30 @@
  
  void
  view(const Arg *arg) {
  	selmon->seltags ^= 1; /* toggle sel tagset */
  	if(arg->ui & TAGMASK) {
  		selmon->pertag->prevtag = selmon->pertag->curtag;
-@@ -2246,6 +2335,7 @@
+@@ -2247,6 +2336,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);
-@@ -2258,7 +2348,7 @@
+@@ -2259,7 +2349,7 @@
  	Monitor *m;
  
  	for(m = mons; m; m = m->next)
  			if(c->win == w)
  				return c;
  	return NULL;
-@@ -2316,23 +2406,23 @@
+@@ -2317,23 +2407,23 @@
  void
  zoom(const Arg *arg) {
  	Client *c = selmon->sel;
  	pop(c);
  	/* swap windows instead of pushing the previous one down */
  	if(at && at != c) {
-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
+diff -r 004645a03fb9 focusmaster.c
+--- a/focusmaster.c	Sun Aug 05 20:41:01 2012 +0200
++++ b/focusmaster.c	Sun Aug 05 20:42:13 2012 +0200
 @@ -1,4 +1,4 @@
  static void
  focusmaster(const Arg *arg) {
--	focus(selmon->clients);
-+	focus(selmon->cl->clients);
+-	focus(nexttiled(selmon->clients));
++	focus(nexttiled(selmon->cl->clients, selmon));
  }
-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
+diff -r 004645a03fb9 push.c
+--- a/push.c	Sun Aug 05 20:41:01 2012 +0200
++++ b/push.c	Sun Aug 05 20:42:13 2012 +0200
 @@ -2,8 +2,8 @@
  prevtiled(Client *c) {
  	Client *p, *r;
  		/* attach after c */
  		detach(sel);
  		sel->next = c->next;
-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
+diff -r 004645a03fb9 tagall.c
+--- a/tagall.c	Sun Aug 05 20:41:01 2012 +0200
++++ b/tagall.c	Sun Aug 05 20:42:13 2012 +0200
 @@ -1,6 +1,6 @@
  void
  tagall(const Arg *arg) {