diff options
author | Moonchild <moonchild@palemoon.org> | 2020-10-06 09:23:59 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-10-06 09:32:13 +0000 |
commit | 1e8d07cac205a5db3d7d416d7f414a213fd892ff (patch) | |
tree | 60452c5f39b8dc60a8e97454d4103baf2cd194ae /widget/windows/WinUtils.h | |
parent | e7a0013f81b1b73979f8673fd0ed88833c8f6313 (diff) | |
download | UXP-1e8d07cac205a5db3d7d416d7f414a213fd892ff.tar UXP-1e8d07cac205a5db3d7d416d7f414a213fd892ff.tar.gz UXP-1e8d07cac205a5db3d7d416d7f414a213fd892ff.tar.lz UXP-1e8d07cac205a5db3d7d416d7f414a213fd892ff.tar.xz UXP-1e8d07cac205a5db3d7d416d7f414a213fd892ff.zip |
Issue #1606 - Add support for multi-monitor DPI awareness v2 (W10 1706+)
Diffstat (limited to 'widget/windows/WinUtils.h')
-rw-r--r-- | widget/windows/WinUtils.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/widget/windows/WinUtils.h b/widget/windows/WinUtils.h index 1281171be..f268f907f 100644 --- a/widget/windows/WinUtils.h +++ b/widget/windows/WinUtils.h @@ -96,6 +96,11 @@ typedef enum DPI_AWARENESS { #define DPI_AWARENESS_CONTEXT_DECLARED #endif // (DPI_AWARENESS_CONTEXT_DECLARED) +#if WINVER < 0x0605 +WINUSERAPI DPI_AWARENESS_CONTEXT WINAPI GetThreadDpiAwarenessContext(); +WINUSERAPI BOOL WINAPI +AreDpiAwarenessContextsEqual(DPI_AWARENESS_CONTEXT, DPI_AWARENESS_CONTEXT); +#endif /* WINVER < 0x0605 */ typedef DPI_AWARENESS_CONTEXT(WINAPI * SetThreadDpiAwarenessContextProc)(DPI_AWARENESS_CONTEXT); typedef BOOL(WINAPI * EnableNonClientDpiScalingProc)(HWND); @@ -152,6 +157,12 @@ class WinUtils static SetThreadDpiAwarenessContextProc sSetThreadDpiAwarenessContext; static EnableNonClientDpiScalingProc sEnableNonClientDpiScaling; + // Wrapper for DefWindowProc that will enable non-client dpi scaling on the + // window during creation. + static LRESULT WINAPI + NonClientDpiScalingDefWindowProcW(HWND hWnd, UINT msg, + WPARAM wParam, LPARAM lParam); + public: class AutoSystemDpiAware { @@ -174,11 +185,11 @@ public: DPI_AWARENESS_CONTEXT mPrevContext; }; - // Wrapper for DefWindowProc that will enable non-client dpi scaling on the - // window during creation. - static LRESULT WINAPI - NonClientDpiScalingDefWindowProcW(HWND hWnd, UINT msg, - WPARAM wParam, LPARAM lParam); + static decltype(::DefWindowProcW)* GetDefWindowProc() { + return sEnableNonClientDpiScaling ? + NonClientDpiScalingDefWindowProcW : + ::DefWindowProcW; + } /** * Get the system's default logical-to-physical DPI scaling factor, |