From 275ff53029f21c2da45e598ee2061b48707f1572 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 10 Jan 2026 18:53:33 +0000 Subject: [PATCH] perf(drw): replace XSync with XFlush in drw_map for reduced latency Replaced the blocking `XSync(drw->dpy, False)` call with `XFlush(drw->dpy)` in `drw_map`. `drw_map` is frequently called during UI redraws (e.g., status bar updates). `XSync` forces a round-trip to the X server, blocking the window manager until the server processes the request. `XFlush` sends the request asynchronously, improving responsiveness and reducing latency in the main event loop. Impact: - Reduces blocking time during bar and window title redraws. - Improves overall responsiveness of the window manager. --- drw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drw.c b/drw.c index 7e99a386..e3f9501b 100644 --- a/drw.c +++ b/drw.c @@ -494,7 +494,7 @@ void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, } XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y); - XSync(drw->dpy, False); + XFlush(drw->dpy); } unsigned int drw_fontset_getwidth(Drw *drw, const char *text) {