summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index e009f5ac0..20a2da824 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -2020,3 +2020,13 @@ void set_dc_nickname(struct dive *dive)
dc = dc->next;
}
}
+
+gdouble get_screen_dpi(void)
+{
+ const gdouble mm_per_inch = 25.4;
+ GdkScreen *scr = gdk_screen_get_default();
+ gdouble h_mm = gdk_screen_get_height_mm(scr);
+ gdouble h = gdk_screen_get_height(scr);
+ gdouble dpi_h = floor((h / h_mm) * mm_per_inch);
+ return dpi_h;
+}