diff options
Diffstat (limited to 'src/yuzu_cmd/emu_window/emu_window_sdl2.cpp')
| -rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp index 8dfc09393..353e51ea7 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 8 | #include "common/scm_rev.h" | 8 | #include "common/scm_rev.h" |
| 9 | #include "common/settings.h" | ||
| 9 | #include "core/core.h" | 10 | #include "core/core.h" |
| 10 | #include "core/perf_stats.h" | 11 | #include "core/perf_stats.h" |
| 11 | #include "input_common/keyboard.h" | 12 | #include "input_common/keyboard.h" |
| @@ -122,24 +123,37 @@ void EmuWindow_SDL2::OnResize() { | |||
| 122 | } | 123 | } |
| 123 | 124 | ||
| 124 | void EmuWindow_SDL2::Fullscreen() { | 125 | void EmuWindow_SDL2::Fullscreen() { |
| 125 | // Try a different fullscreening method | 126 | switch (Settings::values.fullscreen_mode.GetValue()) { |
| 126 | LOG_INFO(Frontend, "Attempting to use borderless fullscreen..."); | 127 | case 1: // Exclusive fullscreen |
| 127 | if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) { | 128 | // Set window size to render size before entering fullscreen -- SDL does not resize to |
| 128 | return; | 129 | // display dimensions in this mode. |
| 129 | } | 130 | // TODO: Multiply the window size by resolution_factor (for both docked modes) |
| 130 | 131 | if (Settings::values.use_docked_mode) { | |
| 131 | LOG_ERROR(Frontend, "Borderless fullscreening failed: {}", SDL_GetError()); | 132 | SDL_SetWindowSize(render_window, Layout::ScreenDocked::Width, |
| 133 | Layout::ScreenDocked::Height); | ||
| 134 | } | ||
| 132 | 135 | ||
| 133 | if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN) == 0) { | 136 | if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN) == 0) { |
| 134 | return; | 137 | return; |
| 135 | } | 138 | } |
| 136 | 139 | ||
| 137 | LOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError()); | 140 | LOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError()); |
| 141 | LOG_INFO(Frontend, "Attempting to use borderless fullscreen..."); | ||
| 142 | [[fallthrough]]; | ||
| 143 | case 0: // Borderless window | ||
| 144 | if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) { | ||
| 145 | return; | ||
| 146 | } | ||
| 138 | 147 | ||
| 139 | // Fallback algorithm: Maximise window. | 148 | LOG_ERROR(Frontend, "Borderless fullscreening failed: {}", SDL_GetError()); |
| 140 | // Works on all systems (unless something is seriously wrong), so no fallback for this one. | 149 | [[fallthrough]]; |
| 141 | LOG_INFO(Frontend, "Falling back on a maximised window..."); | 150 | default: |
| 142 | SDL_MaximizeWindow(render_window); | 151 | // Fallback algorithm: Maximise window. |
| 152 | // Works on all systems (unless something is seriously wrong), so no fallback for this one. | ||
| 153 | LOG_INFO(Frontend, "Falling back on a maximised window..."); | ||
| 154 | SDL_MaximizeWindow(render_window); | ||
| 155 | break; | ||
| 156 | } | ||
| 143 | } | 157 | } |
| 144 | 158 | ||
| 145 | void EmuWindow_SDL2::WaitEvent() { | 159 | void EmuWindow_SDL2::WaitEvent() { |