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 3464 - Fix for Android hint SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH
Summary: Fix for Android hint SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: All Android (All)
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-21 19:30 UTC by ny00
Modified: 2017-08-11 20:38 UTC (History)
0 users

See Also:


Attachments
Sample code (2.59 KB, text/x-csrc)
2016-10-21 19:30 UTC, ny00
Details
Patch (635 bytes, patch)
2016-10-21 19:32 UTC, ny00
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ny00 2016-10-21 19:30:38 UTC
Created attachment 2588 [details]
Sample code

According to the current documentation in SDL_hints.h, if SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH is set to "0" (or not set at all) then mouse input should lead to touch events, along with corresponding *fake* mouse events with mouse id SDL_TOUCH_MOUSEID.

However, while moving a mouse around (actually using a trackpad identified as a mouse), I get SDL mouse motion events with differing mouse ids, as follows:
- If the mouse is moved while a mouse button is pressed, the mouse id is SDL_TOUCH_MOUSEID.
- Otherwise, the mouse id for mouse motion events is 0.

I've attached sample code for reference, which includes logs of the various mouse events (the "which" field is covered).

I believe that no actual mouse event should arrive, if the hint is unset. In particular, no mouse motion event should arrive while no mouse button is pressed.

I'm going to attach a patch which resolves this, while also disabling mouse wheel motion events.
Comment 1 ny00 2016-10-21 19:32:13 UTC
Created attachment 2589 [details]
Patch

This patch disables actual mouse motion and mouse wheel motion events, in case SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH is unset.
Comment 2 Sam Lantinga 2017-08-11 20:38:03 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/10e7bb76a62a