[gtk+/gtk-2-24] Entry—Fix inverted movements by arrow keys in RTL



commit f7da9dba1d9d38e8fc02a027abf10be98bb7451f
Author: Daniel Boles <dboles src gnome org>
Date:   Sat Feb 18 22:50:00 2017 +0000

    Entry—Fix inverted movements by arrow keys in RTL
    
    Using Ctrl + left/right to skip between words, or left/right to cancel a
    selection, were causing movement on the screen in the opposite direction
    of the glyph on the key. This was surprising and awful UX for RTL users.
    
    This is based on a patch covering the former case by:
    Author:    Ori Avtalion <ori avtalion name>
    Date:      Tue Apr 20 08:06:23 2010 +0000
    
    https://bugzilla.gnome.org/show_bug.cgi?id=136059

 gtk/gtkentry.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index bc33754..e9cc564 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -4776,8 +4776,11 @@ gtk_entry_move_cursor (GtkEntry       *entry,
              new_pos = current_x > bound_x ? entry->current_pos : entry->selection_bound;
            break;
          }
-       case GTK_MOVEMENT_LOGICAL_POSITIONS:
        case GTK_MOVEMENT_WORDS:
+          if (priv->resolved_dir == PANGO_DIRECTION_RTL)
+            count *= -1;
+          /* Fall through */
+       case GTK_MOVEMENT_LOGICAL_POSITIONS:
          if (count < 0)
            new_pos = MIN (entry->current_pos, entry->selection_bound);
          else
@@ -4828,6 +4831,8 @@ gtk_entry_move_cursor (GtkEntry       *entry,
             }
          break;
        case GTK_MOVEMENT_WORDS:
+          if (priv->resolved_dir == PANGO_DIRECTION_RTL)
+            count *= -1;
          while (count > 0)
            {
              new_pos = gtk_entry_move_forward_word (entry, new_pos, FALSE);


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