Edje entry: Enabled Ecore_IMF.

Fixed formatting issues.
Fixed typos.
Fixed clearing of selection when pressing a key in a software keyboard.
Patch by Jihoon Kim and small adjustments by myself. Thanks a lot.

SVN revision: 51897
This commit is contained in:
Tom Hacohen 2010-09-05 07:20:47 +00:00
parent cc250013be
commit 7258468265
1 changed files with 52 additions and 43 deletions

View File

@ -24,6 +24,8 @@ void *alloca (size_t);
#include "edje_private.h" #include "edje_private.h"
#ifdef HAVE_ECORE_IMF #ifdef HAVE_ECORE_IMF
#include <Ecore_IMF_Evas.h>
static int _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos); static int _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos);
static Eina_Bool _edje_entry_imf_event_commit_cb(void *data, int type, void *event); static Eina_Bool _edje_entry_imf_event_commit_cb(void *data, int type, void *event);
static Eina_Bool _edje_entry_imf_event_changed_cb(void *data, int type, void *event); static Eina_Bool _edje_entry_imf_event_changed_cb(void *data, int type, void *event);
@ -118,7 +120,7 @@ _edje_entry_focus_out_cb(void *data, Evas_Object *o __UNUSED__, const char *emis
} }
#endif #endif
static void static void
_edje_focus_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) _edje_focus_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{ {
Edje *ed = data; Edje *ed = data;
@ -174,7 +176,7 @@ _edje_focus_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
} }
// need one for markup and format too - how to do it? extra type param? // need one for markup and format too - how to do it? extra type param?
static void static void __UNUSED__
_text_filter_prepend(Entry *en, const char *text) _text_filter_prepend(Entry *en, const char *text)
{ {
char *text2; char *text2;
@ -960,7 +962,6 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
if (!ev->key) return; if (!ev->key) return;
#ifdef HAVE_ECORE_IMF #ifdef HAVE_ECORE_IMF
#if 0 // FIXME -- keyboard activated IMF
if (en->imf_context) if (en->imf_context)
{ {
Ecore_IMF_Event_Key_Down ecore_ev; Ecore_IMF_Event_Key_Down ecore_ev;
@ -970,7 +971,6 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
(Ecore_IMF_Event *)&ecore_ev)) (Ecore_IMF_Event *)&ecore_ev))
return; return;
} }
#endif
#endif #endif
tc = evas_object_textblock_cursor_new(rp->object); tc = evas_object_textblock_cursor_new(rp->object);
@ -1291,9 +1291,10 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
} }
static void static void
_edje_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) _edje_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
{ {
Edje *ed = data; Edje *ed = data;
Evas_Event_Key_Up *ev = event_info;
Edje_Real_Part *rp = ed->focused_part; Edje_Real_Part *rp = ed->focused_part;
Entry *en; Entry *en;
if (!rp) return; if (!rp) return;
@ -1303,19 +1304,16 @@ _edje_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, voi
return; return;
#ifdef HAVE_ECORE_IMF #ifdef HAVE_ECORE_IMF
#if 0 // FIXME key activation imf
if (en->imf_context) if (en->imf_context)
{ {
Ecore_IMF_Event_Key_Up ecore_ev; Ecore_IMF_Event_Key_Up ecore_ev;
ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev); ecore_imf_evas_event_key_up_wrap(ev, &ecore_ev);
if (ecore_imf_context_filter_event(en->imf_context, if (ecore_imf_context_filter_event(en->imf_context,
ECORE_IMF_EVENT_KEY_UP, ECORE_IMF_EVENT_KEY_UP,
(Ecore_IMF_Event *)&ecore_ev)) (Ecore_IMF_Event *)&ecore_ev))
return; return;
} }
#endif #endif
#endif
} }
static void static void
@ -1744,7 +1742,6 @@ _edje_entry_real_part_init(Edje_Real_Part *rp)
{ {
en->imf_context = ecore_imf_context_add(ctx_id); en->imf_context = ecore_imf_context_add(ctx_id);
} }
else else
{ {
ctx_id = ecore_imf_context_default_id_by_canvas_type_get("evas"); ctx_id = ecore_imf_context_default_id_by_canvas_type_get("evas");
@ -2508,6 +2505,12 @@ _edje_entry_imf_event_commit_cb(void *data, int type __UNUSED__, void *event)
if (en->imf_context != ev->ctx) return ECORE_CALLBACK_PASS_ON; if (en->imf_context != ev->ctx) return ECORE_CALLBACK_PASS_ON;
if (en->have_selection)
{
_range_del(en->cursor, rp->object, en);
_sel_clear(en->cursor, rp->object, en);
}
if (en->have_composition) if (en->have_composition)
{ {
for (i = 0; i < en->comp_len; i++) for (i = 0; i < en->comp_len; i++)
@ -2555,6 +2558,12 @@ _edje_entry_imf_event_changed_cb(void *data, int type __UNUSED__, void *event)
if ( 0 /* check the maximum length of evas_textblock */ ) if ( 0 /* check the maximum length of evas_textblock */ )
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
if (en->have_selection)
{
_range_del(en->cursor, rp->object, en);
_sel_clear(en->cursor, rp->object, en);
}
if (en->have_composition) if (en->have_composition)
{ {
// delete the composing characters // delete the composing characters