diff options
author | bunnei <bunneidev@gmail.com> | 2021-12-22 03:05:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-22 03:05:11 +0100 |
commit | 6991d447d4f2c02b941cc6194a4d256c56063143 (patch) | |
tree | b27f885d147836a1b9dd3507c3ab455d773dac71 | |
parent | Merge pull request #7608 from Tatsh/scm-ver-override (diff) | |
parent | main: Refactor to reduce code duplication in ShowFullscreen() (diff) | |
download | yuzu-6991d447d4f2c02b941cc6194a4d256c56063143.tar yuzu-6991d447d4f2c02b941cc6194a4d256c56063143.tar.gz yuzu-6991d447d4f2c02b941cc6194a4d256c56063143.tar.bz2 yuzu-6991d447d4f2c02b941cc6194a4d256c56063143.tar.lz yuzu-6991d447d4f2c02b941cc6194a4d256c56063143.tar.xz yuzu-6991d447d4f2c02b941cc6194a4d256c56063143.tar.zst yuzu-6991d447d4f2c02b941cc6194a4d256c56063143.zip |
-rw-r--r-- | src/yuzu/main.cpp | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index b7bb43348..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(this); - 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); } } |