From c75f49d323a17d244e3363c2fc9152bc275c5fb2 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Wed, 19 Oct 2016 12:36:30 -0400 Subject: Take monitor scale factor into account when calculating zoom. https://github.com/linuxmint/xreader/commit/c47a1f4 --- libdocument/ev-document-misc.c | 6 +++++- libdocument/ev-document-misc.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'libdocument') diff --git a/libdocument/ev-document-misc.c b/libdocument/ev-document-misc.c index 1afa1d77..c8d15ae1 100644 --- a/libdocument/ev-document-misc.c +++ b/libdocument/ev-document-misc.c @@ -379,7 +379,7 @@ ev_document_misc_invert_pixbuf (GdkPixbuf *pixbuf) } gdouble -ev_document_misc_get_screen_dpi (GdkScreen *screen) +ev_document_misc_get_screen_dpi (GdkScreen *screen, gint monitor) { gdouble dp, di; @@ -389,6 +389,10 @@ ev_document_misc_get_screen_dpi (GdkScreen *screen) /*diagonal in inches*/ di = hypot (gdk_screen_get_width_mm(screen), gdk_screen_get_height_mm (screen)) / 25.4; +#ifdef HAVE_HIDPI_SUPPORT + di /= gdk_screen_get_monitor_scale_factor(screen, monitor); +#endif + return (dp / di); } diff --git a/libdocument/ev-document-misc.h b/libdocument/ev-document-misc.h index 98c791ca..e6480ed0 100644 --- a/libdocument/ev-document-misc.h +++ b/libdocument/ev-document-misc.h @@ -58,7 +58,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); +gdouble ev_document_misc_get_screen_dpi (GdkScreen *screen, gint monitor); gchar *ev_document_misc_format_date (GTime utime); -- cgit v1.2.1