Skip to content

Conversation

@Kontrabant
Copy link
Contributor

Use viewports to handle scaled custom cursors instead of building a new set of images for every scale, and set tablet tool cursors separately from the pointer cursor, as some compositors don't implicitly use the pointer cursor when the tablet cursor is unset, and the presence of a tablet doesn't imply that the pointer capability will be exposed.

There isn't that much change to the cursor logic itself, but splitting out the cursor state so that it can be used by both pointer and tablet tool cursors caused a lot of churn, so it's probably best to hold on merging this until 3.4.2 to allow for time to shake out any subtile bugs this might have introduced. The tablet changes could also do with more testing, as they seem to work with emulated input, but more testing on real hardware would be preferable (the Osu project tends to find these bugs quickly).

Fixes #14332

Cache the cursor image data at creation time, and use a viewport to render scaled custom cursors, instead of generating new cursor images for every scale.
@slouken
Copy link
Collaborator

slouken commented Oct 30, 2025

FYI, we have more time for this to land in 3.4.0. Anything that goes in 3.4.2 should be extremely low risk and may get less testing than 3.4.0.

@Kontrabant Kontrabant force-pushed the wl_cursor_vp branch 2 times, most recently from aeadb5a to 7b4e79f Compare October 31, 2025 13:52
@Kontrabant
Copy link
Contributor Author

Understood. I'll look over this again today, and hit the go button if there aren't any issues so it can get wider testing.

Some compositors don't implicitly use the pointer cursor when the tablet cursor is not set, and the presence of a tablet doesn't necessarily guarantee pointer capability. Set the cursor for tablet tools independently of pointer cursors.

This required refactoring of cursor state handling, as well as some tablet related structures.
Store the images in order from smallest to largest to simplify lookup and be able to early-out of the search loop even if there is no exact match for the scale.
@Kontrabant Kontrabant marked this pull request as ready for review October 31, 2025 20:13
@Kontrabant Kontrabant merged commit 3a59163 into libsdl-org:main Oct 31, 2025
43 checks passed
@Kontrabant Kontrabant deleted the wl_cursor_vp branch October 31, 2025 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDL does not set tablet cursors under wayland

2 participants