summaryrefslogtreecommitdiff
path: root/dggui/nativewindow_x11.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2024-03-31 19:27:56 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2024-03-31 21:06:12 +0200
commit4947f735fbf035febbd8435c32a50d37af2633cb (patch)
tree162c912c0e9465a426da405265565317329899b0 /dggui/nativewindow_x11.cc
parentaab05ac13b6fe094bb0dc7c5e50c5a76250aa131 (diff)
Add isHiDPI function to NativeWindow and it's implementations.hidpi
Diffstat (limited to 'dggui/nativewindow_x11.cc')
-rw-r--r--dggui/nativewindow_x11.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/dggui/nativewindow_x11.cc b/dggui/nativewindow_x11.cc
index 04f1b35..2f94935 100644
--- a/dggui/nativewindow_x11.cc
+++ b/dggui/nativewindow_x11.cc
@@ -240,6 +240,15 @@ std::pair<std::size_t, std::size_t> NativeWindowX11::getSize() const
return {width, height};
}
+bool NativeWindowX11::isHiDPI()
+{
+ auto xres = ((((double) DisplayWidth(display, screen)) * 25.4) /
+ ((double) DisplayWidthMM(display, screen))) + 0.5;
+ auto yres = ((((double) DisplayHeight(display, screen)) * 25.4) /
+ ((double) DisplayHeightMM(display, screen))) + 0.5;
+ return xres >= 2 * 96 || yres >= 2 * 96;
+}
+
void NativeWindowX11::move(int x, int y)
{
if(display == nullptr)