diff options
author | Matthew Petroff <[email protected]> | 2016-10-19 12:36:30 -0400 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-08-15 15:31:07 +0200 |
commit | c75f49d323a17d244e3363c2fc9152bc275c5fb2 (patch) | |
tree | b4639d39a203c15e702b06973b0626222d9fc561 | |
parent | 31251cb1202aec7cb3bb1addfbbfe55c125f10d7 (diff) | |
download | atril-c75f49d323a17d244e3363c2fc9152bc275c5fb2.tar.bz2 atril-c75f49d323a17d244e3363c2fc9152bc275c5fb2.tar.xz |
Take monitor scale factor into account when calculating zoom.
https://github.com/linuxmint/xreader/commit/c47a1f4
-rw-r--r-- | libdocument/ev-document-misc.c | 6 | ||||
-rw-r--r-- | libdocument/ev-document-misc.h | 2 | ||||
-rw-r--r-- | libview/ev-annotation-window.c | 4 | ||||
-rw-r--r-- | previewer/ev-previewer-window.c | 4 | ||||
-rw-r--r-- | shell/ev-window.c | 4 |
5 files changed, 15 insertions, 5 deletions
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); diff --git a/libview/ev-annotation-window.c b/libview/ev-annotation-window.c index de5c8876..dac7f8d4 100644 --- a/libview/ev-annotation-window.c +++ b/libview/ev-annotation-window.c @@ -99,9 +99,11 @@ static gdouble get_screen_dpi (EvAnnotationWindow *window) { GdkScreen *screen; + gint monitor; screen = gtk_window_get_screen (GTK_WINDOW (window)); - return ev_document_misc_get_screen_dpi (screen); + monitor = gdk_screen_get_monitor_at_window(screen, gtk_widget_get_window(GTK_WIDGET(GTK_WINDOW(window)))); + return ev_document_misc_get_screen_dpi (screen, monitor); } static GtkIconSize diff --git a/previewer/ev-previewer-window.c b/previewer/ev-previewer-window.c index e92eb75d..45545fbf 100644 --- a/previewer/ev-previewer-window.c +++ b/previewer/ev-previewer-window.c @@ -71,9 +71,11 @@ static gdouble get_screen_dpi (EvPreviewerWindow *window) { GdkScreen *screen; + gint monitor; screen = gtk_window_get_screen (GTK_WINDOW (window)); - return ev_document_misc_get_screen_dpi (screen); + monitor = gdk_screen_get_monitor_at_window(screen, gtk_widget_get_window(GTK_WIDGET(GTK_WINDOW(window)))); + return ev_document_misc_get_screen_dpi (screen, monitor); } #if GTKUNIXPRINT_ENABLED diff --git a/shell/ev-window.c b/shell/ev-window.c index 94cd5071..88cfa5f7 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -384,9 +384,11 @@ static gdouble get_screen_dpi (EvWindow *window) { GdkScreen *screen; + gint monitor; screen = gtk_window_get_screen (GTK_WINDOW (window)); - return ev_document_misc_get_screen_dpi (screen); + monitor = gdk_screen_get_monitor_at_window(screen, gtk_widget_get_window(GTK_WIDGET(GTK_WINDOW(window)))); + return ev_document_misc_get_screen_dpi (screen, monitor); } static void |