diff options
Diffstat (limited to 'libdocument')
-rw-r--r-- | libdocument/ev-document-misc.c | 9 |
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); |