[Xfce4-commits] <ristretto:stephan/gtk3> Support shift+scroll to pan across an image

Stephan Arts noreply at xfce.org
Sat Feb 2 16:16:38 CET 2013


Updating branch refs/heads/stephan/gtk3
         to be3743f7b244fbecb57c5e634192bf73791e5be0 (commit)
       from 02b161c7b57b47237fb3f8b1f29a70bdc53f8c89 (commit)

commit be3743f7b244fbecb57c5e634192bf73791e5be0
Author: Andrew Ash <andrew at andrewash.com>
Date:   Fri Aug 3 01:15:09 2012 -0700

    Support shift+scroll to pan across an image
    
    - /* multi-line */ comments
    - Single point of exit for a function
    
    Signed-off-by: Stephan Arts <stephan at xfce.org>

 src/main_window.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/main_window.c b/src/main_window.c
index 7dd02ba..3d3879b 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -2391,21 +2391,29 @@ cb_rstto_main_window_image_viewer_scroll_event (GtkWidget *widget,
                                                 gpointer user_data)
 {
     RsttoMainWindow *window = RSTTO_MAIN_WINDOW (user_data);
-    if (!(event->state & (GDK_CONTROL_MASK)))
+    gboolean ret = FALSE;
+
+    /*
+     * - scroll through images with scroll
+     * - pan across current image with shift+scroll
+     * - zoom on current image with ctrl+scroll
+     */
+    if (!(event->state & (GDK_CONTROL_MASK)) &&
+        !(event->state & (GDK_SHIFT_MASK)))
     {
         switch(event->direction)
         {
             case GDK_SCROLL_UP:
             case GDK_SCROLL_LEFT:
                 rstto_image_list_iter_previous (window->priv->iter);
-                break;
+                ret = TRUE; /* don't call other callbacks */
             case GDK_SCROLL_DOWN:
             case GDK_SCROLL_RIGHT:
                 rstto_image_list_iter_next (window->priv->iter);
-                break;
+                ret = TRUE;
         }
     }
-    return FALSE;
+    return ret;
 }
 
 static gboolean


More information about the Xfce4-commits mailing list