]> www.fi.muni.cz Git - evince.git/commitdiff
Stop autoscroll when Escape key is pressed. Fixes bug #511635.
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sat, 26 Jan 2008 15:59:00 +0000 (15:59 +0000)
committerCarlos Garcia Campos <carlosgc@src.gnome.org>
Sat, 26 Jan 2008 15:59:00 +0000 (15:59 +0000)
2008-01-26  Carlos Garcia Campos  <carlosgc@gnome.org>
* shell/ev-view.[ch]: (ev_view_button_release_event),
(ev_view_autoscroll_start), (ev_view_autoscroll_stop):
* shell/ev-window.c: (ev_window_cmd_view_autoscroll),
(ev_window_cmd_escape):
Stop autoscroll when Escape key is pressed. Fixes bug #511635.

svn path=/trunk/; revision=2860

ChangeLog
shell/ev-view.c
shell/ev-view.h
shell/ev-window.c

index 253457e20be425a92702adb3b134a4259c88daf5..4fe67cf11c932e0e8ef658b200b05e5dc304690b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-01-26  Carlos Garcia Campos  <carlosgc@gnome.org>
+
+       * shell/ev-view.[ch]: (ev_view_button_release_event),
+       (ev_view_autoscroll_start), (ev_view_autoscroll_stop):
+       * shell/ev-window.c: (ev_window_cmd_view_autoscroll),
+       (ev_window_cmd_escape):
+
+       Stop autoscroll when Escape key is pressed. Fixes bug #511635.
+       
 2008-01-25  Carlos Garcia Campos  <carlosgc@gnome.org>
 
        * configure.ac:
index 286350678557723b4d2c51367f53ec406b3c3f87..fa9fbd8dc65f9ab894e0bef07ee14268ce07bd98 100644 (file)
@@ -3135,12 +3135,7 @@ ev_view_button_release_event (GtkWidget      *widget,
        view->image_dnd_info.in_drag = FALSE;
 
        if (view->scroll_info.autoscrolling) {
-               view->scroll_info.autoscrolling = FALSE;
-               if (view->scroll_info.timeout_id) {
-                       g_source_remove (view->scroll_info.timeout_id);
-                       view->scroll_info.timeout_id = 0;
-               }
-               ev_view_handle_cursor_over_xy (view, event->x, event->y);
+               ev_view_autoscroll_stop (view);
                view->pressed_button = -1;
 
                return TRUE;
@@ -4467,10 +4462,42 @@ ev_view_autoscroll_cb (EvView *view)
 }
 
 void
-ev_view_autoscroll (EvView *view)
+ev_view_autoscroll_start (EvView *view)
 {
+       gint x, y;
+       
+       g_return_if_fail (EV_IS_VIEW (view));
+
+       if (view->scroll_info.autoscrolling)
+               return;
+       
        view->scroll_info.autoscrolling = TRUE;
-       view->scroll_info.timeout_id = g_timeout_add (20, (GSourceFunc)(ev_view_autoscroll_cb), view);
+       view->scroll_info.timeout_id =
+               g_timeout_add (20, (GSourceFunc)ev_view_autoscroll_cb,
+                              view);
+       
+       gtk_widget_get_pointer (GTK_WIDGET (view), &x, &y);
+       ev_view_handle_cursor_over_xy (view, x, y);
+}
+
+void
+ev_view_autoscroll_stop (EvView *view)
+{
+       gint x, y;
+       
+       g_return_if_fail (EV_IS_VIEW (view));
+
+       if (!view->scroll_info.autoscrolling)
+               return;
+
+       view->scroll_info.autoscrolling = FALSE;
+       if (view->scroll_info.timeout_id) {
+               g_source_remove (view->scroll_info.timeout_id);
+               view->scroll_info.timeout_id = 0;
+       }
+
+       gtk_widget_get_pointer (GTK_WIDGET (view), &x, &y);
+       ev_view_handle_cursor_over_xy (view, x, y);
 }
 
 void
index 784f7972e6ccc514d22d3c069dd415456cfa181e..d6dd40e063d40e0312847cd22c943e588581e6bc 100644 (file)
@@ -144,7 +144,8 @@ gchar*         ev_view_page_label_from_dest (EvView *view, EvLinkDest *dest);
 
 void           ev_view_update_view_size (EvView *view, GtkScrolledWindow *scrolled_window);
 
-void          ev_view_autoscroll         (EvView *view);
+void          ev_view_autoscroll_start   (EvView *view);
+void           ev_view_autoscroll_stop    (EvView *view);
 
 G_END_DECLS
 
index 0ec0533b94a809451975a33ecefb6ceaeb6ce4a7..f15e06fc20da6d1aa4a2867122c131353f7ee2b0 100644 (file)
@@ -3302,7 +3302,7 @@ ev_window_cmd_view_reload (GtkAction *action, EvWindow *ev_window)
 static void
 ev_window_cmd_view_autoscroll (GtkAction *action, EvWindow *ev_window)
 {
-       ev_view_autoscroll (EV_VIEW (ev_window->priv->view));
+       ev_view_autoscroll_start (EV_VIEW (ev_window->priv->view));
 }
 
 static void
@@ -3505,6 +3505,8 @@ ev_window_cmd_escape (GtkAction *action, EvWindow *window)
 {
        GtkWidget *widget;
 
+       ev_view_autoscroll_stop (window->priv->view);
+       
        widget = gtk_window_get_focus (GTK_WINDOW (window));
        if (widget && gtk_widget_get_ancestor (widget, EGG_TYPE_FIND_BAR)) {
                update_chrome_flag (window, EV_CHROME_FINDBAR, FALSE);