From 14e0759b76e3213334ae8be367382695f9fe8d55 Mon Sep 17 00:00:00 2001 From: ZenWalker Date: Sat, 19 Aug 2017 02:26:18 +0200 Subject: ev-document-misc.c: avoid deprecated gdk_screen_get_width/height_mm Fixes #177 --- libdocument/ev-document-misc.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libdocument/ev-document-misc.c') 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); -- cgit v1.2.1