From 208de4897aad63e1bee6cfd6f3dcd7b3ea9a3ff8 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Thu, 27 Oct 2005 02:44:36 +0000 Subject: [PATCH] the first wave of evas smart object modes. commit hell #1. :) other things still need updating in cvs - but i am sure others can do that :) SVN revision: 18001 --- legacy/edje/src/lib/edje_container.c | 61 +---- legacy/edje/src/lib/edje_private.h | 1 - legacy/edje/src/lib/edje_smart.c | 213 +----------------- legacy/edje/src/lib/edje_text.c | 1 - legacy/edje/src/lib/edje_util.c | 2 - legacy/evas/src/lib/Evas.h | 23 +- legacy/evas/src/lib/canvas/evas_events.c | 85 +++++-- legacy/evas/src/lib/canvas/evas_layer.c | 10 +- legacy/evas/src/lib/canvas/evas_object_main.c | 14 +- .../evas/src/lib/canvas/evas_object_smart.c | 28 ++- legacy/evas/src/lib/canvas/evas_render.c | 178 +++++++++------ legacy/evas/src/lib/canvas/evas_smart.c | 37 --- legacy/evas/src/lib/canvas/evas_stack.c | 146 ++++++------ legacy/evas/src/lib/include/evas_private.h | 15 +- 14 files changed, 299 insertions(+), 515 deletions(-) diff --git a/legacy/edje/src/lib/edje_container.c b/legacy/edje/src/lib/edje_container.c index 6d4d95b6de..d32c754c52 100644 --- a/legacy/edje/src/lib/edje_container.c +++ b/legacy/edje/src/lib/edje_container.c @@ -725,11 +725,6 @@ edje_container_scroll_get(Evas_Object *obj, double *pos, double *shift) static void _smart_init(void); static void _smart_add(Evas_Object * obj); static void _smart_del(Evas_Object * obj); -static void _smart_layer_set(Evas_Object * obj, int layer); -static void _smart_raise(Evas_Object * obj); -static void _smart_lower(Evas_Object * obj); -static void _smart_stack_above(Evas_Object * obj, Evas_Object * above); -static void _smart_stack_below(Evas_Object * obj, Evas_Object * below); static void _smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y); static void _smart_resize(Evas_Object * obj, Evas_Coord w, Evas_Coord h); static void _smart_show(Evas_Object * obj); @@ -757,11 +752,7 @@ _smart_init(void) smart = evas_smart_new(E_OBJ_NAME, _smart_add, _smart_del, - _smart_layer_set, - _smart_raise, - _smart_lower, - _smart_stack_above, - _smart_stack_below, + NULL, NULL, NULL, NULL, NULL, _smart_move, _smart_resize, _smart_show, @@ -796,56 +787,6 @@ _smart_del(Evas_Object *obj) free(sd); } -static void -_smart_layer_set(Evas_Object *obj, int layer) -{ - Smart_Data *sd; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; -// evas_object_layer_set(sd->obj, layer); -} - -static void -_smart_raise(Evas_Object *obj) -{ - Smart_Data *sd; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; -// evas_object_raise(sd->obj); -} - -static void -_smart_lower(Evas_Object *obj) -{ - Smart_Data *sd; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; -// evas_object_lower(sd->obj); -} - -static void -_smart_stack_above(Evas_Object *obj, Evas_Object *above) -{ - Smart_Data *sd; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; -// evas_object_stack_above(sd->obj, above); -} - -static void -_smart_stack_below(Evas_Object *obj, Evas_Object *below) -{ - Smart_Data *sd; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; -// evas_object_stack_below(sd->obj, below); -} - static void _smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) { diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h index b1bd3cd994..38e8d7c44d 100644 --- a/legacy/edje/src/lib/edje_private.h +++ b/legacy/edje/src/lib/edje_private.h @@ -457,7 +457,6 @@ struct _Edje char *path; char *part; - int layer; Evas_Coord x, y, w, h; struct { Evas_Coord w, h; diff --git a/legacy/edje/src/lib/edje_smart.c b/legacy/edje/src/lib/edje_smart.c index bf6532012c..4b512a1d6c 100644 --- a/legacy/edje/src/lib/edje_smart.c +++ b/legacy/edje/src/lib/edje_smart.c @@ -3,13 +3,6 @@ static void _edje_smart_add(Evas_Object * obj); static void _edje_smart_del(Evas_Object * obj); -static void _edje_smart_layer_set(Evas_Object * obj, int layer); -static void _edje_smart_raise(Evas_Object * obj); -static void _edje_smart_lower(Evas_Object * obj); -static void _edje_smart_stack_above(Evas_Object * obj, Evas_Object * above); -static void _edje_smart_stack_below(Evas_Object * obj, Evas_Object * below); -static Evas_Object *_edje_smart_above_get(Evas_Object * obj); -static Evas_Object *_edje_smart_below_get(Evas_Object * obj); static void _edje_smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y); static void _edje_smart_resize(Evas_Object * obj, Evas_Coord w, Evas_Coord h); static void _edje_smart_show(Evas_Object * obj); @@ -39,11 +32,7 @@ edje_object_add(Evas *evas) _edje_smart = evas_smart_new("edje", _edje_smart_add, _edje_smart_del, - _edje_smart_layer_set, - _edje_smart_raise, - _edje_smart_lower, - _edje_smart_stack_above, - _edje_smart_stack_below, + NULL, NULL, NULL, NULL, NULL, _edje_smart_move, _edje_smart_resize, _edje_smart_show, @@ -52,8 +41,6 @@ edje_object_add(Evas *evas) _edje_smart_clip_set, _edje_smart_clip_unset, NULL); - evas_smart_above_get_set(_edje_smart, _edje_smart_above_get); - evas_smart_below_get_set(_edje_smart, _edje_smart_below_get); } return evas_object_smart_add(evas, _edje_smart); } @@ -86,204 +73,6 @@ _edje_smart_del(Evas_Object * obj) _edje_unref(ed); } -static void -_edje_smart_layer_set(Evas_Object * obj, int layer) -{ - Edje *ed; - Evas_List *l; - - ed = evas_object_smart_data_get(obj); - if (!ed) return; - if (ed->layer == layer) return; - ed->layer = layer; - for (l = ed->parts; l; l = l->next) - { - Edje_Real_Part *ep; - - ep = l->data; - if (ep->extra_objects) - { - Evas_List *el; - - for (el = ep->extra_objects; el; el = el->next) - { - Evas_Object *o; - - o = el->data; - evas_object_layer_set(o, ed->layer); - } - } - evas_object_layer_set(ep->object, ed->layer); - if (ep->swallowed_object) - evas_object_layer_set(ep->swallowed_object, ed->layer); - } - _edje_emit(ed, "layer,set", ""); -} - -static void -_edje_smart_raise(Evas_Object * obj) -{ - Edje *ed; - Evas_List *l; - - ed = evas_object_smart_data_get(obj); - if (!ed) return; - for (l = ed->parts; l; l = l->next) - { - Edje_Real_Part *ep; - - ep = l->data; - if (ep->extra_objects) - { - Evas_List *el; - - for (el = ep->extra_objects; el; el = el->next) - { - Evas_Object *o; - - o = el->data; - evas_object_raise(o); - } - } - evas_object_raise(ep->object); - if (ep->swallowed_object) - evas_object_raise(ep->swallowed_object); - } - _edje_emit(ed, "raise", ""); -} - -static void -_edje_smart_lower(Evas_Object * obj) -{ - Edje *ed; - Evas_List *l; - - ed = evas_object_smart_data_get(obj); - if (!ed) return; - for (l = evas_list_last(ed->parts); l; l = l->prev) - { - Edje_Real_Part *ep; - - ep = l->data; - if (ep->swallowed_object) - evas_object_lower(ep->swallowed_object); - evas_object_lower(ep->object); - if (ep->extra_objects) - { - Evas_List *el; - - for (el = ep->extra_objects; el; el = el->next) - { - Evas_Object *o; - - o = el->data; - evas_object_lower(o); - } - } - } - _edje_emit(ed, "lower", ""); -} - -static void -_edje_smart_stack_above(Evas_Object * obj, Evas_Object * above) -{ - Edje *ed; - Evas_List *l; - - ed = evas_object_smart_data_get(obj); - if (!ed) return; - for (l = evas_list_last(ed->parts); l; l = l->prev) - { - Edje_Real_Part *ep; - - ep = l->data; - if (ep->swallowed_object) - evas_object_stack_above(ep->swallowed_object, above); - evas_object_stack_above(ep->object, above); - if (ep->extra_objects) - { - Evas_List *el; - - for (el = evas_list_last(ep->extra_objects); el; el = el->prev) - { - Evas_Object *o; - - o = el->data; - evas_object_stack_above(o, above); - } - } - } - _edje_emit(ed, "stack_above", ""); -} - -static void -_edje_smart_stack_below(Evas_Object * obj, Evas_Object * below) -{ - Edje *ed; - Evas_List *l; - - ed = evas_object_smart_data_get(obj); - if (!ed) return; - for (l = ed->parts; l; l = l->next) - { - Edje_Real_Part *ep; - - ep = l->data; - if (ep->extra_objects) - { - Evas_List *el; - - for (el = ep->extra_objects; el; el = el->next) - { - Evas_Object *o; - - o = el->data; - evas_object_stack_below(o, below); - } - } - evas_object_stack_below(ep->object, below); - if (ep->swallowed_object) - evas_object_stack_below(ep->swallowed_object, below); - } - _edje_emit(ed, "stack_below", ""); -} - -static Evas_Object * -_edje_smart_above_get(Evas_Object * obj) -{ - Edje *ed; - - ed = evas_object_smart_data_get(obj); - if (!ed) return obj; - if (ed->parts) - { - Edje_Real_Part *ep; - - ep = evas_list_last(ed->parts)->data; - if (ep->swallowed_object) - return ep->swallowed_object; - return ep->object; - } - return obj; -} - -static Evas_Object * -_edje_smart_below_get(Evas_Object * obj) -{ - Edje *ed; - - ed = evas_object_smart_data_get(obj); - if (!ed) return obj; - if (ed->parts) - { - Edje_Real_Part *ep; - - ep = ed->parts->data; - return ep->object; - } - return obj; -} - static void _edje_smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y) { diff --git a/legacy/edje/src/lib/edje_text.c b/legacy/edje/src/lib/edje_text.c index ba8baf6b78..fa14845472 100644 --- a/legacy/edje/src/lib/edje_text.c +++ b/legacy/edje/src/lib/edje_text.c @@ -198,7 +198,6 @@ _edje_text_part_on_add(Edje *ed, Edje_Real_Part *ep) evas_object_smart_member_add(o, ed->obj); evas_object_pass_events_set(o, 1); evas_object_clip_set(o, ed->clipper); - evas_object_layer_set(o, evas_object_layer_get(ed->obj)); evas_object_show(o); ep->extra_objects = evas_list_append(ep->extra_objects, o); diff --git a/legacy/edje/src/lib/edje_util.c b/legacy/edje/src/lib/edje_util.c index cc316d94ee..3ee39bc081 100644 --- a/legacy/edje/src/lib/edje_util.c +++ b/legacy/edje/src/lib/edje_util.c @@ -573,8 +573,6 @@ edje_object_part_swallow(Evas_Object *obj, const char *part, Evas_Object *obj_sw if (rp->clip_to) evas_object_clip_set(rp->swallowed_object, rp->clip_to->object); else evas_object_clip_set(rp->swallowed_object, ed->clipper); - if (evas_object_layer_get(rp->swallowed_object) != ed->layer) - evas_object_layer_set(rp->swallowed_object, ed->layer); evas_object_stack_above(rp->swallowed_object, rp->object); evas_object_event_callback_add(rp->swallowed_object, EVAS_CALLBACK_FREE, diff --git a/legacy/evas/src/lib/Evas.h b/legacy/evas/src/lib/Evas.h index 6731942a05..f33a8e4726 100644 --- a/legacy/evas/src/lib/Evas.h +++ b/legacy/evas/src/lib/Evas.h @@ -90,20 +90,13 @@ struct _Evas_Smart_Class /** a smart object class */ void (*add) (Evas_Object *o); void (*del) (Evas_Object *o); - void (*layer_set) (Evas_Object *o, int l); - void (*raise) (Evas_Object *o); - void (*lower) (Evas_Object *o); - void (*stack_above) (Evas_Object *o, Evas_Object *above); - void (*stack_below) (Evas_Object *o, Evas_Object *below); - Evas_Object *(*above_get) (Evas_Object *o); - Evas_Object *(*below_get) (Evas_Object *o); void (*move) (Evas_Object *o, Evas_Coord x, Evas_Coord y); - void (*resize) (Evas_Object *o, Evas_Coord w, Evas_Coord h); - void (*show) (Evas_Object *o); - void (*hide) (Evas_Object *o); - void (*color_set) (Evas_Object *o, int r, int g, int b, int a); - void (*clip_set) (Evas_Object *o, Evas_Object *clip); - void (*clip_unset) (Evas_Object *o); + void (*resize) (Evas_Object *o, Evas_Coord w, Evas_Coord h); + void (*show) (Evas_Object *o); // FIXME: DELETE ME + void (*hide) (Evas_Object *o); // FIXME: DELETE ME + void (*color_set) (Evas_Object *o, int r, int g, int b, int a); // FIXME: DELETE ME + void (*clip_set) (Evas_Object *o, Evas_Object *clip); // FIXME: DELETE ME + void (*clip_unset) (Evas_Object *o); // FIXME: DELETE ME const void *data; }; @@ -591,8 +584,6 @@ extern "C" { EAPI Evas_Smart *evas_smart_new (const char *name, void (*func_add) (Evas_Object *obj), void (*func_del) (Evas_Object *obj), void (*func_layer_set) (Evas_Object *obj, int l), void (*func_raise) (Evas_Object *obj), void (*func_lower) (Evas_Object *obj), void (*func_stack_above) (Evas_Object *obj, Evas_Object *above), void (*func_stack_below) (Evas_Object *obj, Evas_Object *below), void (*func_move) (Evas_Object *obj, Evas_Coord x, Evas_Coord y), void (*func_resize) (Evas_Object *obj, Evas_Coord w, Evas_Coord h), void (*func_show) (Evas_Object *obj), void (*func_hide) (Evas_Object *obj), void (*func_color_set) (Evas_Object *obj, int r, int g, int b, int a), void (*func_clip_set) (Evas_Object *obj, Evas_Object *clip), void (*func_clip_unset) (Evas_Object *obj), const void *data); EAPI void evas_smart_free (Evas_Smart *s); - EAPI void evas_smart_above_get_set (Evas_Smart *s, Evas_Object *(*func_above_get) (Evas_Object *o)); - EAPI void evas_smart_below_get_set (Evas_Smart *s, Evas_Object *(*func_below_get) (Evas_Object *o)); EAPI Evas_Smart *evas_smart_class_new (Evas_Smart_Class *sc); EAPI Evas_Smart_Class *evas_smart_class_get (Evas_Smart *s); @@ -644,7 +635,7 @@ extern "C" { EAPI Evas_Modifier_Mask evas_key_modifier_mask_get (Evas *e, const char *keyname); - EAPI Evas_Bool evas_object_key_grab (Evas_Object *obj, const char *keyname, Evas_Modifier_Mask modifiers, Evas_Modifier_Mask not_modifiers, Evas_Bool exclusive); + EAPI Evas_Bool evas_object_key_grab (Evas_Object *obj, const char *keyname, Evas_Modifier_Mask modifiers, Evas_Modifier_Mask not_modifiers, Evas_Bool exclusive); EAPI void evas_object_key_ungrab (Evas_Object *obj, const char *keyname, Evas_Modifier_Mask modifiers, Evas_Modifier_Mask not_modifiers); EAPI void evas_object_pass_events_set (Evas_Object *obj, Evas_Bool pass); diff --git a/legacy/evas/src/lib/canvas/evas_events.c b/legacy/evas/src/lib/canvas/evas_events.c index 46c1d28ed1..04138d60f2 100644 --- a/legacy/evas/src/lib/canvas/evas_events.c +++ b/legacy/evas/src/lib/canvas/evas_events.c @@ -19,6 +19,61 @@ evas_event_passes_through(Evas_Object *obj) return 0; } +static Evas_List * +_evas_event_object_list_in_get(Evas *e, Evas_List *in, Evas_Object_List *list, Evas_Object *stop, int x, int y, int *no_rep) +{ + Evas_Object_List *l; + + if (!list) return in; + for (l = list->last; l; l = l->prev) + { + Evas_Object *obj; + + obj = (Evas_Object *)l; + if (obj == stop) + { + *no_rep = 1; + return in; + } + if (!evas_event_passes_through(obj)) + { + if ((obj->cur.visible) && (obj->delete_me == 0) && + (!obj->clip.clipees) && + (evas_object_clippers_is_visible(obj))) + { + if (obj->smart.smart) + { + int norep; + + norep = 0; + in = _evas_event_object_list_in_get(e, in, + obj->smart.contained, + stop, x, y, &norep); + if (norep) + { + *no_rep = 1; + return in; + } + } + else + { + if (evas_object_is_in_output_rect(obj, x, y, 1, 1)) + { + in = evas_list_append(in, obj); + if (!obj->repeat_events) + { + *no_rep = 1; + return in; + } + } + } + } + } + } + *no_rep = 0; + return in; +} + Evas_List * evas_event_objects_event_list(Evas *e, Evas_Object *stop, int x, int y) { @@ -28,33 +83,15 @@ evas_event_objects_event_list(Evas *e, Evas_Object *stop, int x, int y) if (!e->layers) return NULL; for (l = ((Evas_Object_List *)(e->layers))->last; l; l = l->prev) { - Evas_Object_List *l2; Evas_Layer *lay; + int norep; lay = (Evas_Layer *)l; - for (l2 = ((Evas_Object_List *)(lay->objects))->last; l2; l2 = l2->prev) - { - Evas_Object *obj; - - obj = (Evas_Object *)l2; - if (obj == stop) goto done; - if ((!evas_event_passes_through(obj)) && (!obj->smart.smart)) - { -// FIXME: i don't think we need this -// evas_object_clip_recalc(obj); - if ((evas_object_is_in_output_rect(obj, x, y, 1, 1)) && - (obj->cur.visible) && - (obj->delete_me == 0) && - (evas_object_clippers_is_visible(obj)) && - (!obj->clip.clipees)) - { - in = evas_list_append(in, obj); - if (!obj->repeat_events) goto done; - } - } - } + norep = 0; + in = _evas_event_object_list_in_get(e, in, lay->objects, stop, + x, y, &norep); + if (norep) return in; } - done: return in; } @@ -431,7 +468,6 @@ evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const if ((obj->cur.visible) && (evas_object_clippers_is_visible(obj)) && (!evas_event_passes_through(obj)) && - (!obj->smart.smart) && (!obj->clip.clipees)) { if ((px != x) || (py != y)) @@ -510,7 +546,6 @@ evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const (evas_object_clippers_is_visible(obj)) && (evas_list_find(ins, obj)) && (!evas_event_passes_through(obj)) && - (!obj->smart.smart) && (!obj->clip.clipees)) { if ((px != x) || (py != y)) diff --git a/legacy/evas/src/lib/canvas/evas_layer.c b/legacy/evas/src/lib/canvas/evas_layer.c index 52495f333a..367558f10e 100644 --- a/legacy/evas/src/lib/canvas/evas_layer.c +++ b/legacy/evas/src/lib/canvas/evas_layer.c @@ -6,6 +6,7 @@ evas_object_inject(Evas_Object *obj, Evas *e) { Evas_Layer *lay; + if (obj->in_layer) return; lay = evas_layer_find(e, obj->cur.layer); if (!lay) { @@ -15,11 +16,13 @@ evas_object_inject(Evas_Object *obj, Evas *e) } lay->objects = evas_object_list_append(lay->objects, obj); obj->layer = lay; + obj->in_layer = 1; } void evas_object_release(Evas_Object *obj, int clean_layer) { + if (!obj->in_layer) return; obj->layer->objects = evas_object_list_remove(obj->layer->objects, obj); if (clean_layer) { @@ -30,6 +33,7 @@ evas_object_release(Evas_Object *obj, int clean_layer) } } obj->layer = NULL; + obj->in_layer = 0; } Evas_Layer * @@ -140,16 +144,12 @@ evas_object_layer_set(Evas_Object *obj, int l) return; MAGIC_CHECK_END(); if (evas_object_intercept_call_layer_set(obj, l)) return; + if (obj->smart.parent) return; if (obj->cur.layer == l) { evas_object_raise(obj); return; } - if (obj->smart.smart) - { - if (obj->smart.smart->smart_class->layer_set) - obj->smart.smart->smart_class->layer_set(obj, l); - } e = obj->layer->evas; evas_object_release(obj, 1); obj->cur.layer = l; diff --git a/legacy/evas/src/lib/canvas/evas_object_main.c b/legacy/evas/src/lib/canvas/evas_object_main.c index d8cb991257..e5278c9a82 100644 --- a/legacy/evas/src/lib/canvas/evas_object_main.c +++ b/legacy/evas/src/lib/canvas/evas_object_main.c @@ -18,13 +18,15 @@ evas_object_new(void) void evas_object_free(Evas_Object *obj, int clean_layer) { + int was_smart_child = 0; + evas_object_grabs_cleanup(obj); evas_object_intercept_cleanup(obj); + if (obj->smart.parent) was_smart_child = 1; evas_object_smart_cleanup(obj); obj->func->free(obj); - if (obj->name) - evas_object_name_set(obj, NULL); - evas_object_release(obj, clean_layer); + if (obj->name) evas_object_name_set(obj, NULL); + if (!was_smart_child) evas_object_release(obj, clean_layer); if (obj->name) { free(obj->name); @@ -59,12 +61,9 @@ evas_object_change(Evas_Object *obj) { Evas_List *l; - if (obj->smart.smart) return; - if (!((obj->cur.visible != obj->prev.visible) || (obj->cur.visible))) - return; + obj->layer->evas->changed = 1; if (obj->changed) return; obj->changed = 1; - obj->layer->evas->changed = 1; /* set changed flag on all objects this one clips too */ for (l = obj->clip.clipees; l; l = l->next) { @@ -73,6 +72,7 @@ evas_object_change(Evas_Object *obj) o = (Evas_Object *)l->data; evas_object_change(o); } + if (obj->smart.parent) evas_object_change(obj->smart.parent); } Evas_List * diff --git a/legacy/evas/src/lib/canvas/evas_object_smart.c b/legacy/evas/src/lib/canvas/evas_object_smart.c index c2b222c4a8..390c08b1bc 100644 --- a/legacy/evas/src/lib/canvas/evas_object_smart.c +++ b/legacy/evas/src/lib/canvas/evas_object_smart.c @@ -132,11 +132,18 @@ evas_object_smart_member_add(Evas_Object *obj, Evas_Object *smart_obj) return; MAGIC_CHECK_END(); + if (obj->smart.parent == smart_obj) return; + if (obj->smart.parent) evas_object_smart_member_del(obj); - + + evas_object_release(obj, 1); + obj->layer = smart_obj->layer; + obj->cur.layer = obj->layer->layer; obj->smart.parent = smart_obj; - smart_obj->smart.contained = evas_list_append(smart_obj->smart.contained, obj); + smart_obj->smart.contained = evas_object_list_append(smart_obj->smart.contained, obj); evas_object_smart_member_cache_invalidate(obj); + obj->restack = 1; + evas_object_change(obj); } /** @@ -153,10 +160,13 @@ evas_object_smart_member_del(Evas_Object *obj) MAGIC_CHECK_END(); if (!obj->smart.parent) return; - - obj->smart.parent->smart.contained = evas_list_remove(obj->smart.parent->smart.contained, obj); + obj->smart.parent->smart.contained = evas_object_list_remove(obj->smart.parent->smart.contained, obj); obj->smart.parent = NULL; evas_object_smart_member_cache_invalidate(obj); + obj->cur.layer = obj->layer->layer; + evas_object_inject(obj, obj->layer->evas); + obj->restack = 1; + evas_object_change(obj); } /** @@ -340,11 +350,7 @@ evas_object_smart_cleanup(Evas_Object *obj) if (obj->smart.parent) evas_object_smart_member_del(obj); while (obj->smart.contained) - { - /* null out smart parent object - maybe a hole to creep through? */ - ((Evas_Object *)obj->smart.contained->data)->smart.parent = NULL; - obj->smart.contained = evas_list_remove(obj->smart.contained, obj->smart.contained->data); - } + evas_object_smart_member_del((Evas_Object *)obj->smart.contained); while (obj->smart.callbacks) { Evas_Smart_Callback *cb; @@ -362,14 +368,14 @@ evas_object_smart_cleanup(Evas_Object *obj) void evas_object_smart_member_cache_invalidate(Evas_Object *obj) { - Evas_List *l; + Evas_Object_List *l; obj->parent_cache_valid = 0; for (l = obj->smart.contained; l; l = l->next) { Evas_Object *obj2; - obj2 = l->data; + obj2 = (Evas_Object *)l; evas_object_smart_member_cache_invalidate(obj2); } } diff --git a/legacy/evas/src/lib/canvas/evas_render.c b/legacy/evas/src/lib/canvas/evas_render.c index 5ad3fad2df..20c3ce2e84 100644 --- a/legacy/evas/src/lib/canvas/evas_render.c +++ b/legacy/evas/src/lib/canvas/evas_render.c @@ -64,6 +64,103 @@ evas_obscured_clear(Evas *e) } } + +static void +_evas_render_phase1_object_process(Evas *e, Evas_Object *obj, Evas_List **active_objects, Evas_List **restack_objects, int restack) +{ +/* if (obj->cur.cache.clip.dirty) */ + evas_object_clip_recalc(obj); + /* build active object list */ + if (evas_object_is_active(obj)) + *active_objects = evas_list_append(*active_objects, obj); + /* something changed... maybe... */ + if (restack) + { + obj->restack = 1; + obj->changed = 1; + } + if (obj->changed) + { + if (obj->smart.smart) + { + Evas_Object_List *l; + + for (l = obj->smart.contained; l; l = l->next) + { + Evas_Object *obj2; + + obj2 = (Evas_Object *)l; + _evas_render_phase1_object_process(e, obj2, + active_objects, + restack_objects, obj->restack); + } + + } + else + { + if ((obj->restack) && (!obj->clip.clipees) && + evas_object_is_active(obj)) + *restack_objects = evas_list_append(*restack_objects, obj); + else + obj->func->render_pre(obj); + } + } + /* nothing changed at all */ + else + { + if ((!obj->clip.clipees) && (obj->delete_me == 0)) + { + if (obj->smart.smart) + { + Evas_Object_List *l; + + for (l = obj->smart.contained; l; l = l->next) + { + Evas_Object *obj2; + + obj2 = (Evas_Object *)l; + _evas_render_phase1_object_process(e, obj2, + active_objects, + restack_objects, + restack); + } + } + else + { + if (evas_object_is_opaque(obj) && + evas_object_is_visible(obj)) + e->engine.func->output_redraws_rect_del(e->engine.data.output, + obj->cur.cache.clip.x, + obj->cur.cache.clip.y, + obj->cur.cache.clip.w, + obj->cur.cache.clip.h); + } + } + } + obj->restack = 0; +} + +static void +_evas_render_phase1_process(Evas *e, Evas_List **active_objects, Evas_List **restack_objects) +{ + Evas_Object_List *l; + + for (l = (Evas_Object_List *)e->layers; l; l = l->next) + { + Evas_Object_List *l2; + Evas_Layer *lay; + + lay = (Evas_Layer *)l; + for (l2 = (Evas_Object_List *)lay->objects; l2; l2 = l2->next) + { + Evas_Object *obj; + + obj = (Evas_Object *)l2; + _evas_render_phase1_object_process(e, obj, active_objects, restack_objects, 0); + } + } +} + /** * To be documented. * @@ -91,49 +188,7 @@ evas_render_updates(Evas *e) if (!e->changed) return NULL; /* phase 1. add extra updates for changed objects */ - for (l = (Evas_Object_List *)e->layers; l; l = l->next) - { - Evas_Object_List *l2; - Evas_Layer *lay; - - lay = (Evas_Layer *)l; - for (l2 = (Evas_Object_List *)lay->objects; l2; l2 = l2->next) - { - Evas_Object *obj; - - obj = (Evas_Object *)l2; -// if (obj->cur.cache.clip.dirty) - evas_object_clip_recalc(obj); - /* build active object list */ - if (evas_object_is_active(obj)) - active_objects = evas_list_append(active_objects, obj); - /* something changed... maybe... */ - if (obj->changed) - { - if ((obj->restack) && - (!obj->clip.clipees) && - (!obj->smart.smart) && - evas_object_is_active(obj)) - restack_objects = evas_list_append(restack_objects, obj); - else - obj->func->render_pre(obj); - } - /* nothing changed at all */ - else - { - if (evas_object_is_opaque(obj) && - evas_object_is_visible(obj) && - (!obj->smart.smart) && - (!obj->clip.clipees) && - (!obj->delete_me)) - e->engine.func->output_redraws_rect_del(e->engine.data.output, - obj->cur.cache.clip.x, - obj->cur.cache.clip.y, - obj->cur.cache.clip.w, - obj->cur.cache.clip.h); - } - } - } + _evas_render_phase1_process(e, &active_objects, &restack_objects); /* phase 2. force updates for restacks */ while (restack_objects) { @@ -299,29 +354,22 @@ evas_render_updates(Evas *e) /* clear redraws */ e->engine.func->output_redraws_clear(e->engine.data.output); /* and do a post render pass */ - for (l = (Evas_Object_List *)e->layers; l; l = l->next) + for (ll = active_objects; ll; ll = ll->next) { - Evas_Object_List *l2; - Evas_Layer *lay; - - lay = (Evas_Layer *)l; - for (l2 = (Evas_Object_List *)lay->objects; l2; l2 = l2->next) + Evas_Object *obj; + + obj = (Evas_Object *)(ll->data); + obj->pre_render_done = 0; + if (obj->changed) { - Evas_Object *obj; - - obj = (Evas_Object *)l2; - obj->pre_render_done = 0; - if (obj->changed) - { - obj->func->render_post(obj); - obj->restack = 0; - obj->changed = 0; - } - /* if the object is flagged for deletion - note it */ - if (obj->delete_me == 2) - delete_objects = evas_list_append(delete_objects, obj); - if (obj->delete_me) obj->delete_me ++; + obj->func->render_post(obj); + obj->restack = 0; + obj->changed = 0; } + /* if the object is flagged for deletion - note it */ + if (obj->delete_me == 2) + delete_objects = evas_list_append(delete_objects, obj); + if (obj->delete_me) obj->delete_me ++; } /* delete all objects flagged for deletion now */ while (delete_objects) @@ -333,9 +381,9 @@ evas_render_updates(Evas *e) evas_object_free(obj, 1); } /* free our obscuring object list */ - obscuring_objects_orig = evas_list_free(obscuring_objects_orig); + evas_list_free(obscuring_objects_orig); /* free our active object list */ - active_objects = evas_list_free(active_objects); + evas_list_free(active_objects); e->changed = 0; e->viewport.changed = 0; e->output.changed = 0; diff --git a/legacy/evas/src/lib/canvas/evas_smart.c b/legacy/evas/src/lib/canvas/evas_smart.c index 289d7e07d2..489234f716 100644 --- a/legacy/evas/src/lib/canvas/evas_smart.c +++ b/legacy/evas/src/lib/canvas/evas_smart.c @@ -47,11 +47,6 @@ evas_smart_new(const char *name, s->smart_class->name = name; s->smart_class->add = func_add; s->smart_class->del = func_del; - s->smart_class->layer_set = func_layer_set; - s->smart_class->raise = func_raise; - s->smart_class->lower = func_lower; - s->smart_class->stack_above = func_stack_above; - s->smart_class->stack_below = func_stack_below; s->smart_class->move = func_move; s->smart_class->resize = func_resize; s->smart_class->show = func_show; @@ -82,38 +77,6 @@ evas_smart_free(Evas_Smart *s) free(s); } -/** - * To be documented. - * - * FIXME: To be fixed. - * - */ -void -evas_smart_above_get_set(Evas_Smart *s, Evas_Object *(*func_above_get) (Evas_Object *o)) -{ - Evas_Smart_Class *sc; - - if (!(sc = evas_smart_class_get(s))) - return; - sc->above_get = func_above_get; -} - -/** - * To be documented. - * - * FIXME: To be fixed. - * - */ -void -evas_smart_below_get_set(Evas_Smart *s, Evas_Object *(*func_below_get) (Evas_Object *o)) -{ - Evas_Smart_Class *sc; - - if (!(sc = evas_smart_class_get(s))) - return; - sc->below_get = func_below_get; -} - /** * To be documented. * diff --git a/legacy/evas/src/lib/canvas/evas_stack.c b/legacy/evas/src/lib/canvas/evas_stack.c index 22e916d136..56d46817ed 100644 --- a/legacy/evas/src/lib/canvas/evas_stack.c +++ b/legacy/evas/src/lib/canvas/evas_stack.c @@ -58,12 +58,18 @@ evas_object_raise(Evas_Object *obj) evas_object_inform_call_restack(obj); return; } - obj->layer->objects = evas_object_list_remove(obj->layer->objects, obj); - obj->layer->objects = evas_object_list_append(obj->layer->objects, obj); - if (obj->smart.smart) + if (obj->smart.parent) { - if (obj->smart.smart->smart_class->raise) - obj->smart.smart->smart_class->raise(obj); + obj->smart.parent->smart.contained = evas_object_list_remove(obj->smart.parent->smart.contained, obj); + obj->smart.parent->smart.contained = evas_object_list_append(obj->smart.parent->smart.contained, obj); + } + else + { + if (obj->in_layer) + { + obj->layer->objects = evas_object_list_remove(obj->layer->objects, obj); + obj->layer->objects = evas_object_list_append(obj->layer->objects, obj); + } } if (obj->clip.clipees) { @@ -106,18 +112,24 @@ evas_object_lower(Evas_Object *obj) return; MAGIC_CHECK_END(); if (evas_object_intercept_call_lower(obj)) return; - if (obj->smart.smart) - { - if (obj->smart.smart->smart_class->lower) - obj->smart.smart->smart_class->lower(obj); - } if (!(((Evas_Object_List *)obj)->prev)) { evas_object_inform_call_restack(obj); return; } - obj->layer->objects = evas_object_list_remove(obj->layer->objects, obj); - obj->layer->objects = evas_object_list_prepend(obj->layer->objects, obj); + if (obj->smart.parent) + { + obj->smart.parent->smart.contained = evas_object_list_remove(obj->smart.parent->smart.contained, obj); + obj->smart.parent->smart.contained = evas_object_list_prepend(obj->smart.parent->smart.contained, obj); + } + else + { + if (obj->in_layer) + { + obj->layer->objects = evas_object_list_remove(obj->layer->objects, obj); + obj->layer->objects = evas_object_list_prepend(obj->layer->objects, obj); + } + } if (obj->clip.clipees) { evas_object_inform_call_restack(obj); @@ -162,19 +174,9 @@ evas_object_stack_above(Evas_Object *obj, Evas_Object *above) return; MAGIC_CHECK_END(); if (evas_object_intercept_call_stack_above(obj, above)) return; - if (above->smart.smart) + if (!above) { - if (above->smart.smart->smart_class->above_get) - above = above->smart.smart->smart_class->above_get(above); - } - if (obj->smart.smart) - { - if (obj->smart.smart->smart_class->stack_above) - obj->smart.smart->smart_class->stack_above(obj, above); - } - if (above->layer != obj->layer) - { - evas_object_inform_call_restack(obj); + evas_object_raise(obj); return; } if (((Evas_Object_List *)obj)->prev == (Evas_Object_List *)above) @@ -182,8 +184,28 @@ evas_object_stack_above(Evas_Object *obj, Evas_Object *above) evas_object_inform_call_restack(obj); return; } - obj->layer->objects = evas_object_list_remove(obj->layer->objects, obj); - obj->layer->objects = evas_object_list_append_relative(obj->layer->objects, obj, above); + if (obj->smart.parent) + { + if (obj->smart.parent != above->smart.parent) + { +// printf("BITCH! evas_object_stack_above(), %p not inside same smart as %p!\n", obj, above); + return; + } + obj->smart.parent->smart.contained = evas_object_list_remove(obj->smart.parent->smart.contained, obj); + obj->smart.parent->smart.contained = evas_object_list_append_relative(obj->smart.parent->smart.contained, obj, above); + } + else + { + if (obj->layer != above->layer) + { + return; + } + if (obj->in_layer) + { + obj->layer->objects = evas_object_list_remove(obj->layer->objects, obj); + obj->layer->objects = evas_object_list_append_relative(obj->layer->objects, obj, above); + } + } if (obj->clip.clipees) { evas_object_inform_call_restack(obj); @@ -228,19 +250,9 @@ evas_object_stack_below(Evas_Object *obj, Evas_Object *below) return; MAGIC_CHECK_END(); if (evas_object_intercept_call_stack_below(obj, below)) return; - if (below->smart.smart) + if (!below) { - if (below->smart.smart->smart_class->below_get) - below = below->smart.smart->smart_class->below_get(below); - } - if (obj->smart.smart) - { - if (obj->smart.smart->smart_class->stack_below) - obj->smart.smart->smart_class->stack_below(obj, below); - } - if (below->layer != obj->layer) - { - evas_object_inform_call_restack(obj); + evas_object_lower(obj); return; } if (((Evas_Object_List *)obj)->next == (Evas_Object_List *)below) @@ -248,8 +260,28 @@ evas_object_stack_below(Evas_Object *obj, Evas_Object *below) evas_object_inform_call_restack(obj); return; } - obj->layer->objects = evas_object_list_remove(obj->layer->objects, obj); - obj->layer->objects = evas_object_list_prepend_relative(obj->layer->objects, obj, below); + if (obj->smart.parent) + { + if (obj->smart.parent != below->smart.parent) + { +// printf("BITCH! evas_object_stack_below(), %p not inside same smart as %p!\n", obj, below); + return; + } + obj->smart.parent->smart.contained = evas_object_list_remove(obj->smart.parent->smart.contained, obj); + obj->smart.parent->smart.contained = evas_object_list_prepend_relative(obj->smart.parent->smart.contained, obj, below); + } + else + { + if (obj->layer != below->layer) + { + return; + } + if (obj->in_layer) + { + obj->layer->objects = evas_object_list_remove(obj->layer->objects, obj); + obj->layer->objects = evas_object_list_prepend_relative(obj->layer->objects, obj, below); + } + } if (obj->clip.clipees) { evas_object_inform_call_restack(obj); @@ -287,16 +319,12 @@ evas_object_stack_below(Evas_Object *obj, Evas_Object *below) Evas_Object * evas_object_above_get(Evas_Object *obj) { - Evas_Object *obj2; - MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return NULL; MAGIC_CHECK_END(); - obj2 = evas_object_above_get_internal(obj); - while (((obj2) && (obj2->smart.parent)) || - ((obj2) && (obj2->delete_me))) - obj2 = evas_object_above_get_internal(obj2); - return obj2; + if (obj->smart.parent) + return (Evas_Object *)(((Evas_Object_List *)(obj))->next); + return evas_object_above_get_internal(obj); } /** @@ -308,16 +336,12 @@ evas_object_above_get(Evas_Object *obj) Evas_Object * evas_object_below_get(Evas_Object *obj) { - Evas_Object *obj2; - MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return NULL; MAGIC_CHECK_END(); - obj2 = evas_object_below_get_internal(obj); - while (((obj2) && (obj2->smart.parent)) || - ((obj2) && (obj2->delete_me))) - obj2 = evas_object_below_get_internal(obj2); - return obj2; + if (obj->smart.parent) + return (Evas_Object *)(((Evas_Object_List *)(obj))->prev); + return evas_object_below_get_internal(obj); } /** @@ -329,17 +353,12 @@ evas_object_below_get(Evas_Object *obj) Evas_Object * evas_object_bottom_get(Evas *e) { - Evas_Object *obj2 = NULL; - MAGIC_CHECK(e, Evas, MAGIC_EVAS); return NULL; MAGIC_CHECK_END(); if (e->layers) - obj2 = e->layers->objects; - while (((obj2) && (obj2->smart.parent)) || - ((obj2) && (obj2->delete_me))) - obj2 = evas_object_above_get_internal(obj2); - return obj2; + return e->layers->objects; + return NULL; } /** @@ -371,10 +390,5 @@ evas_object_top_get(Evas *e) obj2 = (Evas_Object *) list->last; if (!obj2) return NULL; - while (((obj2) && (obj2->smart.parent)) || - ((obj2) && (obj2->delete_me))) { - obj2 = evas_object_below_get_internal(obj2); - } - return obj2; } diff --git a/legacy/evas/src/lib/include/evas_private.h b/legacy/evas/src/lib/include/evas_private.h index 427fc81b83..17e68e87b9 100644 --- a/legacy/evas/src/lib/include/evas_private.h +++ b/legacy/evas/src/lib/include/evas_private.h @@ -343,13 +343,13 @@ struct _Evas_Object void *object_data; struct { - int walking_list; - Evas_Smart *smart; - void *data; - Evas_Object *parent; - Evas_List *contained; - Evas_List *callbacks; - char deletions_waiting : 1; + int walking_list; + Evas_Smart *smart; + void *data; + Evas_Object *parent; + Evas_Object_List *contained; + Evas_List *callbacks; + char deletions_waiting : 1; } smart; int mouse_grabbed; @@ -365,6 +365,7 @@ struct _Evas_Object short pre_render_done : 1; short intercepted : 1; short focused : 1; + short in_layer : 1; unsigned char delete_me; };