summaryrefslogtreecommitdiff
path: root/libdocument
diff options
context:
space:
mode:
Diffstat (limited to 'libdocument')
-rw-r--r--libdocument/ev-document-misc.c10
-rw-r--r--libdocument/ev-document-misc.h2
2 files changed, 8 insertions, 4 deletions
diff --git a/libdocument/ev-document-misc.c b/libdocument/ev-document-misc.c
index 1a07781c..e25b9ca6 100644
--- a/libdocument/ev-document-misc.c
+++ b/libdocument/ev-document-misc.c
@@ -339,16 +339,20 @@ ev_document_misc_invert_pixbuf (GdkPixbuf *pixbuf)
}
gdouble
-ev_document_misc_get_screen_dpi (GdkScreen *screen, GdkMonitor *monitor)
+ev_document_misc_get_monitor_dpi (GdkMonitor *monitor)
{
+ GdkRectangle geometry;
+ int s;
gdouble dp, di;
+ gdk_monitor_get_geometry (monitor, &geometry);
+ s = gdk_monitor_get_scale_factor (monitor);
+
/*diagonal in pixels*/
- dp = hypot (WidthOfScreen (gdk_x11_screen_get_xscreen (screen)), HeightOfScreen (gdk_x11_screen_get_xscreen (screen)));
+ dp = hypot (geometry.width * s, geometry.height * s);
/*diagonal in inches*/
di = hypot (gdk_monitor_get_width_mm(monitor), gdk_monitor_get_height_mm (monitor)) / 25.4;
- di /= gdk_monitor_get_scale_factor (monitor);
return (dp / di);
}
diff --git a/libdocument/ev-document-misc.h b/libdocument/ev-document-misc.h
index 5dec395a..3b97e3f8 100644
--- a/libdocument/ev-document-misc.h
+++ b/libdocument/ev-document-misc.h
@@ -61,7 +61,7 @@ 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);
-gdouble ev_document_misc_get_screen_dpi (GdkScreen *screen, GdkMonitor *monitor);
+gdouble ev_document_misc_get_monitor_dpi (GdkMonitor *monitor);
gchar *ev_document_misc_format_date (GTime utime);