From: Jihoon Kim <jihoon48.kim@samsung.com>

Subject: [E-devel] [PATCH] e17: notify immodule to know the cursor
location

In immodule, the cursor location is needed to move the candidate word window.
In this patch, calling ecore_imf_context_cursor_location_set in e_entry.c
lets immodule know the cursor location. This patch is similar to
http://www.mail-archive.com/enlightenment-devel@lists.sourceforge.net/msg338
89.html, but it is for e17 entry.

oh definitely! that helps.. it works well too! thanks! in svn



SVN revision: 62676
This commit is contained in:
Jihoon Kim 2011-08-22 05:18:03 +00:00 committed by Carsten Haitzler
parent 715ce20226
commit d1a0f6f8a0
3 changed files with 77 additions and 40 deletions

View File

@ -399,6 +399,26 @@ e_editable_cursor_pos_get(Evas_Object *editable)
return sd->cursor_pos;
}
/**
* Gets the geometry of the cursor of the editable object
*
* @param editable an editable object
* @param cx the x of the cursor
* @param cy the y of the cursor
* @param cw the width of the cursor
* @param ch the height of the cursor
*/
EAPI void
e_editable_cursor_geometry_get(Evas_Object *editable, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
{
E_Editable_Smart_Data *sd;
if ((!editable) || (!(sd = evas_object_smart_data_get(editable))))
return;
evas_object_geometry_get(sd->cursor_object, cx, cy, cw, ch);
}
/**
* Moves the cursor to the start of the editable object
*

View File

@ -17,6 +17,7 @@ EAPI int e_editable_delete (Evas_Object *editable, int
EAPI void e_editable_cursor_pos_set (Evas_Object *editable, int pos);
EAPI int e_editable_cursor_pos_get (Evas_Object *editable);
EAPI void e_editable_cursor_geometry_get (Evas_Object *editable, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
EAPI void e_editable_cursor_move_to_start (Evas_Object *editable);
EAPI void e_editable_cursor_move_to_end (Evas_Object *editable);
EAPI void e_editable_cursor_move_left (Evas_Object *editable);

View File

@ -59,6 +59,8 @@ static void _e_entry_cb_copy(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_entry_cb_paste(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_entry_cb_select_all(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_entry_cb_delete(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_entry_imf_cursor_info_set(Evas_Object *object);
static void _e_entry_imf_context_reset(Evas_Object *object);
#ifdef HAVE_ECORE_IMF
static Eina_Bool _e_entry_cb_imf_retrieve_surrounding(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos);
static Eina_Bool _e_entry_cb_imf_event_commit(void *data, int type, void *event);
@ -244,14 +246,10 @@ e_entry_focus(Evas_Object *entry)
if (!sd->selection_dragging)
{
e_editable_cursor_move_to_end(sd->editable_object);
#ifdef HAVE_ECORE_IMF
if (sd->imf_context)
{
ecore_imf_context_reset(sd->imf_context);
ecore_imf_context_cursor_position_set(sd->imf_context,
e_editable_cursor_pos_get(sd->editable_object));
}
#endif
_e_entry_imf_context_reset(entry);
_e_entry_imf_cursor_info_set(entry);
e_editable_selection_move_to_end(sd->editable_object);
}
if (sd->enabled)
@ -541,14 +539,8 @@ _e_entry_mouse_down_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o
E_MENU_POP_DIRECTION_DOWN, event->timestamp);
}
#ifdef HAVE_ECORE_IMF
if (sd->imf_context)
{
ecore_imf_context_reset(sd->imf_context);
ecore_imf_context_cursor_position_set(sd->imf_context,
e_editable_cursor_pos_get(sd->editable_object));
}
#endif
_e_entry_imf_context_reset(obj);
_e_entry_imf_cursor_info_set(obj);
}
/* Called when the entry object is released by the mouse */
@ -614,14 +606,9 @@ _e_entry_mouse_move_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o
event->cur.canvas.x - ox,
event->cur.canvas.y - oy);
e_editable_cursor_pos_set(sd->editable_object, pos);
#ifdef HAVE_ECORE_IMF
if (sd->imf_context)
{
ecore_imf_context_reset(sd->imf_context);
ecore_imf_context_cursor_position_set(sd->imf_context,
pos);
}
#endif
_e_entry_imf_context_reset(obj);
_e_entry_imf_cursor_info_set(obj);
}
}
@ -853,14 +840,8 @@ _e_entry_key_down_windows(Evas_Object *entry, Evas_Event_Key_Down *event)
changed |= e_editable_insert(editable, start_pos, event->string);
}
#ifdef HAVE_ECORE_IMF
if (sd->imf_context)
{
ecore_imf_context_reset(sd->imf_context);
ecore_imf_context_cursor_position_set(sd->imf_context,
e_editable_cursor_pos_get(editable));
}
#endif
_e_entry_imf_context_reset(entry);
_e_entry_imf_cursor_info_set(entry);
if (changed)
evas_object_smart_callback_call(entry, "changed", NULL);
@ -1006,14 +987,8 @@ _e_entry_key_down_emacs(Evas_Object *entry, Evas_Event_Key_Down *event)
(event->string[0] >= 0x20 && event->string[0] != 0x7f)))
changed = e_editable_insert(editable, cursor_pos, event->string);
#ifdef HAVE_ECORE_IMF
if (sd->imf_context)
{
ecore_imf_context_reset(sd->imf_context);
ecore_imf_context_cursor_position_set(sd->imf_context,
e_editable_cursor_pos_get(editable));
}
#endif
_e_entry_imf_context_reset(entry);
_e_entry_imf_cursor_info_set(entry);
if (changed)
evas_object_smart_callback_call(entry, "changed", NULL);
@ -1369,6 +1344,43 @@ _e_entry_cb_delete(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
}
}
static void
_e_entry_imf_context_reset(Evas_Object *object)
{
E_Entry_Smart_Data *sd;
if ((!object) || !(sd = evas_object_smart_data_get(object)))
return;
#ifdef HAVE_ECORE_IMF
if (sd->imf_context)
ecore_imf_context_reset(sd->imf_context);
#endif
}
static void
_e_entry_imf_cursor_info_set(Evas_Object *object)
{
E_Entry_Smart_Data *sd;
Evas_Coord cx, cy, cw, ch;
Evas_Object *editable;
if ((!object) || !(sd = evas_object_smart_data_get(object)))
return;
#ifdef HAVE_ECORE_IMF
if (!sd || !sd->imf_context) return;
editable = sd->editable_object;
e_editable_cursor_geometry_get(editable, &cx, &cy, &cw, &ch);
ecore_imf_context_cursor_position_set(sd->imf_context,
e_editable_cursor_pos_get(editable));
ecore_imf_context_cursor_location_set(sd->imf_context, cx, cy, cw, ch);
#endif
}
#ifdef HAVE_ECORE_IMF
static Eina_Bool
_e_entry_cb_imf_retrieve_surrounding(void *data, Ecore_IMF_Context *ctx __UNUSED__, char **text, int *cursor_pos)
@ -1430,6 +1442,8 @@ _e_entry_cb_imf_event_commit(void *data, int type __UNUSED__, void *event)
changed |= e_editable_insert(editable, start_pos, ev->str);
_e_entry_imf_cursor_info_set(entry);
if (changed)
evas_object_smart_callback_call(entry, "changed", NULL);
@ -1489,6 +1503,8 @@ _e_entry_cb_imf_event_preedit_changed(void *data, int type __UNUSED__, void *eve
else
sd->have_preedit = EINA_TRUE;
_e_entry_imf_cursor_info_set(entry);
if (changed)
evas_object_smart_callback_call(entry, "preedit,changed", NULL);