summaryrefslogtreecommitdiff
path: root/src/examples/ecore
diff options
context:
space:
mode:
authorJihoon Kim <imfine98@gmail.com>2013-01-26 02:49:39 +0000
committerJihoon Kim <imfine98@gmail.com>2013-01-26 02:49:39 +0000
commit81370c8926cef9e88825bf79cab7c5d38bcc5c87 (patch)
tree4201e164809539d8fe249ce960b81354e3d30efc /src/examples/ecore
parenta9eeda6300b562fe9c406c9696501cb326a33cce (diff)
ecore_imf_example: add mouse down event handler
SVN revision: 83338
Diffstat (limited to 'src/examples/ecore')
-rw-r--r--src/examples/ecore/ecore_imf_example.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/examples/ecore/ecore_imf_example.c b/src/examples/ecore/ecore_imf_example.c
index ff0c5717c3..e9f91c121e 100644
--- a/src/examples/ecore/ecore_imf_example.c
+++ b/src/examples/ecore/ecore_imf_example.c
@@ -27,16 +27,32 @@ struct _Entry
27 Eina_Bool have_preedit : 1; 27 Eina_Bool have_preedit : 1;
28}; 28};
29 29
30static void _imf_cursor_info_set(Entry *en);
31
30static void 32static void
31_mouse_up_cb(void *data, Evas *e, Evas_Object *o, void *event_info) 33_mouse_down_cb(void *data, Evas *e, Evas_Object *o, void *event_info)
32{ 34{
33 Entry *en = data; 35 Entry *en = data;
34 if (!en) return; 36 if (!en) return;
35 37
36 if (en->imf_context) 38 // ecore_imf_context_reset should be called before calculating new cursor position
37 ecore_imf_context_reset(en->imf_context);
38 39
39 evas_object_focus_set(en->rect, EINA_TRUE); 40 // calculate new cursor position
41}
42
43static void
44_mouse_up_cb(void *data, Evas *e, Evas_Object *o, void *event_info)
45{
46 Entry *en = data;
47 if (!en) return;
48
49 if (evas_object_focus_get(en->rect))
50 {
51 // notify cursor information
52 _imf_cursor_info_set(en);
53 }
54 else
55 evas_object_focus_set(en->rect, EINA_TRUE);
40} 56}
41 57
42static void 58static void
@@ -448,6 +464,7 @@ create_input_field(Evas *evas, Entry *en, Evas_Coord x, Evas_Coord y, Evas_Coord
448 464
449 evas_object_event_callback_add(en->rect, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, en); 465 evas_object_event_callback_add(en->rect, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, en);
450 evas_object_event_callback_add(en->rect, EVAS_CALLBACK_KEY_UP, _key_up_cb, en); 466 evas_object_event_callback_add(en->rect, EVAS_CALLBACK_KEY_UP, _key_up_cb, en);
467 evas_object_event_callback_add(en->rect, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, en);
451 evas_object_event_callback_add(en->rect, EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, en); 468 evas_object_event_callback_add(en->rect, EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, en);
452 evas_object_event_callback_add(en->rect, EVAS_CALLBACK_FOCUS_IN, _entry_focus_in_cb, en); 469 evas_object_event_callback_add(en->rect, EVAS_CALLBACK_FOCUS_IN, _entry_focus_in_cb, en);
453 evas_object_event_callback_add(en->rect, EVAS_CALLBACK_FOCUS_OUT, _entry_focus_out_cb, en); 470 evas_object_event_callback_add(en->rect, EVAS_CALLBACK_FOCUS_OUT, _entry_focus_out_cb, en);