cursor: Avoid loading all images at once
When the cursor theme has a lot of data, for instance if it contains many animation frames, or if the user loads a HiDPI theme, all images are loaded in memory at load time even if the application seldom uses them.
It can waste quite a lot of memory (about 4 MiB loading the default Adwaita at size 64 in addition to size 32) and use CPU time on load (28.18% according to perf, vs. 9.80% with only size 32 loaded), delaying the actual start of the application.
This kind of lazy loading would require a refactoring from the Xcursor code path, to keep the XcursorFile
around during the entire lifetime of the wl_cursor_theme
and expose _XcursorReadImage()
as a public API in xcursor.h for integration in wl_cursor_theme_get_cursor()
.