(Unix) Changed the fullscreen mode to SDL_WINDOW_FULLSCREEN_DESKTOP.

Also removed the --windowed, --fullscreen-normal and --fullscreen-borderless command line options and menu entry.
This commit is contained in:
Leon Styhre 2021-12-05 13:51:39 +01:00
parent 50a8edecf3
commit 515577c8f9
5 changed files with 16 additions and 80 deletions

View file

@ -878,25 +878,6 @@ void GuiMenu::openOtherOptions()
}
});
#if defined(__unix__)
// Fullscreen mode.
auto fullscreen_mode = std::make_shared<OptionListComponent<std::string>>(
mWindow, getHelpStyle(), "FULLSCREEN MODE", false);
std::vector<std::string> screenmode;
screenmode.push_back("normal");
screenmode.push_back("borderless");
for (auto it = screenmode.cbegin(); it != screenmode.cend(); ++it)
fullscreen_mode->add(*it, *it, Settings::getInstance()->getString("FullscreenMode") == *it);
s->addWithLabel("FULLSCREEN MODE (REQUIRES RESTART)", fullscreen_mode);
s->addSaveFunc([fullscreen_mode, s] {
if (fullscreen_mode->getSelected() !=
Settings::getInstance()->getString("FullscreenMode")) {
Settings::getInstance()->setString("FullscreenMode", fullscreen_mode->getSelected());
s->setNeedsSaving();
}
});
#endif
#if defined(BUILD_VLC_PLAYER)
// Video player.
auto video_player = std::make_shared<OptionListComponent<std::string>>(

View file

@ -273,22 +273,6 @@ bool parseArgs(int argc, char* argv[])
Settings::getInstance()->setInt("ScreenRotate", rotate);
++i;
}
// On Unix, enable settings for the fullscreen mode.
// On macOS and Windows only windowed mode is supported.
#if defined(__unix__)
else if (strcmp(argv[i], "--windowed") == 0) {
Settings::getInstance()->setBool("Windowed", true);
}
else if (strcmp(argv[i], "--fullscreen-normal") == 0) {
Settings::getInstance()->setString("FullscreenMode", "normal");
settingsNeedSaving = true;
}
else if (strcmp(argv[i], "--fullscreen-borderless") == 0) {
Settings::getInstance()->setString("FullscreenMode", "borderless");
settingsNeedSaving = true;
}
#endif
else if (strcmp(argv[i], "--vsync") == 0) {
if (i >= argc - 1) {
std::cerr << "Error: No VSync value supplied.\n";
@ -360,11 +344,6 @@ bool parseArgs(int argc, char* argv[])
"Options:\n"
" --display [index 1-4] Display/monitor to use\n"
" --resolution [width] [height] Application resolution\n"
#if defined(__unix__)
" --windowed Windowed mode, should be combined with --resolution\n"
" --fullscreen-normal Normal fullscreen mode\n"
" --fullscreen-borderless Borderless fullscreen mode (always on top)\n"
#endif
" --vsync [1/on or 0/off] Turn VSync on or off (default is on)\n"
" --max-vram [size] Max VRAM to use (in mebibytes) before swapping\n"
" --no-splash Don't show the splash screen during startup\n"

View file

@ -102,7 +102,7 @@ int launchGameUnix(const std::string& cmd_utf8, bool runInBackground)
#if defined(_RPI_)
// Hack to avoid that the application window occasionally loses focus when returning from
// a game, which only seems to happen on the Raspberry Pi.
// a game, which only seems to happen on Raspberry Pi OS 10.
SDL_Delay(50);
SDL_SetWindowInputFocus(Renderer::getSDLWindow());
#endif

View file

@ -25,8 +25,7 @@ namespace
// the in-program settings menu. Most can be set using command-line arguments,
// but some are debug flags that are either hardcoded or set by internal debug
// functions.
std::vector<std::string> settingsSkipSaving
{
std::vector<std::string> settingsSkipSaving{
// clang-format off
// These options can be set using command-line arguments:
"WindowWidth", // Set via --resolution [width] [height]
@ -35,9 +34,6 @@ namespace
"IgnoreGamelist", // --ignore-gamelist
"SplashScreen", // --no-splash
"Debug", // --debug
#if !defined(_WIN64)
"Windowed", // --windowed
#endif
"VSync", // --vsync [1/on or 0/off]
"ForceFull", // --force-full
"ForceKiosk", // --force-kiosk
@ -225,9 +221,6 @@ void Settings::setDefaults()
mIntMap["MaxVRAM"] = {256, 256};
#endif
mIntMap["DisplayIndex"] = {1, 1};
#if defined(__unix__)
mStringMap["FullscreenMode"] = {"normal", "normal"};
#endif
#if defined(BUILD_VLC_PLAYER)
mStringMap["VideoPlayer"] = {"ffmpeg", "ffmpeg"};
#endif
@ -275,9 +268,6 @@ void Settings::setDefaults()
mBoolMap["IgnoreGamelist"] = {false, false};
mBoolMap["SplashScreen"] = {true, true};
mBoolMap["VSync"] = {true, true};
#if !defined(_WIN64)
mBoolMap["Windowed"] = {false, false};
#endif
mIntMap["WindowWidth"] = {0, 0};
mIntMap["WindowHeight"] = {0, 0};
mIntMap["ScreenWidth"] = {0, 0};

View file

@ -172,23 +172,19 @@ namespace Renderer
setupWindow();
#if defined(_WIN64)
// For Windows, always set the mode to windowed, as full screen mode seems to
// behave quite erratic. There may be a proper fix for this, but for now windowed
// mode seems to behave well and it's almost completely seamless, especially with
// a hidden taskbar. As well, setting SDL_WINDOW_BORDERLESS introduces issues too
// so unfortunately this needs to be avoided.
// For Windows, always set the mode to windowed as full screen mode seems to behave quite
// erratic. There may be a proper fix for this, but for now windowed mode seems to behave
// well and it's almost completely seamless, especially with a hidden taskbar.
windowFlags = getWindowFlags();
#elif defined(__APPLE__)
// This seems to be the only full window mode that somehow works on macOS as a real
// fullscreen mode will do lots of weird stuff like preventing window switching
// or refusing to let emulators run at all. SDL_WINDOW_FULLSCREEN_DESKTOP almost
// works, but it "shuffles" windows when starting the emulator and won't return
// properly when the game has exited. With the current mode, the top menu is visible
// and hides that part of the ES window. Also, the splash screen is not displayed
// until the point where ES has almost completely finished loading. I'm not sure
// if anything can be done to improve these things as it's quite obvious that
// Apple has shipped a broken and/or dysfunctional window manager with their
// operating system.
// The SDL_WINDOW_BORDERLESS mode seems to be the only mode that somehow works on macOS
// as a real fullscreen mode will do lots of weird stuff like preventing window switching
// or refusing to let emulators run at all. SDL_WINDOW_FULLSCREEN_DESKTOP almost works, but
// it "shuffles" windows when starting the emulator and won't return properly when the game
// has exited. With SDL_WINDOW_BORDERLESS, the splash screen is not displayed until the
// point where ES-DE has almost completely finished loading. As well the emulator has to be
// configured to run in fullscreen mode or switching to its windows will not work when a
// game is launched. So there is room for improvement although it's acceptable for now.
if (!userResolution)
windowFlags = SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI | getWindowFlags();
else
@ -196,20 +192,10 @@ namespace Renderer
// border to the window.
windowFlags = SDL_WINDOW_ALLOW_HIGHDPI | getWindowFlags();
#else
if (Settings::getInstance()->getBool("Windowed")) {
windowFlags = getWindowFlags();
}
else if (Settings::getInstance()->getString("FullscreenMode") == "borderless") {
if (!userResolution)
windowFlags = SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALWAYS_ON_TOP | getWindowFlags();
windowFlags = SDL_WINDOW_FULLSCREEN_DESKTOP | 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 =