[eog/gnome-3-34] EogScrollView: Fix image selection in RTL locales



commit 2a331f3ea99bd5419d7efe78412c4d966b19cbe3
Author: Felix Riemann <friemann gnome org>
Date:   Sun Dec 1 18:55:57 2019 +0000

    EogScrollView: Fix image selection in RTL locales
    
    Previously it would always select the next image while it should
    simply mirror the image selection in LTR mode.
    
    Fixes #93.
    
    
    (cherry picked from commit f6fadb87bf476f803ce3b33782e1cfb5a08939e3)

 src/eog-scroll-view.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/eog-scroll-view.c b/src/eog-scroll-view.c
index 454b904e..9eb4da85 100644
--- a/src/eog-scroll-view.c
+++ b/src/eog-scroll-view.c
@@ -1497,6 +1497,7 @@ pan_gesture_pan_cb (GtkGesturePan   *gesture,
                     EogScrollView   *view)
 {
        EogScrollViewPrivate *priv;
+       const gboolean is_rtl = gtk_widget_get_direction (GTK_WIDGET (view)) == GTK_TEXT_DIR_RTL;
 
        if (eog_scroll_view_scrollbars_visible (view)) {
                gtk_gesture_set_state (GTK_GESTURE (gesture),
@@ -1511,11 +1512,13 @@ pan_gesture_pan_cb (GtkGesturePan   *gesture,
        gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
 
        if (offset > PAN_ACTION_DISTANCE) {
-               if (direction == GTK_PAN_DIRECTION_LEFT ||
-                   gtk_widget_get_direction (GTK_WIDGET (view)) == GTK_TEXT_DIR_RTL)
-                       priv->pan_action = EOG_PAN_ACTION_NEXT;
+               if (direction == GTK_PAN_DIRECTION_LEFT)
+                       priv->pan_action = is_rtl ? EOG_PAN_ACTION_PREV
+                                                 : EOG_PAN_ACTION_NEXT;
                else
-                       priv->pan_action = EOG_PAN_ACTION_PREV;
+                       priv->pan_action = is_rtl ? EOG_PAN_ACTION_NEXT
+                                                 : EOG_PAN_ACTION_PREV;
+
        }
 #undef PAN_ACTION_DISTANCE
 }


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