src/events/SDL_mouse.c
changeset 5370 cb219a294ebf
parent 5262 b530ef003506
child 5371 fc3d3d580777
equal deleted inserted replaced
5369:e049a7b85fd1 5370:cb219a294ebf
   151         mouse->x += xrel;
   151         mouse->x += xrel;
   152         mouse->y += yrel;
   152         mouse->y += yrel;
   153     }
   153     }
   154 
   154 
   155     SDL_GetWindowSize(mouse->focus, &x_max, &y_max);
   155     SDL_GetWindowSize(mouse->focus, &x_max, &y_max);
       
   156     --x_max;
       
   157     --y_max;
   156 
   158 
   157     /* make sure that the pointers find themselves inside the windows */
   159     /* make sure that the pointers find themselves inside the windows */
   158     /* only check if mouse->xmax is set ! */
   160     /* only check if mouse->xmax is set ! */
   159     if (x_max && mouse->x > x_max) {
   161     if (mouse->x > x_max) {
   160         mouse->x = x_max;
   162         mouse->x = x_max;
   161     } else if (mouse->x < 0) {
   163     }
       
   164     if (mouse->x < 0) {
   162         mouse->x = 0;
   165         mouse->x = 0;
   163     }
   166     }
   164 
   167 
   165     if (y_max && mouse->y > y_max) {
   168     if (mouse->y > y_max) {
   166         mouse->y = y_max;
   169         mouse->y = y_max;
   167     } else if (mouse->y < 0) {
   170     }
       
   171     if (mouse->y < 0) {
   168         mouse->y = 0;
   172         mouse->y = 0;
   169     }
   173     }
   170 
   174 
   171     mouse->xdelta += xrel;
   175     mouse->xdelta += xrel;
   172     mouse->ydelta += yrel;
   176     mouse->ydelta += yrel;