summaryrefslogtreecommitdiffstats
path: root/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2.cpp52
1 files changed, 29 insertions, 23 deletions
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
index 06b20c975..353e51ea7 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
@@ -2,18 +2,11 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-// Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
-#endif
#include <SDL.h>
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
#include "common/logging/log.h"
#include "common/scm_rev.h"
+#include "common/settings.h"
#include "core/core.h"
#include "core/perf_stats.h"
#include "input_common/keyboard.h"
@@ -130,24 +123,37 @@ void EmuWindow_SDL2::OnResize() {
}
void EmuWindow_SDL2::Fullscreen() {
- if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN) == 0) {
- return;
- }
-
- LOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError());
+ switch (Settings::values.fullscreen_mode.GetValue()) {
+ case 1: // Exclusive fullscreen
+ // Set window size to render size before entering fullscreen -- SDL does not resize to
+ // display dimensions in this mode.
+ // TODO: Multiply the window size by resolution_factor (for both docked modes)
+ if (Settings::values.use_docked_mode) {
+ SDL_SetWindowSize(render_window, Layout::ScreenDocked::Width,
+ Layout::ScreenDocked::Height);
+ }
- // Try a different fullscreening method
- LOG_INFO(Frontend, "Attempting to use borderless fullscreen...");
- if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) {
- return;
- }
+ if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN) == 0) {
+ return;
+ }
- LOG_ERROR(Frontend, "Borderless fullscreening failed: {}", SDL_GetError());
+ LOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError());
+ LOG_INFO(Frontend, "Attempting to use borderless fullscreen...");
+ [[fallthrough]];
+ case 0: // Borderless window
+ if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) {
+ return;
+ }
- // Fallback algorithm: Maximise window.
- // Works on all systems (unless something is seriously wrong), so no fallback for this one.
- LOG_INFO(Frontend, "Falling back on a maximised window...");
- SDL_MaximizeWindow(render_window);
+ LOG_ERROR(Frontend, "Borderless fullscreening failed: {}", SDL_GetError());
+ [[fallthrough]];
+ default:
+ // Fallback algorithm: Maximise window.
+ // Works on all systems (unless something is seriously wrong), so no fallback for this one.
+ LOG_INFO(Frontend, "Falling back on a maximised window...");
+ SDL_MaximizeWindow(render_window);
+ break;
+ }
}
void EmuWindow_SDL2::WaitEvent() {