src/video/x11/SDL_x11xinput2.c
changeset 12029 dfebed374d73
parent 11811 5d94cb6b24d3
child 12069 317db3d3712c
equal deleted inserted replaced
12028:8aa5a79c8805 12029:dfebed374d73
    81 {
    81 {
    82     int i;
    82     int i;
    83     for (i = 0; i < videodata->numwindows; i++) {
    83     for (i = 0; i < videodata->numwindows; i++) {
    84         SDL_WindowData *d = videodata->windowlist[i];
    84         SDL_WindowData *d = videodata->windowlist[i];
    85         if (d->xwindow == window) {
    85         if (d->xwindow == window) {
    86             if (d->window->w == 1) {
    86             *out_x = in_x / d->window->w;
    87                 *out_x = 0.5f;
    87             *out_y = in_y / d->window->h;
    88             } else {
       
    89                 *out_x = in_x / (d->window->w - 1);
       
    90             }
       
    91             if (d->window->h == 1) {
       
    92                 *out_y = 0.5f;
       
    93             } else {
       
    94                 *out_y = in_y / (d->window->h - 1);
       
    95             }
       
    96             return;
    88             return;
    97         }
    89         }
    98     }
    90     }
    99     // couldn't find the window...
    91     // couldn't find the window...
   100     *out_x = in_x;
    92     *out_x = in_x;