summaryrefslogtreecommitdiff
path: root/src/lib/edje
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2016-11-17 15:21:02 -0200
committerBruno Dilly <bdilly@profusion.mobi>2016-12-19 14:58:35 -0200
commit5cfdf3ec3af60394dfaa19440f475fc23a8567e6 (patch)
treea5c09935a6c4ec9c5bc65ac2bd8a7ac4b1d78a6d /src/lib/edje
parentfecd59fe3237d930d86e8b166b57271b16c5df43 (diff)
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not provided, act over default seat), and emit signals with seat suffix: * focus,in,$SEAT * focus,out,$SEAT * focus,part,in,$SEAT * focus,part,out,$SEAT
Diffstat (limited to 'src/lib/edje')
-rw-r--r--src/lib/edje/Edje_Common.h2
-rw-r--r--src/lib/edje/edje_callbacks.c10
-rw-r--r--src/lib/edje/edje_data.c2
-rw-r--r--src/lib/edje/edje_edit.c2
-rw-r--r--src/lib/edje/edje_entry.c162
-rw-r--r--src/lib/edje/edje_load.c13
-rw-r--r--src/lib/edje/edje_private.h14
-rw-r--r--src/lib/edje/edje_program.c107
8 files changed, 250 insertions, 62 deletions
diff --git a/src/lib/edje/Edje_Common.h b/src/lib/edje/Edje_Common.h
index b99de45935..243a28ca00 100644
--- a/src/lib/edje/Edje_Common.h
+++ b/src/lib/edje/Edje_Common.h
@@ -1924,7 +1924,7 @@ typedef enum _Edje_Action_Type
1924 EDJE_ACTION_TYPE_DRAG_VAL_STEP = 5, /**< Drag val step action value */ 1924 EDJE_ACTION_TYPE_DRAG_VAL_STEP = 5, /**< Drag val step action value */
1925 EDJE_ACTION_TYPE_DRAG_VAL_PAGE = 6, /**< Drag val page action value */ 1925 EDJE_ACTION_TYPE_DRAG_VAL_PAGE = 6, /**< Drag val page action value */
1926 EDJE_ACTION_TYPE_SCRIPT = 7, /**< Script action value */ 1926 EDJE_ACTION_TYPE_SCRIPT = 7, /**< Script action value */
1927 EDJE_ACTION_TYPE_FOCUS_SET = 8, /**< Forcus set action value */ 1927 EDJE_ACTION_TYPE_FOCUS_SET = 8, /**< Focus set action value */
1928 EDJE_ACTION_TYPE_RESERVED00 = 9, /**< Reversed do action value */ 1928 EDJE_ACTION_TYPE_RESERVED00 = 9, /**< Reversed do action value */
1929 EDJE_ACTION_TYPE_FOCUS_OBJECT = 10, /**< Forcus object action value */ 1929 EDJE_ACTION_TYPE_FOCUS_OBJECT = 10, /**< Forcus object action value */
1930 EDJE_ACTION_TYPE_PARAM_COPY = 11, /**< Param copy action value */ 1930 EDJE_ACTION_TYPE_PARAM_COPY = 11, /**< Param copy action value */
diff --git a/src/lib/edje/edje_callbacks.c b/src/lib/edje/edje_callbacks.c
index b367d0c0a5..c92f3295bf 100644
--- a/src/lib/edje/edje_callbacks.c
+++ b/src/lib/edje/edje_callbacks.c
@@ -25,29 +25,35 @@ _edje_hold_signal_cb(void *data, const Efl_Event *event)
25static void 25static void
26_edje_focus_in_signal_cb(void *data, const Efl_Event *event) 26_edje_focus_in_signal_cb(void *data, const Efl_Event *event)
27{ 27{
28 Efl_Input_Focus *ev;
28 Edje *ed; 29 Edje *ed;
29 Edje_Real_Part *rp; 30 Edje_Real_Part *rp;
30 31
32 ev = event->info;
31 ed = data; 33 ed = data;
32 rp = evas_object_data_get(event->object, "real_part"); 34 rp = evas_object_data_get(event->object, "real_part");
33 if ((!rp) || (!ed)) 35 if ((!rp) || (!ed))
34 return; 36 return;
35 37
36 _edje_emit(ed, "focus,part,in", rp->part->name); 38 _edje_seat_emit(ed, efl_input_device_get(ev),
39 "focus,part,in", rp->part->name);
37} 40}
38 41
39static void 42static void
40_edje_focus_out_signal_cb(void *data, const Efl_Event *event) 43_edje_focus_out_signal_cb(void *data, const Efl_Event *event)
41{ 44{
45 Efl_Input_Focus *ev;
42 Edje *ed; 46 Edje *ed;
43 Edje_Real_Part *rp; 47 Edje_Real_Part *rp;
44 48
49 ev = event->info;
45 ed = data; 50 ed = data;
46 rp = evas_object_data_get(event->object, "real_part"); 51 rp = evas_object_data_get(event->object, "real_part");
47 if ((!rp) || (!ed)) 52 if ((!rp) || (!ed))
48 return; 53 return;
49 54
50 _edje_emit(ed, "focus,part,out", rp->part->name); 55 _edje_seat_emit(ed, efl_input_device_get(ev),
56 "focus,part,out", rp->part->name);
51} 57}
52 58
53static void 59static void
diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c
index b9a0ee2532..9141ae139b 100644
--- a/src/lib/edje/edje_data.c
+++ b/src/lib/edje/edje_data.c
@@ -1062,6 +1062,8 @@ _edje_edd_init(void)
1062 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "vibration_name", vibration_name, EET_T_STRING); 1062 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "vibration_name", vibration_name, EET_T_STRING);
1063 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "vibration_repeat", vibration_repeat, EET_T_INT); 1063 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "vibration_repeat", vibration_repeat, EET_T_INT);
1064 1064
1065 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "seat", seat, EET_T_STRING);
1066
1065 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "state", state, EET_T_STRING); 1067 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "state", state, EET_T_STRING);
1066 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "state2", state2, EET_T_STRING); 1068 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "state2", state2, EET_T_STRING);
1067 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "value", value, EET_T_DOUBLE); 1069 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "value", value, EET_T_DOUBLE);
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 486395c491..eab121f498 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -10693,6 +10693,7 @@ edje_edit_program_add(Evas_Object *obj, const char *name)
10693 epr->in.from = 0.0; 10693 epr->in.from = 0.0;
10694 epr->in.range = 0.0; 10694 epr->in.range = 0.0;
10695 epr->action = 0; 10695 epr->action = 0;
10696 epr->seat = NULL;
10696 epr->state = NULL; 10697 epr->state = NULL;
10697 epr->value = 0.0; 10698 epr->value = 0.0;
10698 epr->state2 = NULL; 10699 epr->state2 = NULL;
@@ -10788,6 +10789,7 @@ edje_edit_program_del(Evas_Object *obj, const char *prog)
10788 _edje_if_string_free(ed, &epr->source); 10789 _edje_if_string_free(ed, &epr->source);
10789 _edje_if_string_free(ed, &epr->filter.part); 10790 _edje_if_string_free(ed, &epr->filter.part);
10790 _edje_if_string_free(ed, &epr->filter.state); 10791 _edje_if_string_free(ed, &epr->filter.state);
10792 _edje_if_string_free(ed, &epr->seat);
10791 _edje_if_string_free(ed, &epr->state); 10793 _edje_if_string_free(ed, &epr->state);
10792 _edje_if_string_free(ed, &epr->state2); 10794 _edje_if_string_free(ed, &epr->state2);
10793 _edje_if_string_free(ed, &epr->sample_name); 10795 _edje_if_string_free(ed, &epr->sample_name);
diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c
index 0d85a5b368..f999d0a76a 100644
--- a/src/lib/edje/edje_entry.c
+++ b/src/lib/edje/edje_entry.c
@@ -113,12 +113,17 @@ _preedit_del(Entry *en)
113} 113}
114 114
115static void 115static void
116_edje_entry_focus_in_cb(void *data, Evas_Object *o, const char *emission EINA_UNUSED, const char *source EINA_UNUSED) 116_edje_entry_focus_in_cb(void *data, Evas_Object *o, const char *emission, const char *source EINA_UNUSED)
117{ 117{
118 Efl_Input_Device *seat;
119 const char *seat_name;
118 Edje_Real_Part *rp; 120 Edje_Real_Part *rp;
119 Entry *en; 121 Entry *en;
120 Edje *ed; 122 Edje *ed;
121 123
124 seat_name = emission + strlen("focus,part,in,");
125 seat = evas_device_get(evas_object_evas_get(o), seat_name);
126
122 rp = data; 127 rp = data;
123 if ((!rp) || (rp->type != EDJE_RP_TYPE_TEXT) || 128 if ((!rp) || (rp->type != EDJE_RP_TYPE_TEXT) ||
124 (!rp->typedata.text)) return; 129 (!rp->typedata.text)) return;
@@ -130,7 +135,7 @@ _edje_entry_focus_in_cb(void *data, Evas_Object *o, const char *emission EINA_UN
130 en = rp->typedata.text->entry_data; 135 en = rp->typedata.text->entry_data;
131 if (!en || !en->imf_context) return; 136 if (!en || !en->imf_context) return;
132 137
133 if (evas_object_focus_get(ed->obj)) 138 if (evas_object_seat_focus_check(ed->obj, seat))
134 { 139 {
135 ecore_imf_context_focus_in(en->imf_context); 140 ecore_imf_context_focus_in(en->imf_context);
136 _edje_entry_imf_cursor_info_set(en); 141 _edje_entry_imf_cursor_info_set(en);
@@ -158,17 +163,16 @@ _edje_entry_focus_out_cb(void *data, Evas_Object *o EINA_UNUSED, const char *emi
158#endif 163#endif
159 164
160static void 165static void
161_edje_focus_in_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 166_edje_focus_in(Edje *ed, Efl_Input_Device *seat)
162{ 167{
163 Edje *ed = data;
164#ifdef HAVE_ECORE_IMF 168#ifdef HAVE_ECORE_IMF
165 Edje_Real_Part *rp; 169 Edje_Real_Part *rp;
166 Entry *en; 170 Entry *en;
167#endif 171#endif
168 172
169 _edje_emit(ed, "focus,in", ""); 173 _edje_seat_emit(ed, seat, "focus,in", "");
170#ifdef HAVE_ECORE_IMF 174#ifdef HAVE_ECORE_IMF
171 rp = ed->focused_part; 175 rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat));
172 if (!rp) return; 176 if (!rp) return;
173 if ((rp->type != EDJE_RP_TYPE_TEXT) || 177 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
174 (!rp->typedata.text)) return; 178 (!rp->typedata.text)) return;
@@ -185,17 +189,25 @@ _edje_focus_in_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
185} 189}
186 190
187static void 191static void
188_edje_focus_out_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 192_edje_focus_in_cb(void *data, const Efl_Event *event)
193{
194 Efl_Input_Focus *ev = event->info;
195
196 _edje_focus_in(data, efl_input_device_get(ev));
197}
198
199static void
200_edje_focus_out(Edje *ed, Efl_Input_Device *seat)
189{ 201{
190 Edje *ed = data;
191#ifdef HAVE_ECORE_IMF 202#ifdef HAVE_ECORE_IMF
192 Edje_Real_Part *rp = ed->focused_part; 203 Edje_Real_Part *rp;
193 Entry *en; 204 Entry *en;
194#endif 205#endif
195 206
196 _edje_emit(ed, "focus,out", ""); 207 _edje_seat_emit(ed, seat, "focus,out", "");
197 208
198#ifdef HAVE_ECORE_IMF 209#ifdef HAVE_ECORE_IMF
210 rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat));
199 if (!rp) return; 211 if (!rp) return;
200 if ((rp->type != EDJE_RP_TYPE_TEXT) || 212 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
201 (!rp->typedata.text)) return; 213 (!rp->typedata.text)) return;
@@ -211,6 +223,14 @@ _edje_focus_out_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED
211#endif 223#endif
212} 224}
213 225
226static void
227_edje_focus_out_cb(void *data, const Efl_Event *event)
228{
229 Efl_Input_Focus *ev = event->info;
230
231 _edje_focus_out(data, efl_input_device_get(ev));
232}
233
214static Edje_Entry_Change_Info * 234static Edje_Entry_Change_Info *
215_text_filter_markup_prepend_internal(Edje *ed, Entry *en, Evas_Textblock_Cursor *c, 235_text_filter_markup_prepend_internal(Edje *ed, Entry *en, Evas_Textblock_Cursor *c,
216 char *text, 236 char *text,
@@ -1676,7 +1696,9 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
1676{ 1696{
1677 Edje *ed = data; 1697 Edje *ed = data;
1678 Evas_Event_Key_Down *ev = event_info; 1698 Evas_Event_Key_Down *ev = event_info;
1679 Edje_Real_Part *rp = ed->focused_part; 1699 Edje_Real_Part *rp;
1700 Efl_Input_Device *seat;
1701
1680 Entry *en; 1702 Entry *en;
1681 Eina_Bool control, alt, shift; 1703 Eina_Bool control, alt, shift;
1682#if defined(__APPLE__) && defined(__MACH__) 1704#if defined(__APPLE__) && defined(__MACH__)
@@ -1685,6 +1707,10 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
1685 Eina_Bool multiline; 1707 Eina_Bool multiline;
1686 Eina_Bool cursor_changed; 1708 Eina_Bool cursor_changed;
1687 int old_cur_pos; 1709 int old_cur_pos;
1710
1711 seat = efl_input_device_seat_get(ev->dev);
1712 rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat));
1713
1688 if (!rp) return; 1714 if (!rp) return;
1689 if ((rp->type != EDJE_RP_TYPE_TEXT) || 1715 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
1690 (!rp->typedata.text)) return; 1716 (!rp->typedata.text)) return;
@@ -2340,10 +2366,14 @@ end:
2340static void 2366static void
2341_edje_key_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) 2367_edje_key_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
2342{ 2368{
2369 Evas_Event_Key_Up *ev = event_info;
2370 Efl_Input_Device *seat;
2343 Edje *ed = data; 2371 Edje *ed = data;
2344 Edje_Real_Part *rp = ed->focused_part; 2372 Edje_Real_Part *rp;
2345 Entry *en; 2373 Entry *en;
2346 2374
2375 seat = efl_input_device_seat_get(ev->dev);
2376 rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat));
2347 if (!rp) return; 2377 if (!rp) return;
2348 if ((rp->type != EDJE_RP_TYPE_TEXT) || 2378 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
2349 (!rp->typedata.text)) return; 2379 (!rp->typedata.text)) return;
@@ -2356,7 +2386,6 @@ _edje_key_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, v
2356#ifdef HAVE_ECORE_IMF 2386#ifdef HAVE_ECORE_IMF
2357 if (en->imf_context) 2387 if (en->imf_context)
2358 { 2388 {
2359 Evas_Event_Key_Up *ev = event_info;
2360 Ecore_IMF_Event_Key_Up ecore_ev; 2389 Ecore_IMF_Event_Key_Up ecore_ev;
2361 2390
2362 ecore_imf_evas_event_key_up_wrap(ev, &ecore_ev); 2391 ecore_imf_evas_event_key_up_wrap(ev, &ecore_ev);
@@ -2797,26 +2826,36 @@ _canvas_viewport_resize_cb(void *data, Evas *e EINA_UNUSED, void *event_info EIN
2797} 2826}
2798 2827
2799static void 2828static void
2800_evas_focus_in_cb(void *data, Evas *e, EINA_UNUSED void *event_info) 2829_evas_focus_in_cb(void *data, const Efl_Event *event)
2801{ 2830{
2802 Edje *ed = (Edje *)data; 2831 Efl_Input_Focus *ev = event->info;
2832 Evas *e = event->object;
2833 Efl_Input_Device *seat;
2834 Edje *ed = data;
2835
2803 if (!ed) return; 2836 if (!ed) return;
2804 2837
2805 if (evas_focus_get(e) == ed->obj) 2838 seat = efl_input_device_get(ev);
2839 if (evas_canvas_seat_focus_get(e, seat) == ed->obj)
2806 { 2840 {
2807 _edje_focus_in_cb(data, NULL, NULL, NULL); 2841 _edje_focus_in(data, seat);
2808 } 2842 }
2809} 2843}
2810 2844
2811static void 2845static void
2812_evas_focus_out_cb(void *data, Evas *e, EINA_UNUSED void *event_info) 2846_evas_focus_out_cb(void *data, const Efl_Event *event)
2813{ 2847{
2814 Edje *ed = (Edje *)data; 2848 Efl_Input_Focus *ev = event->info;
2849 Evas *e = event->object;
2850 Efl_Input_Device *seat;
2851 Edje *ed = data;
2852
2815 if (!ed) return; 2853 if (!ed) return;
2816 2854
2817 if (evas_focus_get(e) == ed->obj) 2855 seat = efl_input_device_get(ev);
2856 if (evas_canvas_seat_focus_get(e, seat) == ed->obj)
2818 { 2857 {
2819 _edje_focus_out_cb(data, NULL, NULL, NULL); 2858 _edje_focus_out(data, seat);
2820 } 2859 }
2821} 2860}
2822 2861
@@ -2830,12 +2869,16 @@ _edje_entry_init(Edje *ed)
2830 return; 2869 return;
2831 ed->entries_inited = EINA_TRUE; 2870 ed->entries_inited = EINA_TRUE;
2832 2871
2833 evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_FOCUS_IN, _edje_focus_in_cb, ed); 2872 efl_event_callback_add(ed->obj, EFL_EVENT_FOCUS_IN, _edje_focus_in_cb, ed);
2834 evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_FOCUS_OUT, _edje_focus_out_cb, ed); 2873 efl_event_callback_add(ed->obj, EFL_EVENT_FOCUS_OUT, _edje_focus_out_cb, ed);
2835 evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_KEY_DOWN, _edje_key_down_cb, ed); 2874 evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_KEY_DOWN,
2836 evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_KEY_UP, _edje_key_up_cb, ed); 2875 _edje_key_down_cb, ed);
2837 evas_event_callback_add(ed->base->evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _evas_focus_in_cb, ed); 2876 evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_KEY_UP,
2838 evas_event_callback_add(ed->base->evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _evas_focus_out_cb, ed); 2877 _edje_key_up_cb, ed);
2878 efl_event_callback_add(ed->base->evas, EFL_CANVAS_EVENT_FOCUS_IN,
2879 _evas_focus_in_cb, ed);
2880 efl_event_callback_add(ed->base->evas, EFL_CANVAS_EVENT_FOCUS_OUT,
2881 _evas_focus_out_cb, ed);
2839} 2882}
2840 2883
2841void 2884void
@@ -2847,14 +2890,16 @@ _edje_entry_shutdown(Edje *ed)
2847 return; 2890 return;
2848 ed->entries_inited = EINA_FALSE; 2891 ed->entries_inited = EINA_FALSE;
2849 2892
2850 evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_FOCUS_IN, _edje_focus_in_cb); 2893 efl_event_callback_del(ed->obj, EFL_EVENT_FOCUS_IN, _edje_focus_in_cb, ed);
2851 evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_FOCUS_OUT, _edje_focus_out_cb); 2894 efl_event_callback_del(ed->obj, EFL_EVENT_FOCUS_OUT, _edje_focus_out_cb, ed);
2852 evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_KEY_DOWN, _edje_key_down_cb); 2895 evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_KEY_DOWN,
2853 evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_KEY_UP, _edje_key_up_cb); 2896 _edje_key_down_cb);
2854 if (evas_event_callback_del_full(ed->base->evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _evas_focus_in_cb, ed) != ed) 2897 evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_KEY_UP,
2855 ERR("could not unregister EVAS_CALLBACK_FOCUS_IN"); 2898 _edje_key_up_cb);
2856 if (evas_event_callback_del_full(ed->base->evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _evas_focus_out_cb, ed) != ed) 2899 efl_event_callback_del(ed->base->evas, EFL_CANVAS_EVENT_FOCUS_IN,
2857 ERR("could not unregister EVAS_CALLBACK_FOCUS_OUT"); 2900 _evas_focus_in_cb, ed);
2901 efl_event_callback_del(ed->base->evas, EFL_CANVAS_EVENT_FOCUS_OUT,
2902 _evas_focus_out_cb, ed);
2858} 2903}
2859 2904
2860void 2905void
@@ -2948,8 +2993,12 @@ _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp)
2948 2993
2949 en->commit_cancel = EINA_FALSE; 2994 en->commit_cancel = EINA_FALSE;
2950 2995
2951 edje_object_signal_callback_add(ed->obj, "focus,part,in", rp->part->name, _edje_entry_focus_in_cb, rp); 2996 edje_object_signal_callback_add(ed->obj, "focus,part,in,*",
2952 edje_object_signal_callback_add(ed->obj, "focus,part,out", rp->part->name, _edje_entry_focus_out_cb, rp); 2997 rp->part->name,
2998 _edje_entry_focus_in_cb, rp);
2999 edje_object_signal_callback_add(ed->obj, "focus,part,out,*",
3000 rp->part->name,
3001 _edje_entry_focus_out_cb, rp);
2953 3002
2954 ctx_id = ecore_imf_context_default_id_get(); 3003 ctx_id = ecore_imf_context_default_id_get();
2955 if (ctx_id) 3004 if (ctx_id)
@@ -3053,8 +3102,12 @@ _edje_entry_real_part_shutdown(Edje *ed, Edje_Real_Part *rp)
3053 en->imf_context = NULL; 3102 en->imf_context = NULL;
3054 } 3103 }
3055 3104
3056 edje_object_signal_callback_del(ed->obj, "focus,part,in", rp->part->name, _edje_entry_focus_in_cb); 3105 edje_object_signal_callback_del(ed->obj, "focus,part,in,*",
3057 edje_object_signal_callback_del(ed->obj, "focus,part,out", rp->part->name, _edje_entry_focus_out_cb); 3106 rp->part->name,
3107 _edje_entry_focus_in_cb);
3108 edje_object_signal_callback_del(ed->obj, "focus,part,out,*",
3109 rp->part->name,
3110 _edje_entry_focus_out_cb);
3058 } 3111 }
3059#endif 3112#endif
3060 _compose_seq_reset(en); 3113 _compose_seq_reset(en);
@@ -4429,11 +4482,14 @@ static Eina_Bool
4429_edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, char **text, int *cursor_pos) 4482_edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, char **text, int *cursor_pos)
4430{ 4483{
4431 Edje *ed = data; 4484 Edje *ed = data;
4432 Edje_Real_Part *rp = ed->focused_part; 4485 Edje_Real_Part *rp;
4433 Entry *en = NULL; 4486 Entry *en = NULL;
4434 const char *str; 4487 const char *str;
4435 char *plain_text; 4488 char *plain_text;
4436 4489
4490 // FIXME
4491 //rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat));
4492 rp = _edje_focused_part_get(ed, "default");
4437 if (!rp) return EINA_FALSE; 4493 if (!rp) return EINA_FALSE;
4438 if ((rp->type != EDJE_RP_TYPE_TEXT) || 4494 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4439 (!rp->typedata.text)) return EINA_FALSE; 4495 (!rp->typedata.text)) return EINA_FALSE;
@@ -4506,11 +4562,14 @@ static void
4506_edje_entry_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info) 4562_edje_entry_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info)
4507{ 4563{
4508 Edje *ed = data; 4564 Edje *ed = data;
4509 Edje_Real_Part *rp = ed->focused_part; 4565 Edje_Real_Part *rp;
4510 Entry *en = NULL; 4566 Entry *en = NULL;
4511 char *commit_str = event_info; 4567 char *commit_str = event_info;
4512 Edje_Entry_Change_Info *info = NULL; 4568 Edje_Entry_Change_Info *info = NULL;
4513 4569
4570 // FIXME
4571 //rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat));
4572 rp = _edje_focused_part_get(ed, "default");
4514 if ((!rp)) return; 4573 if ((!rp)) return;
4515 if ((rp->type != EDJE_RP_TYPE_TEXT) || 4574 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4516 (!rp->typedata.text)) return; 4575 (!rp->typedata.text)) return;
@@ -4587,7 +4646,7 @@ static void
4587_edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info EINA_UNUSED) 4646_edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info EINA_UNUSED)
4588{ 4647{
4589 Edje *ed = data; 4648 Edje *ed = data;
4590 Edje_Real_Part *rp = ed->focused_part; 4649 Edje_Real_Part *rp;
4591 Entry *en = NULL; 4650 Entry *en = NULL;
4592 Edje_Entry_Change_Info *info = NULL; 4651 Edje_Entry_Change_Info *info = NULL;
4593 int cursor_pos; 4652 int cursor_pos;
@@ -4610,6 +4669,9 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA
4610 Eina_Strbuf *buf; 4669 Eina_Strbuf *buf;
4611 Eina_Strbuf *preedit_attr_str; 4670 Eina_Strbuf *preedit_attr_str;
4612 4671
4672 // FIXME
4673 //rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat));
4674 rp = _edje_focused_part_get(ed, "default");
4613 if ((!rp)) return; 4675 if ((!rp)) return;
4614 4676
4615 if ((rp->type != EDJE_RP_TYPE_TEXT) || 4677 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
@@ -4751,7 +4813,7 @@ static void
4751_edje_entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info) 4813_edje_entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info)
4752{ 4814{
4753 Edje *ed = data; 4815 Edje *ed = data;
4754 Edje_Real_Part *rp = ed->focused_part; 4816 Edje_Real_Part *rp;
4755 Entry *en = NULL; 4817 Entry *en = NULL;
4756 Ecore_IMF_Event_Delete_Surrounding *ev = event_info; 4818 Ecore_IMF_Event_Delete_Surrounding *ev = event_info;
4757 Evas_Textblock_Cursor *del_start, *del_end; 4819 Evas_Textblock_Cursor *del_start, *del_end;
@@ -4759,6 +4821,10 @@ _edje_entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx E
4759 int cursor_pos; 4821 int cursor_pos;
4760 int start, end; 4822 int start, end;
4761 4823
4824 // FIXME
4825 //rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat));
4826 rp = _edje_focused_part_get(ed, "default");
4827 if ((!rp)) return;
4762 if ((!rp) || (!ev)) return; 4828 if ((!rp) || (!ev)) return;
4763 if ((rp->type != EDJE_RP_TYPE_TEXT) || 4829 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4764 (!rp->typedata.text)) return; 4830 (!rp->typedata.text)) return;
@@ -4810,10 +4876,13 @@ static void
4810_edje_entry_imf_event_selection_set_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info) 4876_edje_entry_imf_event_selection_set_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info)
4811{ 4877{
4812 Edje *ed = data; 4878 Edje *ed = data;
4813 Edje_Real_Part *rp = ed->focused_part; 4879 Edje_Real_Part *rp;
4814 Entry *en = NULL; 4880 Entry *en = NULL;
4815 Ecore_IMF_Event_Selection *ev = event_info; 4881 Ecore_IMF_Event_Selection *ev = event_info;
4816 4882
4883 // FIXME
4884 //rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat));
4885 rp = _edje_focused_part_get(ed, "default");
4817 if ((!rp) || (!ev)) return; 4886 if ((!rp) || (!ev)) return;
4818 if ((rp->type != EDJE_RP_TYPE_TEXT) || 4887 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4819 (!rp->typedata.text)) return; 4888 (!rp->typedata.text)) return;
@@ -4844,10 +4913,13 @@ static Eina_Bool
4844_edje_entry_imf_retrieve_selection_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, char **text) 4913_edje_entry_imf_retrieve_selection_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, char **text)
4845{ 4914{
4846 Edje *ed = data; 4915 Edje *ed = data;
4847 Edje_Real_Part *rp = ed->focused_part; 4916 Edje_Real_Part *rp;
4848 Entry *en = NULL; 4917 Entry *en = NULL;
4849 const char *selection_text = NULL; 4918 const char *selection_text = NULL;
4850 4919
4920 // FIXME
4921 //rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat));
4922 rp = _edje_focused_part_get(ed, "default");
4851 if (!rp) return EINA_FALSE; 4923 if (!rp) return EINA_FALSE;
4852 if ((rp->type != EDJE_RP_TYPE_TEXT) || 4924 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4853 (!rp->typedata.text)) return EINA_FALSE; 4925 (!rp->typedata.text)) return EINA_FALSE;
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index 3751fae34a..214f3e83b2 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -1809,13 +1809,23 @@ _edje_file_del(Edje *ed)
1809 } 1809 }
1810 } 1810 }
1811 1811
1812 if (ed->focused_parts)
1813 {
1814 Edje_Focused_Part *focused_part;
1815
1816 EINA_LIST_FREE(ed->focused_parts, focused_part)
1817 {
1818 free(focused_part->seat);
1819 free(focused_part);
1820 }
1821 }
1822
1812 if (ed->L) _edje_lua2_script_shutdown(ed); 1823 if (ed->L) _edje_lua2_script_shutdown(ed);
1813 while (ed->subobjs) 1824 while (ed->subobjs)
1814 _edje_subobj_unregister(ed, ed->subobjs->data); 1825 _edje_subobj_unregister(ed, ed->subobjs->data);
1815 if (ed->table_parts) free(ed->table_parts); 1826 if (ed->table_parts) free(ed->table_parts);
1816 ed->table_parts = NULL; 1827 ed->table_parts = NULL;
1817 ed->table_parts_size = 0; 1828 ed->table_parts_size = 0;
1818 ed->focused_part = NULL;
1819 if (tev) 1829 if (tev)
1820 { 1830 {
1821 evas_event_thaw(tev); 1831 evas_event_thaw(tev);
@@ -1982,6 +1992,7 @@ _edje_program_free(Edje_Program *pr, Eina_Bool free_strings)
1982 if (pr->state2) eina_stringshare_del(pr->state2); 1992 if (pr->state2) eina_stringshare_del(pr->state2);
1983 if (pr->sample_name) eina_stringshare_del(pr->sample_name); 1993 if (pr->sample_name) eina_stringshare_del(pr->sample_name);
1984 if (pr->tone_name) eina_stringshare_del(pr->tone_name); 1994 if (pr->tone_name) eina_stringshare_del(pr->tone_name);
1995 if (pr->seat) eina_stringshare_del(pr->seat);
1985 } 1996 }
1986 EINA_LIST_FREE(pr->targets, prt) 1997 EINA_LIST_FREE(pr->targets, prt)
1987 free(prt); 1998 free(prt);
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 7dc1d59684..feafaa98e7 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -805,6 +805,8 @@ struct _Edje_Program /* a conditional program to be run */
805 double range; 805 double range;
806 } in; 806 } in;
807 807
808 const char *seat; /* which seat to focus, NULL = default seat */
809
808 const char *state; /* what state of alternates to apply, NULL = default */ 810 const char *state; /* what state of alternates to apply, NULL = default */
809 const char *state2; /* what other state to use - for signal emit action */ 811 const char *state2; /* what other state to use - for signal emit action */
810 double value; /* value of state to apply (if multiple names match) */ 812 double value; /* value of state to apply (if multiple names match) */
@@ -1659,7 +1661,7 @@ struct _Edje
1659 Edje_Var_Pool *var_pool; 1661 Edje_Var_Pool *var_pool;
1660 /* for faster lookups to avoid nth list walks */ 1662 /* for faster lookups to avoid nth list walks */
1661 Edje_Real_Part **table_parts; 1663 Edje_Real_Part **table_parts;
1662 Edje_Real_Part *focused_part; 1664 Eina_List *focused_parts;
1663 Eina_List *subobjs; 1665 Eina_List *subobjs;
1664 Eina_List *text_insert_filter_callbacks; 1666 Eina_List *text_insert_filter_callbacks;
1665 Eina_List *markup_filter_callbacks; 1667 Eina_List *markup_filter_callbacks;
@@ -2273,6 +2275,13 @@ struct _Edje_Font
2273 char *file; 2275 char *file;
2274}; 2276};
2275 2277
2278typedef struct _Edje_Focused_Part Edje_Focused_Part;
2279struct _Edje_Focused_Part
2280{
2281 Edje_Real_Part *part;
2282 char *seat;
2283};
2284
2276Edje_Patterns *edje_match_collection_dir_init(const Eina_List *lst); 2285Edje_Patterns *edje_match_collection_dir_init(const Eina_List *lst);
2277Edje_Patterns *edje_match_programs_signal_init(Edje_Program * const *array, 2286Edje_Patterns *edje_match_programs_signal_init(Edje_Program * const *array,
2278 unsigned int count); 2287 unsigned int count);
@@ -2472,6 +2481,9 @@ void _edje_emit_full(Edje *ed, const char *sig, const char *src, void *data, voi
2472void _edje_emit_handle(Edje *ed, const char *sig, const char *src, Edje_Message_Signal_Data *data, Eina_Bool prop); 2481void _edje_emit_handle(Edje *ed, const char *sig, const char *src, Edje_Message_Signal_Data *data, Eina_Bool prop);
2473void _edje_signals_sources_patterns_clean(Edje_Signals_Sources_Patterns *ssp); 2482void _edje_signals_sources_patterns_clean(Edje_Signals_Sources_Patterns *ssp);
2474 2483
2484void _edje_focused_part_set(Edje *ed, const char *seat_name, Edje_Real_Part *rp);
2485Edje_Real_Part *_edje_focused_part_get(Edje *ed, const char *seat_name);
2486
2475const Edje_Signals_Sources_Patterns *_edje_signal_callback_patterns_ref(const Edje_Signal_Callback_Group *gp); 2487const Edje_Signals_Sources_Patterns *_edje_signal_callback_patterns_ref(const Edje_Signal_Callback_Group *gp);
2476void _edje_signal_callback_patterns_unref(const Edje_Signals_Sources_Patterns *essp); 2488void _edje_signal_callback_patterns_unref(const Edje_Signals_Sources_Patterns *essp);
2477void _edje_signal_callback_reset(Edje_Signal_Callback_Flags *flags, unsigned int length); 2489void _edje_signal_callback_reset(Edje_Signal_Callback_Flags *flags, unsigned int length);
diff --git a/src/lib/edje/edje_program.c b/src/lib/edje/edje_program.c
index 2a6e100622..f2c4f4cc7e 100644
--- a/src/lib/edje/edje_program.c
+++ b/src/lib/edje/edje_program.c
@@ -615,6 +615,20 @@ _edje_physics_action_set(Edje *ed, Edje_Program *pr, void (*func)(EPhysics_Body
615 615
616#endif 616#endif
617 617
618static void
619_edje_seat_name_emit(Edje *ed, const char *name, const char *sig, const char *src)
620{
621 char buf[128];
622
623 /* keep sending signals without seat information for legacy compatibility */
624 _edje_emit_full(ed, sig, src, NULL, NULL);
625
626 if (!name) return;
627
628 snprintf(buf, sizeof(buf), "%s,%s", sig, name);
629 _edje_emit_full(ed, buf, src, NULL, NULL);
630}
631
618void 632void
619_edje_program_run(Edje *ed, Edje_Program *pr, Eina_Bool force, const char *ssig, const char *ssrc) 633_edje_program_run(Edje *ed, Edje_Program *pr, Eina_Bool force, const char *ssig, const char *ssrc)
620{ 634{
@@ -943,12 +957,32 @@ low_mem_current:
943 break; 957 break;
944 958
945 case EDJE_ACTION_TYPE_FOCUS_SET: 959 case EDJE_ACTION_TYPE_FOCUS_SET:
960 {
961 Edje_Real_Part *focused_part;
962 const char *seat_name;
963
964 /* TODO : use edje custom seat naming */
965 if (pr->seat)
966 seat_name = pr->seat;
967 else
968 {
969 Efl_Input_Device *seat;
970 Evas *e;
971
972 e = evas_object_evas_get(ed->obj);
973 seat = evas_canvas_default_device_get(e, EFL_INPUT_DEVICE_CLASS_SEAT);
974 seat_name = evas_device_name_get(seat);
975 if (!seat_name)
976 break;
977 }
978
946 if (!pr->targets) 979 if (!pr->targets)
947 { 980 {
948 if (ed->focused_part) 981 focused_part = _edje_focused_part_get(ed, seat_name);
949 _edje_emit(ed, "focus,part,out", 982 if (focused_part)
950 ed->focused_part->part->name); 983 _edje_seat_name_emit(ed, seat_name, "focus,part,out",
951 ed->focused_part = NULL; 984 focused_part->part->name);
985 _edje_focused_part_set(ed, seat_name, NULL);
952 } 986 }
953 else 987 else
954 { 988 {
@@ -959,20 +993,25 @@ low_mem_current:
959 rp = ed->table_parts[pt->id % ed->table_parts_size]; 993 rp = ed->table_parts[pt->id % ed->table_parts_size];
960 if (rp) 994 if (rp)
961 { 995 {
962 if (ed->focused_part != rp) 996 focused_part = _edje_focused_part_get(ed,
997 seat_name);
998 if (focused_part != rp)
963 { 999 {
964 if (ed->focused_part) 1000 if (focused_part)
965 _edje_emit(ed, "focus,part,out", 1001 _edje_seat_name_emit(ed, seat_name,
966 ed->focused_part->part->name); 1002 "focus,part,out",
967 ed->focused_part = rp; 1003 focused_part->part->name);
968 _edje_emit(ed, "focus,part,in", 1004 _edje_focused_part_set(ed, seat_name, rp);
969 ed->focused_part->part->name); 1005 _edje_seat_name_emit(ed, seat_name,
1006 "focus,part,in",
1007 rp->part->name);
970 } 1008 }
971 } 1009 }
972 } 1010 }
973 } 1011 }
974 } 1012 }
975 break; 1013 }
1014 break;
976 1015
977 case EDJE_ACTION_TYPE_FOCUS_OBJECT: 1016 case EDJE_ACTION_TYPE_FOCUS_OBJECT:
978 if (!pr->targets) 1017 if (!pr->targets)
@@ -1267,6 +1306,50 @@ _edje_emit_full(Edje *ed, const char *sig, const char *src, void *data, void (*f
1267 _edje_emit_send(ed, broadcast, sig, src, data, free_func); 1306 _edje_emit_send(ed, broadcast, sig, src, data, free_func);
1268} 1307}
1269 1308
1309void
1310_edje_focused_part_set(Edje *ed, const char *seat_name, Edje_Real_Part *rp)
1311{
1312 Edje_Focused_Part *focused_part;
1313 Eina_List *l;
1314
1315 EINA_LIST_FOREACH(ed->focused_parts, l, focused_part)
1316 {
1317 if (!strcmp(seat_name, focused_part->seat))
1318 {
1319 focused_part->part = rp;
1320 return;
1321 }
1322 }
1323
1324 focused_part = calloc(1, sizeof(Edje_Focused_Part));
1325 EINA_SAFETY_ON_NULL_RETURN(focused_part);
1326
1327 focused_part->seat = strdup(seat_name);
1328 if (!focused_part->seat)
1329 {
1330 free(focused_part);
1331 return;
1332 }
1333
1334 focused_part->part = rp;
1335 ed->focused_parts = eina_list_append(ed->focused_parts, focused_part);
1336}
1337
1338Edje_Real_Part *
1339_edje_focused_part_get(Edje *ed, const char *seat_name)
1340{
1341 Edje_Focused_Part *focused_part;
1342 Eina_List *l;
1343
1344 EINA_LIST_FOREACH(ed->focused_parts, l, focused_part)
1345 {
1346 if (!strcmp(seat_name, focused_part->seat))
1347 return focused_part->part;
1348 }
1349
1350 return NULL;
1351}
1352
1270struct _Edje_Program_Data 1353struct _Edje_Program_Data
1271{ 1354{
1272 Eina_List *matches; 1355 Eina_List *matches;