summaryrefslogtreecommitdiff
path: root/src/lib/edje
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2016-11-30 19:52:14 -0200
committerBruno Dilly <bdilly@profusion.mobi>2016-12-19 14:58:35 -0200
commitbb3fd015de8ab75fd509602a3c868ea9fdce9bb3 (patch)
treebf5f7871e83ad93a9a00cfdf81fb4b7d70c9fcd8 /src/lib/edje
parent5cfdf3ec3af60394dfaa19440f475fc23a8567e6 (diff)
edje: add names for seats following an incremental pattern
This way it'll be possible to write EDC with seat names that will work no matter how seats are named by each ecore_evas backend or users.
Diffstat (limited to 'src/lib/edje')
-rw-r--r--src/lib/edje/edje_entry.c49
-rw-r--r--src/lib/edje/edje_load.c119
-rw-r--r--src/lib/edje/edje_object.eo34
-rw-r--r--src/lib/edje/edje_private.h16
-rw-r--r--src/lib/edje/edje_program.c95
5 files changed, 254 insertions, 59 deletions
diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c
index f999d0a76a..b836e9596e 100644
--- a/src/lib/edje/edje_entry.c
+++ b/src/lib/edje/edje_entry.c
@@ -121,9 +121,6 @@ _edje_entry_focus_in_cb(void *data, Evas_Object *o, const char *emission, const
121 Entry *en; 121 Entry *en;
122 Edje *ed; 122 Edje *ed;
123 123
124 seat_name = emission + strlen("focus,part,in,");
125 seat = evas_device_get(evas_object_evas_get(o), seat_name);
126
127 rp = data; 124 rp = data;
128 if ((!rp) || (rp->type != EDJE_RP_TYPE_TEXT) || 125 if ((!rp) || (rp->type != EDJE_RP_TYPE_TEXT) ||
129 (!rp->typedata.text)) return; 126 (!rp->typedata.text)) return;
@@ -135,6 +132,9 @@ _edje_entry_focus_in_cb(void *data, Evas_Object *o, const char *emission, const
135 en = rp->typedata.text->entry_data; 132 en = rp->typedata.text->entry_data;
136 if (!en || !en->imf_context) return; 133 if (!en || !en->imf_context) return;
137 134
135 seat_name = emission + sizeof("focus,part,in,") - 1;
136 seat = _edje_seat_get(ed, seat_name);
137
138 if (evas_object_seat_focus_check(ed->obj, seat)) 138 if (evas_object_seat_focus_check(ed->obj, seat))
139 { 139 {
140 ecore_imf_context_focus_in(en->imf_context); 140 ecore_imf_context_focus_in(en->imf_context);
@@ -1709,7 +1709,7 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
1709 int old_cur_pos; 1709 int old_cur_pos;
1710 1710
1711 seat = efl_input_device_seat_get(ev->dev); 1711 seat = efl_input_device_seat_get(ev->dev);
1712 rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat)); 1712 rp = _edje_focused_part_get(ed, _edje_seat_name_get(ed, seat));
1713 1713
1714 if (!rp) return; 1714 if (!rp) return;
1715 if ((rp->type != EDJE_RP_TYPE_TEXT) || 1715 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
@@ -2373,7 +2373,7 @@ _edje_key_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, v
2373 Entry *en; 2373 Entry *en;
2374 2374
2375 seat = efl_input_device_seat_get(ev->dev); 2375 seat = efl_input_device_seat_get(ev->dev);
2376 rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat)); 2376 rp = _edje_focused_part_get(ed, _edje_seat_name_get(ed, seat));
2377 if (!rp) return; 2377 if (!rp) return;
2378 if ((rp->type != EDJE_RP_TYPE_TEXT) || 2378 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
2379 (!rp->typedata.text)) return; 2379 (!rp->typedata.text)) return;
@@ -4478,6 +4478,21 @@ _edje_entry_imf_cursor_info_set(Entry *en)
4478} 4478}
4479 4479
4480#ifdef HAVE_ECORE_IMF 4480#ifdef HAVE_ECORE_IMF
4481
4482static Edje_Real_Part *
4483_edje_entry_imf_default_focused_rp_get(Edje *ed)
4484{
4485 Eina_Stringshare *seat_name;
4486 Efl_Input_Device *seat;
4487 Evas *e;
4488
4489 e = evas_object_evas_get(ed->obj);
4490 seat = evas_canvas_default_device_get(e, EFL_INPUT_DEVICE_CLASS_SEAT);
4491 seat_name = _edje_seat_name_get(ed, seat);
4492
4493 return _edje_focused_part_get(ed, seat_name);
4494}
4495
4481static Eina_Bool 4496static Eina_Bool
4482_edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, char **text, int *cursor_pos) 4497_edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, char **text, int *cursor_pos)
4483{ 4498{
@@ -4487,9 +4502,7 @@ _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_
4487 const char *str; 4502 const char *str;
4488 char *plain_text; 4503 char *plain_text;
4489 4504
4490 // FIXME 4505 rp = _edje_entry_imf_default_focused_rp_get(ed);
4491 //rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat));
4492 rp = _edje_focused_part_get(ed, "default");
4493 if (!rp) return EINA_FALSE; 4506 if (!rp) return EINA_FALSE;
4494 if ((rp->type != EDJE_RP_TYPE_TEXT) || 4507 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4495 (!rp->typedata.text)) return EINA_FALSE; 4508 (!rp->typedata.text)) return EINA_FALSE;
@@ -4567,9 +4580,7 @@ _edje_entry_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED,
4567 char *commit_str = event_info; 4580 char *commit_str = event_info;
4568 Edje_Entry_Change_Info *info = NULL; 4581 Edje_Entry_Change_Info *info = NULL;
4569 4582
4570 // FIXME 4583 rp = _edje_entry_imf_default_focused_rp_get(ed);
4571 //rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat));
4572 rp = _edje_focused_part_get(ed, "default");
4573 if ((!rp)) return; 4584 if ((!rp)) return;
4574 if ((rp->type != EDJE_RP_TYPE_TEXT) || 4585 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4575 (!rp->typedata.text)) return; 4586 (!rp->typedata.text)) return;
@@ -4669,9 +4680,7 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA
4669 Eina_Strbuf *buf; 4680 Eina_Strbuf *buf;
4670 Eina_Strbuf *preedit_attr_str; 4681 Eina_Strbuf *preedit_attr_str;
4671 4682
4672 // FIXME 4683 rp = _edje_entry_imf_default_focused_rp_get(ed);
4673 //rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat));
4674 rp = _edje_focused_part_get(ed, "default");
4675 if ((!rp)) return; 4684 if ((!rp)) return;
4676 4685
4677 if ((rp->type != EDJE_RP_TYPE_TEXT) || 4686 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
@@ -4821,9 +4830,7 @@ _edje_entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx E
4821 int cursor_pos; 4830 int cursor_pos;
4822 int start, end; 4831 int start, end;
4823 4832
4824 // FIXME 4833 rp = _edje_entry_imf_default_focused_rp_get(ed);
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; 4834 if ((!rp)) return;
4828 if ((!rp) || (!ev)) return; 4835 if ((!rp) || (!ev)) return;
4829 if ((rp->type != EDJE_RP_TYPE_TEXT) || 4836 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
@@ -4880,9 +4887,7 @@ _edje_entry_imf_event_selection_set_cb(void *data, Ecore_IMF_Context *ctx EINA_U
4880 Entry *en = NULL; 4887 Entry *en = NULL;
4881 Ecore_IMF_Event_Selection *ev = event_info; 4888 Ecore_IMF_Event_Selection *ev = event_info;
4882 4889
4883 // FIXME 4890 rp = _edje_entry_imf_default_focused_rp_get(ed);
4884 //rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat));
4885 rp = _edje_focused_part_get(ed, "default");
4886 if ((!rp) || (!ev)) return; 4891 if ((!rp) || (!ev)) return;
4887 if ((rp->type != EDJE_RP_TYPE_TEXT) || 4892 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4888 (!rp->typedata.text)) return; 4893 (!rp->typedata.text)) return;
@@ -4917,9 +4922,7 @@ _edje_entry_imf_retrieve_selection_cb(void *data, Ecore_IMF_Context *ctx EINA_UN
4917 Entry *en = NULL; 4922 Entry *en = NULL;
4918 const char *selection_text = NULL; 4923 const char *selection_text = NULL;
4919 4924
4920 // FIXME 4925 rp = _edje_entry_imf_default_focused_rp_get(ed);
4921 //rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat));
4922 rp = _edje_focused_part_get(ed, "default");
4923 if (!rp) return EINA_FALSE; 4926 if (!rp) return EINA_FALSE;
4924 if ((rp->type != EDJE_RP_TYPE_TEXT) || 4927 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4925 (!rp->typedata.text)) return EINA_FALSE; 4928 (!rp->typedata.text)) return EINA_FALSE;
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index 214f3e83b2..d3b9f20db3 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -507,6 +507,102 @@ _edje_physics_world_update_cb(void *data, EPhysics_World *world EINA_UNUSED, voi
507} 507}
508#endif 508#endif
509 509
510static void
511_edje_device_add(Edje *ed, Efl_Input_Device *dev)
512{
513 Edje_Seat *s, *seat = NULL;
514 Eina_Stringshare *name;
515 char sig[256];
516 Eina_List *l;
517
518 ed->seats_count++;
519 name = eina_stringshare_printf("seat%i", ed->seats_count);
520 EINA_SAFETY_ON_NULL_RETURN(name);
521
522 EINA_LIST_FOREACH(ed->seats, l, s)
523 {
524 if (s->name != name)
525 continue;
526 seat = s;
527 break;
528 }
529
530 if (!seat)
531 {
532 seat = calloc(1, sizeof(Edje_Seat));
533 EINA_SAFETY_ON_NULL_GOTO(seat, seat_err);
534 ed->seats = eina_list_append(ed->seats, seat);
535 seat->name = eina_stringshare_ref(name);
536 }
537
538 seat->device = dev;
539 snprintf(sig, sizeof(sig), "seat,added,%s,%s", seat->name,
540 efl_input_device_name_get(dev));
541 _edje_emit(ed, sig, "");
542
543seat_err:
544 eina_stringshare_del(name);
545}
546
547static void
548_edje_device_added_cb(void *data, const Efl_Event *event)
549{
550 Efl_Input_Device *dev = event->info;
551 Edje *ed = data;
552
553 if (efl_input_device_type_get(dev) != EFL_INPUT_DEVICE_CLASS_SEAT)
554 return;
555
556 _edje_device_add(ed, dev);
557}
558
559static void
560_edje_device_removed_cb(void *data, const Efl_Event *event)
561{
562 Efl_Input_Device *dev = event->info;
563 Edje_Seat *s, *seat = NULL;
564 Edje *ed = data;
565 char sig[256];
566 Eina_List *l;
567
568 if (efl_input_device_type_get(dev) != EFL_INPUT_DEVICE_CLASS_SEAT)
569 return;
570
571 EINA_LIST_FOREACH(ed->seats, l, s)
572 {
573 if (s->device != dev)
574 continue;
575 seat = s;
576 break;
577 }
578
579 /* It shouldn't happen. New seats are always registered. */
580 EINA_SAFETY_ON_NULL_RETURN(seat);
581
582 seat->device = NULL;
583 snprintf(sig, sizeof(sig), "seat,removed,%s", seat->name);
584 _edje_emit(ed, sig, "");
585}
586
587static void
588_edje_devices_add(Edje *ed, Evas *tev)
589{
590 const Eina_List *devices, *l;
591 Efl_Input_Device *dev;
592
593 devices = evas_device_list(tev, NULL);
594 EINA_LIST_FOREACH(devices, l, dev)
595 {
596 if (efl_input_device_type_get(dev) == EFL_INPUT_DEVICE_CLASS_SEAT)
597 _edje_device_add(ed, dev);
598 }
599
600 efl_event_callback_add(tev, EFL_CANVAS_EVENT_DEVICE_ADDED,
601 _edje_device_added_cb, ed);
602 efl_event_callback_add(tev, EFL_CANVAS_EVENT_DEVICE_REMOVED,
603 _edje_device_removed_cb, ed);
604}
605
510int 606int
511_edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const char *group, const char *parent, Eina_List *group_path, Eina_Array *nested) 607_edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const char *group, const char *parent, Eina_List *group_path, Eina_Array *nested)
512{ 608{
@@ -627,6 +723,9 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
627 ERR("Edje compiled without support to physics."); 723 ERR("Edje compiled without support to physics.");
628#endif 724#endif
629 725
726 /* handle multiseat stuff */
727 _edje_devices_add(ed, tev);
728
630 /* colorclass stuff */ 729 /* colorclass stuff */
631 for (i = 0; i < ed->collection->parts_count; ++i) 730 for (i = 0; i < ed->collection->parts_count; ++i)
632 { 731 {
@@ -1599,7 +1698,15 @@ _edje_file_del(Edje *ed)
1599 1698
1600 ed->groups = eina_list_free(ed->groups); 1699 ed->groups = eina_list_free(ed->groups);
1601 1700
1602 if (tev) evas_event_freeze(tev); 1701 if (tev)
1702 {
1703 efl_event_callback_del(tev, EFL_CANVAS_EVENT_DEVICE_ADDED,
1704 _edje_device_added_cb, ed);
1705 efl_event_callback_del(tev, EFL_CANVAS_EVENT_DEVICE_REMOVED,
1706 _edje_device_removed_cb, ed);
1707 evas_event_freeze(tev);
1708 }
1709
1603 if (ed->freeze_calc) 1710 if (ed->freeze_calc)
1604 { 1711 {
1605 _edje_util_freeze_calc_list = eina_list_remove(_edje_util_freeze_calc_list, ed); 1712 _edje_util_freeze_calc_list = eina_list_remove(_edje_util_freeze_calc_list, ed);
@@ -1809,14 +1916,14 @@ _edje_file_del(Edje *ed)
1809 } 1916 }
1810 } 1917 }
1811 1918
1812 if (ed->focused_parts) 1919 if (ed->seats)
1813 { 1920 {
1814 Edje_Focused_Part *focused_part; 1921 Edje_Seat *seat;
1815 1922
1816 EINA_LIST_FREE(ed->focused_parts, focused_part) 1923 EINA_LIST_FREE(ed->seats, seat)
1817 { 1924 {
1818 free(focused_part->seat); 1925 eina_stringshare_del(seat->name);
1819 free(focused_part); 1926 free(seat);
1820 } 1927 }
1821 } 1928 }
1822 1929
diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo
index 35ce01ef40..4cfded612d 100644
--- a/src/lib/edje/edje_object.eo
+++ b/src/lib/edje/edje_object.eo
@@ -2066,6 +2066,40 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
2066 part: string; [[The part name]] 2066 part: string; [[The part name]]
2067 } 2067 }
2068 } 2068 }
2069 @property seat {
2070 get {
2071 [[Return the seat device given its Edje's name.
2072
2073 Edje references seats by a name that differs from Evas.
2074 Edje naming follows a incrementional convention: first
2075 registered name is "seat1", second is "seat2", differently
2076 from Evas.
2077
2078 @since 1.19]]
2079
2080 return: Efl.Input.Device; [[The seat device or $null if not found.]]
2081 }
2082 keys {
2083 name: stringshare; [[The name's character string.]]
2084 }
2085 }
2086 @property seat_name {
2087 get {
2088 [[Get the name given to a set by Edje.
2089
2090 Edje references seats by a name that differs from Evas.
2091 Edje naming follows a incrementional convention: first
2092 registered name is "seat1", second is "seat2", differently
2093 from Evas.
2094
2095 @since 1.19]]
2096
2097 return: stringshare; [[The name's character string or $null if not found.]]
2098 }
2099 keys {
2100 device: Efl.Input.Device; [[The seat device]]
2101 }
2102 }
2069 } 2103 }
2070 implements { 2104 implements {
2071 Efl.Gfx.visible.set; 2105 Efl.Gfx.visible.set;
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index feafaa98e7..d98f324f23 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -1661,7 +1661,7 @@ struct _Edje
1661 Edje_Var_Pool *var_pool; 1661 Edje_Var_Pool *var_pool;
1662 /* for faster lookups to avoid nth list walks */ 1662 /* for faster lookups to avoid nth list walks */
1663 Edje_Real_Part **table_parts; 1663 Edje_Real_Part **table_parts;
1664 Eina_List *focused_parts; 1664 Eina_List *seats;
1665 Eina_List *subobjs; 1665 Eina_List *subobjs;
1666 Eina_List *text_insert_filter_callbacks; 1666 Eina_List *text_insert_filter_callbacks;
1667 Eina_List *markup_filter_callbacks; 1667 Eina_List *markup_filter_callbacks;
@@ -1719,6 +1719,8 @@ struct _Edje
1719 unsigned short block; 1719 unsigned short block;
1720 unsigned short state; 1720 unsigned short state;
1721 1721
1722 unsigned short seats_count;
1723
1722 unsigned char load_error; 1724 unsigned char load_error;
1723 1725
1724 Eina_Bool is_rtl : 1; 1726 Eina_Bool is_rtl : 1;
@@ -2275,11 +2277,12 @@ struct _Edje_Font
2275 char *file; 2277 char *file;
2276}; 2278};
2277 2279
2278typedef struct _Edje_Focused_Part Edje_Focused_Part; 2280typedef struct _Edje_Seat Edje_Seat;
2279struct _Edje_Focused_Part 2281struct _Edje_Seat
2280{ 2282{
2281 Edje_Real_Part *part; 2283 Edje_Real_Part *focused_part;
2282 char *seat; 2284 Efl_Input_Device *device;
2285 Eina_Stringshare *name;
2283}; 2286};
2284 2287
2285Edje_Patterns *edje_match_collection_dir_init(const Eina_List *lst); 2288Edje_Patterns *edje_match_collection_dir_init(const Eina_List *lst);
@@ -2484,6 +2487,9 @@ void _edje_signals_sources_patterns_clean(Edje_Signals_Sources_Patterns *ssp);
2484void _edje_focused_part_set(Edje *ed, const char *seat_name, Edje_Real_Part *rp); 2487void _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); 2488Edje_Real_Part *_edje_focused_part_get(Edje *ed, const char *seat_name);
2486 2489
2490Eina_Stringshare *_edje_seat_name_get(Edje *ed, Efl_Input_Device *device);
2491Efl_Input_Device *_edje_seat_get(Edje *ed, Eina_Stringshare *name);
2492
2487const Edje_Signals_Sources_Patterns *_edje_signal_callback_patterns_ref(const Edje_Signal_Callback_Group *gp); 2493const Edje_Signals_Sources_Patterns *_edje_signal_callback_patterns_ref(const Edje_Signal_Callback_Group *gp);
2488void _edje_signal_callback_patterns_unref(const Edje_Signals_Sources_Patterns *essp); 2494void _edje_signal_callback_patterns_unref(const Edje_Signals_Sources_Patterns *essp);
2489void _edje_signal_callback_reset(Edje_Signal_Callback_Flags *flags, unsigned int length); 2495void _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 f2c4f4cc7e..3cc0d2d873 100644
--- a/src/lib/edje/edje_program.c
+++ b/src/lib/edje/edje_program.c
@@ -177,6 +177,18 @@ _edje_emit_send(Edje *ed, Eina_Bool broadcast, const char *sig, const char *src,
177* API * 177* API *
178*============================================================================*/ 178*============================================================================*/
179 179
180EOLIAN Eina_Stringshare*
181_edje_object_seat_name_get(Eo *obj EINA_UNUSED, Edje *ed, Efl_Input_Device *device)
182{
183 return _edje_seat_name_get(ed, device);
184}
185
186EOLIAN Efl_Input_Device *
187_edje_object_seat_get(Eo *obj EINA_UNUSED, Edje *ed, Eina_Stringshare *name)
188{
189 return _edje_seat_get(ed, name);
190}
191
180EAPI void 192EAPI void
181edje_frametime_set(double t) 193edje_frametime_set(double t)
182{ 194{
@@ -959,19 +971,22 @@ low_mem_current:
959 case EDJE_ACTION_TYPE_FOCUS_SET: 971 case EDJE_ACTION_TYPE_FOCUS_SET:
960 { 972 {
961 Edje_Real_Part *focused_part; 973 Edje_Real_Part *focused_part;
962 const char *seat_name; 974 Eina_Stringshare *seat_name;
975 Eina_Bool unref_name = EINA_FALSE;
963 976
964 /* TODO : use edje custom seat naming */
965 if (pr->seat) 977 if (pr->seat)
966 seat_name = pr->seat; 978 {
967 else 979 seat_name = eina_stringshare_add(pr->seat);
980 unref_name = EINA_TRUE;
981 }
982 else /* Use default seat name */
968 { 983 {
969 Efl_Input_Device *seat; 984 Efl_Input_Device *seat;
970 Evas *e; 985 Evas *e;
971 986
972 e = evas_object_evas_get(ed->obj); 987 e = evas_object_evas_get(ed->obj);
973 seat = evas_canvas_default_device_get(e, EFL_INPUT_DEVICE_CLASS_SEAT); 988 seat = evas_canvas_default_device_get(e, EFL_INPUT_DEVICE_CLASS_SEAT);
974 seat_name = evas_device_name_get(seat); 989 seat_name = _edje_seat_name_get(ed, seat);
975 if (!seat_name) 990 if (!seat_name)
976 break; 991 break;
977 } 992 }
@@ -1010,6 +1025,9 @@ low_mem_current:
1010 } 1025 }
1011 } 1026 }
1012 } 1027 }
1028
1029 if (unref_name)
1030 eina_stringshare_del(seat_name);
1013 } 1031 }
1014 break; 1032 break;
1015 1033
@@ -1264,7 +1282,7 @@ _edje_seat_emit(Edje *ed, Efl_Input_Device *dev, const char *sig, const char *sr
1264 seat = efl_input_device_seat_get(dev); 1282 seat = efl_input_device_seat_get(dev);
1265 if (!seat) return; 1283 if (!seat) return;
1266 1284
1267 snprintf(buf, sizeof(buf), "%s,%s", sig, efl_input_device_name_get(seat)); 1285 snprintf(buf, sizeof(buf), "%s,%s", sig, _edje_seat_name_get(ed, seat));
1268 _edje_emit_full(ed, buf, src, NULL, NULL); 1286 _edje_emit_full(ed, buf, src, NULL, NULL);
1269} 1287}
1270 1288
@@ -1307,44 +1325,71 @@ _edje_emit_full(Edje *ed, const char *sig, const char *src, void *data, void (*f
1307} 1325}
1308 1326
1309void 1327void
1310_edje_focused_part_set(Edje *ed, const char *seat_name, Edje_Real_Part *rp) 1328_edje_focused_part_set(Edje *ed, Eina_Stringshare *seat_name, Edje_Real_Part *rp)
1311{ 1329{
1312 Edje_Focused_Part *focused_part; 1330 Edje_Seat *seat;
1313 Eina_List *l; 1331 Eina_List *l;
1314 1332
1315 EINA_LIST_FOREACH(ed->focused_parts, l, focused_part) 1333 EINA_LIST_FOREACH(ed->seats, l, seat)
1316 { 1334 {
1317 if (!strcmp(seat_name, focused_part->seat)) 1335 if (seat_name == seat->name)
1318 { 1336 {
1319 focused_part->part = rp; 1337 seat->focused_part = rp;
1320 return; 1338 return;
1321 } 1339 }
1322 } 1340 }
1323 1341
1324 focused_part = calloc(1, sizeof(Edje_Focused_Part)); 1342 /* A part to be set for a seat not yet announced by Evas */
1325 EINA_SAFETY_ON_NULL_RETURN(focused_part); 1343 seat = calloc(1, sizeof(Edje_Seat));
1344 EINA_SAFETY_ON_NULL_RETURN(seat);
1345
1346 seat->name = eina_stringshare_ref(seat_name);
1347 seat->focused_part = rp;
1348 ed->seats = eina_list_append(ed->seats, seat);
1349
1350 return;
1351}
1352
1353Edje_Real_Part *
1354_edje_focused_part_get(Edje *ed, Eina_Stringshare *seat_name)
1355{
1356 Edje_Seat *seat;
1357 Eina_List *l;
1358
1359 EINA_LIST_FOREACH(ed->seats, l, seat)
1360 {
1361 if (seat_name == seat->name)
1362 return seat->focused_part;
1363 }
1364
1365 return NULL;
1366}
1367
1368Eina_Stringshare*
1369_edje_seat_name_get(Edje *ed, Efl_Input_Device *device)
1370{
1371 Edje_Seat *seat;
1372 Eina_List *l;
1326 1373
1327 focused_part->seat = strdup(seat_name); 1374 EINA_LIST_FOREACH(ed->seats, l, seat)
1328 if (!focused_part->seat)
1329 { 1375 {
1330 free(focused_part); 1376 if (seat->device == device)
1331 return; 1377 return seat->name;
1332 } 1378 }
1333 1379
1334 focused_part->part = rp; 1380 return NULL;
1335 ed->focused_parts = eina_list_append(ed->focused_parts, focused_part);
1336} 1381}
1337 1382
1338Edje_Real_Part * 1383Efl_Input_Device *
1339_edje_focused_part_get(Edje *ed, const char *seat_name) 1384_edje_seat_get(Edje *ed, Eina_Stringshare *name)
1340{ 1385{
1341 Edje_Focused_Part *focused_part; 1386 Edje_Seat *seat;
1342 Eina_List *l; 1387 Eina_List *l;
1343 1388
1344 EINA_LIST_FOREACH(ed->focused_parts, l, focused_part) 1389 EINA_LIST_FOREACH(ed->seats, l, seat)
1345 { 1390 {
1346 if (!strcmp(seat_name, focused_part->seat)) 1391 if (seat->name == name)
1347 return focused_part->part; 1392 return seat->device;
1348 } 1393 }
1349 1394
1350 return NULL; 1395 return NULL;