diff options
author | Li Yuan <li.yuan@sun.com> | 2008-06-06 03:13:48 +0000 |
---|---|---|
committer | Li Yuan <liyuan@src.gnome.org> | 2008-06-06 03:13:48 +0000 |
commit | 277d1744f6bacf2500bd5e05ce636221c803658e (patch) | |
tree | 9826cd912ce667bf4055f92032e940c465d7d4d2 /modules | |
parent | 92c24e41b9cffc41a94be589f659b2af23bcc7ae (diff) | |
download | gtk+-277d1744f6bacf2500bd5e05ce636221c803658e.tar.gz |
Before emitting "text_caret_moved", change the cursor to the changed
2008-06-06 Li Yuan <li.yuan@sun.com>
* gail/gaillabel.c: (gail_label_real_notify_gtk):
Before emitting "text_caret_moved", change the cursor to the
changed bound. Bug #536927.
svn path=/trunk/; revision=20322
Diffstat (limited to 'modules')
-rw-r--r-- | modules/other/gail/ChangeLog | 6 | ||||
-rw-r--r-- | modules/other/gail/gaillabel.c | 34 |
2 files changed, 31 insertions, 9 deletions
diff --git a/modules/other/gail/ChangeLog b/modules/other/gail/ChangeLog index a4a6536347..3944f975e8 100644 --- a/modules/other/gail/ChangeLog +++ b/modules/other/gail/ChangeLog @@ -1,3 +1,9 @@ +2008-06-06 Li Yuan <li.yuan@sun.com> + + * gail/gaillabel.c: (gail_label_real_notify_gtk): + Before emitting "text_caret_moved", change the cursor to the + changed bound. Bug #536927. + 2008-05-30 Michael Natterer <mitch@imendio.com> * gailcellparent.h diff --git a/modules/other/gail/gaillabel.c b/modules/other/gail/gaillabel.c index a54d637c4e..3003b52ae5 100644 --- a/modules/other/gail/gaillabel.c +++ b/modules/other/gail/gaillabel.c @@ -325,23 +325,35 @@ gail_label_real_notify_gtk (GObject *obj, } else if (strcmp (pspec->name, "cursor-position") == 0) { - gint start, end; + gint start, end, tmp; gboolean text_caret_moved = FALSE; gboolean selection_changed = FALSE; - gboolean is_start = TRUE; gail_obj = G_OBJECT (atk_obj); label = GTK_LABEL (widget); + if (gail_label->selection_bound != -1 && gail_label->selection_bound < gail_label->cursor_position) + { + tmp = gail_label->selection_bound; + gail_label->selection_bound = gail_label->cursor_position; + gail_label->cursor_position = tmp; + } + if (gtk_label_get_selection_bounds (label, &start, &end)) { if (start != gail_label->cursor_position || end != gail_label->selection_bound) { if (end != gail_label->selection_bound) - is_start = FALSE; - gail_label->selection_bound = end; - gail_label->cursor_position = start; + { + gail_label->selection_bound = start; + gail_label->cursor_position = end; + } + else + { + gail_label->selection_bound = end; + gail_label->cursor_position = start; + } text_caret_moved = TRUE; if (start != end) selection_changed = TRUE; @@ -358,10 +370,14 @@ gail_label_real_notify_gtk (GObject *obj, if (gail_label->selection_bound != -1 && end != gail_label->selection_bound) { text_caret_moved = TRUE; - is_start = FALSE; + gail_label->cursor_position = end; + gail_label->selection_bound = start; + } + else + { + gail_label->cursor_position = start; + gail_label->selection_bound = end; } - gail_label->cursor_position = start; - gail_label->selection_bound = end; } else { @@ -375,7 +391,7 @@ gail_label_real_notify_gtk (GObject *obj, } if (text_caret_moved) g_signal_emit_by_name (gail_obj, "text_caret_moved", - is_start ? gail_label->cursor_position : gail_label->selection_bound); + gail_label->cursor_position); if (selection_changed) g_signal_emit_by_name (gail_obj, "text_selection_changed"); |