From 39bb6851e42b7cf71c23819009665b10194e12a1 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Sun, 19 Dec 2021 01:56:24 -0500 Subject: [PATCH 1/2] main: Make render window borderless fullscreen toggle on the monitor it resides in Toggling borderless fullscreen on the separate render window made it fullscreen on the monitor which the main yuzu window resided in. This change allows the render window to go fullscreen on the monitor it resides in, independent of the main window location. --- src/yuzu/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index b7bb43348..2daf191b3 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -2574,7 +2574,7 @@ void GMainWindow::ShowFullscreen() { render_window->hide(); render_window->setWindowFlags(windowFlags() | Qt::FramelessWindowHint); - const auto screen_geometry = QApplication::desktop()->screenGeometry(this); + const auto screen_geometry = QApplication::desktop()->screenGeometry(render_window); render_window->setGeometry(screen_geometry.x(), screen_geometry.y(), screen_geometry.width(), screen_geometry.height() + 1); render_window->raise(); From 3074b2eb9393aeb366d334d0dbebc54b3024673a Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Sun, 19 Dec 2021 02:02:09 -0500 Subject: [PATCH 2/2] main: Refactor to reduce code duplication in ShowFullscreen() --- src/yuzu/main.cpp | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 2daf191b3..a7271e075 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -2546,39 +2546,30 @@ void GMainWindow::ToggleFullscreen() { } void GMainWindow::ShowFullscreen() { + const auto show_fullscreen = [](QWidget* window) { + if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { + window->showFullScreen(); + return; + } + window->hide(); + window->setWindowFlags(window->windowFlags() | Qt::FramelessWindowHint); + const auto screen_geometry = QApplication::desktop()->screenGeometry(window); + window->setGeometry(screen_geometry.x(), screen_geometry.y(), screen_geometry.width(), + screen_geometry.height() + 1); + window->raise(); + window->showNormal(); + }; + if (ui->action_Single_Window_Mode->isChecked()) { UISettings::values.geometry = saveGeometry(); ui->menubar->hide(); statusBar()->hide(); - if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { - showFullScreen(); - return; - } - - hide(); - setWindowFlags(windowFlags() | Qt::FramelessWindowHint); - const auto screen_geometry = QApplication::desktop()->screenGeometry(this); - setGeometry(screen_geometry.x(), screen_geometry.y(), screen_geometry.width(), - screen_geometry.height() + 1); - raise(); - showNormal(); + show_fullscreen(this); } else { UISettings::values.renderwindow_geometry = render_window->saveGeometry(); - - if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { - render_window->showFullScreen(); - return; - } - - render_window->hide(); - render_window->setWindowFlags(windowFlags() | Qt::FramelessWindowHint); - const auto screen_geometry = QApplication::desktop()->screenGeometry(render_window); - render_window->setGeometry(screen_geometry.x(), screen_geometry.y(), - screen_geometry.width(), screen_geometry.height() + 1); - render_window->raise(); - render_window->showNormal(); + show_fullscreen(render_window); } }