diff options
author | Owen Taylor <otaylor@redhat.com> | 2004-03-01 16:07:45 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2004-03-01 16:07:45 +0000 |
commit | 8130a8a227f891d0d3aab433c7b19ccaf51e5fa7 (patch) | |
tree | 48c76c69ac87b41ab48ff08a64b970a40f90d44f /gtk/gtktextview.c | |
parent | f0d22047c3126ab2c420dc084b4caaa82a0bd324 (diff) | |
download | gdk-pixbuf-8130a8a227f891d0d3aab433c7b19ccaf51e5fa7.tar.gz |
Patch from Dov Grobgeld to implement auto-bidi-direction for GtkTextView
Mon Mar 1 10:41:27 2004 Owen Taylor <otaylor@redhat.com>
Patch from Dov Grobgeld to implement auto-bidi-direction
for GtkTextView (#118543)
* gtk/gtktextbtree.[ch]: Resolve bidi base direction
for each line by propagating backwards/forwards as
necessary.
* gtk/gtktextlayout.[ch] gtk/gtktextview.c: Set the
bidi base direction for the ;ine with the cursor from
the keyboard direction. Add gtk_text_layout_set_keyboard_direction().
Mon Mar 1 10:31:11 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.[ch]: Implement auto-bidi-direction,
based on a patch from Dov Grobgeld. (#118540)
Diffstat (limited to 'gtk/gtktextview.c')
-rw-r--r-- | gtk/gtktextview.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 5238aa71f..dbb4e2ffc 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -5620,26 +5620,28 @@ gtk_text_view_check_keymap_direction (GtkTextView *text_view) { if (text_view->layout) { - gboolean split_cursor; - GtkTextDirection new_dir; GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (text_view)); - + GdkKeymap *keymap = gdk_keymap_get_for_display (gtk_widget_get_display (GTK_WIDGET (text_view))); + GtkTextDirection new_cursor_dir; + GtkTextDirection new_keyboard_dir; + gboolean split_cursor; + g_object_get (settings, "gtk-split-cursor", &split_cursor, NULL); + + if (gdk_keymap_get_direction (keymap) == PANGO_DIRECTION_LTR) + new_keyboard_dir = GTK_TEXT_DIR_LTR; + else + new_keyboard_dir = GTK_TEXT_DIR_RTL; + if (split_cursor) - { - new_dir = GTK_TEXT_DIR_NONE; - } + new_cursor_dir = GTK_TEXT_DIR_NONE; else - { - GdkKeymap *keymap = gdk_keymap_get_for_display (gtk_widget_get_display (GTK_WIDGET (text_view))); - new_dir = (gdk_keymap_get_direction (keymap) == PANGO_DIRECTION_LTR) ? - GTK_TEXT_DIR_LTR : GTK_TEXT_DIR_RTL; - } + new_cursor_dir = new_keyboard_dir; - if (text_view->layout->cursor_direction != new_dir) - gtk_text_layout_set_cursor_direction (text_view->layout, new_dir); + gtk_text_layout_set_cursor_direction (text_view->layout, new_cursor_dir); + gtk_text_layout_set_keyboard_direction (text_view->layout, new_keyboard_dir); } } |