prevent border flicker

This commit is contained in:
speedie 2022-11-30 17:49:05 +01:00
parent 6f9590d2c5
commit 5f76b12596

View file

@ -779,6 +779,7 @@ static const char notitle[] = ""; /* Title when none can be grabbed. */
#if USEMOUSE
static const char *layoutcmd = "speedwm-utils layout";
#endif
static Client *lastfocused = NULL;
static char stext[1024]; /* max character count */
static char rawstext[1024]; /* max character count */
static int statusw;
@ -2862,6 +2863,10 @@ focus(Client *c)
/* draw window border for the focused window */
XSetWindowBorder(dpy, c->win, scheme[SchemeBorderSel][ColBorder].pixel);
/* lastfocused may be us if another window was unmanaged */
if (lastfocused && lastfocused != c)
XSetWindowBorder(dpy, lastfocused->win, scheme[SchemeBorderNorm][ColBorder].pixel);
/* set focus */
setfocus(c);
@ -6379,7 +6384,7 @@ unfocus(Client *c, int setfocus)
#if USEFADE
opacity(c, inactiveopacity);
#endif
XSetWindowBorder(dpy, c->win, scheme[SchemeBorderNorm][ColBorder].pixel);
lastfocused = c;
if (setfocus) {
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
@ -6426,6 +6431,10 @@ unmanage(Client *c, int destroyed)
}
if (scratchpad_last_showed == c)
scratchpad_last_showed = NULL;
if (lastfocused == c)
lastfocused = NULL;
free(c);
if (!s) {