summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/efl_canvas_object_event_grabber.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/evas/canvas/efl_canvas_object_event_grabber.c')
-rw-r--r--src/lib/evas/canvas/efl_canvas_object_event_grabber.c85
1 files changed, 30 insertions, 55 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 30d3f88..12d882d 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, events->event.member); 34 obj = EINA_CLIST_ENTRY(eina_clist_head(it->current), Evas_Object_Protected_Data, 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,14 +100,6 @@ _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
111_child_insert(Efl_Object_Event_Grabber_Data *pd, Evas_Object_Protected_Data *obj) 103_child_insert(Efl_Object_Event_Grabber_Data *pd, Evas_Object_Protected_Data *obj)
112{ 104{
113 Evas_Object_Protected_Data *a, *i; 105 Evas_Object_Protected_Data *a, *i;
@@ -115,44 +107,38 @@ _child_insert(Efl_Object_Event_Grabber_Data *pd, Evas_Object_Protected_Data *obj
115 if (eina_clist_empty(&pd->contained)) 107 if (eina_clist_empty(&pd->contained))
116 { 108 {
117 /* pd->rect case */ 109 /* pd->rect case */
118 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events) 110 eina_clist_add_head(&pd->contained, &obj->event.member);
119 eina_clist_add_head(&pd->contained, &events->event.member);
120 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
121 return; 111 return;
122 } 112 }
123 113
124 if (pd->vis) _stacking_verify(pd, obj); 114 if (pd->vis) _stacking_verify(pd, obj);
125 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events) 115 EINA_CLIST_FOR_EACH_ENTRY_REV(a, &pd->contained, Evas_Object_Protected_Data, event.member)
126 { 116 {
127 EINA_CLIST_FOR_EACH_ENTRY_REV(a, &pd->contained, Evas_Object_Protected_Data, events->event.member) 117 if (a->object == pd->rect)
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)
128 { 129 {
129 if (a->object == pd->rect) 130 if (a == i)
130 { 131 {
131 _child_add_after(a, events); 132 eina_clist_add_after(&a->event.member, &obj->event.member);
132 return; 133 return;
133 } 134 }
134 if (a->layer->layer > obj->layer->layer) continue; 135 if (obj == i)
135 if (a->layer->layer < obj->layer->layer)
136 { 136 {
137 _child_add_after(a, events); 137 eina_clist_add_before(&a->event.member, &obj->event.member);
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 }
153 } 140 }
154 } 141 }
155 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
156} 142}
157 143
158static void 144static void
@@ -161,10 +147,7 @@ _efl_canvas_object_event_grabber_child_restack(void *data, const Efl_Event *even
161 Efl_Object_Event_Grabber_Data *pd = data; 147 Efl_Object_Event_Grabber_Data *pd = data;
162 Evas_Object_Protected_Data *obj = efl_data_scope_get(event->object, EFL_CANVAS_OBJECT_CLASS); 148 Evas_Object_Protected_Data *obj = efl_data_scope_get(event->object, EFL_CANVAS_OBJECT_CLASS);
163 149
164 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events) 150 eina_clist_remove(&obj->event.member);
165 eina_clist_remove(&events->event.member);
166 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
167
168 _child_insert(pd, obj); 151 _child_insert(pd, obj);
169} 152}
170 153
@@ -214,12 +197,10 @@ _efl_canvas_object_event_grabber_efl_canvas_group_group_member_add(Eo *eo_obj, E
214 return; 197 return;
215 } 198 }
216 } 199 }
217 if (obj->events->event.parent == eo_obj) return; 200 if (obj->event.parent == eo_obj) return;
218 201
219 if (obj->smart.parent || obj->events->event.parent) evas_object_smart_member_del(member); 202 if (obj->smart.parent || obj->event.parent) evas_object_smart_member_del(member);
220 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events) 203 obj->event.parent = eo_obj;
221 events->event.parent = eo_obj;
222 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
223 _child_insert(pd, obj); 204 _child_insert(pd, obj);
224 efl_event_callback_add(member, EFL_EVENT_DEL, _efl_canvas_object_event_grabber_child_del, pd); 205 efl_event_callback_add(member, EFL_EVENT_DEL, _efl_canvas_object_event_grabber_child_del, pd);
225 if (member != pd->rect) 206 if (member != pd->rect)
@@ -233,12 +214,8 @@ _efl_canvas_object_event_grabber_efl_canvas_group_group_member_del(Eo *eo_obj EI
233 214
234 efl_event_callback_del(member, EFL_EVENT_DEL, _efl_canvas_object_event_grabber_child_del, pd); 215 efl_event_callback_del(member, EFL_EVENT_DEL, _efl_canvas_object_event_grabber_child_del, pd);
235 efl_event_callback_del(member, EFL_GFX_EVENT_RESTACK, _efl_canvas_object_event_grabber_child_restack, pd); 216 efl_event_callback_del(member, EFL_GFX_EVENT_RESTACK, _efl_canvas_object_event_grabber_child_restack, pd);
236 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events) 217 eina_clist_remove(&obj->event.member);
237 { 218 obj->event.parent = NULL;
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);
242} 219}
243 220
244EOLIAN static void 221EOLIAN static void
@@ -286,7 +263,7 @@ _efl_canvas_object_event_grabber_efl_gfx_visible_set(Eo *eo_obj EINA_UNUSED, Efl
286 { 263 {
287 Evas_Object_Protected_Data *obj; 264 Evas_Object_Protected_Data *obj;
288 265
289 EINA_CLIST_FOR_EACH_ENTRY(obj, &pd->contained, Evas_Object_Protected_Data, events->event.member) 266 EINA_CLIST_FOR_EACH_ENTRY(obj, &pd->contained, Evas_Object_Protected_Data, event.member)
290 if (obj->object != pd->rect) _stacking_verify(pd, obj); 267 if (obj->object != pd->rect) _stacking_verify(pd, obj);
291 } 268 }
292 pd->vis = !!set; 269 pd->vis = !!set;
@@ -310,13 +287,11 @@ _efl_canvas_object_event_grabber_restack(void *data, const Efl_Event *event)
310 evas_object_layer_set(pd->rect, evas_object_layer_get(event->object)); 287 evas_object_layer_set(pd->rect, evas_object_layer_get(event->object));
311 evas_object_stack_below(pd->rect, event->object); 288 evas_object_stack_below(pd->rect, event->object);
312 289
313 EINA_CLIST_FOR_EACH_ENTRY_SAFE(obj, nobj, &pd->contained, Evas_Object_Protected_Data, events->event.member) 290 EINA_CLIST_FOR_EACH_ENTRY_SAFE(obj, nobj, &pd->contained, Evas_Object_Protected_Data, event.member)
314 { 291 {
315 if (obj->object == pd->rect) continue; 292 if (obj->object == pd->rect) continue;
316 list = eina_list_append(list, obj); 293 list = eina_list_append(list, obj);
317 EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events) 294 eina_clist_remove(&obj->event.member);
318 eina_clist_remove(&events->event.member);
319 EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
320 } 295 }
321 EINA_LIST_FREE(list, obj) 296 EINA_LIST_FREE(list, obj)
322 _child_insert(pd, obj); 297 _child_insert(pd, obj);
@@ -326,7 +301,7 @@ EOLIAN static Eo *
326_efl_canvas_object_event_grabber_efl_object_constructor(Eo *eo_obj, Efl_Object_Event_Grabber_Data *pd) 301_efl_canvas_object_event_grabber_efl_object_constructor(Eo *eo_obj, Efl_Object_Event_Grabber_Data *pd)
327{ 302{
328 Evas_Object_Protected_Data *obj; 303 Evas_Object_Protected_Data *obj;
329 304
330 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); 305 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
331 efl_canvas_object_type_set(eo_obj, MY_CLASS_NAME_LEGACY); 306 efl_canvas_object_type_set(eo_obj, MY_CLASS_NAME_LEGACY);
332 obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 307 obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
@@ -346,7 +321,7 @@ EOLIAN static void
346_efl_canvas_object_event_grabber_efl_object_destructor(Eo *eo_obj, Efl_Object_Event_Grabber_Data *pd) 321_efl_canvas_object_event_grabber_efl_object_destructor(Eo *eo_obj, Efl_Object_Event_Grabber_Data *pd)
347{ 322{
348 Evas_Object_Protected_Data *obj, *nobj; 323 Evas_Object_Protected_Data *obj, *nobj;
349 EINA_CLIST_FOR_EACH_ENTRY_SAFE(obj, nobj, &pd->contained, Evas_Object_Protected_Data, events->event.member) 324 EINA_CLIST_FOR_EACH_ENTRY_SAFE(obj, nobj, &pd->contained, Evas_Object_Protected_Data, event.member)
350 efl_canvas_group_member_del(eo_obj, obj->object); 325 efl_canvas_group_member_del(eo_obj, obj->object);
351 efl_canvas_group_del(eo_obj); 326 efl_canvas_group_del(eo_obj);
352 efl_destructor(efl_super(eo_obj, MY_CLASS)); 327 efl_destructor(efl_super(eo_obj, MY_CLASS));