diff options
author | ZenWalker <[email protected]> | 2017-08-20 03:29:36 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-08-20 17:00:09 +0200 |
commit | 444cec08e38299e5d6ae9489ae74d02f4e4a5f97 (patch) | |
tree | 186b13a66e39402e816a14db612f8dd4b89ee811 | |
parent | 14e0759b76e3213334ae8be367382695f9fe8d55 (diff) | |
download | atril-444cec08e38299e5d6ae9489ae74d02f4e4a5f97.tar.bz2 atril-444cec08e38299e5d6ae9489ae74d02f4e4a5f97.tar.xz |
avoid gdk_screen_get_primary_monitor/gdk_screen_get_monitor_scale_factor
-rw-r--r-- | libdocument/ev-document-misc.c | 15 | ||||
-rw-r--r-- | libdocument/ev-document-misc.h | 4 | ||||
-rw-r--r-- | libview/ev-annotation-window.c | 14 | ||||
-rw-r--r-- | previewer/ev-previewer-window.c | 14 | ||||
-rw-r--r-- | shell/ev-window.c | 14 |
5 files changed, 46 insertions, 15 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); diff --git a/libview/ev-annotation-window.c b/libview/ev-annotation-window.c index 15bdce5a..eadb6d65 100644 --- a/libview/ev-annotation-window.c +++ b/libview/ev-annotation-window.c @@ -96,11 +96,21 @@ send_focus_change (GtkWidget *widget, static gdouble get_screen_dpi (EvAnnotationWindow *window) { - GdkScreen *screen; - gint monitor; + GdkScreen *screen; +#if GTK_CHECK_VERSION (3, 22, 0) + GdkMonitor *monitor; + GdkDisplay *display; +#else + gint monitor; +#endif screen = gtk_window_get_screen (GTK_WINDOW (window)); +#if GTK_CHECK_VERSION (3, 22, 0) + display = gdk_screen_get_display (screen); + monitor = gdk_display_get_primary_monitor (display); +#else monitor = gdk_screen_get_primary_monitor (screen); +#endif return ev_document_misc_get_screen_dpi (screen, monitor); } diff --git a/previewer/ev-previewer-window.c b/previewer/ev-previewer-window.c index 2ec298bb..2571ac8d 100644 --- a/previewer/ev-previewer-window.c +++ b/previewer/ev-previewer-window.c @@ -70,11 +70,21 @@ G_DEFINE_TYPE (EvPreviewerWindow, ev_previewer_window, GTK_TYPE_WINDOW) static gdouble get_screen_dpi (EvPreviewerWindow *window) { - GdkScreen *screen; - gint monitor; + GdkScreen *screen; +#if GTK_CHECK_VERSION (3, 22, 0) + GdkMonitor *monitor; + GdkDisplay *display; +#else + gint monitor; +#endif screen = gtk_window_get_screen (GTK_WINDOW (window)); +#if GTK_CHECK_VERSION (3, 22, 0) + display = gdk_screen_get_display (screen); + monitor = gdk_display_get_primary_monitor (display); +#else monitor = gdk_screen_get_primary_monitor (screen); +#endif return ev_document_misc_get_screen_dpi (screen, monitor); } diff --git a/shell/ev-window.c b/shell/ev-window.c index ca906be3..f15a74da 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -383,11 +383,21 @@ G_DEFINE_TYPE (EvWindow, ev_window, GTK_TYPE_WINDOW) static gdouble get_screen_dpi (EvWindow *window) { - GdkScreen *screen; - gint monitor; + GdkScreen *screen; +#if GTK_CHECK_VERSION (3, 22, 0) + GdkMonitor *monitor; + GdkDisplay *display; +#else + gint monitor; +#endif screen = gtk_window_get_screen (GTK_WINDOW (window)); +#if GTK_CHECK_VERSION (3, 22, 0) + display = gdk_screen_get_display (screen); + monitor = gdk_display_get_primary_monitor (display); +#else monitor = gdk_screen_get_primary_monitor (screen); +#endif return ev_document_misc_get_screen_dpi (screen, monitor); } |