From 196ae04aa7c9b274880409fb38a050db99197900 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 13 Dec 2017 12:10:39 +0100 Subject: Initialize ScreenWin singleton to fix dpi glitches on Windows Static function ScreenWin::GetSystemMetricsInDIP returned an incorrect (already scaled) size for the scrollbars. To take system scaling into account an instance of the ScreenWin singleton has to be created once. So let's use ScreenWin directly, instead of DesktopScreenQt, which is just a mock object anyway. [ChangeLog][Windows] Fixed issues with too large scrollbars on Hi-DPI monitors. Task-number: QTBUG-60705 Change-Id: I7cbc10e98b2a5217b0a0e78afb32818c1cb199d7 Reviewed-by: Alexandru Croitor Reviewed-by: Viktor Engelmann --- src/core/content_browser_client_qt.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/core/content_browser_client_qt.cpp') diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index d446d8ff4..14ec42fb7 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -102,6 +102,10 @@ #include "web_engine_context.h" #include "web_engine_library_info.h" +#if defined(Q_OS_WIN) +#include "ui/display/win/screen_win.h" +#endif + #if defined(Q_OS_LINUX) #include "global_descriptors_qt.h" #include "ui/base/resource/resource_bundle.h" @@ -292,8 +296,11 @@ public: { base::ThreadRestrictions::SetIOAllowed(true); // Like ChromeBrowserMainExtraPartsViews::PreCreateThreads does. +#if defined(Q_OS_WIN) + display::Screen::SetScreenInstance(new display::win::ScreenWin); +#else display::Screen::SetScreenInstance(new DesktopScreenQt); - +#endif return 0; } -- cgit v1.2.3