sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit d45084eaedb4d87ff7d338fc76a3e5e122542e44
parent ba892a7c1b4a99bcf1b7e23939ec1d1af0c4c5c5
Author: Unia <jthidskes@live.nl>
Date:   Sat, 23 Mar 2013 15:14:27 +0100

cleaner approach to having floating windows stay on top

Diffstat:
Mdwm.suckless.org/patches/dwm-6.0-singularborders.diff | 60+++++++++++++++++++++++-------------------------------------
Mdwm.suckless.org/patches/dwm-6.0-singularborders_bstack.diff | 71++++++++++++++++++++++++++++++-----------------------------------------
2 files changed, 53 insertions(+), 78 deletions(-)

diff --git a/dwm.suckless.org/patches/dwm-6.0-singularborders.diff b/dwm.suckless.org/patches/dwm-6.0-singularborders.diff @@ -1,23 +1,27 @@ ---- dwm.c.orig 2013-03-21 12:53:45.498473296 +0100 -+++ dwm.c 2013-03-21 12:54:45.321805710 +0100 -@@ -206,6 +206,7 @@ - static void pop(Client *); - static void propertynotify(XEvent *e); - static void quit(const Arg *arg); -+static void raisefloating(void); - static Monitor *recttomon(int x, int y, int w, int h); - static void resize(Client *c, int x, int y, int w, int h, Bool interact); - static void resizeclient(Client *c, int x, int y, int w, int h); -@@ -856,6 +857,8 @@ +--- dwm.c.orig 2013-03-23 15:13:21.709978427 +0100 ++++ dwm.c 2013-03-23 15:13:13.366645236 +0100 +@@ -842,6 +842,8 @@ + + void + focus(Client *c) { ++ XWindowChanges wc; ++ + if(!c || !ISVISIBLE(c)) + for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext); + /* was if(selmon->sel) */ +@@ -856,6 +858,11 @@ attachstack(c); grabbuttons(c, True); XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]); -+ XRaiseWindow(dpy, c->win); -+ raisefloating(); ++ if(!c->isfloating) { ++ wc.sibling = selmon->barwin; ++ wc.stack_mode = Below; ++ XConfigureWindow(dpy, c->win, CWSibling | CWStackMode, &wc); ++ } setfocus(c); } else -@@ -1200,7 +1203,7 @@ +@@ -1200,7 +1207,7 @@ if(n > 0) /* override layout symbol */ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n); for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) @@ -26,34 +30,16 @@ } void -@@ -1328,6 +1331,20 @@ - running = False; - } - -+void -+raisefloating(void) { -+ Client *c; -+ XEvent ev; -+ -+ if(selmon->lt[selmon->sellt]->arrange) { -+ for(c = selmon->clients; c; c = c->next) -+ if(c->isfloating) -+ XRaiseWindow(dpy, c->win); -+ } -+ XSync(dpy, False); -+ while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); -+} -+ - Monitor * - recttomon(int x, int y, int w, int h) { - Monitor *m, *r = selmon; -@@ -1717,13 +1734,13 @@ +@@ -1717,13 +1724,16 @@ for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) if(i < m->nmaster) { h = (m->wh - my) / (MIN(n, m->nmaster) - i); - resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False); - my += HEIGHT(c); -+ resize(c, m->wx - c->bw, m->wy + my, mw - c->bw, h - c->bw, False); ++ if(n == 1) ++ resize(c, m->wx - c->bw, m->wy, m->ww, m->wh, False); ++ else ++ resize(c, m->wx - c->bw, m->wy + my, mw - c->bw, h - c->bw, False); + my += HEIGHT(c) - c->bw; } else { diff --git a/dwm.suckless.org/patches/dwm-6.0-singularborders_bstack.diff b/dwm.suckless.org/patches/dwm-6.0-singularborders_bstack.diff @@ -1,41 +1,48 @@ ---- dwm.c.orig 2013-03-21 12:56:41.818470330 +0100 -+++ dwm.c 2013-03-21 12:59:07.195134552 +0100 -@@ -207,6 +207,7 @@ - static void pop(Client *); - static void propertynotify(XEvent *e); - static void quit(const Arg *arg); -+static void raisefloating(void); - static Monitor *recttomon(int x, int y, int w, int h); - static void resize(Client *c, int x, int y, int w, int h, Bool interact); - static void resizeclient(Client *c, int x, int y, int w, int h); -@@ -440,13 +441,13 @@ +--- dwm.c.orig 2013-03-23 15:10:01.553315130 +0100 ++++ dwm.c 2013-03-23 15:12:51.639978935 +0100 +@@ -440,13 +440,16 @@ for(i = mx = tx = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) if(i < m->nmasters[m->curtag]) { w = (m->ww - mx) / (MIN(n, m->nmasters[m->curtag]) - i); - resize(c, m->wx + mx, m->wy, w - (2*c->bw), mh - (2*c->bw), False); - mx += WIDTH(c); -+ resize(c, m->wx + mx - c->bw, m->wy, w, mh - c->bw, False); ++ if(n == 1) ++ resize(c, m->wx - c->bw, m->wy, m->ww, m->wh, False); ++ else ++ resize(c, m->wx + mx - c->bw, m->wy, w, mh - c->bw, False); + mx += WIDTH(c) - c->bw; } else { w = (m->ww - tx) / (n - i); -- resize(c, m->wx + tx, m->wy + mh, w - (2*c->bw), m->wh - mh - (2*c->bw$ +- resize(c, m->wx + tx, m->wy + mh, w - (2*c->bw), m->wh - mh - (2*c->bw), False); - tx += WIDTH(c); + resize(c, m->wx + tx - c->bw, m->wy + mh, w, m->wh - mh - c->bw, False); -+ tx += WIDTH(c) - c->bw ++ tx += WIDTH(c) - c->bw; } } -@@ -883,6 +884,8 @@ +@@ -869,6 +872,8 @@ + + void + focus(Client *c) { ++ XWindowChanges wc; ++ + if(!c || !ISVISIBLE(c)) + for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext); + /* was if(selmon->sel) */ +@@ -883,6 +888,11 @@ attachstack(c); grabbuttons(c, True); XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]); -+ XRaiseWindow(dpy, c->win); -+ raisefloating(); ++ if(!c->isfloating) { ++ wc.sibling = selmon->barwin; ++ wc.stack_mode = Below; ++ XConfigureWindow(dpy, c->win, CWSibling | CWStackMode, &wc); ++ } setfocus(c); } else -@@ -1227,7 +1230,7 @@ +@@ -1227,7 +1237,7 @@ if(n > 0) /* override layout symbol */ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n); for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) @@ -44,34 +51,16 @@ } void -@@ -1355,6 +1358,20 @@ - running = False; - } - -+void -+raisefloating(void) { -+ Client *c; -+ XEvent ev; -+ -+ if(selmon->lt[selmon->sellt]->arrange) { -+ for(c = selmon->clients; c; c = c->next) -+ if(c->isfloating) -+ XRaiseWindow(dpy, c->win); -+ } -+ XSync(dpy, False); -+ while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); -+} -+ - Monitor * - recttomon(int x, int y, int w, int h) { - Monitor *m, *r = selmon; -@@ -1744,13 +1761,13 @@ +@@ -1744,13 +1754,16 @@ for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) if(i < m->nmaster) { h = (m->wh - my) / (MIN(n, m->nmaster) - i); - resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False); - my += HEIGHT(c); -+ resize(c, m->wx - c->bw, m->wy + my, mw - c->bw, h - c->bw, False); ++ if(n == 1) ++ resize(c, m->wx - c->bw, m->wy, m->ww, m->wh, False); ++ else ++ resize(c, m->wx - c->bw, m->wy + my, mw - c->bw, h - c->bw, False); + my += HEIGHT(c) - c->bw; } else {