Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2026-01-13 - XSync vs XFlush in Window Managers
**Learning:** In X11 window managers, `XSync(dpy, False)` is a blocking call that waits for the X server to process all requests. This is often necessary for error handling or strict synchronization but is a major performance bottleneck for frequent operations like drawing or resizing.
**Action:** Use `XFlush(dpy)` instead of `XSync` where strict synchronization is not required (e.g., drawing `drw_map` or window configuration `resizeclient`). `XFlush` sends the requests to the server without waiting for a reply, significantly reducing latency and improving animation smoothness.
2 changes: 1 addition & 1 deletion client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion drw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down