src/video/x11/SDL_x11xinput2.c
changeset 12069 317db3d3712c
parent 12029 dfebed374d73
child 12404 eb60e952b13f
equal deleted inserted replaced
12068:ce88faaf8bd2 12069:317db3d3712c
    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             *out_x = in_x / d->window->w;
    86             if (d->window->w == 1) {
    87             *out_y = in_y / d->window->h;
    87                 *out_x = 0.5f;
       
    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             }
    88             return;
    96             return;
    89         }
    97         }
    90     }
    98     }
    91     // couldn't find the window...
    99     // couldn't find the window...
    92     *out_x = in_x;
   100     *out_x = in_x;