From 5d97e4427953a95893110ffc0c75281cc75ebde8 Mon Sep 17 00:00:00 2001 From: James Rowe Date: Wed, 18 Sep 2019 10:14:35 -0600 Subject: [PATCH] Fix macOS pixel ratio detection --- src/citra_qt/bootmanager.cpp | 4 ++-- src/citra_qt/main.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index bfbd465f6b..91d84568f9 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -144,8 +144,8 @@ QByteArray GRenderWindow::saveGeometry() { } qreal GRenderWindow::windowPixelRatio() const { - // windowHandle() might not be accessible until the window is displayed to screen. - return windowHandle() ? windowHandle()->screen()->devicePixelRatio() : 1.0f; + // QOpenGLWidget isn't backed by a native window, so we need to use the top level window instead + return QApplication::activeWindow()->devicePixelRatio(); } std::pair GRenderWindow::ScaleTouch(const QPointF pos) const { diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 9d752d3cee..52c1ba4365 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -2062,6 +2062,7 @@ int main(int argc, char* argv[]) { std::string bin_path = FileUtil::GetBundleDirectory() + DIR_SEP + ".."; chdir(bin_path.c_str()); #endif + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity); QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts); QApplication app(argc, argv);