Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Report raw absolute mouse input as pen events when SDL_HINT_PEN_MOUSE_EVENTS is disabled #12329

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Susko3
Copy link
Contributor

@Susko3 Susko3 commented Feb 18, 2025

Description

Raw absolute mouse input is currently understood as being tablet (pen) input and is converted to relative mouse input events. Raw mouse input is only reported when relative mouse mode is enabled. With this change, and when SDL_HINT_PEN_MOUSE_EVENTS is disabled, this input will be reported as pen motion events.

Some caveats:

  • this leaks 1 byte of memory every time relative mode is (re-)enabled and a pen comes in proximity
    • allocating a handle is required by the pen subsystem for some reason
    • fixing this in a nice way would require exposing SDL_Pen * from SDL_pen.c
    • we could also store pointer to this memory in SDL_VideoData but I find it silly, and the resulting code is hard to read
  • the fake pen will leave proximity only when relative mode is disabled, i.e. it'll be stuck in proximity
    • unsure if detecting proximity is even possible from raw mouse input
  • the reported pen position is not bounded and can be outside the window bounds

Testing

I can confirm this fixes the original issue. Tested on Windows 11 24H2 with OpenTabletDriver and a Wacom CTL-6100WL.

Existing Issue(s)

…NTS is disabled

Some caveats:
- this leaks 1 byte of memory every time relative mode is (re-)enabled and a pen comes in proximity
- the fake pen will leave proximity only when relative mode is disabled
  - unsure if detecting proximity is even possible from raw mouse input
Copy link

@Joehuu Joehuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionally-wise, LGTM.

On osu!-side though, as said on Discord, cursor sensitivity doesn't work for tablets anymore (compared to SDL2). Can be done osu!-side.

@slouken slouken added this to the 3.2.6 milestone Feb 21, 2025
@slouken slouken requested a review from icculus February 21, 2025 19:33
@slouken
Copy link
Collaborator

slouken commented Feb 24, 2025

Can you split these into separate PRs? I want to merge the second commit, but the first one needs more review from @icculus

@Susko3
Copy link
Contributor Author

Susko3 commented Feb 24, 2025

The second commit only touches code added in the first, it's not possible to split it out.

@slouken
Copy link
Collaborator

slouken commented Feb 24, 2025

Okay, never mind, we'll wait on @icculus then.

@slouken slouken modified the milestones: 3.2.6, 3.4.0 Mar 1, 2025
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.

Windows tablets don't report pen events when relative mouse mode is enabled
3 participants