summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2013-02-06 01:10:40 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-07 18:19:28 +1100
commit30466b9abbbbbf215642f73cbae4fbed3d2b9975 (patch)
treeac38038af3cd5d02144c7015c0eaeb7799c3b4e5 /gtk-gui.c
parent6bec608ea09743112ead58f86c7d9b25f10ecee2 (diff)
downloadsubsurface-30466b9abbbbbf215642f73cbae4fbed3d2b9975.tar.gz
Use GDK methods to retrieve the actual screen DPI
gtk-gui.c: + added the method get_screen_dpi() that uses a simple formula to retrieve the actual screen DPI display.h: + use get_screen_dpi() in the SCALE_PRINT macro Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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;
+}