diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 0000000..dd6d369 --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,3 @@ +## 2026-01-09 - X11 Synchronization Bottlenecks +**Learning:** `XSync` forces a round-trip to the X server, blocking the client until the server responds. In `drw_map` (used for bar drawing) and `resizeclient` (used for window resizing), this adds significant latency. +**Action:** Replace `XSync` with `XFlush` in rendering and non-dependent configuration paths. `XFlush` sends the request buffer without waiting, which is sufficient for operations like drawing or configuring windows where the client doesn't immediately read back the result. diff --git a/client.c b/client.c index 13f1e27..4c29a63 100644 --- a/client.c +++ b/client.c @@ -279,7 +279,8 @@ 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); + /* Use XFlush to avoid blocking round-trip latency */ + XFlush(dpy); } void updatetitle(Client *c) { diff --git a/config.mk b/config.mk index 2c834ee..dbe3084 100644 --- a/config.mk +++ b/config.mk @@ -12,8 +12,8 @@ X11INC = /usr/X11R6/include X11LIB = /usr/X11R6/lib # Xinerama, comment if you don't want it -XINERAMALIBS = -lXinerama -XINERAMAFLAGS = -DXINERAMA +#XINERAMALIBS = -lXinerama +#XINERAMAFLAGS = -DXINERAMA # freetype FREETYPELIBS = -lfontconfig -lXft diff --git a/drw.c b/drw.c index 7e99a38..06872fa 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); + /* Use XFlush to avoid blocking round-trip latency */ + XFlush(drw->dpy); } unsigned int drw_fontset_getwidth(Drw *drw, const char *text) {