commit ac966353645938529cf49e2878e43101cf60d2f5
Author: Chris Down <[email protected]>
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
@@ -0,0 +1,53 @@
+diff --git dwm.c dwm.c
+index 0fc328a..4a767bd 100644
+--- dwm.c
++++ dwm.c
+@@ -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);
+@@ -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);
+@@ -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);
+@@ -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
@@ -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 - <[email protected]>
 * Laslo Hunhold - <[email protected]> (6.1, git port)
 * Markus Teich - markus(DOT)teich(AT)stusta(DOT)de (simplification)
 * Aidan Hall - <[email protected]> (floating fix)
+* Chris Down - <[email protected]> (flicker fix)


Reply via email to