summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2017-08-19 02:26:18 +0200
committerraveit65 <[email protected]>2017-08-20 17:00:09 +0200
commit14e0759b76e3213334ae8be367382695f9fe8d55 (patch)
tree3f083a98788b6b901943fd364e57bad9df2cb830
parentd9fffe2dc0e33d6777099c18635b7b75f54d3d35 (diff)
downloadatril-14e0759b76e3213334ae8be367382695f9fe8d55.tar.bz2
atril-14e0759b76e3213334ae8be367382695f9fe8d55.tar.xz
ev-document-misc.c: avoid deprecated gdk_screen_get_width/height_mm
Fixes #177
-rw-r--r--libdocument/ev-document-misc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libdocument/ev-document-misc.c b/libdocument/ev-document-misc.c
index e59eb354..c530018e 100644
--- a/libdocument/ev-document-misc.c
+++ b/libdocument/ev-document-misc.c
@@ -376,6 +376,11 @@ ev_document_misc_get_screen_dpi (GdkScreen *screen, gint monitor)
{
gdouble dp, di;
gint sc_width, sc_height;
+#if GTK_CHECK_VERSION (3, 22, 0)
+ GdkMonitor *monitor_id;
+
+ monitor_id = gdk_display_get_monitor (gdk_screen_get_display (screen), monitor);
+#endif
gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL,
&sc_width, &sc_height);
@@ -384,7 +389,11 @@ ev_document_misc_get_screen_dpi (GdkScreen *screen, gint monitor)
dp = hypot (sc_width, sc_height);
/*diagonal in inches*/
+#if GTK_CHECK_VERSION (3, 22, 0)
+ di = hypot (gdk_monitor_get_width_mm(monitor_id), gdk_monitor_get_height_mm (monitor_id)) / 25.4;
+#else
di = hypot (gdk_screen_get_width_mm(screen), gdk_screen_get_height_mm (screen)) / 25.4;
+#endif
#ifdef HAVE_HIDPI_SUPPORT
di /= gdk_screen_get_monitor_scale_factor(screen, monitor);