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

Summary: Wayland: SDL ignores initial pointer position
Product: SDL Reporter: Tudor <me>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.1   
Hardware: x86_64   
OS: Linux   
Attachments: Attempt #1

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