src/events/SDL_mouse.c
changeset 8983 21f5923cfd15
parent 8976 1a5d959d7b32
child 9161 6e34073ef024
equal deleted inserted replaced
8982:a41a6b334028 8983:21f5923cfd15
   140 SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate)
   140 SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate)
   141 {
   141 {
   142     SDL_Mouse *mouse = SDL_GetMouse();
   142     SDL_Mouse *mouse = SDL_GetMouse();
   143     SDL_bool inWindow = SDL_TRUE;
   143     SDL_bool inWindow = SDL_TRUE;
   144 
   144 
   145     if (window != NULL && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) {
   145     if (window && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) {
   146         int w, h;
   146         int w, h;
   147         SDL_GetWindowSize(window, &w, &h);
   147         SDL_GetWindowSize(window, &w, &h);
   148         if (x < 0 || y < 0 || x >= w || y >= h) {
   148         if (x < 0 || y < 0 || x >= w || y >= h) {
   149             inWindow = SDL_FALSE;
   149             inWindow = SDL_FALSE;
   150         }
   150         }
   245         mouse->y += yrel;
   245         mouse->y += yrel;
   246     }
   246     }
   247 
   247 
   248     /* make sure that the pointers find themselves inside the windows,
   248     /* make sure that the pointers find themselves inside the windows,
   249        unless we have the mouse captured. */
   249        unless we have the mouse captured. */
   250     if (window != NULL && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) {
   250     if (window && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) {
   251         int x_max = 0, y_max = 0;
   251         int x_max = 0, y_max = 0;
   252 
   252 
   253         // !!! FIXME: shouldn't this be (window) instead of (mouse->focus)?
   253         // !!! FIXME: shouldn't this be (window) instead of (mouse->focus)?
   254         SDL_GetWindowSize(mouse->focus, &x_max, &y_max);
   254         SDL_GetWindowSize(mouse->focus, &x_max, &y_max);
   255         --x_max;
   255         --x_max;