| Summary: | Touch events are not normalised on X11 | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Trent Gamblin <trent> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | sezeroz, sylvain.becker |
| Version: | HG 2.0 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: |
Fix for the issue.
Fixed patch (fully spans 0-1) Remove changed files |
||
One small change needed to the patch: divide by width/height - 1 instead of just width/height. Can you please attach a new patch instead? Created attachment 2977 [details]
Fixed patch (fully spans 0-1)
Here's a new patch.
Created attachment 2978 [details]
Remove changed files
Guh, here's one without touching files I'm not supposed to. Sorry about that!
This is a duplicated of bug 2307, Patch are similar, but : - maybe xinput2_normalize_touch_coordinates() should be within preprocessor "#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH". So that it avoids a warning on compilation. - why do you divide by "width/height - 1" and not "width/height" ok, you get a value of 1.0 at the border, but if the window size is 1x1, you have a division by 0 ? Also, in bug 2307, there is a patch to adapt touch event to logical size of the SDL_Renderer, you may want to double check it ! Fixed, thanks! https://hg.libsdl.org/SDL/rev/6fde74294cc9 Sylvain, your comments are addressed here: https://hg.libsdl.org/SDL/rev/8dd72342f1f1 |
Created attachment 2975 [details] Fix for the issue. The documentation for SDL_TouchFingerEvent says that the x and y coordinates are normalised between 0-1. I've found that to be true on Windows, Android and iOS but on X11 they are in pixel coordinates. This patch fixes the issue. This was the cleanest way I could do it with what was available without changing things around a lot but you may know a better way.