From 4947f735fbf035febbd8435c32a50d37af2633cb Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 31 Mar 2024 19:27:56 +0200 Subject: Add isHiDPI function to NativeWindow and it's implementations. --- dggui/nativewindow_win32.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'dggui/nativewindow_win32.cc') 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 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, -- cgit v1.2.3