Restored borderless window behavior where DOTA created a borderless window the size of the desktop and expected it to behave like a fullscreen desktop window.
authorSam Lantinga <slouken@libsdl.org>
Wed, 10 Jan 2018 18:00:51 -0800
changeset 1182400fb5966c44f
parent 11823 56d562cbea17
child 11825 44536468cdd2
Restored borderless window behavior where DOTA created a borderless window the size of the desktop and expected it to behave like a fullscreen desktop window.

A future SDL release will change the borderless window to act more like a normal window that happens to have no chrome, to support windows that draw their own chrome. In the meantime, those applications should set the "SDL_BORDERLESS_WINDOWED_STYLE" hint.
src/video/windows/SDL_windowswindow.c
     1.1 --- a/src/video/windows/SDL_windowswindow.c	Wed Jan 10 19:56:51 2018 -0400
     1.2 +++ b/src/video/windows/SDL_windowswindow.c	Wed Jan 10 18:00:51 2018 -0800
     1.3 @@ -51,14 +51,17 @@
     1.4  static WCHAR *SDL_HelperWindowName = TEXT("SDLHelperWindowInputMsgWindow");
     1.5  static ATOM SDL_HelperWindowClass = 0;
     1.6  
     1.7 -// for borderless Windows, still want the following flags:
     1.8 -// - WS_CAPTION: this seems to enable the Windows minimize animation
     1.9 -// - WS_SYSMENU: enables system context menu on task bar
    1.10 -// - WS_MINIMIZEBOX: window will respond to Windows minimize commands sent to all windows, such as windows key + m, shaking title bar, etc.
    1.11 +/* For borderless Windows, still want the following flags:
    1.12 +   - WS_CAPTION: this seems to enable the Windows minimize animation
    1.13 +   - WS_SYSMENU: enables system context menu on task bar
    1.14 +   - WS_MINIMIZEBOX: window will respond to Windows minimize commands sent to all windows, such as windows key + m, shaking title bar, etc.
    1.15 +   This will also cause the task bar to overlap the window and other windowed behaviors, so only use this for windows that shouldn't appear to be fullscreen
    1.16 + */
    1.17  
    1.18  #define STYLE_BASIC         (WS_CLIPSIBLINGS | WS_CLIPCHILDREN)
    1.19  #define STYLE_FULLSCREEN    (WS_POPUP)
    1.20 -#define STYLE_BORDERLESS    (WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX)
    1.21 +#define STYLE_BORDERLESS    (WS_POPUP)
    1.22 +#define STYLE_BORDERLESS_WINDOWED (WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX)
    1.23  #define STYLE_NORMAL        (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX)
    1.24  #define STYLE_RESIZABLE     (WS_THICKFRAME | WS_MAXIMIZEBOX)
    1.25  #define STYLE_MASK          (STYLE_FULLSCREEN | STYLE_BORDERLESS | STYLE_NORMAL | STYLE_RESIZABLE)
    1.26 @@ -72,7 +75,20 @@
    1.27          style |= STYLE_FULLSCREEN;
    1.28      } else {
    1.29          if (window->flags & SDL_WINDOW_BORDERLESS) {
    1.30 -            style |= STYLE_BORDERLESS;
    1.31 +            /* SDL 2.1:
    1.32 +               This behavior more closely matches other platform where the window is borderless
    1.33 +               but still interacts with the window manager (e.g. task bar shows above it, it can
    1.34 +               be resized to fit within usable desktop area, etc.) so this should be the behavior
    1.35 +               for a future SDL release.
    1.36 +
    1.37 +               If you want a borderless window the size of the desktop that looks like a fullscreen
    1.38 +               window, then you should use the SDL_WINDOW_FULLSCREEN_DESKTOP flag.
    1.39 +             */
    1.40 +            if (SDL_GetHintBoolean("SDL_BORDERLESS_WINDOWED_STYLE", SDL_FALSE)) {
    1.41 +                style |= STYLE_BORDERLESS_WINDOWED;
    1.42 +            } else {
    1.43 +                style |= STYLE_BORDERLESS;
    1.44 +            }
    1.45          } else {
    1.46              style |= STYLE_NORMAL;
    1.47          }