src/video/SDL_video.c
changeset 8927 be64f5daf64b
parent 8783 400f1d2b9e52
child 8931 44d8a2f4b431
     1.1 --- a/src/video/SDL_video.c	Sat May 24 01:27:19 2014 -0400
     1.2 +++ b/src/video/SDL_video.c	Sat May 24 01:30:37 2014 -0400
     1.3 @@ -3269,12 +3269,17 @@
     1.4      int retval = -1;
     1.5      SDL_bool relative_mode;
     1.6      int show_cursor_prev;
     1.7 +    SDL_bool mouse_captured;
     1.8 +    SDL_Window *current_window;
     1.9  
    1.10      if (!messageboxdata) {
    1.11          return SDL_InvalidParamError("messageboxdata");
    1.12      }
    1.13  
    1.14 +    current_window = SDL_GetKeyboardFocus();
    1.15 +    mouse_captured = current_window && ((SDL_GetWindowFlags(current_window) & SDL_WINDOW_MOUSE_CAPTURE) != 0);
    1.16      relative_mode = SDL_GetRelativeMouseMode();
    1.17 +    SDL_CaptureMouse(SDL_FALSE);
    1.18      SDL_SetRelativeMouseMode(SDL_FALSE);
    1.19      show_cursor_prev = SDL_ShowCursor(1);
    1.20  
    1.21 @@ -3326,6 +3331,13 @@
    1.22          SDL_SetError("No message system available");
    1.23      }
    1.24  
    1.25 +    if (current_window) {
    1.26 +        SDL_RaiseWindow(current_window);
    1.27 +        if (mouse_captured) {
    1.28 +            SDL_CaptureMouse(SDL_TRUE);
    1.29 +        }
    1.30 +    }
    1.31 +
    1.32      SDL_ShowCursor(show_cursor_prev);
    1.33      SDL_SetRelativeMouseMode(relative_mode);
    1.34