[wiki] [sites] [dwm][patches][noborder] Add version with border flicker fix || Chris Down

From: <git_AT_suckless.org>
Date: Tue, 26 Apr 2022 10:19:09 +0200

commit ac966353645938529cf49e2878e43101cf60d2f5
Author: Chris Down <chris_AT_chrisdown.name>
Date: Tue Apr 26 09:18:52 2022 +0100

    [dwm][patches][noborder] Add version with border flicker fix

diff --git a/dwm.suckless.org/patches/noborder/dwm-noborderselflickerfix-2022042627-d93ff48803f0.diff b/dwm.suckless.org/patches/noborder/dwm-noborderselflickerfix-2022042627-d93ff48803f0.diff
new file mode 100644
index 00000000..5a82b33a
--- /dev/null
+++ b/dwm.suckless.org/patches/noborder/dwm-noborderselflickerfix-2022042627-d93ff48803f0.diff
_AT_@ -0,0 +1,53 @@
+diff --git dwm.c dwm.c
+index 0fc328a..4a767bd 100644
+--- dwm.c
++++ dwm.c
+_AT_@ -206,6 +206,7 @@ static void setup(void);
+ static void seturgent(Client *c, int urg);
+ static void showhide(Client *c);
+ static void sigchld(int unused);
++static int solitary(Client *c);
+ static void spawn(const Arg *arg);
+ static void tag(const Arg *arg);
+ static void tagmon(const Arg *arg);
+_AT_@ -802,7 +803,11 @@ focus(Client *c)
+ detachstack(c);
+ attachstack(c);
+ grabbuttons(c, 1);
+- XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
++ /* Avoid flickering when another client appears and the border
++ * is restored */
++ if (!solitary(c)) {
++ XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
++ }
+ setfocus(c);
+ } else {
+ XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
+_AT_@ -1288,6 +1293,11 @@ resizeclient(Client *c, int x, int y, int w, int h)
+ c->oldw = c->w; c->w = wc.width = w;
+ c->oldh = c->h; c->h = wc.height = h;
+ wc.border_width = c->bw;
++ if (solitary(c)) {
++ c->w = wc.width += c->bw * 2;
++ c->h = wc.height += c->bw * 2;
++ wc.border_width = 0;
++ }
+ XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
+ configure(c);
+ XSync(dpy, False);
+_AT_@ -1642,6 +1652,15 @@ sigchld(int unused)
+ while (0 < waitpid(-1, NULL, WNOHANG));
+ }
+
++int
++solitary(Client *c)
++{
++ return ((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
++ || &monocle == c->mon->lt[c->mon->sellt]->arrange)
++ && !c->isfullscreen && !c->isfloating
++ && NULL != c->mon->lt[c->mon->sellt]->arrange;
++}
++
+ void
+ spawn(const Arg *arg)
+ {
diff --git a/dwm.suckless.org/patches/noborder/index.md b/dwm.suckless.org/patches/noborder/index.md
index 28ad3ea3..eaf3596b 100644
--- a/dwm.suckless.org/patches/noborder/index.md
+++ b/dwm.suckless.org/patches/noborder/index.md
_AT_@ -13,9 +13,15 @@ Download
 * The normal version of noborder will cause a single window in floating layout to continuously grow whilst being moved. This version checks if the layout is floating before hiding the border:
   * [dwm-noborderfloatingfix-6.2.diff](dwm-noborderfloatingfix-6.2.diff)
 
+* A version of the patch which avoids border flickering between SchemeSel and
+ SchemeNorm when another client appears, in addition to the floating fix, is
+ available here:
+ [dwm-noborderselflickerfix-2022042627-d93ff48803f0.diff](dwm-noborderselflickerfix-2022042627-d93ff48803f0.diff)
+
 Authors
 -------
 * Eric Pruitt - <eric.pruitt_AT_gmail.com>
 * Laslo Hunhold - <dev_AT_frign.de> (6.1, git port)
 * Markus Teich - markus(DOT)teich(AT)stusta(DOT)de (simplification)
 * Aidan Hall - <aidan.hall_AT_outlook.com> (floating fix)
+* Chris Down - <chris_AT_chrisdown.name> (flicker fix)
Received on Tue Apr 26 2022 - 10:19:09 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 26 2022 - 10:24:41 CEST