2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

emu_window_sdl2: Set window size to display dimensions for exclusive fullscreen

Since SDL2 does not automatically resize the canvas when entering
fullscreen mode, resize the window to desktop display dimensions.
This commit is contained in:
lat9nq 2022-03-15 04:28:08 -04:00
parent cd07a43724
commit 50415f68a5

View file

@ -123,14 +123,15 @@ void EmuWindow_SDL2::ShowCursor(bool show_cursor) {
} }
void EmuWindow_SDL2::Fullscreen() { void EmuWindow_SDL2::Fullscreen() {
SDL_DisplayMode display_mode;
switch (Settings::values.fullscreen_mode.GetValue()) { switch (Settings::values.fullscreen_mode.GetValue()) {
case Settings::FullscreenMode::Exclusive: case Settings::FullscreenMode::Exclusive:
// Set window size to render size before entering fullscreen -- SDL does not resize to // Set window size to render size before entering fullscreen -- SDL2 does not resize window
// display dimensions in this mode. // to display dimensions automatically in this mode.
// TODO: Multiply the window size by resolution_factor (for both docked modes) if (SDL_GetDesktopDisplayMode(0, &display_mode) == 0) {
if (Settings::values.use_docked_mode) { SDL_SetWindowSize(render_window, display_mode.w, display_mode.h);
SDL_SetWindowSize(render_window, Layout::ScreenDocked::Width, } else {
Layout::ScreenDocked::Height); LOG_ERROR(Frontend, "SDL_GetDesktopDisplayMode failed: {}", SDL_GetError());
} }
if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN) == 0) { if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN) == 0) {