Retain the high dpi flag when recreating the window (e.g when creating a renderer context)
authorSam Lantinga <slouken@libsdl.org>
Tue, 12 Nov 2013 02:18:52 -0800
changeset 79714151d8c29684
parent 7970 6dc794be47aa
child 7972 96f2f61be1c6
Retain the high dpi flag when recreating the window (e.g when creating a renderer context)
src/video/SDL_video.c
     1.1 --- a/src/video/SDL_video.c	Tue Nov 12 02:04:12 2013 -0800
     1.2 +++ b/src/video/SDL_video.c	Tue Nov 12 02:18:52 2013 -0800
     1.3 @@ -1175,7 +1175,7 @@
     1.4  }
     1.5  
     1.6  #define CREATE_FLAGS \
     1.7 -    (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE)
     1.8 +    (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI)
     1.9  
    1.10  static void
    1.11  SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
    1.12 @@ -1236,6 +1236,17 @@
    1.13              return NULL;
    1.14          }
    1.15      }
    1.16 +
    1.17 +    /* Unless the user has specified the high-DPI disabling hint, respect the
    1.18 +     * SDL_WINDOW_ALLOW_HIGHDPI flag.
    1.19 +     */
    1.20 +    if (flags & SDL_WINDOW_ALLOW_HIGHDPI) {
    1.21 +        hint = SDL_GetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED);
    1.22 +        if (hint && SDL_atoi(hint) > 0) {
    1.23 +            flags &= ~SDL_WINDOW_ALLOW_HIGHDPI;
    1.24 +        }
    1.25 +    }
    1.26 +
    1.27      window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
    1.28      if (!window) {
    1.29          SDL_OutOfMemory();
    1.30 @@ -1266,16 +1277,6 @@
    1.31      window->brightness = 1.0f;
    1.32      window->next = _this->windows;
    1.33  
    1.34 -    /* Unless the user has specified the high-DPI disabling hint, respect the
    1.35 -     * SDL_WINDOW_ALLOW_HIGHDPI flag.
    1.36 -     */
    1.37 -    hint = SDL_GetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED);
    1.38 -    if (!hint || *hint != '1') {
    1.39 -        if ((flags & SDL_WINDOW_ALLOW_HIGHDPI)) {
    1.40 -            window->flags |= SDL_WINDOW_ALLOW_HIGHDPI;
    1.41 -        }
    1.42 -    }
    1.43 -
    1.44      if (_this->windows) {
    1.45          _this->windows->prev = window;
    1.46      }