summaryrefslogtreecommitdiff
path: root/shell/ev-window.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/ev-window.c')
-rw-r--r--shell/ev-window.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 82aa74a7..86019e93 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -402,9 +402,13 @@ get_monitor_dpi (EvWindow *ev_window)
GdkDisplay *display;
window = gtk_widget_get_window (GTK_WIDGET (ev_window));
- display = gdk_window_get_display (window);
- monitor = gdk_display_get_monitor_at_window (display, window);
-
+ if (window) {
+ display = gdk_window_get_display (window);
+ monitor = gdk_display_get_monitor_at_window (display, window);
+ } else {
+ display = gdk_display_get_default();
+ monitor = gdk_display_get_primary_monitor (display);
+ }
return ev_document_misc_get_monitor_dpi (monitor);
}