summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_object_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/evas/canvas/evas_object_main.c')
-rw-r--r--src/lib/evas/canvas/evas_object_main.c84
1 files changed, 28 insertions, 56 deletions
diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c
index b1547b6..9a5ccdd 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -35,16 +35,12 @@ static const Evas_Object_Protected_State default_state = {
35static const Evas_Object_Mask_Data default_mask = { 35static const Evas_Object_Mask_Data default_mask = {
36 NULL, 0, 0, EINA_FALSE, EINA_FALSE, EINA_FALSE, EINA_FALSE 36 NULL, 0, 0, EINA_FALSE, EINA_FALSE, EINA_FALSE, EINA_FALSE
37}; 37};
38static const Evas_Object_Events_Data default_events = {
39 NULL, NULL, NULL, { NULL, { 0 } }
40};
41 38
42Eina_Cow *evas_object_proxy_cow = NULL; 39Eina_Cow *evas_object_proxy_cow = NULL;
43Eina_Cow *evas_object_map_cow = NULL; 40Eina_Cow *evas_object_map_cow = NULL;
44Eina_Cow *evas_object_state_cow = NULL; 41Eina_Cow *evas_object_state_cow = NULL;
45Eina_Cow *evas_object_3d_cow = NULL; 42Eina_Cow *evas_object_3d_cow = NULL;
46Eina_Cow *evas_object_mask_cow = NULL; 43Eina_Cow *evas_object_mask_cow = NULL;
47Eina_Cow *evas_object_events_cow = NULL;
48 44
49static Eina_Bool 45static Eina_Bool
50_init_cow(void) 46_init_cow(void)
@@ -56,24 +52,21 @@ _init_cow(void)
56 evas_object_state_cow = eina_cow_add("Evas Object State", sizeof (Evas_Object_Protected_State), 64, &default_state, EINA_FALSE); 52 evas_object_state_cow = eina_cow_add("Evas Object State", sizeof (Evas_Object_Protected_State), 64, &default_state, EINA_FALSE);
57 evas_object_3d_cow = eina_cow_add("Evas Object 3D", sizeof (Evas_Object_3D_Data), 8, &default_proxy, EINA_TRUE); 53 evas_object_3d_cow = eina_cow_add("Evas Object 3D", sizeof (Evas_Object_3D_Data), 8, &default_proxy, EINA_TRUE);
58 evas_object_mask_cow = eina_cow_add("Evas Mask Data", sizeof (Evas_Object_Mask_Data), 8, &default_mask, EINA_TRUE); 54 evas_object_mask_cow = eina_cow_add("Evas Mask Data", sizeof (Evas_Object_Mask_Data), 8, &default_mask, EINA_TRUE);
59 evas_object_events_cow = eina_cow_add("Evas Events Data", sizeof (Evas_Object_Events_Data), 8, &default_events, EINA_TRUE);
60 55
61 if (!(evas_object_map_cow && evas_object_proxy_cow && evas_object_state_cow && 56 if (!(evas_object_map_cow && evas_object_proxy_cow && evas_object_state_cow &&
62 evas_object_3d_cow && evas_object_mask_cow && evas_object_events_cow)) 57 evas_object_3d_cow && evas_object_mask_cow))
63 { 58 {
64 eina_cow_del(evas_object_proxy_cow); 59 eina_cow_del(evas_object_proxy_cow);
65 eina_cow_del(evas_object_map_cow); 60 eina_cow_del(evas_object_map_cow);
66 eina_cow_del(evas_object_state_cow); 61 eina_cow_del(evas_object_state_cow);
67 eina_cow_del(evas_object_3d_cow); 62 eina_cow_del(evas_object_3d_cow);
68 eina_cow_del(evas_object_mask_cow); 63 eina_cow_del(evas_object_mask_cow);
69 eina_cow_del(evas_object_events_cow);
70 64
71 evas_object_proxy_cow = NULL; 65 evas_object_proxy_cow = NULL;
72 evas_object_map_cow = NULL; 66 evas_object_map_cow = NULL;
73 evas_object_state_cow = NULL; 67 evas_object_state_cow = NULL;
74 evas_object_3d_cow = NULL; 68 evas_object_3d_cow = NULL;
75 evas_object_mask_cow = NULL; 69 evas_object_mask_cow = NULL;
76 evas_object_events_cow = NULL;
77 70
78 return EINA_FALSE; 71 return EINA_FALSE;
79 } 72 }
@@ -87,7 +80,7 @@ _evas_object_pointer_data_find(Evas_Object_Protected_Data *obj,
87{ 80{
88 Evas_Object_Pointer_Data *pdata; 81 Evas_Object_Pointer_Data *pdata;
89 82
90 EINA_INLIST_FOREACH(obj->events->pointer_grabs, pdata) 83 EINA_INLIST_FOREACH(obj->pointer_grabs, pdata)
91 { 84 {
92 if (pdata->evas_pdata->pointer == pointer) 85 if (pdata->evas_pdata->pointer == pointer)
93 return pdata; 86 return pdata;
@@ -120,10 +113,8 @@ _evas_object_pointer_grab_del(Evas_Object_Protected_Data *obj,
120 pdata->evas_pdata->seat->object.in = eina_list_remove(pdata->evas_pdata->seat->object.in, obj->object); 113 pdata->evas_pdata->seat->object.in = eina_list_remove(pdata->evas_pdata->seat->object.in, obj->object);
121 efl_event_callback_del(pdata->evas_pdata->pointer, EFL_EVENT_DEL, 114 efl_event_callback_del(pdata->evas_pdata->pointer, EFL_EVENT_DEL,
122 _evas_device_del_cb, obj); 115 _evas_device_del_cb, obj);
123 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events) 116 obj->pointer_grabs = eina_inlist_remove(obj->pointer_grabs,
124 events->pointer_grabs = eina_inlist_remove(events->pointer_grabs, EINA_INLIST_GET(pdata)); 117 EINA_INLIST_GET(pdata));
125 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
126
127 free(pdata); 118 free(pdata);
128} 119}
129 120
@@ -137,11 +128,8 @@ _evas_object_pointer_data_add(Evas_Pointer_Data *evas_pdata,
137 EINA_SAFETY_ON_NULL_RETURN_VAL(pdata, NULL); 128 EINA_SAFETY_ON_NULL_RETURN_VAL(pdata, NULL);
138 pdata->pointer_mode = EVAS_OBJECT_POINTER_MODE_AUTOGRAB; 129 pdata->pointer_mode = EVAS_OBJECT_POINTER_MODE_AUTOGRAB;
139 pdata->evas_pdata = evas_pdata; 130 pdata->evas_pdata = evas_pdata;
140 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events) 131 obj->pointer_grabs = eina_inlist_append(obj->pointer_grabs,
141 events->pointer_grabs = eina_inlist_append(events->pointer_grabs, 132 EINA_INLIST_GET(pdata));
142 EINA_INLIST_GET(pdata));
143 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
144
145 efl_event_callback_priority_add(evas_pdata->pointer, EFL_EVENT_DEL, 133 efl_event_callback_priority_add(evas_pdata->pointer, EFL_EVENT_DEL,
146 EFL_CALLBACK_PRIORITY_BEFORE, 134 EFL_CALLBACK_PRIORITY_BEFORE,
147 _evas_device_del_cb, obj); 135 _evas_device_del_cb, obj);
@@ -189,7 +177,6 @@ _efl_canvas_object_efl_object_constructor(Eo *eo_obj, Evas_Object_Protected_Data
189 obj->prev = eina_cow_alloc(evas_object_state_cow); 177 obj->prev = eina_cow_alloc(evas_object_state_cow);
190 obj->data_3d = eina_cow_alloc(evas_object_3d_cow); 178 obj->data_3d = eina_cow_alloc(evas_object_3d_cow);
191 obj->mask = eina_cow_alloc(evas_object_mask_cow); 179 obj->mask = eina_cow_alloc(evas_object_mask_cow);
192 obj->events = eina_cow_alloc(evas_object_events_cow);
193 180
194 evas_object_inject(eo_obj, obj, evas); 181 evas_object_inject(eo_obj, obj, evas);
195 evas_object_callback_init(eo_obj, obj); 182 evas_object_callback_init(eo_obj, obj);
@@ -904,7 +891,7 @@ _efl_canvas_object_efl_input_interface_seat_event_filter_get(Eo *eo_obj EINA_UNU
904 //It means this object accept events from any seat. 891 //It means this object accept events from any seat.
905 if (!obj->events_filter_enabled) 892 if (!obj->events_filter_enabled)
906 return EINA_TRUE; 893 return EINA_TRUE;
907 return eina_list_data_find(obj->events->events_whitelist, seat) ? 894 return eina_list_data_find(obj->events_whitelist, seat) ?
908 EINA_TRUE : EINA_FALSE; 895 EINA_TRUE : EINA_FALSE;
909} 896}
910 897
@@ -912,11 +899,8 @@ static void
912_whitelist_events_device_remove_cb(void *data, const Efl_Event *event) 899_whitelist_events_device_remove_cb(void *data, const Efl_Event *event)
913{ 900{
914 Evas_Object_Protected_Data *obj = data; 901 Evas_Object_Protected_Data *obj = data;
915 902 obj->events_whitelist = eina_list_remove(obj->events_whitelist,
916 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events) 903 event->object);
917 events->events_whitelist = eina_list_remove(events->events_whitelist,
918 event->object);
919 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
920} 904}
921 905
922EOLIAN static void 906EOLIAN static void
@@ -932,10 +916,10 @@ _efl_canvas_object_efl_input_interface_seat_event_filter_set(Eo *eo_obj,
932 obj->events_filter_enabled = EINA_TRUE; 916 obj->events_filter_enabled = EINA_TRUE;
933 if (add) 917 if (add)
934 { 918 {
935 if (eina_list_data_find(obj->events->events_whitelist, seat)) return; 919 if (eina_list_data_find(obj->events_whitelist, seat)) return;
936 /* remove all previously focused seats, if any - it may happen 920 /* remove all previously focused seats, if any - it may happen
937 since there wasn't a whitelist in place (no restrictions) */ 921 since there wasn't a whitelist in place (no restrictions) */
938 if ((!obj->events->events_whitelist) && (obj->layer) && (obj->layer->evas)) 922 if ((!obj->events_whitelist) && (obj->layer) && (obj->layer->evas))
939 { 923 {
940 const Eina_List *devices, *l; 924 const Eina_List *devices, *l;
941 Efl_Input_Device *dev; 925 Efl_Input_Device *dev;
@@ -948,20 +932,14 @@ _efl_canvas_object_efl_input_interface_seat_event_filter_set(Eo *eo_obj,
948 efl_canvas_object_seat_focus_del(eo_obj, dev); 932 efl_canvas_object_seat_focus_del(eo_obj, dev);
949 } 933 }
950 } 934 }
951 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events) 935 obj->events_whitelist = eina_list_append(obj->events_whitelist, seat);
952 events->events_whitelist = eina_list_append(events->events_whitelist, seat);
953 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
954
955 efl_event_callback_add(seat, EFL_EVENT_DEL, 936 efl_event_callback_add(seat, EFL_EVENT_DEL,
956 _whitelist_events_device_remove_cb, obj); 937 _whitelist_events_device_remove_cb, obj);
957 } 938 }
958 else 939 else
959 { 940 {
960 efl_canvas_object_seat_focus_del(eo_obj, seat); 941 efl_canvas_object_seat_focus_del(eo_obj, seat);
961 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events) 942 obj->events_whitelist = eina_list_remove(obj->events_whitelist, seat);
962 events->events_whitelist = eina_list_remove(events->events_whitelist, seat);
963 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
964
965 efl_event_callback_del(seat, EFL_EVENT_DEL, 943 efl_event_callback_del(seat, EFL_EVENT_DEL,
966 _whitelist_events_device_remove_cb, obj); 944 _whitelist_events_device_remove_cb, obj);
967 } 945 }
@@ -1032,30 +1010,24 @@ _efl_canvas_object_efl_object_destructor(Eo *eo_obj, Evas_Object_Protected_Data
1032 1010
1033 edata = efl_data_scope_get(evas_object_evas_get(eo_obj), EVAS_CANVAS_CLASS); 1011 edata = efl_data_scope_get(evas_object_evas_get(eo_obj), EVAS_CANVAS_CLASS);
1034 evas_object_hide(eo_obj); 1012 evas_object_hide(eo_obj);
1035 1013 EINA_LIST_FREE (obj->focused_by_seats, dev)
1036 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events) 1014 {
1037 { 1015 event_id = _evas_event_counter;
1038 EINA_LIST_FREE (events->focused_by_seats, dev) 1016 efl_event_callback_del(dev, EFL_EVENT_DEL,
1039 { 1017 _evas_focus_device_del_cb, obj);
1040 event_id = _evas_event_counter; 1018 eina_hash_del_by_key(edata->focused_objects, &dev);
1041 efl_event_callback_del(dev, EFL_EVENT_DEL, 1019 _evas_focus_dispatch_event(obj, dev, EINA_FALSE);
1042 _evas_focus_device_del_cb, obj); 1020 if ((obj->layer) && (obj->layer->evas))
1043 eina_hash_del_by_key(edata->focused_objects, &dev); 1021 _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas, event_id);
1044 _evas_focus_dispatch_event(obj, dev, EINA_FALSE); 1022 }
1045 if ((obj->layer) && (obj->layer->evas)) 1023 EINA_INLIST_FREE(obj->pointer_grabs, pdata)
1046 _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas, event_id); 1024 _evas_object_pointer_grab_del(obj, pdata);
1047 }
1048 EINA_INLIST_FREE(events->pointer_grabs, pdata)
1049 _evas_object_pointer_grab_del(obj, pdata);
1050 EINA_LIST_FREE(events->events_whitelist, dev)
1051 efl_event_callback_del(dev, EFL_EVENT_DEL, _whitelist_events_device_remove_cb, obj);
1052 }
1053 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
1054
1055 event_id = _evas_object_event_new(); 1025 event_id = _evas_object_event_new();
1056 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_DEL, NULL, event_id, NULL); 1026 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_DEL, NULL, event_id, NULL);
1057 if ((obj->layer) && (obj->layer->evas)) 1027 if ((obj->layer) && (obj->layer->evas))
1058 _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas, event_id); 1028 _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas, event_id);
1029 EINA_LIST_FREE(obj->events_whitelist, dev)
1030 efl_event_callback_del(dev, EFL_EVENT_DEL, _whitelist_events_device_remove_cb, obj);
1059 if (obj->name) evas_object_name_set(eo_obj, NULL); 1031 if (obj->name) evas_object_name_set(eo_obj, NULL);
1060 if (obj->layer) 1032 if (obj->layer)
1061 { 1033 {
@@ -1765,7 +1737,7 @@ _hide(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
1765 { 1737 {
1766 Evas_Object_Pointer_Data *obj_pdata; 1738 Evas_Object_Pointer_Data *obj_pdata;
1767 1739
1768 EINA_INLIST_FOREACH(obj->events->pointer_grabs, obj_pdata) 1740 EINA_INLIST_FOREACH(obj->pointer_grabs, obj_pdata)
1769 { 1741 {
1770 if (!obj_pdata->mouse_grabbed && 1742 if (!obj_pdata->mouse_grabbed &&
1771 evas_object_is_in_output_rect(eo_obj, obj, obj_pdata->evas_pdata->seat->x, 1743 evas_object_is_in_output_rect(eo_obj, obj, obj_pdata->evas_pdata->seat->x,