From 5c1fd5888e3d4a8a96b702077c91a238a8ea97db Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 17 Jan 2026 18:50:44 +0000 Subject: [PATCH] Optimize drw_map performance by replacing XSync with XFlush Replaced the blocking `XSync` call with `XFlush` in `drw_map`. This eliminates unnecessary round-trips to the X server during drawing operations, significantly reducing latency and improving responsiveness for frequent UI updates (like status bar refreshes and window redrawing). `XFlush` is sufficient here as it pushes the `XCopyArea` request to the server without waiting for a reply, which is safe since we do not need immediate feedback from the server for this operation. --- drw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drw.c b/drw.c index 7e99a386..85f47e3d 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); + /* XFlush is sufficient here and faster than XSync (no round-trip) */ + XFlush(drw->dpy); } unsigned int drw_fontset_getwidth(Drw *drw, const char *text) {