From fb81ba325198b619ca4b9a745cfd4a60aabc658c Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 14 Jan 2026 19:01:18 +0000 Subject: [PATCH] perf: Replace XSync with XFlush in critical paths Replaces blocking XSync calls with non-blocking XFlush in `drw_map` (drawing) and `resizeclient` (window resizing). This reduces latency by avoiding round-trips to the X server during frequent operations like status bar updates and window resizing, resulting in a smoother user experience. - `drw.c`: Optimized `drw_map` - `client.c`: Optimized `resizeclient` --- client.c | 2 +- drw.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client.c b/client.c index 13f1e27f..c03e6b4b 100644 --- a/client.c +++ b/client.c @@ -279,7 +279,7 @@ void resizeclient(Client *c, int x, int y, int w, int h) { XConfigureWindow(dpy, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc); configure(c); - XSync(dpy, False); + XFlush(dpy); } void updatetitle(Client *c) { 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) {