Scalable Cursors - #2659
Conversation
|
On first glance this looks good, but since this is based on #2610 we need wait for that to be approved first before progressing. |
e404022 to
efe890f
Compare
|
I removed the shake-to-locate commit. The upstream xcursor is also merged. So, this is ready to review. You can use super+scroll to zoom and test. recording-2026-07-31_15-03-16-trimmed.mp4 |
24473ee to
6c63b8b
Compare
Drakulix
left a comment
There was a problem hiding this comment.
Looks mostly good, but I am slightly concerned about the image_cache now. I don't think we have any routine to clean it up, which wasn't a big problem, when - at most - we could end up loading the whole active cursor theme with a bunch of 24x24 icons.
But when we cache arbitrary sized svg rasterizations (which we should), this can grow pretty large, especially since we intentionally don't cap the maximum cursor size.
I think this needs a cleanup function and call from State::cleanup. Easiest would probably be to make the image_cache into a VecDeque, push new entries to the front and then truncate to 10 in cleanup? (Assuming that newest images are likely re-used soon.)
This would also eliminate long searches for cache entries as the vector grows larger.
|
That makes sense. I will add some telemetry to the compositor and monitor the cache hit/misses and size to see how bad does it get right now. My concern is:
What if we do this:
|
d5f2e85 to
b20a76e
Compare
|
Here's what I did:
The only concern is what's the point of SVG then? We could just use pre-rasterize (bitmap) cursors with different sizes! |
leviport
left a comment
There was a problem hiding this comment.
Cursors are much sharper while zooming and/or shaking. I definitely see the upper threshold when it starts scaling the 512 version, but I have to shake/zoom pretty extremely to get to it.
I mean, the current code should've already done that. But with svg's we don't need to ship every ever increasing size of cursors in a theme anymore. So it is mostly an improvement for theme builders. To fully leverage the advantages in the compositor, we would have to upload the path instead and rasterize on the gpu. I believe there is some nvidia-specific extension to do that and potentially more generic svg-render pipelines exist, but that is an optimization that definitely can come later. |
Yes we can. But the installed size would bloat quickly, because the XCursor format is uncompressed. And there are nice things that SVG could enable. E.g., re-color cursors to the theme color.
Yes, but post installation, we still need to generate XCursor files for all cursor sizes we support, for backward compatibility with X11 apps. E.g., https://github.com/jinliu/svg-cursor/tree/main/svg-theme-to-xcursor |
There are two implementations for svg cursors, hyprland and KDE.
xcursor up stream is waiting for other desktops to adopt one, or for KDE to upstream it.
KDE's approach makes more sense. This PR implements that.
This is the first draft, if this is something you want, and you support the approach, I can open a PR to xcursor and work on upstreaming and completing this feature.
Here's how it looks:
recording-2026-07-27_17-53-34-trimmed.mp4
Notes:
Closes #1370