summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2017-06-12 11:41:25 -0700
committerCedric Bail <cedric@osg.samsung.com>2017-06-12 11:41:25 -0700
commitf69686ba4023c7ddd83ea38000e8fa0c61818365 (patch)
tree685a932d5466bb0037f6fa73fb7c17831c33ea2a
parentd1a5df70558a792791d04091ff14feef60ea3bae (diff)
evas: put events related pointer into a cow to reduce evas_object fat.
-rw-r--r--src/lib/evas/canvas/efl_canvas_object_event_grabber.c85
-rw-r--r--src/lib/evas/canvas/evas_callbacks.c4
-rw-r--r--src/lib/evas/canvas/evas_events.c4
-rw-r--r--src/lib/evas/canvas/evas_focus.c18
-rw-r--r--src/lib/evas/canvas/evas_object_main.c84
-rw-r--r--src/lib/evas/include/evas_private.h32
6 files changed, 147 insertions, 80 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_object_event_grabber.c b/src/lib/evas/canvas/efl_canvas_object_event_grabber.c
index 12d882d..30d3f88 100644
--- a/src/lib/evas/canvas/efl_canvas_object_event_grabber.c
+++ b/src/lib/evas/canvas/efl_canvas_object_event_grabber.c
@@ -31,7 +31,7 @@ _efl_canvas_object_event_grabber_efl_canvas_group_group_iterator_next(Efl_Object
31 31
32 if (!eina_clist_next(it->head, it->current)) return EINA_FALSE; 32 if (!eina_clist_next(it->head, it->current)) return EINA_FALSE;
33 33
34 obj = EINA_CLIST_ENTRY(eina_clist_head(it->current), Evas_Object_Protected_Data, event.member); 34 obj = EINA_CLIST_ENTRY(eina_clist_head(it->current), Evas_Object_Protected_Data, events->event.member);
35 if (data) *data = obj->object; 35 if (data) *data = obj->object;
36 36
37 it->current = eina_clist_next(it->head, it->current); 37 it->current = eina_clist_next(it->head, it->current);
@@ -100,6 +100,14 @@ _stacking_verify(Efl_Object_Event_Grabber_Data *pd, Evas_Object_Protected_Data *
100} 100}
101 101
102static void 102static void
103_child_add_after(Evas_Object_Protected_Data *a, Evas_Object_Events_Data *events)
104{
105 EINA_COW_WRITE_BEGIN(evas_object_events_cow, a->events, Evas_Object_Events_Data, evs)
106 eina_clist_add_after(&evs->event.member, &events->event.member);
107 EINA_COW_WRITE_END(evas_object_events_cow, a->events, evs);
108}
109
110static void
103_child_insert(Efl_Object_Event_Grabber_Data *pd, Evas_Object_Protected_Data *obj) 111_child_insert(Efl_Object_Event_Grabber_Data *pd, Evas_Object_Protected_Data *obj)
104{ 112{
105 Evas_Object_Protected_Data *a, *i; 113 Evas_Object_Protected_Data *a, *i;
@@ -107,38 +115,44 @@ _child_insert(Efl_Object_Event_Grabber_Data *pd, Evas_Object_Protected_Data *obj
107 if (eina_clist_empty(&pd->contained)) 115 if (eina_clist_empty(&pd->contained))
108 { 116 {
109 /* pd->rect case */ 117 /* pd->rect case */
110 eina_clist_add_head(&pd->contained, &obj->event.member); 118 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events)
119 eina_clist_add_head(&pd->contained, &events->event.member);
120 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
111 return; 121 return;
112 } 122 }
113 123
114 if (pd->vis) _stacking_verify(pd, obj); 124 if (pd->vis) _stacking_verify(pd, obj);
115 EINA_CLIST_FOR_EACH_ENTRY_REV(a, &pd->contained, Evas_Object_Protected_Data, event.member) 125 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events)
116 { 126 {
117 if (a->object == pd->rect) 127 EINA_CLIST_FOR_EACH_ENTRY_REV(a, &pd->contained, Evas_Object_Protected_Data, events->event.member)
118 {
119 eina_clist_add_after(&a->event.member, &obj->event.member);
120 return;
121 }
122 if (a->layer->layer > obj->layer->layer) continue;
123 if (a->layer->layer < obj->layer->layer)
124 {
125 eina_clist_add_after(&a->event.member, &obj->event.member);
126 return;
127 }
128 EINA_INLIST_FOREACH(EINA_INLIST_GET(a->layer->objects), i)
129 { 128 {
130 if (a == i) 129 if (a->object == pd->rect)
131 { 130 {
132 eina_clist_add_after(&a->event.member, &obj->event.member); 131 _child_add_after(a, events);
133 return; 132 return;
134 } 133 }
135 if (obj == i) 134 if (a->layer->layer > obj->layer->layer) continue;
135 if (a->layer->layer < obj->layer->layer)
136 { 136 {
137 eina_clist_add_before(&a->event.member, &obj->event.member); 137 _child_add_after(a, events);
138 return; 138 return;
139 } 139 }
140 EINA_INLIST_FOREACH(EINA_INLIST_GET(a->layer->objects), i)
141 {
142 if (a == i)
143 {
144 _child_add_after(a, events);
145 return;
146 }
147 if (obj == i)
148 {
149 _child_add_after(a, events);
150 return;
151 }
152 }
140 } 153 }
141 } 154 }
155 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
142} 156}
143 157
144static void 158static void
@@ -147,7 +161,10 @@ _efl_canvas_object_event_grabber_child_restack(void *data, const Efl_Event *even
147 Efl_Object_Event_Grabber_Data *pd = data; 161 Efl_Object_Event_Grabber_Data *pd = data;
148 Evas_Object_Protected_Data *obj = efl_data_scope_get(event->object, EFL_CANVAS_OBJECT_CLASS); 162 Evas_Object_Protected_Data *obj = efl_data_scope_get(event->object, EFL_CANVAS_OBJECT_CLASS);
149 163
150 eina_clist_remove(&obj->event.member); 164 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events)
165 eina_clist_remove(&events->event.member);
166 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
167
151 _child_insert(pd, obj); 168 _child_insert(pd, obj);
152} 169}
153 170
@@ -197,10 +214,12 @@ _efl_canvas_object_event_grabber_efl_canvas_group_group_member_add(Eo *eo_obj, E
197 return; 214 return;
198 } 215 }
199 } 216 }
200 if (obj->event.parent == eo_obj) return; 217 if (obj->events->event.parent == eo_obj) return;
201 218
202 if (obj->smart.parent || obj->event.parent) evas_object_smart_member_del(member); 219 if (obj->smart.parent || obj->events->event.parent) evas_object_smart_member_del(member);
203 obj->event.parent = eo_obj; 220 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events)
221 events->event.parent = eo_obj;
222 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
204 _child_insert(pd, obj); 223 _child_insert(pd, obj);
205 efl_event_callback_add(member, EFL_EVENT_DEL, _efl_canvas_object_event_grabber_child_del, pd); 224 efl_event_callback_add(member, EFL_EVENT_DEL, _efl_canvas_object_event_grabber_child_del, pd);
206 if (member != pd->rect) 225 if (member != pd->rect)
@@ -214,8 +233,12 @@ _efl_canvas_object_event_grabber_efl_canvas_group_group_member_del(Eo *eo_obj EI
214 233
215 efl_event_callback_del(member, EFL_EVENT_DEL, _efl_canvas_object_event_grabber_child_del, pd); 234 efl_event_callback_del(member, EFL_EVENT_DEL, _efl_canvas_object_event_grabber_child_del, pd);
216 efl_event_callback_del(member, EFL_GFX_EVENT_RESTACK, _efl_canvas_object_event_grabber_child_restack, pd); 235 efl_event_callback_del(member, EFL_GFX_EVENT_RESTACK, _efl_canvas_object_event_grabber_child_restack, pd);
217 eina_clist_remove(&obj->event.member); 236 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events)
218 obj->event.parent = NULL; 237 {
238 eina_clist_remove(&events->event.member);
239 events->event.parent = NULL;
240 }
241 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
219} 242}
220 243
221EOLIAN static void 244EOLIAN static void
@@ -263,7 +286,7 @@ _efl_canvas_object_event_grabber_efl_gfx_visible_set(Eo *eo_obj EINA_UNUSED, Efl
263 { 286 {
264 Evas_Object_Protected_Data *obj; 287 Evas_Object_Protected_Data *obj;
265 288
266 EINA_CLIST_FOR_EACH_ENTRY(obj, &pd->contained, Evas_Object_Protected_Data, event.member) 289 EINA_CLIST_FOR_EACH_ENTRY(obj, &pd->contained, Evas_Object_Protected_Data, events->event.member)
267 if (obj->object != pd->rect) _stacking_verify(pd, obj); 290 if (obj->object != pd->rect) _stacking_verify(pd, obj);
268 } 291 }
269 pd->vis = !!set; 292 pd->vis = !!set;
@@ -287,11 +310,13 @@ _efl_canvas_object_event_grabber_restack(void *data, const Efl_Event *event)
287 evas_object_layer_set(pd->rect, evas_object_layer_get(event->object)); 310 evas_object_layer_set(pd->rect, evas_object_layer_get(event->object));
288 evas_object_stack_below(pd->rect, event->object); 311 evas_object_stack_below(pd->rect, event->object);
289 312
290 EINA_CLIST_FOR_EACH_ENTRY_SAFE(obj, nobj, &pd->contained, Evas_Object_Protected_Data, event.member) 313 EINA_CLIST_FOR_EACH_ENTRY_SAFE(obj, nobj, &pd->contained, Evas_Object_Protected_Data, events->event.member)
291 { 314 {
292 if (obj->object == pd->rect) continue; 315 if (obj->object == pd->rect) continue;
293 list = eina_list_append(list, obj); 316 list = eina_list_append(list, obj);
294 eina_clist_remove(&obj->event.member); 317 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events)
318 eina_clist_remove(&events->event.member);
319 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
295 } 320 }
296 EINA_LIST_FREE(list, obj) 321 EINA_LIST_FREE(list, obj)
297 _child_insert(pd, obj); 322 _child_insert(pd, obj);
@@ -301,7 +326,7 @@ EOLIAN static Eo *
301_efl_canvas_object_event_grabber_efl_object_constructor(Eo *eo_obj, Efl_Object_Event_Grabber_Data *pd) 326_efl_canvas_object_event_grabber_efl_object_constructor(Eo *eo_obj, Efl_Object_Event_Grabber_Data *pd)
302{ 327{
303 Evas_Object_Protected_Data *obj; 328 Evas_Object_Protected_Data *obj;
304 329
305 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); 330 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
306 efl_canvas_object_type_set(eo_obj, MY_CLASS_NAME_LEGACY); 331 efl_canvas_object_type_set(eo_obj, MY_CLASS_NAME_LEGACY);
307 obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 332 obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
@@ -321,7 +346,7 @@ EOLIAN static void
321_efl_canvas_object_event_grabber_efl_object_destructor(Eo *eo_obj, Efl_Object_Event_Grabber_Data *pd) 346_efl_canvas_object_event_grabber_efl_object_destructor(Eo *eo_obj, Efl_Object_Event_Grabber_Data *pd)
322{ 347{
323 Evas_Object_Protected_Data *obj, *nobj; 348 Evas_Object_Protected_Data *obj, *nobj;
324 EINA_CLIST_FOR_EACH_ENTRY_SAFE(obj, nobj, &pd->contained, Evas_Object_Protected_Data, event.member) 349 EINA_CLIST_FOR_EACH_ENTRY_SAFE(obj, nobj, &pd->contained, Evas_Object_Protected_Data, events->event.member)
325 efl_canvas_group_member_del(eo_obj, obj->object); 350 efl_canvas_group_member_del(eo_obj, obj->object);
326 efl_canvas_group_del(eo_obj); 351 efl_canvas_group_del(eo_obj);
327 efl_destructor(efl_super(eo_obj, MY_CLASS)); 352 efl_destructor(efl_super(eo_obj, MY_CLASS));
diff --git a/src/lib/evas/canvas/evas_callbacks.c b/src/lib/evas/canvas/evas_callbacks.c
index 822baa2..35cc834 100644
--- a/src/lib/evas/canvas/evas_callbacks.c
+++ b/src/lib/evas/canvas/evas_callbacks.c
@@ -436,13 +436,13 @@ evas_object_event_callback_call(Evas_Object *eo_obj, Evas_Object_Protected_Data
436nothing_here: 436nothing_here:
437 if (!obj->no_propagate) 437 if (!obj->no_propagate)
438 { 438 {
439 if ((obj->smart.parent || obj->event.parent) && (type != EVAS_CALLBACK_FREE) && 439 if ((obj->smart.parent || obj->events->event.parent) && (type != EVAS_CALLBACK_FREE) &&
440 (type <= EVAS_CALLBACK_KEY_UP)) 440 (type <= EVAS_CALLBACK_KEY_UP))
441 { 441 {
442 Evas_Object_Protected_Data *parent_obj; 442 Evas_Object_Protected_Data *parent_obj;
443 Eo *parent; 443 Eo *parent;
444 444
445 parent = obj->event.parent ?: obj->smart.parent; 445 parent = obj->events->event.parent ?: obj->smart.parent;
446 parent_obj = efl_data_scope_get(parent, EFL_CANVAS_OBJECT_CLASS); 446 parent_obj = efl_data_scope_get(parent, EFL_CANVAS_OBJECT_CLASS);
447 evas_object_event_callback_call(parent, parent_obj, type, event_info, event_id, efl_event_desc); 447 evas_object_event_callback_call(parent, parent_obj, type, event_info, event_id, efl_event_desc);
448 } 448 }
diff --git a/src/lib/evas/canvas/evas_events.c b/src/lib/evas/canvas/evas_events.c
index a97129d..222169b 100644
--- a/src/lib/evas/canvas/evas_events.c
+++ b/src/lib/evas/canvas/evas_events.c
@@ -387,7 +387,7 @@ _evas_event_object_list_raw_in_get(Evas *eo_e, Eina_List *in,
387 obj; 387 obj;
388 obj = _EINA_INLIST_CONTAINER(obj, EINA_INLIST_GET(obj)->prev)) 388 obj = _EINA_INLIST_CONTAINER(obj, EINA_INLIST_GET(obj)->prev))
389 { 389 {
390 if (obj->event.parent) continue; 390 if (obj->events->event.parent) continue;
391 in = _evas_event_object_list_raw_in_get_single(eo_e, obj, in, stop, x, y, no_rep, source 391 in = _evas_event_object_list_raw_in_get_single(eo_e, obj, in, stop, x, y, no_rep, source
392#ifdef DDD_DO 392#ifdef DDD_DO
393 ,&spaces 393 ,&spaces
@@ -398,7 +398,7 @@ _evas_event_object_list_raw_in_get(Evas *eo_e, Eina_List *in,
398 } 398 }
399 else 399 else
400 { 400 {
401 EINA_CLIST_FOR_EACH_ENTRY_SAFE_REV(obj, nobj, clist, Evas_Object_Protected_Data, event.member) 401 EINA_CLIST_FOR_EACH_ENTRY_SAFE_REV(obj, nobj, clist, Evas_Object_Protected_Data, events->event.member)
402 { 402 {
403 in = _evas_event_object_list_raw_in_get_single(eo_e, obj, in, stop, x, y, no_rep, source 403 in = _evas_event_object_list_raw_in_get_single(eo_e, obj, in, stop, x, y, no_rep, source
404#ifdef DDD_DO 404#ifdef DDD_DO
diff --git a/src/lib/evas/canvas/evas_focus.c b/src/lib/evas/canvas/evas_focus.c
index 0b79bf9..6ea934a 100644
--- a/src/lib/evas/canvas/evas_focus.c
+++ b/src/lib/evas/canvas/evas_focus.c
@@ -106,7 +106,10 @@ _evas_object_unfocus(Evas_Object_Protected_Data *obj, Efl_Input_Device *seat)
106{ 106{
107 int event_id = _evas_event_counter; 107 int event_id = _evas_event_counter;
108 108
109 obj->focused_by_seats = eina_list_remove(obj->focused_by_seats, seat); 109 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events)
110 events->focused_by_seats = eina_list_remove(events->focused_by_seats, seat);
111 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
112
110 _evas_focus_set(obj->object, seat, EINA_FALSE); 113 _evas_focus_set(obj->object, seat, EINA_FALSE);
111 _evas_focus_dispatch_event(obj, seat, EINA_FALSE); 114 _evas_focus_dispatch_event(obj, seat, EINA_FALSE);
112 _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas, event_id); 115 _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas, event_id);
@@ -138,7 +141,7 @@ _efl_canvas_object_seat_focus_del(Eo *eo_obj,
138 obj->layer->evas->pending_default_focus_obj = NULL; 141 obj->layer->evas->pending_default_focus_obj = NULL;
139 } 142 }
140 143
141 EINA_LIST_FOREACH(obj->focused_by_seats, l, dev) 144 EINA_LIST_FOREACH(obj->events->focused_by_seats, l, dev)
142 { 145 {
143 if (dev != seat) 146 if (dev != seat)
144 continue; 147 continue;
@@ -184,7 +187,7 @@ _efl_canvas_object_seat_focus_add(Eo *eo_obj,
184 if (!efl_input_seat_event_filter_get(eo_obj, seat)) 187 if (!efl_input_seat_event_filter_get(eo_obj, seat))
185 return EINA_FALSE; 188 return EINA_FALSE;
186 189
187 if (_already_focused(obj->focused_by_seats, seat)) 190 if (_already_focused(obj->events->focused_by_seats, seat))
188 goto end; 191 goto end;
189 192
190 if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_FOCUS_SET, 193 if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_FOCUS_SET,
@@ -202,7 +205,10 @@ _efl_canvas_object_seat_focus_add(Eo *eo_obj,
202 205
203 efl_event_callback_add(seat, EFL_EVENT_DEL, _evas_focus_device_del_cb, obj); 206 efl_event_callback_add(seat, EFL_EVENT_DEL, _evas_focus_device_del_cb, obj);
204 207
205 obj->focused_by_seats = eina_list_append(obj->focused_by_seats, seat); 208 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events)
209 events->focused_by_seats = eina_list_append(events->focused_by_seats, seat);
210 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
211
206 _evas_focus_set(eo_obj, seat, EINA_TRUE); 212 _evas_focus_set(eo_obj, seat, EINA_TRUE);
207 213
208 _evas_focus_dispatch_event(obj, seat, EINA_TRUE); 214 _evas_focus_dispatch_event(obj, seat, EINA_TRUE);
@@ -225,7 +231,7 @@ _efl_canvas_object_seat_focus_check(Eo *eo_obj,
225 231
226 if (!seat) seat = _default_seat_get(eo_obj); 232 if (!seat) seat = _default_seat_get(eo_obj);
227 233
228 EINA_LIST_FOREACH(obj->focused_by_seats, l, s) 234 EINA_LIST_FOREACH(obj->events->focused_by_seats, l, s)
229 { 235 {
230 if (s == seat) 236 if (s == seat)
231 return EINA_TRUE; 237 return EINA_TRUE;
@@ -253,7 +259,7 @@ _efl_canvas_object_seat_focus_get(Eo *eo_obj, Evas_Object_Protected_Data *obj)
253 return EINA_FALSE; 259 return EINA_FALSE;
254 MAGIC_CHECK_END(); 260 MAGIC_CHECK_END();
255 261
256 return eina_list_count(obj->focused_by_seats) ? EINA_TRUE : EINA_FALSE; 262 return eina_list_count(obj->events->focused_by_seats) ? EINA_TRUE : EINA_FALSE;
257} 263}
258 264
259EOLIAN Eina_Bool 265EOLIAN Eina_Bool
diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c
index 9a5ccdd..b1547b6 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -35,12 +35,16 @@ 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};
38 41
39Eina_Cow *evas_object_proxy_cow = NULL; 42Eina_Cow *evas_object_proxy_cow = NULL;
40Eina_Cow *evas_object_map_cow = NULL; 43Eina_Cow *evas_object_map_cow = NULL;
41Eina_Cow *evas_object_state_cow = NULL; 44Eina_Cow *evas_object_state_cow = NULL;
42Eina_Cow *evas_object_3d_cow = NULL; 45Eina_Cow *evas_object_3d_cow = NULL;
43Eina_Cow *evas_object_mask_cow = NULL; 46Eina_Cow *evas_object_mask_cow = NULL;
47Eina_Cow *evas_object_events_cow = NULL;
44 48
45static Eina_Bool 49static Eina_Bool
46_init_cow(void) 50_init_cow(void)
@@ -52,21 +56,24 @@ _init_cow(void)
52 evas_object_state_cow = eina_cow_add("Evas Object State", sizeof (Evas_Object_Protected_State), 64, &default_state, EINA_FALSE); 56 evas_object_state_cow = eina_cow_add("Evas Object State", sizeof (Evas_Object_Protected_State), 64, &default_state, EINA_FALSE);
53 evas_object_3d_cow = eina_cow_add("Evas Object 3D", sizeof (Evas_Object_3D_Data), 8, &default_proxy, EINA_TRUE); 57 evas_object_3d_cow = eina_cow_add("Evas Object 3D", sizeof (Evas_Object_3D_Data), 8, &default_proxy, EINA_TRUE);
54 evas_object_mask_cow = eina_cow_add("Evas Mask Data", sizeof (Evas_Object_Mask_Data), 8, &default_mask, EINA_TRUE); 58 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);
55 60
56 if (!(evas_object_map_cow && evas_object_proxy_cow && evas_object_state_cow && 61 if (!(evas_object_map_cow && evas_object_proxy_cow && evas_object_state_cow &&
57 evas_object_3d_cow && evas_object_mask_cow)) 62 evas_object_3d_cow && evas_object_mask_cow && evas_object_events_cow))
58 { 63 {
59 eina_cow_del(evas_object_proxy_cow); 64 eina_cow_del(evas_object_proxy_cow);
60 eina_cow_del(evas_object_map_cow); 65 eina_cow_del(evas_object_map_cow);
61 eina_cow_del(evas_object_state_cow); 66 eina_cow_del(evas_object_state_cow);
62 eina_cow_del(evas_object_3d_cow); 67 eina_cow_del(evas_object_3d_cow);
63 eina_cow_del(evas_object_mask_cow); 68 eina_cow_del(evas_object_mask_cow);
69 eina_cow_del(evas_object_events_cow);
64 70
65 evas_object_proxy_cow = NULL; 71 evas_object_proxy_cow = NULL;
66 evas_object_map_cow = NULL; 72 evas_object_map_cow = NULL;
67 evas_object_state_cow = NULL; 73 evas_object_state_cow = NULL;
68 evas_object_3d_cow = NULL; 74 evas_object_3d_cow = NULL;
69 evas_object_mask_cow = NULL; 75 evas_object_mask_cow = NULL;
76 evas_object_events_cow = NULL;
70 77
71 return EINA_FALSE; 78 return EINA_FALSE;
72 } 79 }
@@ -80,7 +87,7 @@ _evas_object_pointer_data_find(Evas_Object_Protected_Data *obj,
80{ 87{
81 Evas_Object_Pointer_Data *pdata; 88 Evas_Object_Pointer_Data *pdata;
82 89
83 EINA_INLIST_FOREACH(obj->pointer_grabs, pdata) 90 EINA_INLIST_FOREACH(obj->events->pointer_grabs, pdata)
84 { 91 {
85 if (pdata->evas_pdata->pointer == pointer) 92 if (pdata->evas_pdata->pointer == pointer)
86 return pdata; 93 return pdata;
@@ -113,8 +120,10 @@ _evas_object_pointer_grab_del(Evas_Object_Protected_Data *obj,
113 pdata->evas_pdata->seat->object.in = eina_list_remove(pdata->evas_pdata->seat->object.in, obj->object); 120 pdata->evas_pdata->seat->object.in = eina_list_remove(pdata->evas_pdata->seat->object.in, obj->object);
114 efl_event_callback_del(pdata->evas_pdata->pointer, EFL_EVENT_DEL, 121 efl_event_callback_del(pdata->evas_pdata->pointer, EFL_EVENT_DEL,
115 _evas_device_del_cb, obj); 122 _evas_device_del_cb, obj);
116 obj->pointer_grabs = eina_inlist_remove(obj->pointer_grabs, 123 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events)
117 EINA_INLIST_GET(pdata)); 124 events->pointer_grabs = eina_inlist_remove(events->pointer_grabs, EINA_INLIST_GET(pdata));
125 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
126
118 free(pdata); 127 free(pdata);
119} 128}
120 129
@@ -128,8 +137,11 @@ _evas_object_pointer_data_add(Evas_Pointer_Data *evas_pdata,
128 EINA_SAFETY_ON_NULL_RETURN_VAL(pdata, NULL); 137 EINA_SAFETY_ON_NULL_RETURN_VAL(pdata, NULL);
129 pdata->pointer_mode = EVAS_OBJECT_POINTER_MODE_AUTOGRAB; 138 pdata->pointer_mode = EVAS_OBJECT_POINTER_MODE_AUTOGRAB;
130 pdata->evas_pdata = evas_pdata; 139 pdata->evas_pdata = evas_pdata;
131 obj->pointer_grabs = eina_inlist_append(obj->pointer_grabs, 140 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events)
132 EINA_INLIST_GET(pdata)); 141 events->pointer_grabs = eina_inlist_append(events->pointer_grabs,
142 EINA_INLIST_GET(pdata));
143 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
144
133 efl_event_callback_priority_add(evas_pdata->pointer, EFL_EVENT_DEL, 145 efl_event_callback_priority_add(evas_pdata->pointer, EFL_EVENT_DEL,
134 EFL_CALLBACK_PRIORITY_BEFORE, 146 EFL_CALLBACK_PRIORITY_BEFORE,
135 _evas_device_del_cb, obj); 147 _evas_device_del_cb, obj);
@@ -177,6 +189,7 @@ _efl_canvas_object_efl_object_constructor(Eo *eo_obj, Evas_Object_Protected_Data
177 obj->prev = eina_cow_alloc(evas_object_state_cow); 189 obj->prev = eina_cow_alloc(evas_object_state_cow);
178 obj->data_3d = eina_cow_alloc(evas_object_3d_cow); 190 obj->data_3d = eina_cow_alloc(evas_object_3d_cow);
179 obj->mask = eina_cow_alloc(evas_object_mask_cow); 191 obj->mask = eina_cow_alloc(evas_object_mask_cow);
192 obj->events = eina_cow_alloc(evas_object_events_cow);
180 193
181 evas_object_inject(eo_obj, obj, evas); 194 evas_object_inject(eo_obj, obj, evas);
182 evas_object_callback_init(eo_obj, obj); 195 evas_object_callback_init(eo_obj, obj);
@@ -891,7 +904,7 @@ _efl_canvas_object_efl_input_interface_seat_event_filter_get(Eo *eo_obj EINA_UNU
891 //It means this object accept events from any seat. 904 //It means this object accept events from any seat.
892 if (!obj->events_filter_enabled) 905 if (!obj->events_filter_enabled)
893 return EINA_TRUE; 906 return EINA_TRUE;
894 return eina_list_data_find(obj->events_whitelist, seat) ? 907 return eina_list_data_find(obj->events->events_whitelist, seat) ?
895 EINA_TRUE : EINA_FALSE; 908 EINA_TRUE : EINA_FALSE;
896} 909}
897 910
@@ -899,8 +912,11 @@ static void
899_whitelist_events_device_remove_cb(void *data, const Efl_Event *event) 912_whitelist_events_device_remove_cb(void *data, const Efl_Event *event)
900{ 913{
901 Evas_Object_Protected_Data *obj = data; 914 Evas_Object_Protected_Data *obj = data;
902 obj->events_whitelist = eina_list_remove(obj->events_whitelist, 915
903 event->object); 916 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events)
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);
904} 920}
905 921
906EOLIAN static void 922EOLIAN static void
@@ -916,10 +932,10 @@ _efl_canvas_object_efl_input_interface_seat_event_filter_set(Eo *eo_obj,
916 obj->events_filter_enabled = EINA_TRUE; 932 obj->events_filter_enabled = EINA_TRUE;
917 if (add) 933 if (add)
918 { 934 {
919 if (eina_list_data_find(obj->events_whitelist, seat)) return; 935 if (eina_list_data_find(obj->events->events_whitelist, seat)) return;
920 /* remove all previously focused seats, if any - it may happen 936 /* remove all previously focused seats, if any - it may happen
921 since there wasn't a whitelist in place (no restrictions) */ 937 since there wasn't a whitelist in place (no restrictions) */
922 if ((!obj->events_whitelist) && (obj->layer) && (obj->layer->evas)) 938 if ((!obj->events->events_whitelist) && (obj->layer) && (obj->layer->evas))
923 { 939 {
924 const Eina_List *devices, *l; 940 const Eina_List *devices, *l;
925 Efl_Input_Device *dev; 941 Efl_Input_Device *dev;
@@ -932,14 +948,20 @@ _efl_canvas_object_efl_input_interface_seat_event_filter_set(Eo *eo_obj,
932 efl_canvas_object_seat_focus_del(eo_obj, dev); 948 efl_canvas_object_seat_focus_del(eo_obj, dev);
933 } 949 }
934 } 950 }
935 obj->events_whitelist = eina_list_append(obj->events_whitelist, seat); 951 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events)
952 events->events_whitelist = eina_list_append(events->events_whitelist, seat);
953 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
954
936 efl_event_callback_add(seat, EFL_EVENT_DEL, 955 efl_event_callback_add(seat, EFL_EVENT_DEL,
937 _whitelist_events_device_remove_cb, obj); 956 _whitelist_events_device_remove_cb, obj);
938 } 957 }
939 else 958 else
940 { 959 {
941 efl_canvas_object_seat_focus_del(eo_obj, seat); 960 efl_canvas_object_seat_focus_del(eo_obj, seat);
942 obj->events_whitelist = eina_list_remove(obj->events_whitelist, seat); 961 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events)
962 events->events_whitelist = eina_list_remove(events->events_whitelist, seat);
963 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
964
943 efl_event_callback_del(seat, EFL_EVENT_DEL, 965 efl_event_callback_del(seat, EFL_EVENT_DEL,
944 _whitelist_events_device_remove_cb, obj); 966 _whitelist_events_device_remove_cb, obj);
945 } 967 }
@@ -1010,24 +1032,30 @@ _efl_canvas_object_efl_object_destructor(Eo *eo_obj, Evas_Object_Protected_Data
1010 1032
1011 edata = efl_data_scope_get(evas_object_evas_get(eo_obj), EVAS_CANVAS_CLASS); 1033 edata = efl_data_scope_get(evas_object_evas_get(eo_obj), EVAS_CANVAS_CLASS);
1012 evas_object_hide(eo_obj); 1034 evas_object_hide(eo_obj);
1013 EINA_LIST_FREE (obj->focused_by_seats, dev) 1035
1014 { 1036 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events)
1015 event_id = _evas_event_counter; 1037 {
1016 efl_event_callback_del(dev, EFL_EVENT_DEL, 1038 EINA_LIST_FREE (events->focused_by_seats, dev)
1017 _evas_focus_device_del_cb, obj); 1039 {
1018 eina_hash_del_by_key(edata->focused_objects, &dev); 1040 event_id = _evas_event_counter;
1019 _evas_focus_dispatch_event(obj, dev, EINA_FALSE); 1041 efl_event_callback_del(dev, EFL_EVENT_DEL,
1020 if ((obj->layer) && (obj->layer->evas)) 1042 _evas_focus_device_del_cb, obj);
1021 _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas, event_id); 1043 eina_hash_del_by_key(edata->focused_objects, &dev);
1022 } 1044 _evas_focus_dispatch_event(obj, dev, EINA_FALSE);
1023 EINA_INLIST_FREE(obj->pointer_grabs, pdata) 1045 if ((obj->layer) && (obj->layer->evas))
1024 _evas_object_pointer_grab_del(obj, pdata); 1046 _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas, event_id);
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
1025 event_id = _evas_object_event_new(); 1055 event_id = _evas_object_event_new();
1026 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_DEL, NULL, event_id, NULL); 1056 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_DEL, NULL, event_id, NULL);
1027 if ((obj->layer) && (obj->layer->evas)) 1057 if ((obj->layer) && (obj->layer->evas))
1028 _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas, event_id); 1058 _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);
1031 if (obj->name) evas_object_name_set(eo_obj, NULL); 1059 if (obj->name) evas_object_name_set(eo_obj, NULL);
1032 if (obj->layer) 1060 if (obj->layer)
1033 { 1061 {
@@ -1737,7 +1765,7 @@ _hide(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
1737 { 1765 {
1738 Evas_Object_Pointer_Data *obj_pdata; 1766 Evas_Object_Pointer_Data *obj_pdata;
1739 1767
1740 EINA_INLIST_FOREACH(obj->pointer_grabs, obj_pdata) 1768 EINA_INLIST_FOREACH(obj->events->pointer_grabs, obj_pdata)
1741 { 1769 {
1742 if (!obj_pdata->mouse_grabbed && 1770 if (!obj_pdata->mouse_grabbed &&
1743 evas_object_is_in_output_rect(eo_obj, obj, obj_pdata->evas_pdata->seat->x, 1771 evas_object_is_in_output_rect(eo_obj, obj, obj_pdata->evas_pdata->seat->x,
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index fea6c3a..50333f0 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -86,6 +86,7 @@ typedef struct _Evas_Post_Callback Evas_Post_Callback;
86typedef struct _Evas_Coord_Touch_Point Evas_Coord_Touch_Point; 86typedef struct _Evas_Coord_Touch_Point Evas_Coord_Touch_Point;
87typedef struct _Evas_Object_Proxy_Data Evas_Object_Proxy_Data; 87typedef struct _Evas_Object_Proxy_Data Evas_Object_Proxy_Data;
88typedef struct _Evas_Object_Map_Data Evas_Object_Map_Data; 88typedef struct _Evas_Object_Map_Data Evas_Object_Map_Data;
89typedef struct _Evas_Object_Events_Data Evas_Object_Events_Data;
89typedef struct _Evas_Proxy_Render_Data Evas_Proxy_Render_Data; 90typedef struct _Evas_Proxy_Render_Data Evas_Proxy_Render_Data;
90typedef struct _Evas_Object_3D_Data Evas_Object_3D_Data; 91typedef struct _Evas_Object_3D_Data Evas_Object_3D_Data;
91typedef struct _Evas_Object_Mask_Data Evas_Object_Mask_Data; 92typedef struct _Evas_Object_Mask_Data Evas_Object_Mask_Data;
@@ -1093,6 +1094,23 @@ struct _Evas_Object_Mask_Data
1093 Eina_Bool is_scaled : 1; 1094 Eina_Bool is_scaled : 1;
1094}; 1095};
1095 1096
1097struct _Evas_Object_Events_Data
1098{
1099 /*
1100 The list below contain the seats (Efl.Input.Devices) which this
1101 object allows events to be reported (Mouse, Keybord and focus events).
1102 */
1103 Eina_List *events_whitelist;
1104
1105 Eina_List *focused_by_seats;
1106 Eina_Inlist *pointer_grabs;
1107
1108 struct {
1109 Evas_Object *parent;
1110 Eina_Clist member;
1111 } event;
1112};
1113
1096struct _Evas_Object_Protected_State 1114struct _Evas_Object_Protected_State
1097{ 1115{
1098 Evas_Object_Protected_Data *clipper; 1116 Evas_Object_Protected_Data *clipper;
@@ -1148,11 +1166,6 @@ struct _Evas_Object_Protected_Data
1148 Eina_List *grabs; 1166 Eina_List *grabs;
1149 1167
1150 Eina_Inlist *callbacks; 1168 Eina_Inlist *callbacks;
1151 /*
1152 The list below contain the seats (Efl.Input.Devices) which this
1153 object allows events to be reported (Mouse, Keybord and focus events).
1154 */
1155 Eina_List *events_whitelist;
1156 1169
1157 struct { 1170 struct {
1158 Eina_List *clipees; 1171 Eina_List *clipees;
@@ -1171,18 +1184,12 @@ struct _Evas_Object_Protected_Data
1171 Evas_Object_Protected_Data *parent_object_data; 1184 Evas_Object_Protected_Data *parent_object_data;
1172 } smart; 1185 } smart;
1173 1186
1174 struct {
1175 Evas_Object *parent;
1176 Eina_Clist member;
1177 } event;
1178
1179 // Eina_Cow pointer be careful when writing to it 1187 // Eina_Cow pointer be careful when writing to it
1180 const Evas_Object_Proxy_Data *proxy; 1188 const Evas_Object_Proxy_Data *proxy;
1181 const Evas_Object_Map_Data *map; 1189 const Evas_Object_Map_Data *map;
1182 const Evas_Object_3D_Data *data_3d; 1190 const Evas_Object_3D_Data *data_3d;
1183 const Evas_Object_Mask_Data *mask; 1191 const Evas_Object_Mask_Data *mask;
1184 Eina_List *focused_by_seats; 1192 const Evas_Object_Events_Data *events;
1185 Eina_Inlist *pointer_grabs;
1186 1193
1187 // Pointer to the Evas_Object itself 1194 // Pointer to the Evas_Object itself
1188 Evas_Object *object; 1195 Evas_Object *object;
@@ -2078,6 +2085,7 @@ extern Eina_Cow *evas_object_image_pixels_cow;
2078extern Eina_Cow *evas_object_image_load_opts_cow; 2085extern Eina_Cow *evas_object_image_load_opts_cow;
2079extern Eina_Cow *evas_object_image_state_cow; 2086extern Eina_Cow *evas_object_image_state_cow;
2080extern Eina_Cow *evas_object_mask_cow; 2087extern Eina_Cow *evas_object_mask_cow;
2088extern Eina_Cow *evas_object_events_cow;
2081 2089
2082# define EINA_COW_STATE_WRITE_BEGIN(Obj, Write, State) \ 2090# define EINA_COW_STATE_WRITE_BEGIN(Obj, Write, State) \
2083 EINA_COW_WRITE_BEGIN(evas_object_state_cow, Obj->State, \ 2091 EINA_COW_WRITE_BEGIN(evas_object_state_cow, Obj->State, \