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 1713

Summary: simulated mouse events duplicate touch events
Product: SDL Reporter: john
Component: eventsAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2 CC: philipp.wiesemann
Version: HG 2.0   
Hardware: All   
OS: Android (All)   
Attachments: patch to add the new hint support

Description john 2013-02-07 15:52:30 UTC
On Android and UIKit, when SDL sees a touch/finger event, it also sends a mouse motion or mouse button event. When the user touches their device, the application will receive a touch event as well as a mouse down event. This breaks existing applications which handle both types of events. Applications cannot tell whether a mouse event was already handled as a touch event, is about to be handled as a touch event, or is a new event.

Instead of removing the duplicate events, this patch adds a new hint, SDL_HINT_SIMULATE_INPUT_EVENTS, leaving the above described behavior as the default, but permitting portable apps to disable duplicate events. The hint system seems the least intrusive approach, but is inefficient, so I added a flag in the SDL_Mouse struct to mirror the hint.

Portable apps should either (1) not handle touch events at all, or (2) call SDL_SetHint(SDL_HINT_SIMULATE_INPUT_EVENTS, "0") to disable duplicate events.
Comment 1 Philipp Wiesemann 2013-02-16 02:01:10 UTC
The patch was not attached to the bug.
Comment 2 john 2013-02-16 10:40:38 UTC
Created attachment 1044 [details]
patch to add the new hint support
Comment 3 Sam Lantinga 2013-03-02 23:46:24 UTC
You can now tell if a mouse event was simulated by touch input.  The mouse event 'which' field will be set to the value SDL_TOUCH_MOUSEID.