summaryrefslogtreecommitdiff
path: root/libdocument/ev-document-misc.c
diff options
context:
space:
mode:
authorrbuj <[email protected]>2019-08-02 12:56:13 +0200
committerVictor Kareh <[email protected]>2019-08-10 22:58:36 -0400
commitd387353c800961b730496dc79d2372b2a56875d9 (patch)
treefe01277680a993b2b1f666ade7f8410fad21ab2f /libdocument/ev-document-misc.c
parent82d6a871b48c5054c629c83612b60dba63e70cc9 (diff)
downloadatril-d387353c800961b730496dc79d2372b2a56875d9.tar.bz2
atril-d387353c800961b730496dc79d2372b2a56875d9.tar.xz
DPI: compute monitor resolution or get screen resolution
Diffstat (limited to 'libdocument/ev-document-misc.c')
-rw-r--r--libdocument/ev-document-misc.c10
1 files changed, 7 insertions, 3 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);
}