src/video/SDL_video.c
changeset 7971 4151d8c29684
parent 7969 72405c8b7dba
child 7981 6d538bc1b395
equal deleted inserted replaced
7970:6dc794be47aa 7971:4151d8c29684
  1173     /* Restore the cursor position */
  1173     /* Restore the cursor position */
  1174     SDL_RestoreMousePosition(window);
  1174     SDL_RestoreMousePosition(window);
  1175 }
  1175 }
  1176 
  1176 
  1177 #define CREATE_FLAGS \
  1177 #define CREATE_FLAGS \
  1178     (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE)
  1178     (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI)
  1179 
  1179 
  1180 static void
  1180 static void
  1181 SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
  1181 SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
  1182 {
  1182 {
  1183     window->windowed.x = window->x;
  1183     window->windowed.x = window->x;
  1234         }
  1234         }
  1235         if (SDL_GL_LoadLibrary(NULL) < 0) {
  1235         if (SDL_GL_LoadLibrary(NULL) < 0) {
  1236             return NULL;
  1236             return NULL;
  1237         }
  1237         }
  1238     }
  1238     }
       
  1239 
       
  1240     /* Unless the user has specified the high-DPI disabling hint, respect the
       
  1241      * SDL_WINDOW_ALLOW_HIGHDPI flag.
       
  1242      */
       
  1243     if (flags & SDL_WINDOW_ALLOW_HIGHDPI) {
       
  1244         hint = SDL_GetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED);
       
  1245         if (hint && SDL_atoi(hint) > 0) {
       
  1246             flags &= ~SDL_WINDOW_ALLOW_HIGHDPI;
       
  1247         }
       
  1248     }
       
  1249 
  1239     window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
  1250     window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
  1240     if (!window) {
  1251     if (!window) {
  1241         SDL_OutOfMemory();
  1252         SDL_OutOfMemory();
  1242         return NULL;
  1253         return NULL;
  1243     }
  1254     }
  1263         }
  1274         }
  1264     }
  1275     }
  1265     window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
  1276     window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
  1266     window->brightness = 1.0f;
  1277     window->brightness = 1.0f;
  1267     window->next = _this->windows;
  1278     window->next = _this->windows;
  1268 
       
  1269     /* Unless the user has specified the high-DPI disabling hint, respect the
       
  1270      * SDL_WINDOW_ALLOW_HIGHDPI flag.
       
  1271      */
       
  1272     hint = SDL_GetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED);
       
  1273     if (!hint || *hint != '1') {
       
  1274         if ((flags & SDL_WINDOW_ALLOW_HIGHDPI)) {
       
  1275             window->flags |= SDL_WINDOW_ALLOW_HIGHDPI;
       
  1276         }
       
  1277     }
       
  1278 
  1279 
  1279     if (_this->windows) {
  1280     if (_this->windows) {
  1280         _this->windows->prev = window;
  1281         _this->windows->prev = window;
  1281     }
  1282     }
  1282     _this->windows = window;
  1283     _this->windows = window;