Hello,
I found the bug that "cursor,changed" signal is not emitted when the content
of entry is removed.
Let's assume the cursor position is equal to 10.
In this situation, elm_entry_entry_set(en, "") is called.
The content of entry is removed and the cursor position is equal to 0, but
"cursor,changed" signal is not emitted.
This patch is for solving this problem.
In addition, it lets the input method module know the cursor position using
ecore_imf_context_cursor_position_set API
in case that _edje_entry_set_cursor_{start, end} is called.
Would you please review this patch?
Index: edje_entry.c
===================================================================
--- edje_entry.c (revision 58830)
+++ edje_entry.c (working copy)
@@ -2034,14 +2034,19 @@ _edje_entry_text_get(Edje_Real_Part *rp)
void
_edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text)
{
+ int old_cur_pos;
Entry *en = rp->entry_data;
if (!en) return;
+ old_cur_pos = evas_textblock_cursor_pos_get(en->cursor);
+
// set text as markup
_sel_clear(en->cursor, rp->object, en);
evas_object_textblock_text_markup_set(rp->object, text);
_anchors_get(en->cursor, rp->object, en);
_edje_emit(rp->edje, "entry,changed", rp->part->name);
+ if (old_cur_pos != evas_textblock_cursor_pos_get(en->cursor))
+ _edje_emit(rp->edje, "cursor,changed", rp->part->name);
_edje_entry_set_cursor_start(rp);
}
@@ -2079,6 +2084,11 @@ _edje_entry_set_cursor_start(Edje_Real_Part *rp)
Entry *en = rp->entry_data;
if (!en) return;
_curs_start(en->cursor, rp->object, en);
+
+#ifdef HAVE_ECORE_IMF
+ if (en->imf_context)
+ ecore_imf_context_cursor_position_set(en->imf_context, 0);
+#endif
}
void
@@ -2087,6 +2097,12 @@ _edje_entry_set_cursor_end(Edje_Real_Part *rp)
Entry *en = rp->entry_data;
if (!en) return;
_curs_end(en->cursor, rp->object, en);
+
+#ifdef HAVE_ECORE_IMF
+ if (en->imf_context)
+ ecore_imf_context_cursor_position_set(en->imf_context,
+ evas_textblock_cursor_pos_get(en->cursor));
+#endif
}
void
------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been
demonstrated beyond question. Learn why your peers are replacing JEE
containers with lightweight application servers - and what you can gain
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel