We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5151 - Wayland: SDL ignores initial pointer position
Summary: Wayland: SDL ignores initial pointer position
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-21 04:13 UTC by Tudor
Modified: 2020-05-29 22:53 UTC (History)
0 users

See Also:


Attachments
Attempt #1 (2.20 KB, patch)
2020-05-21 04:13 UTC, Tudor
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tudor 2020-05-21 04:13:31 UTC
Created attachment 4352 [details]
Attempt #1

A Wayland compositor may send a `pointer_enter` event with the coordinates of the pointer, followed by no (immediate) `pointer_motion` event. A simple case where this can happen is when a pointer confine is created: the compositor will warp the cursor to the SDL surface and emit a `pointer_enter` event, but no `pointer_motion`.

Since SDL only updates its internal position state on `pointer_motion`, this can lead to confusing results where the hardware cursor does not match where an SDL application thinks the cursor is.

I've attached a patch that addresses this issue, by treating `pointer_enter` as a "special" `pointer_motion` event.
Comment 1 Sam Lantinga 2020-05-29 22:53:50 UTC
Looks good, thanks!
https://hg.libsdl.org/SDL/rev/a9b4bd264f3c