summaryrefslogtreecommitdiff
path: root/libview/ev-annotation-window.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 /libview/ev-annotation-window.c
parent82d6a871b48c5054c629c83612b60dba63e70cc9 (diff)
downloadatril-d387353c800961b730496dc79d2372b2a56875d9.tar.bz2
atril-d387353c800961b730496dc79d2372b2a56875d9.tar.xz
DPI: compute monitor resolution or get screen resolution
Diffstat (limited to 'libview/ev-annotation-window.c')
-rw-r--r--libview/ev-annotation-window.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libview/ev-annotation-window.c b/libview/ev-annotation-window.c
index eab458c2..52be0298 100644
--- a/libview/ev-annotation-window.c
+++ b/libview/ev-annotation-window.c
@@ -94,17 +94,17 @@ send_focus_change (GtkWidget *widget,
}
static gdouble
-get_screen_dpi (EvAnnotationWindow *window)
+get_monitor_dpi (EvAnnotationWindow *window)
{
- GdkScreen *screen;
+ GdkWindow *gdk_window;
GdkMonitor *monitor;
GdkDisplay *display;
- screen = gtk_window_get_screen (GTK_WINDOW (window));
- display = gdk_screen_get_display (screen);
- monitor = gdk_display_get_primary_monitor (display);
+ gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
+ display = gdk_window_get_display (gdk_window);
+ monitor = gdk_display_get_monitor_at_window (display, gdk_window);
- return ev_document_misc_get_screen_dpi (screen, monitor);
+ return ev_document_misc_get_monitor_dpi (monitor);
}
static void
@@ -459,7 +459,7 @@ ev_annotation_window_constructor (GType type,
rect = &window->rect;
/* Rectangle is at doc resolution (72.0) */
- scale = get_screen_dpi (window) / 72.0;
+ scale = get_monitor_dpi (window) / 72.0;
gtk_window_resize (GTK_WINDOW (window),
(gint)((rect->x2 - rect->x1) * scale),
(gint)((rect->y2 - rect->y1) * scale));