[wiki] [sites] cleaner approach to having floating windows stay on top || Unia

From: <git_AT_suckless.org>
Date: Sat, 23 Mar 2013 15:14:14 +0100

commit d45084eaedb4d87ff7d338fc76a3e5e122542e44
Author: Unia <jthidskes_AT_live.nl>
Date: Sat Mar 23 15:14:27 2013 +0100

    cleaner approach to having floating windows stay on top

diff --git a/dwm.suckless.org/patches/dwm-6.0-singularborders.diff b/dwm.suckless.org/patches/dwm-6.0-singularborders.diff
index 08537e2..eb94653 100644
--- a/dwm.suckless.org/patches/dwm-6.0-singularborders.diff
+++ b/dwm.suckless.org/patches/dwm-6.0-singularborders.diff
_AT_@ -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
-_AT_@ -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);
-_AT_@ -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
+_AT_@ -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) */
+_AT_@ -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
-_AT_@ -1200,7 +1203,7 @@
+_AT_@ -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))
_AT_@ -26,34 +30,16 @@
  }
  
  void
-_AT_@ -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;
-_AT_@ -1717,13 +1734,13 @@
+_AT_@ -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
index 746793f..2685ab4 100644
--- a/dwm.suckless.org/patches/dwm-6.0-singularborders_bstack.diff
+++ b/dwm.suckless.org/patches/dwm-6.0-singularborders_bstack.diff
_AT_@ -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
-_AT_@ -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);
-_AT_@ -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
+_AT_@ -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;
                  }
  }
  
-_AT_@ -883,6 +884,8 @@
+_AT_@ -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) */
+_AT_@ -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
-_AT_@ -1227,7 +1230,7 @@
+_AT_@ -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))
_AT_@ -44,34 +51,16 @@
  }
  
  void
-_AT_@ -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;
-_AT_@ -1744,13 +1761,13 @@
+_AT_@ -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 {
Received on Sat Mar 23 2013 - 15:14:14 CET

This archive was generated by hypermail 2.3.0 : Sat Mar 23 2013 - 15:24:06 CET