From 77076c22f4e355ef6b44cf4eef3883e27fab156c Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 23 Aug 2020 22:40:15 +0200 Subject: [PATCH] (Unix) Added border to borderless window if the resolution was manually changed. Also fixed a mistake introduced in the last commit. --- USERGUIDE.md | 2 +- es-core/src/renderers/Renderer.cpp | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/USERGUIDE.md b/USERGUIDE.md index d06426107..eee9aee14 100644 --- a/USERGUIDE.md +++ b/USERGUIDE.md @@ -679,7 +679,7 @@ The amount of video RAM to use for the application. Defaults to 128 MiB which se **Fullscreen mode (requires restart) - Unix only** -This gives you a choice between Normal and Borderless modes. With the borderless being more seamless as the ES window will always stay on top of other windows so the taskbar will not be visible when launching and exiting from games. It will however break the alt-tab application switching of your window manager. +This gives you a choice between Normal and Borderless modes. With the borderless being more seamless as the ES window will always stay on top of other windows so the taskbar will not be visible when launching and returning from games. It will however break the alt-tab application switching of your window manager. For normal fullscreen mode, if a lower resolution than the screen resolution has been set via the --resolution command line argument, ES will render in full screen at the lower resolution. If a higher resolution than the screen resolution has been set, ES will run in a window. For the borderless mode, any changes to the resolution will make ES run in a window. **Power saver modes** diff --git a/es-core/src/renderers/Renderer.cpp b/es-core/src/renderers/Renderer.cpp index 046c3a0bd..f451e7514 100644 --- a/es-core/src/renderers/Renderer.cpp +++ b/es-core/src/renderers/Renderer.cpp @@ -96,7 +96,7 @@ namespace Renderer // games or when manually switching windows using task switcher). SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0"); - #if defined(__APPLE__) + #if defined(__APPLE__) || defined(__unix__) bool userResolution = false; // Check if the user has changed the resolution from the command line. if (windowWidth != dispMode.w || windowHeight != dispMode.h) @@ -133,10 +133,20 @@ namespace Renderer // border to the window. windowFlags = SDL_WINDOW_ALLOW_HIGHDPI | getWindowFlags(); #else - if (Settings::getInstance()->getBool("Windowed")) + if (Settings::getInstance()->getBool("Windowed")) { windowFlags = getWindowFlags(); - else if (Settings::getInstance()->getString("FullscreenMode") == "borderless") - windowFlags = SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALWAYS_ON_TOP | getWindowFlags(); + } + else if (Settings::getInstance()->getString("FullscreenMode") == "borderless") { + if(!userResolution) + windowFlags = SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALWAYS_ON_TOP | getWindowFlags(); + else + // If the user has changed the resolution from the command line, then add a + // border to the window and don't make it stay on top. + windowFlags = getWindowFlags(); + } + else { + windowFlags = SDL_WINDOW_FULLSCREEN | getWindowFlags(); + } #endif if ((sdlWindow = SDL_CreateWindow("EmulationStation", SDL_WINDOWPOS_UNDEFINED,