summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-02-14 15:11:15 +0100
committerGitHub <noreply@github.com>2023-02-14 15:11:15 +0100
commitd87db919f908ce7b8d883ea9a9442f1de5d2c1e8 (patch)
treebbf26b639360d3e97be69cb090c25d82e13ae47b
parentMerge pull request #9784 from m-HD/master (diff)
parentmain: Fix borderless fullscreen for high dpi scaled displays (diff)
downloadyuzu-d87db919f908ce7b8d883ea9a9442f1de5d2c1e8.tar
yuzu-d87db919f908ce7b8d883ea9a9442f1de5d2c1e8.tar.gz
yuzu-d87db919f908ce7b8d883ea9a9442f1de5d2c1e8.tar.bz2
yuzu-d87db919f908ce7b8d883ea9a9442f1de5d2c1e8.tar.lz
yuzu-d87db919f908ce7b8d883ea9a9442f1de5d2c1e8.tar.xz
yuzu-d87db919f908ce7b8d883ea9a9442f1de5d2c1e8.tar.zst
yuzu-d87db919f908ce7b8d883ea9a9442f1de5d2c1e8.zip
-rw-r--r--src/yuzu/main.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index c278d8dab..62dfc526a 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -3167,8 +3167,20 @@ void GMainWindow::ShowFullscreen() {
window->hide();
window->setWindowFlags(window->windowFlags() | Qt::FramelessWindowHint);
const auto screen_geometry = GuessCurrentScreen(window)->geometry();
+ // NB: On Windows, a borderless window will be treated the same as exclusive fullscreen
+ // when the window geometry matches the physical dimensions of the screen.
+ // However, with High DPI scaling, when the devicePixelRatioF() is > 1, the borderless
+ // window apparently is not treated as exclusive fullscreen and functions correctly.
+ // One can verify and replicate this behavior by using a high resolution (4K) display,
+ // and switching between 100% and 200% scaling in Windows' display settings.
+ // At 100%, without the addition of 1, it is treated as exclusive fullscreen.
+ // At 200%, with or without the addition of 1, it is treated as borderless windowed.
+ // Therefore, we can use (read: abuse) this difference in behavior to fix this issue for
+ // those with higher resolution displays when the Qt scaling ratio is > 1.
+ // Should this behavior be changed in the future, please revisit this workaround.
+ const bool must_add_one = devicePixelRatioF() == 1.0f;
window->setGeometry(screen_geometry.x(), screen_geometry.y(), screen_geometry.width(),
- screen_geometry.height() + 1);
+ screen_geometry.height() + (must_add_one ? 1 : 0));
window->raise();
window->showNormal();
};