add edje_object_part_text_imf_context_reset that will use for reseting the input method context

SVN revision: 67881
This commit is contained in:
Jihoon Kim 2012-02-13 11:40:55 +00:00
parent 0c74d1c82d
commit e1668198af
5 changed files with 57 additions and 28 deletions

View File

@ -336,4 +336,6 @@
2012-02-13 Jihoon Kim
* add edje_object_part_text_input_panel_show/hide.
These APIs can be used in input panel manual control mode
These APIs can be used in input panel manual control mode
* add edje_object_part_text_imf_context_reset that will use
for reseting the input method context

View File

@ -2840,6 +2840,17 @@ EAPI void edje_object_part_text_cursor_pos_set (Evas_Ob
*/
EAPI int edje_object_part_text_cursor_pos_get (const Evas_Object *obj, const char *part, Edje_Cursor cur);
/**
* @brief Reset the input method context if needed.
*
* This can be necessary in the case where modifying the buffer would confuse on-going input method behavior
*
* @param obj A valid Evas_Object handle
* @param part The part name
* @since 1.2.0
*/
EAPI void edje_object_part_text_imf_context_reset (const Evas_Object *obj, const char *part);
/**
* @brief Set the layout of the input panel.
*

View File

@ -12,7 +12,6 @@ typedef struct _Sel Sel;
typedef struct _Anchor Anchor;
static void _edje_entry_imf_cursor_info_set(Entry *en);
static void _edje_entry_imf_context_reset(Entry *en);
struct _Entry
{
@ -472,7 +471,7 @@ static void
_sel_extend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
{
if (!en->sel_end) return;
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(en->rp);
_sel_enable(c, o, en);
if (!evas_textblock_cursor_compare(c, en->sel_end)) return;
evas_textblock_cursor_copy(c, en->sel_end);
@ -488,7 +487,7 @@ static void
_sel_preextend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
{
if (!en->sel_end) return;
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(en->rp);
_sel_enable(c, o, en);
if (!evas_textblock_cursor_compare(c, en->sel_start)) return;
evas_textblock_cursor_copy(c, en->sel_start);
@ -1166,7 +1165,7 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
if ((!strcmp(ev->key, "Escape")) ||
(!strcmp(ev->key, "Return")) || (!strcmp(ev->key, "KP_Enter")))
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
old_cur_pos = evas_textblock_cursor_pos_get(en->cursor);
@ -1655,7 +1654,7 @@ _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS
}
#endif
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
en->select_mod_start = EINA_FALSE;
en->select_mod_end = EINA_FALSE;
@ -1816,7 +1815,7 @@ _edje_part_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED
}
#endif
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
tc = evas_object_textblock_cursor_new(rp->object);
evas_textblock_cursor_copy(en->cursor, tc);
@ -1986,7 +1985,7 @@ _edje_part_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS
}
evas_textblock_cursor_free(tc);
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
_edje_entry_imf_cursor_info_set(en);
_edje_entry_real_part_configure(rp);
@ -2272,7 +2271,7 @@ _edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text)
{
Entry *en = rp->entry_data;
if (!en) return;
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
// set text as markup
_sel_clear(en->cursor, rp->object, en);
evas_object_textblock_text_markup_set(rp->object, text);
@ -2311,7 +2310,7 @@ _edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text)
{
Entry *en = rp->entry_data;
if (!en) return;
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
// prepend markup @ cursor pos
if (en->have_selection)
@ -2362,7 +2361,7 @@ _edje_entry_select_all(Edje_Real_Part *rp)
Entry *en = rp->entry_data;
if (!en) return;
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
_sel_clear(en->cursor, rp->object, en);
_curs_start(en->cursor, rp->object, en);
@ -2381,7 +2380,7 @@ _edje_entry_select_begin(Edje_Real_Part *rp)
Entry *en = rp->entry_data;
if (!en) return;
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
_sel_clear(en->cursor, rp->object, en);
_sel_enable(en->cursor, rp->object, en);
@ -2398,7 +2397,7 @@ _edje_entry_select_extend(Edje_Real_Part *rp)
{
Entry *en = rp->entry_data;
if (!en) return;
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
_sel_extend(en->cursor, rp->object, en);
_edje_entry_imf_cursor_info_set(en);
@ -2543,7 +2542,7 @@ _edje_entry_select_abort(Edje_Real_Part *rp)
{
en->selecting = EINA_FALSE;
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
_edje_entry_imf_cursor_info_set(en);
_edje_entry_real_part_configure(rp);
}
@ -2667,7 +2666,7 @@ _edje_entry_cursor_next(Edje_Real_Part *rp, Edje_Cursor cur)
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
if (!c) return EINA_FALSE;
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
if (!evas_textblock_cursor_char_next(c))
{
@ -2688,7 +2687,7 @@ _edje_entry_cursor_prev(Edje_Real_Part *rp, Edje_Cursor cur)
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
if (!c) return EINA_FALSE;
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
if (!evas_textblock_cursor_char_prev(c))
{
@ -2714,7 +2713,7 @@ _edje_entry_cursor_up(Edje_Real_Part *rp, Edje_Cursor cur)
int ln;
if (!c) return EINA_FALSE;
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL);
ln--;
@ -2748,7 +2747,7 @@ _edje_entry_cursor_down(Edje_Real_Part *rp, Edje_Cursor cur)
int ln;
if (!c) return EINA_FALSE;
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL);
ln++;
@ -2778,7 +2777,7 @@ _edje_entry_cursor_begin(Edje_Real_Part *rp, Edje_Cursor cur)
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
if (!c) return;
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
evas_textblock_cursor_paragraph_first(c);
_sel_update(c, rp->object, rp->entry_data);
@ -2795,7 +2794,7 @@ _edje_entry_cursor_end(Edje_Real_Part *rp, Edje_Cursor cur)
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
if (!c) return;
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
_curs_end(c, rp->object, rp->entry_data);
_sel_update(c, rp->object, rp->entry_data);
@ -2820,7 +2819,7 @@ _edje_entry_cursor_copy(Edje_Real_Part *rp, Edje_Cursor cur, Edje_Cursor dst)
evas_textblock_cursor_copy(c, d);
_sel_update(c, rp->object, rp->entry_data);
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
_edje_entry_imf_cursor_info_set(en);
_edje_emit(rp->edje, "cursor,changed", rp->part->name);
_edje_entry_real_part_configure(rp);
@ -2832,7 +2831,7 @@ _edje_entry_cursor_line_begin(Edje_Real_Part *rp, Edje_Cursor cur)
Entry *en = rp->entry_data;
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
if (!c) return;
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
evas_textblock_cursor_line_char_first(c);
_sel_update(c, rp->object, rp->entry_data);
@ -2849,7 +2848,7 @@ _edje_entry_cursor_line_end(Edje_Real_Part *rp, Edje_Cursor cur)
Entry *en = rp->entry_data;
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
if (!c) return;
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
evas_textblock_cursor_line_char_last(c);
_sel_update(c, rp->object, rp->entry_data);
@ -2911,7 +2910,7 @@ _edje_entry_cursor_pos_set(Edje_Real_Part *rp, Edje_Cursor cur, int pos)
if (evas_textblock_cursor_pos_get(c) == pos)
return;
_edje_entry_imf_context_reset(en);
_edje_entry_imf_context_reset(rp);
evas_textblock_cursor_pos_set(c, pos);
_sel_update(c, rp->object, rp->entry_data);
@ -2954,14 +2953,14 @@ _edje_entry_input_panel_layout_get(Edje_Real_Part *rp)
return EDJE_INPUT_PANEL_LAYOUT_INVALID;
}
static void
_edje_entry_imf_context_reset(Entry *en)
void
_edje_entry_imf_context_reset(Edje_Real_Part *rp)
{
Entry *en = rp->entry_data;
if (!en) return;
#ifdef HAVE_ECORE_IMF
if (en->imf_context)
ecore_imf_context_reset(en->imf_context);
#else
(void) en;
#endif
}

View File

@ -1939,6 +1939,7 @@ Eina_Bool _edje_entry_cursor_is_visible_format_get(Edje_Real_Part *rp, Edje_Curs
char *_edje_entry_cursor_content_get(Edje_Real_Part *rp, Edje_Cursor cur);
void _edje_entry_cursor_pos_set(Edje_Real_Part *rp, Edje_Cursor cur, int pos);
int _edje_entry_cursor_pos_get(Edje_Real_Part *rp, Edje_Cursor cur);
void _edje_entry_imf_context_reset(Edje_Real_Part *rp);
void _edje_entry_input_panel_layout_set(Edje_Real_Part *rp, Edje_Input_Panel_Layout layout);
Edje_Input_Panel_Layout _edje_entry_input_panel_layout_get(Edje_Real_Part *rp);
void _edje_entry_autocapital_type_set(Edje_Real_Part *rp, Edje_Text_Autocapital_Type autocapital_type);

View File

@ -1777,6 +1777,22 @@ edje_object_part_text_cursor_pos_get(const Evas_Object *obj, const char *part, E
return 0;
}
EAPI void
edje_object_part_text_imf_context_reset(const Evas_Object *obj, const char *part)
{
Edje *ed;
Edje_Real_Part *rp;
ed = _edje_fetch(obj);
if ((!ed) || (!part)) return;
rp = _edje_real_part_recursive_get(ed, part);
if (!rp) return;
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
{
_edje_entry_imf_context_reset(rp);
}
}
EAPI void
edje_object_part_text_input_panel_layout_set(const Evas_Object *obj, const char *part, Edje_Input_Panel_Layout layout)
{