commit 131bf5fe9e1dd6697fdb26037ade243d2ff72d9f
Author: Chris Down <[email protected]>
Date:   Fri Dec 31 00:07:51 2021 +0000

    [dwm][patches][noborderflicker] Handle when lastfocused == c

diff --git 
a/dwm.suckless.org/patches/noborderflicker/dwm-noborderflicker-20211227-8657affa2a61.diff
 
b/dwm.suckless.org/patches/noborderflicker/dwm-noborderflicker-20211227-8657affa2a61.diff
index 9f3bb9b1..c4369f2c 100644
--- 
a/dwm.suckless.org/patches/noborderflicker/dwm-noborderflicker-20211227-8657affa2a61.diff
+++ 
b/dwm.suckless.org/patches/noborderflicker/dwm-noborderflicker-20211227-8657affa2a61.diff
@@ -1,5 +1,5 @@
 diff --git dwm.c dwm.c
-index a96f33c..50ccf00 100644
+index a96f33c..3fd4a88 100644
 --- dwm.c
 +++ dwm.c
 @@ -236,6 +236,7 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee);
@@ -10,18 +10,19 @@ index a96f33c..50ccf00 100644
  static const char broken[] = "broken";
  static char stext[256];
  static int screen;
-@@ -799,7 +800,10 @@ focus(Client *c)
+@@ -799,7 +800,11 @@ focus(Client *c)
                detachstack(c);
                attachstack(c);
                grabbuttons(c, 1);
 +              /* set new focused border first to avoid flickering */
                XSetWindowBorder(dpy, c->win, 
scheme[SchemeSel][ColBorder].pixel);
-+              if (lastfocused)
++              /* lastfocused may be us if another window was unmanaged */
++              if (lastfocused != c)
 +                      XSetWindowBorder(dpy, lastfocused->win, 
scheme[SchemeNorm][ColBorder].pixel);
                setfocus(c);
        } else {
                XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
-@@ -1758,7 +1762,7 @@ unfocus(Client *c, int setfocus)
+@@ -1758,7 +1763,7 @@ unfocus(Client *c, int setfocus)
        if (!c)
                return;
        grabbuttons(c, 0);
@@ -30,7 +31,7 @@ index a96f33c..50ccf00 100644
        if (setfocus) {
                XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
                XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
-@@ -1784,6 +1788,8 @@ unmanage(Client *c, int destroyed)
+@@ -1784,6 +1789,8 @@ unmanage(Client *c, int destroyed)
                XSetErrorHandler(xerror);
                XUngrabServer(dpy);
        }


Reply via email to