From 8f0cc4a4b75acebc5b684be29261335acbd37cd6 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 22 Jul 2018 19:42:08 -0400 Subject: [PATCH] Backed out changeset 2e42ec46061e. This change isn't correct. See comments in Bugzilla #4183. --- src/video/x11/SDL_x11xinput2.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c index e8bb141d60ce2..06a8937cf0f58 100644 --- a/src/video/x11/SDL_x11xinput2.c +++ b/src/video/x11/SDL_x11xinput2.c @@ -83,8 +83,16 @@ 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) { - *out_x = in_x / d->window->w; - *out_y = in_y / d->window->h; + 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); + } return; } }