sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 1328e6c8188f247204f617f6e355af4b670cbc9b
parent 98380b3dfcb2721cee229fa0aedc5c3f560d1523
Author: Eric Pruitt <eric.pruitt@gmail.com>
Date:   Sat,  2 Jul 2016 18:12:34 -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.

Diffstat:
Mdwm.suckless.org/patches/better-borders.md | 9+++------
Ddwm.suckless.org/patches/dwm-6.1-better-borders.diff | 91-------------------------------------------------------------------------------
Adwm.suckless.org/patches/dwm-better-borders-git-20160702-56a31dc.diff | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 78 insertions(+), 97 deletions(-)

diff --git a/dwm.suckless.org/patches/better-borders.md b/dwm.suckless.org/patches/better-borders.md @@ -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. @@ -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 @@ -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 -@@ -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 -@@ -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 -@@ -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); - } - -@@ -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 @@ -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 +@@ -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 +@@ -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 +@@ -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); + } +