atagen

monolith

public
Star0
Watch0

Commit bbb50b4f27f7

tarball

atagen <boss@atagen.co>2026-10-17 04:23 UTC

1 file changed+15-0
monolith: load common cursor shapes at startup

Loading a shape from the xcursor theme the first time a client asks for it cost about 4 ms inside a frame on bare metal.
Modified file: crates/monolith/src/cursor.rs+15 additions
@@ -42,6 +42,21 @@ impl Cursor {
4242 if cursor.image(CursorIcon::Default).is_none() {
4343 tracing::warn!(theme, "no xcursor theme found, drawing a plain cursor");
4444 }
45+ // Reading a shape from the theme takes milliseconds, which in a frame
46+ // makes it miss, so the ones clients ask for most load up front.
47+ for icon in [
48+ CursorIcon::Text,
49+ CursorIcon::Pointer,
50+ CursorIcon::Grab,
51+ CursorIcon::Grabbing,
52+ CursorIcon::NotAllowed,
53+ CursorIcon::Wait,
54+ CursorIcon::Progress,
55+ CursorIcon::EwResize,
56+ CursorIcon::NsResize,
57+ ] {
58+ cursor.image(icon);
59+ }
4560 cursor
4661 }