Fixed Bug 3215 - Win32: 'fullscreen' app doesn't always extend to top of screen
authorDavid Ludwig <dludwig@pobox.com>
Wed, 30 Dec 2015 12:44:13 -0500
changeset 9990c8fd9b498b67
parent 9989 b01c5397d489
child 9991 5843ea14ca5c
Fixed Bug 3215 - Win32: 'fullscreen' app doesn't always extend to top of screen
src/video/windows/SDL_windowsevents.c
src/video/windows/SDL_windowswindow.c
src/video/windows/SDL_windowswindow.h
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Tue Dec 29 19:14:19 2015 +0100
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Wed Dec 30 12:44:13 2015 -0500
     1.3 @@ -419,11 +419,15 @@
     1.4                  SDL_ToggleModState(KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) != 0);
     1.5                  SDL_ToggleModState(KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0);
     1.6              } else {
     1.7 +                data->in_window_deactivation = SDL_TRUE;
     1.8 +
     1.9                  if (SDL_GetKeyboardFocus() == data->window) {
    1.10                      SDL_SetKeyboardFocus(NULL);
    1.11                  }
    1.12  
    1.13                  ClipCursor(NULL);
    1.14 +
    1.15 +                data->in_window_deactivation = SDL_FALSE;
    1.16              }
    1.17          }
    1.18          returnCode = 0;
     2.1 --- a/src/video/windows/SDL_windowswindow.c	Tue Dec 29 19:14:19 2015 +0100
     2.2 +++ b/src/video/windows/SDL_windowswindow.c	Wed Dec 30 12:44:13 2015 -0500
     2.3 @@ -559,7 +559,25 @@
     2.4          y = bounds.y;
     2.5          w = bounds.w;
     2.6          h = bounds.h;
     2.7 +
     2.8 +        /* Unset the maximized flag.  This fixes
     2.9 +           https://bugzilla.libsdl.org/show_bug.cgi?id=3215
    2.10 +        */
    2.11 +        if (style & WS_MAXIMIZE) {
    2.12 +            data->windowed_mode_was_maximized = SDL_TRUE;
    2.13 +            style &= ~WS_MAXIMIZE;
    2.14 +        }
    2.15      } else {
    2.16 +        /* Restore window-maximization state, as applicable.
    2.17 +           Special care is taken to *not* do this if and when we're
    2.18 +           alt-tab'ing away (to some other window; as indicated by
    2.19 +           in_window_deactivation), otherwise
    2.20 +           https://bugzilla.libsdl.org/show_bug.cgi?id=3215 can reproduce!
    2.21 +        */
    2.22 +        if (data->windowed_mode_was_maximized && !data->in_window_deactivation) {
    2.23 +            style |= WS_MAXIMIZE;
    2.24 +            data->windowed_mode_was_maximized = SDL_FALSE;
    2.25 +        }
    2.26          rect.left = 0;
    2.27          rect.top = 0;
    2.28          rect.right = window->windowed.w;
     3.1 --- a/src/video/windows/SDL_windowswindow.h	Tue Dec 29 19:14:19 2015 +0100
     3.2 +++ b/src/video/windows/SDL_windowswindow.h	Wed Dec 30 12:44:13 2015 -0500
     3.3 @@ -42,6 +42,8 @@
     3.4      SDL_bool in_border_change;
     3.5      SDL_bool in_title_click;
     3.6      SDL_bool focus_click_pending;
     3.7 +    SDL_bool windowed_mode_was_maximized;
     3.8 +    SDL_bool in_window_deactivation;
     3.9      struct SDL_VideoData *videodata;
    3.10  #if SDL_VIDEO_OPENGL_EGL  
    3.11      EGLSurface egl_surface;