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 1506

Summary: Changing orientation on the devices throws off touch scaling
Product: SDL Reporter: Gabriel Jacobo <gabomdq>
Component: *don't know*Assignee: Gabriel Jacobo <gabomdq>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: Android (All)   
Bug Depends on:    
Bug Blocks: 1603    

Description Gabriel Jacobo 2012-05-25 16:30:29 UTC
The problem is simple enough, if you look at Android_OnTouch it creates a Touch device if none exist, and it scales the touches using Android_ScreenWidth/Android_ScreenHeight.

However, if you turn the device around, these values will of course change, but the scaling remains the same...so the touches are wrongly scaled.

It's an interesting hurdle what to do to solve it.

We can do a hacky thing and for every touch get the touch device pointer (which we already do) and update x_max and y_max blindly...or we can be a more elaborate and only update if x_max != Android_ScreenWidth for example.

I think the best would be to remove all touch devices when the screen size changes, the question is how... (SDL_TouchQuit ?)
Comment 1 Gabriel Jacobo 2012-08-24 09:11:29 UTC
Fixed http://hg.libsdl.org/SDL/rev/2ed5671bc5e0