diff options
Diffstat (limited to 'libdocument')
-rw-r--r-- | libdocument/ev-document-misc.c | 15 | ||||
-rw-r--r-- | libdocument/ev-document-misc.h | 4 |
2 files changed, 10 insertions, 9 deletions
diff --git a/libdocument/ev-document-misc.c b/libdocument/ev-document-misc.c index c530018e..6794d050 100644 --- a/libdocument/ev-document-misc.c +++ b/libdocument/ev-document-misc.c @@ -372,15 +372,14 @@ ev_document_misc_invert_pixbuf (GdkPixbuf *pixbuf) } gdouble +#if GTK_CHECK_VERSION (3, 22, 0) +ev_document_misc_get_screen_dpi (GdkScreen *screen, GdkMonitor *monitor) +#else ev_document_misc_get_screen_dpi (GdkScreen *screen, gint monitor) +#endif { 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); @@ -390,12 +389,10 @@ ev_document_misc_get_screen_dpi (GdkScreen *screen, gint monitor) /*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; + di = hypot (gdk_monitor_get_width_mm(monitor), gdk_monitor_get_height_mm (monitor)) / 25.4; + di /= gdk_monitor_get_scale_factor (monitor); #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); #endif diff --git a/libdocument/ev-document-misc.h b/libdocument/ev-document-misc.h index e6480ed0..25e3b8ce 100644 --- a/libdocument/ev-document-misc.h +++ b/libdocument/ev-document-misc.h @@ -58,7 +58,11 @@ cairo_surface_t *ev_document_misc_surface_rotate_and_scale (cairo_surface_t *sur void ev_document_misc_invert_surface (cairo_surface_t *surface); void ev_document_misc_invert_pixbuf (GdkPixbuf *pixbuf); +#if GTK_CHECK_VERSION (3, 22, 0) +gdouble ev_document_misc_get_screen_dpi (GdkScreen *screen, GdkMonitor *monitor); +#else gdouble ev_document_misc_get_screen_dpi (GdkScreen *screen, gint monitor); +#endif gchar *ev_document_misc_format_date (GTime utime); |