From: Jihoon Kim <imfine98@gmail.com>
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 25 Apr 2011 05:36:58 +0000 (05:36 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 25 Apr 2011 05:36:58 +0000 (05:36 +0000)
Subject: [E-devel] [PATCH] bug fix in : "cursor, changed" signal is
not emitted when the content of entry is removed

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.

(Raster: actually it should always emit changed. not check pos at all.
technically pos could be the same BUT cursor moved on screen due to a
reformat). :)

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@58886 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/edje_entry.c

index e92475e..474f516 100644 (file)
@@ -2036,12 +2036,14 @@ _edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text)
 {
    Entry *en = rp->entry_data;
    if (!en) return;
+
    // 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);
+   _edje_emit(rp->edje, "cursor,changed", rp->part->name);
    _edje_entry_set_cursor_start(rp);
 }
 
@@ -2079,6 +2081,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 +2094,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