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 pen handling invokes undefined behaviour #11843

Open
Susko3 opened this issue Jan 4, 2025 · 1 comment
Open

Windows pen handling invokes undefined behaviour #11843

Susko3 opened this issue Jan 4, 2025 · 1 comment
Assignees
Milestone

Comments

@Susko3
Copy link
Contributor

Susko3 commented Jan 4, 2025

SDL pen handling on Windows will selectively handle some (pen) pointer events while ignoring the rest and passing it to DefWindowProc.

} else if (pointer_type != PT_PEN) {
break; // we only care about pens here.

Microsoft docs explicitly call this out as undefined behaviour:

If an application selectively consumes some pointer input and passes the rest to DefWindowProc, the resulting behavior is undefined.

The wording is unclear. Perhaps this is trying to tell that all message types (e.g. WM_POINTERDOWN, WM_POINTERCAPTURECHANGED, etc.) for a given pointer type (PT_*) should be handled.
But even if you take this lenient definition, SDL may still violates it as it ignores pens it "doesn't already know about" and doesn't handle all pointer message types.

The side effects of not following the documentation might include (completely untested, just educated guesses):

  • touch input not working properly (PT_TOUCH)
  • windows precision touchpad input not working properly (PT_TOUCHPAD)
  • mouse input not working properly if EnableMouseInPointer is used (PT_MOUSE)
  • unhandled pen-related pointer events causing general weirdness and incoherent behaviour
@icculus
Copy link
Collaborator

icculus commented Jan 7, 2025

Moving this out of the 3.2.0 milestone until (and if) more bug reports show up. See discussion in #11869.

@icculus icculus modified the milestones: 3.2.0, 3.x Jan 7, 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 a pull request may close this issue.

2 participants