diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2024-03-31 19:27:56 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2024-03-31 21:06:12 +0200 |
commit | 4947f735fbf035febbd8435c32a50d37af2633cb (patch) | |
tree | 162c912c0e9465a426da405265565317329899b0 /dggui/nativewindow_win32.cc | |
parent | aab05ac13b6fe094bb0dc7c5e50c5a76250aa131 (diff) |
Add isHiDPI function to NativeWindow and it's implementations.hidpi
Diffstat (limited to 'dggui/nativewindow_win32.cc')
-rw-r--r-- | dggui/nativewindow_win32.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/dggui/nativewindow_win32.cc b/dggui/nativewindow_win32.cc index db785e9..45cbd30 100644 --- a/dggui/nativewindow_win32.cc +++ b/dggui/nativewindow_win32.cc @@ -489,6 +489,15 @@ std::pair<std::size_t, std::size_t> NativeWindowWin32::getSize() const return std::make_pair(rect.right - rect.left, rect.bottom - rect.top); } +bool NativeWindowWin32::isHiDPI() +{ + HDC hDC = GetDC(m_hwnd); + INT xres = GetDeviceCaps(hDC, LOGPIXELSX); + INT yres = GetDeviceCaps(hDC, LOGPIXELSY); + ReleaseDC(m_hwnd, hDC); + return xres >= 2 * 96 || yres >= 2 * 96; +} + void NativeWindowWin32::move(int x, int y) { SetWindowPos(m_hwnd, always_on_top ? HWND_TOPMOST : nullptr, |