mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
x11: Normalize x11xinput2 touch x to be 1.0 at width (thanks, Zach!).
"Applications (such as SDL's testgesture) do "event.tfinger.x * window_width" to find window coord. Currently the X11 XInput2 backend expects application to do "event.tfinger.x * (window_width-1)" instead. X11 XInput2 touch events are normalized so x is 1.0 at "width - 1" but other SDL backends appear to have x be 1.0 at "width". Same issue for touch event y with regards to height." Fixes Bugzilla #4183.
This commit is contained in:
parent
fe6828272a
commit
59574fe2f0
@ -83,16 +83,8 @@ xinput2_normalize_touch_coordinates(SDL_VideoData *videodata, Window window,
|
||||
for (i = 0; i < videodata->numwindows; i++) {
|
||||
SDL_WindowData *d = videodata->windowlist[i];
|
||||
if (d->xwindow == window) {
|
||||
if (d->window->w == 1) {
|
||||
*out_x = 0.5f;
|
||||
} else {
|
||||
*out_x = in_x / (d->window->w - 1);
|
||||
}
|
||||
if (d->window->h == 1) {
|
||||
*out_y = 0.5f;
|
||||
} else {
|
||||
*out_y = in_y / (d->window->h - 1);
|
||||
}
|
||||
*out_x = in_x / d->window->w;
|
||||
*out_y = in_y / d->window->h;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user