diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 0000000..33ea382 --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,6 @@ +## 2026-02-04 - XSync vs XFlush in Drawing +**Learning:** forces a blocking round-trip to the X server, which is catastrophic for frequent drawing operations like bar updates (). +**Action:** Use for drawing operations where the client doesn't need to wait for the server's response. +## 2026-02-04 - XSync vs XFlush in Drawing +**Learning:** `XSync` forces a blocking round-trip to the X server, which is catastrophic for frequent drawing operations like bar updates (`drw_map`). +**Action:** Use `XFlush` for drawing operations where the client doesn't need to wait for the server's response. diff --git a/drw.c b/drw.c index 7e99a38..3eb6af8 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 and avoids blocking round-trip overhead of XSync */ + XFlush(drw->dpy); } unsigned int drw_fontset_getwidth(Drw *drw, const char *text) {