diff options
author | raveit65 <[email protected]> | 2019-07-31 16:05:49 +0200 |
---|---|---|
committer | Robert Antoni Buj Gelonch <[email protected]> | 2019-08-19 14:15:38 +0200 |
commit | e467608b6003d6c02952ed98b04f007a95d7b600 (patch) | |
tree | de4a35a7f1c9968d757fa1f96d8cb22119f739d7 /libview/ev-view-presentation.c | |
parent | be9ae6b93b257af960da4eebf6544fd1331b5acf (diff) | |
download | atril-e467608b6003d6c02952ed98b04f007a95d7b600.tar.bz2 atril-e467608b6003d6c02952ed98b04f007a95d7b600.tar.xz |
view-presentation: Use monitor instead of screen
to determine window size.
Replace {Width/Hight}OfScreen which works only with X11
Diffstat (limited to 'libview/ev-view-presentation.c')
-rw-r--r-- | libview/ev-view-presentation.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/libview/ev-view-presentation.c b/libview/ev-view-presentation.c index 644cda54..0bcfe54d 100644 --- a/libview/ev-view-presentation.c +++ b/libview/ev-view-presentation.c @@ -752,17 +752,43 @@ ev_view_presentation_goto_entry_grab_focus (EvViewPresentation *pview) } static void +monitor_get_dimesions (EvViewPresentation *pview, + gint *width, + gint *height) +{ + GdkDisplay *display; + GdkWindow *gdk_window; + GdkMonitor *monitor; + GdkRectangle geometry; + + *width = 0; + *height = 0; + + display = gtk_widget_get_display (GTK_WIDGET (pview)); + gdk_window = gtk_widget_get_window (GTK_WIDGET (pview)); + + if (gdk_window) { + monitor = gdk_display_get_monitor_at_window (display, + gdk_window); + gdk_monitor_get_workarea (monitor, &geometry); + *width = geometry.width; + *height = geometry.height; + } +} + +static void ev_view_presentation_goto_window_send_key_event (EvViewPresentation *pview, GdkEvent *event) { GdkEventKey *new_event; - GdkScreen *screen; + gint monitor_width; + gint monitor_height; /* Move goto window off screen */ - screen = gtk_widget_get_screen (GTK_WIDGET (pview)); + monitor_get_dimesions (pview, &monitor_width, &monitor_height); gtk_window_move (GTK_WINDOW (pview->goto_window), - WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) + 1, - HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) + 1); + monitor_width + 1, + monitor_height + 1); gtk_widget_show (pview->goto_window); new_event = (GdkEventKey *) gdk_event_copy (event); |