From f061c413de2e3fdc4cc1578f420651a7c45da3e9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 23 Apr 2020 06:32:56 +0200 Subject: Windows: Fix wrong DPI used in font size after changing scaling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QWindowsFontDatabase::defaultVerticalDPI(), which was used for converting the point sizes was missing an updating logic for scaling changes. When implementing it, it turned out that the value obtained from GetDC(0) does not adapt to scaling changes. Remove the function and set it from the screen manager directly to the DPI of the primary screen. Pick-to: 5.15 Task-number: QTBUG-82267 Change-Id: If05ebc893fe78a9461500aba97f2dc127cdf4406 Reviewed-by: André de la Rocha Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/windows/qwindowsscreen.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/windows/qwindowsscreen.cpp') diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index 8850d8cdd4..689624ff2a 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -111,8 +112,11 @@ static bool monitorData(HMONITOR hMonitor, QWindowsScreenData *data) // EnumDisplayMonitors (as opposed to EnumDisplayDevices) enumerates only // virtual desktop screens. data->flags |= QWindowsScreenData::VirtualDesktop; - if (info.dwFlags & MONITORINFOF_PRIMARY) + if (info.dwFlags & MONITORINFOF_PRIMARY) { data->flags |= QWindowsScreenData::PrimaryScreen; + if ((data->flags & QWindowsScreenData::LockScreen) == 0) + QWindowsFontDatabase::setDefaultVerticalDPI(data->dpi.second); + } return true; } -- cgit v1.2.3