[evince] ev-view-presentation: Don't move goto window offscreen



commit fecb83dd7bccb474a81e8c787c8216e58adb0e2e
Author: Jason Crain <jcrain inspiresomeone us>
Date:   Sun Jan 12 12:35:12 2020 -0700

    ev-view-presentation: Don't move goto window offscreen
    
    The gdk_screen_get_width() and gdk_screen_get_height() functions are
    deprecated since gdk 3.22. They are used by EvViewPresentation's
    ev_view_presentation_goto_window_send_key_event() function to move a
    window offscreen.
    
    This function's purpose is to forward an event to the goto window, but
    since windows can only receive events when they are 'shown', it first
    moves the window offscreen so it won't be visible, then shows the
    window, forwards the event, and hides the window again.
    
    Rearrange the code so that the goto window is already visible and in the
    correct location before forwarding the event. Remove the now unneeded
    showing and hiding code and remove use of the deprecated GdkScreen
    functions.
    
    Issue #1023

 libview/ev-view-presentation.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
---
diff --git a/libview/ev-view-presentation.c b/libview/ev-view-presentation.c
index 8f551997..d0ff2133 100644
--- a/libview/ev-view-presentation.c
+++ b/libview/ev-view-presentation.c
@@ -779,14 +779,6 @@ ev_view_presentation_goto_window_send_key_event (EvViewPresentation *pview,
                                                 GdkEvent           *event)
 {
        GdkEventKey *new_event;
-       GdkScreen   *screen;
-
-       /* Move goto window off screen */
-       screen = gtk_widget_get_screen (GTK_WIDGET (pview));
-       gtk_window_move (GTK_WINDOW (pview->goto_window),
-                        gdk_screen_get_width (screen) + 1,
-                        gdk_screen_get_height (screen) + 1);
-       gtk_widget_show (pview->goto_window);
 
        new_event = (GdkEventKey *) gdk_event_copy (event);
        g_object_unref (new_event->window);
@@ -797,7 +789,6 @@ ev_view_presentation_goto_window_send_key_event (EvViewPresentation *pview,
 
        gtk_widget_event (pview->goto_window, (GdkEvent *)new_event);
        gdk_event_free ((GdkEvent *)new_event);
-       gtk_widget_hide (pview->goto_window);
 }
 
 /* Links */
@@ -1211,10 +1202,10 @@ ev_view_presentation_key_press_event (GtkWidget   *widget,
                gint x, y;
 
                ev_view_presentation_goto_window_create (pview);
-               ev_view_presentation_goto_window_send_key_event (pview, (GdkEvent *)event);
                ev_document_misc_get_pointer_position (GTK_WIDGET (pview), &x, &y);
                gtk_window_move (GTK_WINDOW (pview->goto_window), x, y);
                gtk_widget_show (pview->goto_window);
+               ev_view_presentation_goto_window_send_key_event (pview, (GdkEvent *)event);
                ev_view_presentation_goto_entry_grab_focus (pview);
 
                return TRUE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]