src/video/SDL_video.c
changeset 5479 5c4635640bf9
parent 5478 6b65ff3cee62
child 5480 55a687c55676
     1.1 --- a/src/video/SDL_video.c	Fri Mar 11 16:54:43 2011 -0800
     1.2 +++ b/src/video/SDL_video.c	Fri Mar 11 18:16:39 2011 -0800
     1.3 @@ -1018,6 +1018,17 @@
     1.4  }
     1.5  
     1.6  static void
     1.7 +SDL_RestoreMousePosition(SDL_Window *window)
     1.8 +{
     1.9 +    int x, y;
    1.10 +
    1.11 +    if (window == SDL_GetMouseFocus()) {
    1.12 +        SDL_GetMouseState(&x, &y);
    1.13 +        SDL_WarpMouseInWindow(window, x, y);
    1.14 +    }
    1.15 +}
    1.16 +
    1.17 +static void
    1.18  SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
    1.19  {
    1.20      SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
    1.21 @@ -1070,6 +1081,8 @@
    1.22                  } else {
    1.23                      SDL_OnWindowResized(other);
    1.24                  }
    1.25 +
    1.26 +                SDL_RestoreMousePosition(other);
    1.27                  return;
    1.28              }
    1.29          }
    1.30 @@ -1085,6 +1098,9 @@
    1.31  
    1.32      /* Generate a mode change event here */
    1.33      SDL_OnWindowResized(window);
    1.34 +
    1.35 +    /* Restore the cursor position */
    1.36 +    SDL_RestoreMousePosition(window);
    1.37  }
    1.38  
    1.39  #define CREATE_FLAGS \