diff options
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | dwm.c | 9 |
2 files changed, 9 insertions, 1 deletions
@@ -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/) @@ -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(); |