From 79003cd089a8c0028a036d59e3ddef93b6d0ce8e Mon Sep 17 00:00:00 2001 From: Megamouse Date: Fri, 20 Jul 2018 07:48:11 +0200 Subject: [PATCH] Qt/windows: use Qt's high dpi scaling --- rpcs3/main.cpp | 8 ++------ rpcs3/rpcs3qt/gs_frame.cpp | 26 ++++++++++++++++---------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/rpcs3/main.cpp b/rpcs3/main.cpp index 1ad213a146..a367f1dc72 100644 --- a/rpcs3/main.cpp +++ b/rpcs3/main.cpp @@ -94,12 +94,8 @@ int main(int argc, char** argv) { logs::set_init(); -#ifdef _WIN32 - // use this instead of SetProcessDPIAware if Qt ever fully supports this on windows - // at the moment it can't display QCombobox frames for example - // I think there was an issue with gsframe if I recall correctly, so look out for that - //QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - SetProcessDPIAware(); +#if defined(_WIN32) || defined(__APPLE__) + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #else qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1"); #endif diff --git a/rpcs3/rpcs3qt/gs_frame.cpp b/rpcs3/rpcs3qt/gs_frame.cpp index 00c0016d6a..8c3064b9b1 100644 --- a/rpcs3/rpcs3qt/gs_frame.cpp +++ b/rpcs3/rpcs3qt/gs_frame.cpp @@ -252,20 +252,26 @@ void gs_frame::delete_context(draw_context_t ctx) int gs_frame::client_width() { -#if defined(_WIN32) || defined(__APPLE__) - return size().width(); -#else - return size().width() * devicePixelRatio(); -#endif +#ifdef _WIN32 + RECT rect; + if (GetClientRect(HWND(winId()), &rect)) + { + return rect.right - rect.left; + } +#endif // _WIN32 + return width() * devicePixelRatio(); } int gs_frame::client_height() { -#if defined(_WIN32) || defined(__APPLE__) - return size().height(); -#else - return size().height() * devicePixelRatio(); -#endif +#ifdef _WIN32 + RECT rect; + if (GetClientRect(HWND(winId()), &rect)) + { + return rect.bottom - rect.top; + } +#endif // _WIN32 + return height() * devicePixelRatio(); } void gs_frame::flip(draw_context_t, bool /*skip_frame*/)