summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJehan <jehan@girinstud.io>2022-04-09 22:13:46 +0200
committerJehan <jehan@girinstud.io>2022-04-09 22:40:58 +0200
commit6e93974eb0d5397c7a6a97a631cff07066032741 (patch)
tree89dab1d0377d7defd15702c1616ccb50201a2981
parenta47f81804deb6f2d6dbfcac29b44f77ea17186f4 (diff)
downloadgtk+-wip/Jehan/gimp-issue-7944-broken-gtk-entry-in-rtl.tar.gz
gtk: text direction in GtkEntry does not properly follow widget…wip/Jehan/gimp-issue-7944-broken-gtk-entry-in-rtl
… 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.
-rw-r--r--gtk/gtkentry.c18
1 files 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);