From 7330fe1b2d64cf252b1ae446c241896c9892c050 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 7 Jan 2026 18:35:18 +0000 Subject: [PATCH] perf: Use XFlush instead of XSync in drw_map Replacing XSync with XFlush reduces the blocking round-trip to the X server, improving performance during frequent drawing operations (e.g., bar updates). XFlush sends the requests asynchronously without waiting for a reply, which is sufficient for drawing operations where the client doesn't need to read back data immediately. --- drw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drw.c b/drw.c index 7e99a386..190f8017 100644 --- a/drw.c +++ b/drw.c @@ -494,7 +494,8 @@ 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); + /* Optimized: Use XFlush instead of XSync to avoid blocking round-trip */ + XFlush(drw->dpy); } unsigned int drw_fontset_getwidth(Drw *drw, const char *text) {