sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit bbba95cd3dac12e9a83a44e60fa546a3de0a3701
parent 194d3409bb68d0dc19b2089b27d1d88b309e6d15
Author: Chris Down <chris@chrisdown.name>
Date:   Mon, 27 Dec 2021 13:45:22 +0000

[dwm][patches][noborderflicker] Add noborderflicker patch

Diffstat:
Adwm.suckless.org/patches/noborderflicker/dwm-noborderflicker-20211227-8657affa2a61.diff | 41+++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/noborderflicker/index.md | 22++++++++++++++++++++++
2 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/noborderflicker/dwm-noborderflicker-20211227-8657affa2a61.diff b/dwm.suckless.org/patches/noborderflicker/dwm-noborderflicker-20211227-8657affa2a61.diff @@ -0,0 +1,41 @@ +diff --git dwm.c dwm.c +index a96f33c..50ccf00 100644 +--- dwm.c ++++ dwm.c +@@ -236,6 +236,7 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee); + static void zoom(const Arg *arg); + + /* variables */ ++static Client *lastfocused = NULL; + static const char broken[] = "broken"; + static char stext[256]; + static int screen; +@@ -799,7 +800,10 @@ 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) ++ 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) + 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]); +@@ -1784,6 +1788,8 @@ unmanage(Client *c, int destroyed) + XSetErrorHandler(xerror); + XUngrabServer(dpy); + } ++ if (lastfocused == c) ++ lastfocused = NULL; + free(c); + focus(NULL); + updateclientlist(); diff --git a/dwm.suckless.org/patches/noborderflicker/index.md b/dwm.suckless.org/patches/noborderflicker/index.md @@ -0,0 +1,22 @@ +noborderflicker +=============== + +Description +----------- +Depending on machine configuration and luck, borders may flicker when changing +focus to a new client. This happens because there may be a tangible delay +between unfocus(), which sets the normal border, and focus(), which sets the +focused border. + +This patch avoids that flickering by deferring drawing the normal border around +the newly unfocused client until the new focused border has already been drawn. +Even better, in reality, these are now close enough together that it's very +likely the two updates will be rendered on the same monitor refresh. + +Download +-------- +* [dwm-noborderflicker-20211227-8657affa2a61.diff](dwm-noborderflicker-20211227-8657affa2a61.diff) + +Authors +------- +* Chris Down - <chris@chrisdown.name>