[wiki] [sites] Resolved some glitches in better-borders patch || Eric Pruitt

From: <git_AT_suckless.org>
Date: Sun, 03 Jul 2016 03:14:49 +0200

commit 1328e6c8188f247204f617f6e355af4b670cbc9b
Author: Eric Pruitt <eric.pruitt_AT_gmail.com>
Date: Sat Jul 2 18:12:34 2016 -0700

    Resolved some glitches in better-borders patch
    
    This better-borders patch has been updated to fix glitchy borders when
    toggling between floating layouts and also resolves an issue where
    windows would be frozen after restarting dwm. The patch name has been
    updated to reflect the recently proposed changes on the suckless mailing
    list.

diff --git a/dwm.suckless.org/patches/better-borders.md b/dwm.suckless.org/patches/better-borders.md
index a0d89eb..51df740 100644
--- a/dwm.suckless.org/patches/better-borders.md
+++ b/dwm.suckless.org/patches/better-borders.md
_AT_@ -6,11 +6,8 @@ Description
 
 Like [Ebersbach's patch](http://dwm.suckless.org/patches/noborder), this patch
 removes the border when there is only one window visible, but this patch does
-not depend on layout-specific changes and should automatically work with most
-layouts. The patch also removes borders from any windows that are the same size
-as the monitor and marks them full-screen even if their X properties indicate
-otherwise. This eliminates nuisance borders that appear with some games and
-applications while in full-screen mode.
+should automatically work with most other custom layouts with no additiona
+layout-specific changes.
 
 Thanks to Alesandar Metodiev for reporting a bug that lead to the patch being
 rewritten.
_AT_@ -18,7 +15,7 @@ rewritten.
 Download
 --------
 
- * [dwm-6.1-better-borders.diff](dwm-6.1-better-borders.diff) (2015-12-27)
+ * [dwm-better-borders-git-20160702-56a31dc.diff](dwm-better-borders-git-20160702-56a31dc.diff)
 
 Author
 ------
diff --git a/dwm.suckless.org/patches/dwm-6.1-better-borders.diff b/dwm.suckless.org/patches/dwm-6.1-better-borders.diff
deleted file mode 100644
index 5488b2e..0000000
--- a/dwm.suckless.org/patches/dwm-6.1-better-borders.diff
+++ /dev/null
_AT_@ -1,91 +0,0 @@
-Author: Eric Pruitt, https://github.com/ericpruitt/
-Description: This patch makes dwm remove borders when only one, non-floating
-window is visible. Additionally, any windows that are the same size as the
-monitor are considered full-screen and their borders removed accordingly.
-
-diff --git a/dwm.c b/dwm.c
-index 0362114..03fddb6 100644
---- a/dwm.c
-+++ b/dwm.c
-_AT_@ -393,9 +393,24 @@ arrange(Monitor *m)
- void
- arrangemon(Monitor *m)
- {
-+ int n = 0;
-+ Client *c;
- strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
-- if (m->lt[m->sellt]->arrange)
-- m->lt[m->sellt]->arrange(m);
-+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
-+ if (n > 1 || !m->lt[m->sellt]->arrange) {
-+ for (c = m->clients; c; c = c->next) {
-+ if (ISVISIBLE(c) && (!m->lt[m->sellt]->arrange || !c->isfloating) && (c->bw != borderpx)) {
-+ c->oldbw = c->oldbw;
-+ c->bw = borderpx;
-+ resizeclient(c, m->wx, m->wy, m->ww - (2 * c->bw), m->wh - (2 * c->bw));
-+ }
-+ }
-+ if (m->lt[m->sellt]->arrange) {
-+ m->lt[m->sellt]->arrange(m);
-+ }
-+ } else {
-+ monocle(m);
-+ }
- }
-
- void
-_AT_@ -1117,16 +1132,25 @@ maprequest(XEvent *e)
- void
- monocle(Monitor *m)
- {
-- unsigned int n = 0;
-+ unsigned int n = 0, r = 0;
- Client *c;
-
- for (c = m->clients; c; c = c->next)
- if (ISVISIBLE(c))
- n++;
-- if (n > 0) /* override layout symbol */
-+ if (n > 0 && m->lt[m->sellt]->arrange == monocle) /* override layout symbol */
- snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
-- for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
-- resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
-+ for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
-+ if (c->bw) {
-+ c->oldbw = c->bw;
-+ c->bw = 0;
-+ r = 1;
-+ }
-+ resize(c, m->wx, m->wy, m->ww - (2 * c->bw), m->wh - (2 * c->bw), False);
-+ if(r) {
-+ resizeclient(c, m->wx, m->wy, m->ww - (2 * c->bw), m->wh - (2 * c->bw));
-+ }
-+ }
- }
-
- void
-_AT_@ -1706,9 +1730,11 @@ togglefloating(const Arg *arg)
- if (selmon->sel->isfullscreen) /* no support for fullscreen windows */
- return;
- selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
-- if (selmon->sel->isfloating)
-- resize(selmon->sel, selmon->sel->x, selmon->sel->y,
-- selmon->sel->w, selmon->sel->h, 0);
-+ if (selmon->sel->isfloating) {
-+ selmon->sel->oldbw = selmon->sel->bw;
-+ selmon->sel->bw = borderpx;
-+ resizeclient(selmon->sel, selmon->wx, selmon->wy, selmon->ww - (2 * selmon->sel->bw), selmon->wh - (2 * selmon->sel->bw));
-+ }
- arrange(selmon);
- }
-
-_AT_@ -2003,7 +2029,8 @@ updatewindowtype(Client *c)
- Atom state = getatomprop(c, netatom[NetWMState]);
- Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
-
-- if (state == netatom[NetWMFullscreen])
-+ if(state == netatom[NetWMFullscreen] ||
-+ (WIDTH(c) >= (c->mon->mx + c->mon->mw) && (HEIGHT(c) >= (c->mon->my + c->mon->mh))))
- setfullscreen(c, 1);
- if (wtype == netatom[NetWMWindowTypeDialog])
- c->isfloating = 1;
diff --git a/dwm.suckless.org/patches/dwm-better-borders-git-20160702-56a31dc.diff b/dwm.suckless.org/patches/dwm-better-borders-git-20160702-56a31dc.diff
new file mode 100644
index 0000000..c792762
--- /dev/null
+++ b/dwm.suckless.org/patches/dwm-better-borders-git-20160702-56a31dc.diff
_AT_@ -0,0 +1,75 @@
+Author: Eric Pruitt, https://github.com/ericpruitt/
+Description: This patch disables borders on tiled windows when only one,
+non-floating window is visible.
+
+diff --git a/dwm.c b/dwm.c
+index b2bc9bd..d3e1970 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -395,9 +395,24 @@ arrange(Monitor *m)
+ void
+ arrangemon(Monitor *m)
+ {
++ int n = 0;
++ Client *c;
+ strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
+- if (m->lt[m->sellt]->arrange)
+- m->lt[m->sellt]->arrange(m);
++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
++ if ((m->lt[m->sellt]->arrange != monocle && n > 1) || !m->lt[m->sellt]->arrange) {
++ for (c = m->clients; c; c = c->next) {
++ if (ISVISIBLE(c) && (!m->lt[m->sellt]->arrange || !c->isfloating) && (c->bw != borderpx)) {
++ c->oldbw = c->bw;
++ c->bw = borderpx;
++ resizeclient(c, m->wx, m->wy, m->ww - (2 * c->bw), m->wh - (2 * c->bw));
++ }
++ }
++ if (m->lt[m->sellt]->arrange) {
++ m->lt[m->sellt]->arrange(m);
++ }
++ } else {
++ monocle(m);
++ }
+ }
+
+ void
+_AT_@ -1126,10 +1141,19 @@ monocle(Monitor *m)
+ for (c = m->clients; c; c = c->next)
+ if (ISVISIBLE(c))
+ n++;
+- if (n > 0) /* override layout symbol */
++ if (n > 0 && m->lt[m->sellt]->arrange == monocle) /* override layout symbol */
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
+- for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
+- resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
++ for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
++ // I'm not sure, but calling resize with the border width subtractions
++ // fixes a glitch where windows would not redraw until they were
++ // manually resized after restarting dwm.
++ resize(c, m->wx, m->wy, m->ww - (2 * c->bw), m->wh - (2 * c->bw), False);
++ if (c->bw) {
++ c->oldbw = c->bw;
++ c->bw = 0;
++ resizeclient(c, m->wx, m->wy, m->ww, m->wh);
++ }
++ }
+ }
+
+ void
+_AT_@ -1705,9 +1729,14 @@ togglefloating(const Arg *arg)
+ if (selmon->sel->isfullscreen) /* no support for fullscreen windows */
+ return;
+ selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
+- if (selmon->sel->isfloating)
++ if (selmon->sel->isfloating) {
++ if (selmon->sel->bw != borderpx) {
++ selmon->sel->oldbw = selmon->sel->bw;
++ selmon->sel->bw = borderpx;
++ }
+ resize(selmon->sel, selmon->sel->x, selmon->sel->y,
+- selmon->sel->w, selmon->sel->h, 0);
++ selmon->sel->w - selmon->sel->bw * 2, selmon->sel->h - selmon->sel->bw * 2, 0);
++ }
+ arrange(selmon);
+ }
+
Received on Sun Jul 03 2016 - 03:14:49 CEST

This archive was generated by hypermail 2.3.0 : Sun Jul 03 2016 - 03:24:14 CEST