aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--dwm.c9
2 files changed, 9 insertions, 1 deletions
diff --git a/README.md b/README.md
index 3165481..e275cc6 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,7 @@ $ sudo make clean install
- [center](https://dwm.suckless.org/patches/center/)
- [fixborders](https://dwm.suckless.org/patches/alpha/)
- [hide vacant tags](https://dwm.suckless.org/patches/hide_vacant_tags/)
+- [noborderflicker](https://dwm.suckless.org/patches/noborderflicker/)
- [pertag](https://dwm.suckless.org/patches/pertag/)
- [push](https://dwm.suckless.org/patches/push/)
- [scratchpads](https://dwm.suckless.org/patches/scratchpads/)
diff --git a/dwm.c b/dwm.c
index b8dcf62..589a403 100644
--- a/dwm.c
+++ b/dwm.c
@@ -286,6 +286,7 @@ static void zoom(const Arg *arg);
/* variables */
static Systray *systray = NULL;
static Client *prevzoom = NULL;
+static Client *lastfocused = NULL;
static const char broken[] = "broken";
static char stext[256];
static int screen;
@@ -963,7 +964,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);
+ /* lastfocused may be us if another window was unmanaged */
+ if (lastfocused && lastfocused != c)
+ XSetWindowBorder(dpy, lastfocused->win, scheme[SchemeNorm][ColBorder].pixel);
setfocus(c);
} else {
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
@@ -2188,7 +2193,7 @@ unfocus(Client *c, int setfocus)
if (!c)
return;
grabbuttons(c, 0);
- XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
+ lastfocused = c;
if (setfocus) {
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
@@ -2214,6 +2219,8 @@ unmanage(Client *c, int destroyed)
XSetErrorHandler(xerror);
XUngrabServer(dpy);
}
+ if (lastfocused == c)
+ lastfocused = NULL;
free(c);
focus(NULL);
updateclientlist();