[eog: 1/2] Shortcuts: Update shortcuts




commit 161aedf725101443c516b263efb26da3ce5c171d
Author: Jeremias Ortega <jeremias ortega tech>
Date:   Sat Jan 8 18:49:33 2022 -0600

    Shortcuts: Update shortcuts
    
    Since we moved to a scrolled window some shortcuts were added by it.
    This updates the help and cleans some old code.

 data/help-overlay.ui  |  23 +++----
 src/eog-application.c |  32 +++++++--
 src/eog-scroll-view.c | 144 ++-------------------------------------
 src/eog-window.c      | 182 +++++++++++++++++++++++++-------------------------
 4 files changed, 134 insertions(+), 247 deletions(-)
---
diff --git a/data/help-overlay.ui b/data/help-overlay.ui
index 827828af..87e2fe46 100644
--- a/data/help-overlay.ui
+++ b/data/help-overlay.ui
@@ -119,21 +119,21 @@
             <child>
               <object class="GtkShortcutsShortcut">
                 <property name="visible">1</property>
-                <property name="accelerator">plus</property>
+                <property name="accelerator">plus &lt;Ctrl&gt;plus</property>
                 <property name="title" translatable="yes" context="shortcut window">Zoom in</property>
               </object>
             </child>
             <child>
               <object class="GtkShortcutsShortcut">
                 <property name="visible">1</property>
-                <property name="accelerator">minus</property>
+                <property name="accelerator">minus &lt;Ctrl&gt;minus</property>
                 <property name="title" translatable="yes" context="shortcut window">Zoom out</property>
               </object>
             </child>
             <child>
               <object class="GtkShortcutsShortcut">
                 <property name="visible">1</property>
-                <property name="accelerator">1</property>
+                <property name="accelerator">1 &lt;Ctrl&gt;0</property>
                 <property name="title" translatable="yes" context="shortcut window">Actual size</property>
               </object>
             </child>
@@ -186,7 +186,7 @@
               <object class="GtkShortcutsShortcut">
                 <property name="visible">1</property>
                 <property name="direction">GTK_TEXT_DIR_LTR</property>
-                <property name="accelerator">Left</property>
+                <property name="accelerator">Left &lt;Alt&gt;Left</property>
                 <property name="title" translatable="yes" context="shortcut window">Go to the previous image 
in the folder</property>
               </object>
             </child>
@@ -194,7 +194,7 @@
               <object class="GtkShortcutsShortcut">
                 <property name="visible">1</property>
                 <property name="direction">GTK_TEXT_DIR_RTL</property>
-                <property name="accelerator">Right</property>
+                <property name="accelerator">Right &lt;Alt&gt;Right</property>
                 <property name="title" translatable="yes" context="shortcut window">Go to the previous image 
in the folder</property>
               </object>
             </child>
@@ -202,7 +202,7 @@
               <object class="GtkShortcutsShortcut">
                 <property name="visible">1</property>
                 <property name="direction">GTK_TEXT_DIR_LTR</property>
-                <property name="accelerator">Right</property>
+                <property name="accelerator">Right &lt;Alt&gt;Right</property>
                 <property name="title" translatable="yes" context="shortcut window">Go to the next image in 
the folder</property>
               </object>
             </child>
@@ -210,7 +210,7 @@
               <object class="GtkShortcutsShortcut">
                 <property name="visible">1</property>
                 <property name="direction">GTK_TEXT_DIR_RTL</property>
-                <property name="accelerator">Left</property>
+                <property name="accelerator">Left &lt;Alt&gt;Left</property>
                 <property name="title" translatable="yes" context="shortcut window">Go to the next image in 
the folder</property>
               </object>
             </child>
@@ -346,28 +346,28 @@
             <child>
               <object class="GtkShortcutsShortcut">
                 <property name="visible">1</property>
-                <property name="accelerator">&lt;Alt&gt;Left</property>
+                <property name="accelerator">&lt;Ctrl&gt;Left &lt;Ctrl&gt;Page_Up &lt;Ctrl&gt;Home</property>
                 <property name="title" translatable="yes" context="shortcut window">Scroll left in a large 
image</property>
               </object>
             </child>
             <child>
               <object class="GtkShortcutsShortcut">
                 <property name="visible">1</property>
-                <property name="accelerator">&lt;Alt&gt;Right</property>
+                <property name="accelerator">&lt;Ctrl&gt;Right &lt;Ctrl&gt;Page_Down 
&lt;Ctrl&gt;End</property>
                 <property name="title" translatable="yes" context="shortcut window">Scroll right in a large 
image</property>
               </object>
             </child>
             <child>
               <object class="GtkShortcutsShortcut">
                 <property name="visible">1</property>
-                <property name="accelerator">&lt;Alt&gt;Up</property>
+                <property name="accelerator">&lt;Ctrl&gt;Up Page_Up Home</property>
                 <property name="title" translatable="yes" context="shortcut window">Scroll up in a large 
image</property>
               </object>
             </child>
             <child>
               <object class="GtkShortcutsShortcut">
                 <property name="visible">1</property>
-                <property name="accelerator">&lt;Alt&gt;Down</property>
+                <property name="accelerator">&lt;Ctrl&gt;Down Page_Down End</property>
                 <property name="title" translatable="yes" context="shortcut window">Scroll down in a large 
image</property>
               </object>
             </child>
@@ -376,5 +376,4 @@
       </object>
     </child>
   </object>
-
 </interface>
diff --git a/src/eog-application.c b/src/eog-application.c
index 69a5c060..1b4a049b 100644
--- a/src/eog-application.c
+++ b/src/eog-application.c
@@ -49,6 +49,8 @@
 #include <exempi/xmp.h>
 #endif
 
+#define is_rtl (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
+
 static void eog_application_load_accelerators (void);
 static void eog_application_save_accelerators (void);
 
@@ -194,7 +196,7 @@ eog_application_init_app_menu (EogApplication *application)
 static void
 eog_application_init_accelerators (GtkApplication *application)
 {
-       /* Based on a simular construct in Evince (src/ev-application.c).
+       /* Based on a similar construct in Evince (src/ev-application.c).
         * Setting multiple accelerators at once for an action
         * is not very straight forward in a static way.
         *
@@ -212,8 +214,6 @@ eog_application_init_accelerators (GtkApplication *application)
                "win.set-wallpaper",    "<Ctrl>F8", NULL,
                "win.manual",           "F1", NULL,
 
-               "win.go-previous",      "BackSpace", NULL,
-               /* "win.go-next",       NULL,*/
                "win.go-first",         "<Alt>Home", "Home", NULL,
                "win.go-last",          "<Alt>End", "End", NULL,
                "win.go-random",        "<Ctrl>m", NULL,
@@ -225,9 +225,14 @@ eog_application_init_accelerators (GtkApplication *application)
                "win.undo",             "<Ctrl>z", NULL,
                "win.zoom-in",          "<Ctrl>equal", "<Ctrl>KP_Add",
                                        "<Ctrl>plus", NULL,
+               "win.zoom-in-smooth",           "equal", "KP_Add",
+                                       "plus", NULL,
                "win.zoom-out",         "<Ctrl>minus",
                                        "<Ctrl>KP_Subtract", NULL,
-               "win.zoom-normal",      "<Ctrl>0", "<Ctrl>KP_0", NULL,
+               "win.zoom-out-smooth",          "minus",
+                                       "KP_Subtract", NULL,
+               "win.zoom-normal",      "<Ctrl>0", "<Ctrl>KP_0",
+                                       "1", "KP_1", NULL,
 
                "win.view-gallery",     "<Ctrl>F9", NULL,
                "win.view-sidebar",     "F9", NULL,
@@ -246,6 +251,25 @@ eog_application_init_accelerators (GtkApplication *application)
                gtk_application_set_accels_for_action (GTK_APPLICATION (application),
                                                       it[0], &it[1]);
        }
+
+       static const gchar * const accels_left[] = {
+               "Left", "<Alt>Left", NULL
+       };
+       static const gchar * const accels_right[] = {
+               "Right", "<Alt>Right", NULL
+       };
+
+       if (is_rtl) {
+               gtk_application_set_accels_for_action (GTK_APPLICATION (application),
+                                              "win.go-previous", accels_right);
+               gtk_application_set_accels_for_action (GTK_APPLICATION (application),
+                                              "win.go-next", accels_left);
+       } else {
+               gtk_application_set_accels_for_action (GTK_APPLICATION (application),
+                                              "win.go-previous", accels_left);
+               gtk_application_set_accels_for_action (GTK_APPLICATION (application),
+                                              "win.go-next", accels_right);
+       }
 }
 
 static void
diff --git a/src/eog-scroll-view.c b/src/eog-scroll-view.c
index c9a4f801..1484a5ff 100644
--- a/src/eog-scroll-view.c
+++ b/src/eog-scroll-view.c
@@ -781,6 +781,9 @@ set_zoom_fit (EogScrollView *view)
        priv->xofs = 0;
        priv->yofs = 0;
 
+       /* we make use of the new values here */
+       update_adjustment_values (view);
+
        g_signal_emit (view, view_signals [SIGNAL_ZOOM_CHANGED], 0, priv->zoom);
 }
 
@@ -790,141 +793,6 @@ set_zoom_fit (EogScrollView *view)
 
   ---------------------------------*/
 
-/* Key press event handler for the image view */
-static gboolean
-display_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer data)
-{
-       EogScrollView *view;
-       EogScrollViewPrivate *priv;
-       GtkAllocation allocation;
-       gboolean do_zoom;
-       double zoom;
-       gboolean do_scroll;
-       int xofs, yofs;
-       GdkModifierType modifiers;
-
-       view = EOG_SCROLL_VIEW (data);
-       priv = view->priv;
-
-       do_zoom = FALSE;
-       do_scroll = FALSE;
-       xofs = yofs = 0;
-       zoom = 1.0;
-
-       gtk_widget_get_allocation (GTK_WIDGET (priv->display), &allocation);
-
-       modifiers = gtk_accelerator_get_default_mod_mask ();
-
-       switch (event->keyval) {
-       case GDK_KEY_Up:
-               if ((event->state & modifiers) == GDK_MOD1_MASK) {
-                       do_scroll = TRUE;
-                       xofs = 0;
-                       yofs = -SCROLL_STEP_SIZE;
-               }
-               break;
-
-       case GDK_KEY_Page_Up:
-               if ((event->state & GDK_MOD1_MASK) != 0) {
-                       do_scroll = TRUE;
-                       if (event->state & GDK_CONTROL_MASK) {
-                               xofs = -(allocation.width * 3) / 4;
-                               yofs = 0;
-                       } else {
-                               xofs = 0;
-                               yofs = -(allocation.height * 3) / 4;
-                       }
-               }
-               break;
-
-       case GDK_KEY_Down:
-               if ((event->state & modifiers) == GDK_MOD1_MASK) {
-                       do_scroll = TRUE;
-                       xofs = 0;
-                       yofs = SCROLL_STEP_SIZE;
-               }
-               break;
-
-       case GDK_KEY_Page_Down:
-               if ((event->state & GDK_MOD1_MASK) != 0) {
-                       do_scroll = TRUE;
-                       if (event->state & GDK_CONTROL_MASK) {
-                               xofs = (allocation.width * 3) / 4;
-                               yofs = 0;
-                       } else {
-                               xofs = 0;
-                               yofs = (allocation.height * 3) / 4;
-                       }
-               }
-               break;
-
-       case GDK_KEY_Left:
-               if ((event->state & modifiers) == GDK_MOD1_MASK) {
-                       do_scroll = TRUE;
-                       xofs = -SCROLL_STEP_SIZE;
-                       yofs = 0;
-               }
-               break;
-
-       case GDK_KEY_Right:
-               if ((event->state & modifiers) == GDK_MOD1_MASK) {
-                       do_scroll = TRUE;
-                       xofs = SCROLL_STEP_SIZE;
-                       yofs = 0;
-               }
-               break;
-
-       case GDK_KEY_plus:
-       case GDK_KEY_equal:
-       case GDK_KEY_KP_Add:
-               if (!(event->state & modifiers)) {
-                       do_zoom = TRUE;
-                       zoom = priv->zoom * priv->zoom_multiplier;
-               }
-               break;
-
-       case GDK_KEY_minus:
-       case GDK_KEY_KP_Subtract:
-               if (!(event->state & modifiers)) {
-                       do_zoom = TRUE;
-                       zoom = priv->zoom / priv->zoom_multiplier;
-               }
-               break;
-
-       case GDK_KEY_1:
-               if (!(event->state & modifiers)) {
-                       do_zoom = TRUE;
-                       zoom = 1.0;
-               }
-               break;
-
-       default:
-               return FALSE;
-       }
-
-       if (do_zoom) {
-               GdkSeat *seat;
-               GdkDevice *device;
-               gint x, y;
-
-               seat = gdk_display_get_default_seat (gtk_widget_get_display (widget));
-               device = gdk_seat_get_pointer (seat);
-
-               gdk_window_get_device_position (gtk_widget_get_window (widget), device,
-                                               &x, &y, NULL);
-               set_zoom (view, zoom, TRUE, x, y);
-       }
-
-       if (do_scroll)
-               scroll_by (view, xofs, yofs);
-
-       if(!do_scroll && !do_zoom)
-               return FALSE;
-
-       return TRUE;
-}
-
-
 /* Button press event handler for the image view */
 static gboolean
 eog_scroll_view_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer data)
@@ -2094,8 +1962,7 @@ eog_scroll_view_init (EogScrollView *view)
                               | GDK_POINTER_MOTION_MASK
                               | GDK_POINTER_MOTION_HINT_MASK
                               | GDK_TOUCH_MASK
-                              | GDK_SCROLL_MASK
-                              | GDK_KEY_PRESS_MASK);
+                              | GDK_SCROLL_MASK);
        g_signal_connect (G_OBJECT (priv->display), "configure_event",
                          G_CALLBACK (display_size_change), view);
        g_signal_connect (G_OBJECT (priv->display), "draw",
@@ -2117,9 +1984,6 @@ eog_scroll_view_init (EogScrollView *view)
        g_signal_connect (G_OBJECT (priv->display), "focus_out_event",
                          G_CALLBACK (eog_scroll_view_focus_out_event), NULL);
 
-       g_signal_connect (G_OBJECT (view), "key_press_event",
-                         G_CALLBACK (display_key_press_event), view);
-
        gtk_drag_source_set (priv->display, GDK_BUTTON1_MASK,
                             target_table, G_N_ELEMENTS (target_table),
                             GDK_ACTION_COPY | GDK_ACTION_MOVE |
diff --git a/src/eog-window.c b/src/eog-window.c
index 8536fc63..f9392f01 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -129,7 +129,7 @@ struct _EogWindowPrivate {
         GtkWidget           *box;
         GtkWidget           *layout;
         GtkWidget           *cbox;
-        GtkWidget           *scrollViewContainer;
+        GtkWidget           *scroll_view_container;
         GtkWidget           *view;
         GtkWidget           *sidebar;
         GtkWidget           *thumbview;
@@ -648,7 +648,9 @@ _eog_window_enable_image_actions (EogWindow *window, gboolean enable)
                "delete",
                "copy",
                "zoom-in",
+               "zoom-in-smooth",
                "zoom-out",
+               "zoom-out-smooth",
                "zoom-normal",
                NULL
        };
@@ -1015,9 +1017,7 @@ eog_window_display_image (EogWindow *window, EogImage *image)
                eog_window_set_message_area (window, info_bar);
        }
 
-       if (window->priv->mode == EOG_WINDOW_MODE_SLIDESHOW) {
-               slideshow_set_timeout (window);
-       }
+       slideshow_set_timeout (window);
 }
 
 static void
@@ -1634,6 +1634,8 @@ view_zoom_changed_cb (GtkWidget *widget, double zoom, gpointer user_data)
        EogWindow *window;
        GAction *action_zoom_in;
        GAction *action_zoom_out;
+       GAction *action_zoom_in_smooth;
+       GAction *action_zoom_out_smooth;
 
        g_return_if_fail (EOG_IS_WINDOW (user_data));
 
@@ -1644,15 +1646,25 @@ view_zoom_changed_cb (GtkWidget *widget, double zoom, gpointer user_data)
        action_zoom_in =
                g_action_map_lookup_action (G_ACTION_MAP (window),
                                             "zoom-in");
+       action_zoom_in_smooth =
+               g_action_map_lookup_action (G_ACTION_MAP (window),
+                                            "zoom-in-smooth");
 
        action_zoom_out =
                g_action_map_lookup_action (G_ACTION_MAP (window),
                                             "zoom-out");
+       action_zoom_out_smooth =
+               g_action_map_lookup_action (G_ACTION_MAP (window),
+                                            "zoom-out-smooth");
 
        g_simple_action_set_enabled (G_SIMPLE_ACTION (action_zoom_in),
                        !eog_scroll_view_get_zoom_is_max (EOG_SCROLL_VIEW (window->priv->view)));
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action_zoom_in_smooth),
+                       !eog_scroll_view_get_zoom_is_max (EOG_SCROLL_VIEW (window->priv->view)));
        g_simple_action_set_enabled (G_SIMPLE_ACTION (action_zoom_out),
                        !eog_scroll_view_get_zoom_is_min (EOG_SCROLL_VIEW (window->priv->view)));
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action_zoom_out_smooth),
+                       !eog_scroll_view_get_zoom_is_min (EOG_SCROLL_VIEW (window->priv->view)));
 }
 
 static void
@@ -3785,6 +3797,24 @@ eog_window_action_zoom_in (GSimpleAction *action,
        }
 }
 
+static void
+eog_window_action_zoom_in_smooth (GSimpleAction *action,
+                                  GVariant      *parameter,
+                                  gpointer       user_data)
+{
+       EogWindowPrivate *priv;
+
+       g_return_if_fail (EOG_IS_WINDOW (user_data));
+
+       eog_debug (DEBUG_WINDOW);
+
+       priv = EOG_WINDOW (user_data)->priv;
+
+       if (priv->view) {
+               eog_scroll_view_zoom_in (EOG_SCROLL_VIEW (priv->view), TRUE);
+       }
+}
+
 static void
 eog_window_action_zoom_out (GSimpleAction *action,
                            GVariant      *parameter,
@@ -3803,6 +3833,24 @@ eog_window_action_zoom_out (GSimpleAction *action,
        }
 }
 
+static void
+eog_window_action_zoom_out_smooth (GSimpleAction *action,
+                                   GVariant      *parameter,
+                                   gpointer       user_data)
+{
+       EogWindowPrivate *priv;
+
+       g_return_if_fail (EOG_IS_WINDOW (user_data));
+
+       eog_debug (DEBUG_WINDOW);
+
+       priv = EOG_WINDOW (user_data)->priv;
+
+       if (priv->view) {
+               eog_scroll_view_zoom_out (EOG_SCROLL_VIEW (priv->view), TRUE);
+       }
+}
+
 static void
 eog_window_action_zoom_normal (GSimpleAction *action,
                               GVariant      *variant,
@@ -3849,16 +3897,18 @@ eog_window_action_go_prev (GSimpleAction *action,
                            GVariant      *parameter,
                            gpointer       user_data)
 {
-       EogWindowPrivate *priv;
+       EogWindow *window;
 
        g_return_if_fail (EOG_IS_WINDOW (user_data));
 
        eog_debug (DEBUG_WINDOW);
 
-       priv = EOG_WINDOW (user_data)->priv;
+       window = EOG_WINDOW (user_data);
 
-       eog_thumb_view_select_single (EOG_THUMB_VIEW (priv->thumbview),
+       eog_thumb_view_select_single (EOG_THUMB_VIEW (window->priv->thumbview),
                                      EOG_THUMB_VIEW_SELECT_LEFT);
+
+       slideshow_set_timeout (window);
 }
 
 static void
@@ -3866,16 +3916,18 @@ eog_window_action_go_next (GSimpleAction *action,
                            GVariant      *parameter,
                            gpointer       user_data)
 {
-       EogWindowPrivate *priv;
+       EogWindow *window;
 
        g_return_if_fail (EOG_IS_WINDOW (user_data));
 
        eog_debug (DEBUG_WINDOW);
 
-       priv = EOG_WINDOW (user_data)->priv;
+       window = EOG_WINDOW (user_data);
 
-       eog_thumb_view_select_single (EOG_THUMB_VIEW (priv->thumbview),
+       eog_thumb_view_select_single (EOG_THUMB_VIEW (window->priv->thumbview),
                                      EOG_THUMB_VIEW_SELECT_RIGHT);
+
+       slideshow_set_timeout (window);
 }
 
 static void
@@ -3883,16 +3935,18 @@ eog_window_action_go_first (GSimpleAction *action,
                             GVariant      *parameter,
                             gpointer       user_data)
 {
-       EogWindowPrivate *priv;
+       EogWindow *window;
 
        g_return_if_fail (EOG_IS_WINDOW (user_data));
 
        eog_debug (DEBUG_WINDOW);
 
-       priv = EOG_WINDOW (user_data)->priv;
+       window = EOG_WINDOW (user_data);
 
-       eog_thumb_view_select_single (EOG_THUMB_VIEW (priv->thumbview),
+       eog_thumb_view_select_single (EOG_THUMB_VIEW (window->priv->thumbview),
                                      EOG_THUMB_VIEW_SELECT_FIRST);
+
+       slideshow_set_timeout (window);
 }
 
 static void
@@ -3900,16 +3954,18 @@ eog_window_action_go_last (GSimpleAction *action,
                            GVariant      *parameter,
                            gpointer       user_data)
 {
-       EogWindowPrivate *priv;
+       EogWindow *window;
 
        g_return_if_fail (EOG_IS_WINDOW (user_data));
 
        eog_debug (DEBUG_WINDOW);
 
-       priv = EOG_WINDOW (user_data)->priv;
+       window = EOG_WINDOW (user_data);
 
-       eog_thumb_view_select_single (EOG_THUMB_VIEW (priv->thumbview),
+       eog_thumb_view_select_single (EOG_THUMB_VIEW (window->priv->thumbview),
                                      EOG_THUMB_VIEW_SELECT_LAST);
+
+       slideshow_set_timeout (window);
 }
 
 static void
@@ -3917,16 +3973,18 @@ eog_window_action_go_random (GSimpleAction *action,
                              GVariant      *parameter,
                              gpointer       user_data)
 {
-       EogWindowPrivate *priv;
+       EogWindow *window;
 
        g_return_if_fail (EOG_IS_WINDOW (user_data));
 
        eog_debug (DEBUG_WINDOW);
 
-       priv = EOG_WINDOW (user_data)->priv;
+       window = EOG_WINDOW (user_data);
 
-       eog_thumb_view_select_single (EOG_THUMB_VIEW (priv->thumbview),
+       eog_thumb_view_select_single (EOG_THUMB_VIEW (window->priv->thumbview),
                                      EOG_THUMB_VIEW_SELECT_RANDOM);
+
+       slideshow_set_timeout (window);
 }
 
 static void
@@ -3992,7 +4050,9 @@ static const GActionEntry window_actions[] = {
        { "copy",            eog_window_action_copy_image },
        { "undo",            eog_window_action_undo },
        { "zoom-in",         eog_window_action_zoom_in },
+       { "zoom-in-smooth",  eog_window_action_zoom_in_smooth },
        { "zoom-out",        eog_window_action_zoom_out },
+       { "zoom-out-smooth", eog_window_action_zoom_out_smooth },
        { "zoom-normal",     eog_window_action_zoom_normal },
        { "zoom-set",        eog_window_action_set_zoom, "d" },
 
@@ -4346,9 +4406,9 @@ eog_window_construct_ui (EogWindow *window)
                          G_CALLBACK (eog_window_view_previous_image_cb),
                          window);
 
-       priv->scrollViewContainer = gtk_scrolled_window_new(NULL, NULL);
-       gtk_container_add (GTK_CONTAINER(priv->scrollViewContainer), priv->view);
-       gtk_container_add (GTK_CONTAINER(priv->overlay), priv->scrollViewContainer);
+       priv->scroll_view_container = gtk_scrolled_window_new(NULL, NULL);
+       gtk_container_add (GTK_CONTAINER(priv->scroll_view_container), priv->view);
+       gtk_container_add (GTK_CONTAINER(priv->overlay), priv->scroll_view_container);
 
        eog_sidebar_add_page (EOG_SIDEBAR (priv->sidebar),
                              _("Properties"),
@@ -4699,17 +4759,10 @@ eog_window_delete (GtkWidget *widget, GdkEventAny *event)
 static gint
 eog_window_key_press (GtkWidget *widget, GdkEventKey *event)
 {
-       static gpointer grand_parent_class = NULL;
-
        gint result = FALSE;
        gboolean handle_selection = FALSE;
        GdkModifierType modifiers;
 
-       if (grand_parent_class == NULL)
-       {
-               grand_parent_class = g_type_class_peek_parent (eog_window_parent_class);
-       }
-
        /* handle focus widget key events */
        if (!handle_selection) {
                handle_selection = gtk_window_propagate_key_event (GTK_WINDOW (widget), event);
@@ -4720,17 +4773,7 @@ eog_window_key_press (GtkWidget *widget, GdkEventKey *event)
                handle_selection = gtk_window_activate_key (GTK_WINDOW (widget), event);
        }
 
-       /* This part is disabled for now as it overrides the arrow key handlers
-        * below which are still needed in RTL scenarios */
-#if 0
-       /* Chain up, invokes binding set on window */
-       if (!handle_selection) {
-               handle_selection = GTK_WIDGET_CLASS (grand_parent_class)->key_press_event (widget, event);
-       }
-#endif
-
-       /* If the workaround already handled the key event return early */
-       if(handle_selection)
+       if (handle_selection)
                return TRUE;
 
        modifiers = gtk_accelerator_get_default_mod_mask ();
@@ -4742,20 +4785,6 @@ eog_window_key_press (GtkWidget *widget, GdkEventKey *event)
                        handle_selection = TRUE;
                        break;
                }
-       case GDK_KEY_Return:
-               /* Image properties dialog case */
-               if ((event->state & modifiers) == GDK_MOD1_MASK) {
-                       result = FALSE;
-                       break;
-               }
-
-               if ((event->state & modifiers) == GDK_SHIFT_MASK) {
-                       eog_window_action_go_prev (NULL, NULL, EOG_WINDOW (widget));
-               } else {
-                       eog_window_action_go_next (NULL, NULL, EOG_WINDOW (widget));
-               }
-               result = TRUE;
-               break;
 #endif
        case GDK_KEY_Escape:
                if (EOG_WINDOW (widget)->priv->mode == EOG_WINDOW_MODE_FULLSCREEN) {
@@ -4764,32 +4793,8 @@ eog_window_key_press (GtkWidget *widget, GdkEventKey *event)
                        eog_window_stop_fullscreen (EOG_WINDOW (widget), TRUE);
                } else {
                        eog_window_action_close_window (NULL, NULL, EOG_WINDOW (widget));
-                       return TRUE;
-               }
-               break;
-       case GDK_KEY_Left:
-       /* case GDK_KEY_Up: */
-               if ((event->state & modifiers) == 0) {
-                       /* Left and Up move to previous image */
-                       if (is_rtl) { /* move to next in RTL mode */
-                               eog_window_action_go_next (NULL, NULL, EOG_WINDOW (widget));
-                       } else {
-                               eog_window_action_go_prev (NULL, NULL, EOG_WINDOW (widget));
-                       }
-                       result = TRUE;
-               }
-               break;
-       case GDK_KEY_Right:
-       /* case GDK_KEY_Down: */
-               if ((event->state & modifiers) == 0) {
-                       /* Right and Down move to next image */
-                       if (is_rtl) { /* move to previous in RTL mode */
-                               eog_window_action_go_prev (NULL, NULL, EOG_WINDOW (widget));
-                       } else {
-                               eog_window_action_go_next (NULL, NULL, EOG_WINDOW (widget));
-                       }
-                       result = TRUE;
                }
+               return TRUE;
                break;
        case GDK_KEY_Page_Up:
                if ((event->state & modifiers) == 0) {
@@ -4821,27 +4826,22 @@ eog_window_key_press (GtkWidget *widget, GdkEventKey *event)
                break;
        }
 
-       /* Update slideshow timeout */
-       if (result && (EOG_WINDOW (widget)->priv->mode == EOG_WINDOW_MODE_SLIDESHOW)) {
-               slideshow_set_timeout (EOG_WINDOW (widget));
-       }
-
-       if (handle_selection == TRUE && result == FALSE) {
+       if (handle_selection && !result) {
                gtk_widget_grab_focus (GTK_WIDGET (EOG_WINDOW (widget)->priv->thumbview));
 
                result = gtk_widget_event (GTK_WIDGET (EOG_WINDOW (widget)->priv->thumbview),
                                           (GdkEvent *) event);
        }
 
-       /* If we still haven't handled the event, give the scrollview a chance to do it.  */
-       if (result == FALSE &&
-               gtk_widget_get_realized (GTK_WIDGET (EOG_WINDOW (widget)->priv->view))) {
-                       result = gtk_widget_event (GTK_WIDGET (EOG_WINDOW (widget)->priv->view),
+       /* If we still haven't handled the event, give the scrolled window a chance to do it.  */
+       if (!result &&
+               gtk_widget_get_realized (GTK_WIDGET (EOG_WINDOW (widget)->priv->scroll_view_container))) {
+                       result = gtk_widget_event (GTK_WIDGET (EOG_WINDOW 
(widget)->priv->scroll_view_container),
                                                   (GdkEvent *) event);
        }
 
-       if (result == FALSE && GTK_WIDGET_CLASS (eog_window_parent_class)->key_press_event) {
-               result = (* GTK_WIDGET_CLASS (eog_window_parent_class)->key_press_event) (widget, event);
+       if (!result && GTK_WIDGET_CLASS (eog_window_parent_class)->key_press_event) {
+               result = GTK_WIDGET_CLASS (eog_window_parent_class)->key_press_event (widget, event);
        }
 
        return result;


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