diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-12-10 16:19:40 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-12-10 16:01:50 +0000 |
commit | 51f6c2793adab2d864b3d2b360000ef8db1d3e92 (patch) | |
tree | 835b3b4446b012c75e80177cef9fbe6972cc7dbe /chromium/base/win/win_util.cc | |
parent | 6036726eb981b6c4b42047513b9d3f4ac865daac (diff) |
BASELINE: Update Chromium to 71.0.3578.93
Change-Id: I6a32086c33670e1b033f8b10e6bf1fd4da1d105d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/base/win/win_util.cc')
-rw-r--r-- | chromium/base/win/win_util.cc | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/chromium/base/win/win_util.cc b/chromium/base/win/win_util.cc index 7f9cc50a3f4..4628713ec23 100644 --- a/chromium/base/win/win_util.cc +++ b/chromium/base/win/win_util.cc @@ -121,6 +121,29 @@ bool SetProcessDpiAwarenessWrapper(PROCESS_DPI_AWARENESS value) { return false; } +// Enable V2 per-monitor high-DPI support for the process. This will cause +// Windows to scale dialogs, comctl32 controls, context menus, and non-client +// area owned by this process on a per-monitor basis. If per-monitor V2 is not +// available (i.e., prior to Windows 10 1703) or fails, returns false. +// https://docs.microsoft.com/en-us/windows/desktop/hidpi/dpi-awareness-context +bool EnablePerMonitorV2() { + decltype( + &::SetProcessDpiAwarenessContext) set_process_dpi_awareness_context_func = + reinterpret_cast<decltype(&::SetProcessDpiAwarenessContext)>( + ::GetProcAddress(::GetModuleHandle(L"user32.dll"), + "SetProcessDpiAwarenessContext")); + if (set_process_dpi_awareness_context_func) { + return set_process_dpi_awareness_context_func( + DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); + } + + DCHECK_LT(GetVersion(), VERSION_WIN10_RS2) + << "SetProcessDpiAwarenessContext should be available on all platforms" + " >= Windows 10 Redstone 2"; + + return false; +} + bool* GetDomainEnrollmentStateStorage() { static bool state = IsOS(OS_DOMAINMEMBER); return &state; @@ -685,9 +708,13 @@ bool IsProcessPerMonitorDpiAware() { } void EnableHighDPISupport() { - // Enable per-monitor DPI for Win10 or above instead of Win8.1 since Win8.1 - // does not have EnableChildWindowDpiMessage, necessary for correct non-client - // area scaling across monitors. + // Enable per-monitor V2 if it is available (Win10 1703 or later). + if (EnablePerMonitorV2()) + return; + + // Fall back to per-monitor DPI for older versions of Win10 instead of Win8.1 + // since Win8.1 does not have EnableChildWindowDpiMessage, necessary for + // correct non-client area scaling across monitors. PROCESS_DPI_AWARENESS process_dpi_awareness = GetVersion() >= VERSION_WIN10 ? PROCESS_PER_MONITOR_DPI_AWARE : PROCESS_SYSTEM_DPI_AWARE; |