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 3348 - SDL_FINGERDOWN gives wrong cursor position on MultiTouch,OSX
Summary: SDL_FINGERDOWN gives wrong cursor position on MultiTouch,OSX
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: 2.0.4
Hardware: x86_64 Mac OS X 10.11
: P2 minor
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-28 19:04 UTC by Denis
Modified: 2016-09-25 19:05 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Denis 2016-05-28 19:04:53 UTC
I've described it here: https://forums.libsdl.org/viewtopic.php?t=11922
Duplicate:

Device: Macbook, OS X, multitouch, SDL2. 

My code:
float posX = event.tfinger.x; 
float posY = event.tfinger.y; 
if ( event.type == SDL_FINGERDOWN ) std::cout << "posX = " << posX << ", posY = " <<  posY << "\n"; 


It returns me coordinates of my multitouch device. If I tap my multitouch at the left-top corner it returns me coordinates something like 0.1x0.1. Ok, right. But how to get coordinates of the cursor position in OS X? 

I can get only coordinates of multitouch device but it doesn't mean that it's the coordinates of the cursor on the screen. I mean... I can tap my multitouch at the left-top corner but my cursor at this time will be at the right-bottom corner of the screen.
Comment 1 Alex Szpakowski 2016-05-29 12:16:33 UTC
You can get the mouse cursor position via the SDL_MOUSEMOTION, SDL_MOUSEBUTTONDOWN, or SDL_MOUSEBUTTONUP events, or the SDL_GetMouseState function.
Comment 2 Denis 2016-05-29 15:00:45 UTC
(In reply to Alex Szpakowski from comment #1)
> You can get the mouse cursor position via the SDL_MOUSEMOTION,
> SDL_MOUSEBUTTONDOWN, or SDL_MOUSEBUTTONUP events, or the SDL_GetMouseState
> function.

What if I need to use multiple finger gestures on my macbook?
Comment 3 Alex Szpakowski 2016-05-29 18:48:12 UTC
Multi-finger trackpad gestures don't modify the mouse position, so you can just use the touch APIs.

The touch coordinates for trackpads and other non-touchscreen devices don't correspond to specific pixels on the screen, since they aren't touch screens.
Comment 4 Alex Szpakowski 2016-09-25 19:05:18 UTC
It would be nice to be able to query whether a touch device is a touchscreen (direct touch input) or not (indirect touch input), but that's a somewhat separate issue.