From 50415f68a50307f9fd88d4cd4f843d1f116cca75 Mon Sep 17 00:00:00 2001
From: lat9nq <lat9nq@gmail.com>
Date: Tue, 15 Mar 2022 04:28:08 -0400
Subject: [PATCH] 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.
---
 src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
index 57f8078265..ae2e62dc5e 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
@@ -123,14 +123,15 @@ void EmuWindow_SDL2::ShowCursor(bool show_cursor) {
 }
 
 void EmuWindow_SDL2::Fullscreen() {
+    SDL_DisplayMode display_mode;
     switch (Settings::values.fullscreen_mode.GetValue()) {
     case Settings::FullscreenMode::Exclusive:
-        // 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);
+        // Set window size to render size before entering fullscreen -- SDL2 does not resize window
+        // to display dimensions automatically in this mode.
+        if (SDL_GetDesktopDisplayMode(0, &display_mode) == 0) {
+            SDL_SetWindowSize(render_window, display_mode.w, display_mode.h);
+        } else {
+            LOG_ERROR(Frontend, "SDL_GetDesktopDisplayMode failed: {}", SDL_GetError());
         }
 
         if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN) == 0) {