aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/PlatWin.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2022-11-29 10:22:23 +1100
committerNeil <nyamatongwe@gmail.com>2022-11-29 10:22:23 +1100
commitfce791bd563134b793ddd79b45c91b7d59e14c7b (patch)
tree80bae5dcd6cdd20f02aa3462d9f506b454bebe56 /win32/PlatWin.cxx
parent8cedd574bc15453d86926a71f9a8197dc5fdb5ee (diff)
downloadscintilla-mirror-fce791bd563134b793ddd79b45c91b7d59e14c7b.tar.gz
Bug [#2344]. When GDI scaling is active, ensure correct monitor used for
determining scale factor. Function name changed to avoid possibility of confusion with Win32 API.
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r--win32/PlatWin.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index b52aa477a..0b36c42da 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -374,7 +374,7 @@ struct FontDirectWrite : public FontWin {
}
-HMONITOR MonitorFromWindow(HWND hWnd) noexcept {
+HMONITOR MonitorFromWindowHandleScaling(HWND hWnd) noexcept {
constexpr DWORD monitorFlags = MONITOR_DEFAULTTONEAREST;
if (!fnSetThreadDpiAwarenessContext) {
@@ -398,7 +398,7 @@ int GetDeviceScaleFactorWhenGdiScalingActive(HWND hWnd) noexcept {
PLATFORM_ASSERT(fnGetWindowDpiAwarenessContext && fnGetScaleFactorForMonitor);
if (fnAreDpiAwarenessContextsEqual(DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED, fnGetWindowDpiAwarenessContext(hWnd))) {
const HWND hRootWnd = ::GetAncestor(hWnd, GA_ROOT); // Scale factor applies to entire (root) window.
- const HMONITOR hMonitor = MonitorFromWindow(hRootWnd, MONITOR_DEFAULTTONEAREST);
+ const HMONITOR hMonitor = MonitorFromWindowHandleScaling(hRootWnd);
DEVICE_SCALE_FACTOR deviceScaleFactor;
if (S_OK == fnGetScaleFactorForMonitor(hMonitor, &deviceScaleFactor))
return (static_cast<int>(deviceScaleFactor) + 99) / 100; // increase to first integral multiple of 1