[gtk/wip/Jehan/gimp-issue-7944-broken-gtk-entry-in-rtl] gtk: text direction in GtkEntry does not properly follow widget…




commit 6e93974eb0d5397c7a6a97a631cff07066032741
Author: Jehan <jehan girinstud io>
Date:   Sat Apr 9 22:13:46 2022 +0200

    gtk: text direction in GtkEntry does not properly follow widget…
    
    … direction with neutral contents when the widget is focused.
    
    The code was introduced in commit f0d22047c31 to handle bidirectional
    text. It is mostly ok except in the focus case when text direction is
    suddenly bypassed. This provokes weird "jumping" text behavior as well
    as unexpected positionning despite explicit RTL direction.

 gtk/gtkentry.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 864c217408..263119107d 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -6402,22 +6402,10 @@ gtk_entry_create_layout (GtkEntry *entry,
 
       if (pango_dir == PANGO_DIRECTION_NEUTRAL)
         {
-          if (gtk_widget_has_focus (widget))
-           {
-             GdkDisplay *display = gtk_widget_get_display (widget);
-             GdkKeymap *keymap = gdk_keymap_get_for_display (display);
-             if (gdk_keymap_get_direction (keymap) == PANGO_DIRECTION_RTL)
-               pango_dir = PANGO_DIRECTION_RTL;
-             else
-               pango_dir = PANGO_DIRECTION_LTR;
-           }
+          if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+            pango_dir = PANGO_DIRECTION_RTL;
           else
-           {
-             if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
-               pango_dir = PANGO_DIRECTION_RTL;
-             else
-               pango_dir = PANGO_DIRECTION_LTR;
-           }
+            pango_dir = PANGO_DIRECTION_LTR;
         }
 
       pango_context_set_base_dir (gtk_widget_get_pango_context (widget), pango_dir);


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