src/video/x11/SDL_x11xinput2.c
changeset 12069 317db3d3712c
parent 12029 dfebed374d73
child 12404 eb60e952b13f
     1.1 --- a/src/video/x11/SDL_x11xinput2.c	Sun Jul 22 19:40:42 2018 -0400
     1.2 +++ b/src/video/x11/SDL_x11xinput2.c	Sun Jul 22 19:42:08 2018 -0400
     1.3 @@ -83,8 +83,16 @@
     1.4      for (i = 0; i < videodata->numwindows; i++) {
     1.5          SDL_WindowData *d = videodata->windowlist[i];
     1.6          if (d->xwindow == window) {
     1.7 -            *out_x = in_x / d->window->w;
     1.8 -            *out_y = in_y / d->window->h;
     1.9 +            if (d->window->w == 1) {
    1.10 +                *out_x = 0.5f;
    1.11 +            } else {
    1.12 +                *out_x = in_x / (d->window->w - 1);
    1.13 +            }
    1.14 +            if (d->window->h == 1) {
    1.15 +                *out_y = 0.5f;
    1.16 +            } else {
    1.17 +                *out_y = in_y / (d->window->h - 1);
    1.18 +            }
    1.19              return;
    1.20          }
    1.21      }