From f56726798f1bf27f1bd038a12a2d7298749358a5 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Sun, 30 Oct 2005 05:07:51 +0000 Subject: [PATCH] add calls to tell evas to propagate (or not) events on an object to its parent smart object IF there is a callback set. ie. if there is a key down callback set and propagae is set to false then the key event will not prpagate to the parent as long as the child gets the key down events and has the callback set. SVN revision: 18123 --- legacy/evas/src/lib/Evas.h | 4 +- legacy/evas/src/lib/canvas/evas_callbacks.c | 1 + legacy/evas/src/lib/canvas/evas_events.c | 30 ++++++++++ .../src/lib/canvas/evas_object_rectangle.c | 4 +- legacy/evas/src/lib/include/evas_private.h | 59 ++++++++++--------- 5 files changed, 67 insertions(+), 31 deletions(-) diff --git a/legacy/evas/src/lib/Evas.h b/legacy/evas/src/lib/Evas.h index eaf13028ff..6cb3609854 100644 --- a/legacy/evas/src/lib/Evas.h +++ b/legacy/evas/src/lib/Evas.h @@ -609,7 +609,9 @@ extern "C" { EAPI Evas_Bool evas_object_pass_events_get (Evas_Object *obj); EAPI void evas_object_repeat_events_set (Evas_Object *obj, Evas_Bool repeat); EAPI Evas_Bool evas_object_repeat_events_get (Evas_Object *obj); - + EAPI void evas_object_propagate_events_set (Evas_Object *obj, Evas_Bool prop); + EAPI Evas_Bool evas_object_propagate_events_get (Evas_Object *obj); + EAPI void evas_object_event_callback_add (Evas_Object *obj, Evas_Callback_Type type, void (*func) (void *data, Evas *e, Evas_Object *obj, void *event_info), const void *data); EAPI void *evas_object_event_callback_del (Evas_Object *obj, Evas_Callback_Type type, void (*func) (void *data, Evas *e, Evas_Object *obj, void *event_info)); diff --git a/legacy/evas/src/lib/canvas/evas_callbacks.c b/legacy/evas/src/lib/canvas/evas_callbacks.c index a31a718215..6a67591087 100644 --- a/legacy/evas/src/lib/canvas/evas_callbacks.c +++ b/legacy/evas/src/lib/canvas/evas_callbacks.c @@ -193,6 +193,7 @@ evas_object_event_callback_call(Evas_Object *obj, Evas_Callback_Type type, void obj->callbacks->walking_list--; if (!obj->callbacks->walking_list) evas_object_event_callback_clear(obj); + if ((obj->no_propagate) && (*l_mod)) return; if ((obj->smart.parent) && (type != EVAS_CALLBACK_FREE) && (type <= EVAS_CALLBACK_KEY_UP)) diff --git a/legacy/evas/src/lib/canvas/evas_events.c b/legacy/evas/src/lib/canvas/evas_events.c index 04138d60f2..5cc173feb8 100644 --- a/legacy/evas/src/lib/canvas/evas_events.c +++ b/legacy/evas/src/lib/canvas/evas_events.c @@ -971,3 +971,33 @@ evas_object_repeat_events_get(Evas_Object *obj) MAGIC_CHECK_END(); return obj->repeat_events; } + +/** + * To be documented. + * + * FIXME: To be fixed. + * + */ +void +evas_object_propagate_events_set(Evas_Object *obj, Evas_Bool prop) +{ + MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); + return; + MAGIC_CHECK_END(); + obj->no_propagate = !prop; +} + +/** + * To be documented. + * + * FIXME: To be fixed. + * + */ +Evas_Bool +evas_object_propagate_events_get(Evas_Object *obj) +{ + MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); + return 0; + MAGIC_CHECK_END(); + return !(obj->no_propagate); +} diff --git a/legacy/evas/src/lib/canvas/evas_object_rectangle.c b/legacy/evas/src/lib/canvas/evas_object_rectangle.c index 9bcced4512..da1058d7b2 100644 --- a/legacy/evas/src/lib/canvas/evas_object_rectangle.c +++ b/legacy/evas/src/lib/canvas/evas_object_rectangle.c @@ -213,7 +213,7 @@ evas_object_rectangle_render_pre(Evas_Object *obj) { Evas_Rectangle *r; Evas_List *rl; - + rl = evas_rects_return_difference_rects(obj->cur.cache.geometry.x, obj->cur.cache.geometry.y, obj->cur.cache.geometry.w, @@ -233,6 +233,7 @@ evas_object_rectangle_render_pre(Evas_Object *obj) /* it obviously didn't change - add a NO obscure - this "unupdates" this */ /* area so if there were updates for it they get wiped. don't do it if we */ /* arent fully opaque and we are visible */ +/* if (evas_object_is_visible(obj) && evas_object_is_opaque(obj) && (!obj->clip.clipees)) @@ -241,6 +242,7 @@ evas_object_rectangle_render_pre(Evas_Object *obj) obj->cur.cache.clip.y, obj->cur.cache.clip.w, obj->cur.cache.clip.h); + */ done: evas_object_render_pre_effect_updates(updates, obj, is_v, was_v); } diff --git a/legacy/evas/src/lib/include/evas_private.h b/legacy/evas/src/lib/include/evas_private.h index 17e68e87b9..b18998606f 100644 --- a/legacy/evas/src/lib/include/evas_private.h +++ b/legacy/evas/src/lib/include/evas_private.h @@ -136,9 +136,9 @@ struct _Evas_Key_Grab Evas_Modifier_Mask modifiers; Evas_Modifier_Mask not_modifiers; Evas_Object *object; - char exclusive : 1; - char just_added : 1; - char delete_me : 1; + unsigned char exclusive : 1; + unsigned char just_added : 1; + unsigned char delete_me : 1; }; struct _Evas_Intercept_Func @@ -160,8 +160,8 @@ struct _Evas_Smart int usage; - char delete_me : 1; - char class_allocated : 1; + unsigned char delete_me : 1; + unsigned char class_allocated : 1; Evas_Smart_Class *smart_class; }; @@ -186,7 +186,7 @@ struct _Evas_Lock struct _Evas_Callbacks { - char deletions_waiting : 1; + unsigned char deletions_waiting : 1; int walking_list; Evas_Object_List *down; Evas_Object_List *up; @@ -213,7 +213,7 @@ struct _Evas DATA32 magic; struct { - char inside : 1; + unsigned char inside : 1; int mouse_grabbed; DATA32 button; int x, y; @@ -227,14 +227,14 @@ struct _Evas } pointer; struct { - Evas_Coord x, y, w, h; - char changed : 1; + Evas_Coord x, y, w, h; + unsigned char changed : 1; } viewport; struct { int w, h; DATA32 render_method; - char changed : 1; + unsigned char changed : 1; } output; int output_validity; @@ -246,8 +246,8 @@ struct _Evas Evas_Hash *name_hash; - char changed : 1; - char walking_layers : 1; + unsigned char changed : 1; + unsigned char walking_layers : 1; int events_frozen; @@ -285,7 +285,7 @@ struct _Evas_Layer Evas *evas; void *engine_data; - char delete_me : 1; + unsigned char delete_me : 1; }; struct _Evas_Object @@ -306,8 +306,8 @@ struct _Evas_Object struct { int x, y, w, h; unsigned char r, g, b, a; - char visible : 1; - char dirty : 1; + unsigned char visible : 1; + unsigned char dirty : 1; } clip; } cache; struct { @@ -316,7 +316,7 @@ struct _Evas_Object struct { unsigned char r, g, b, a; } color; - char visible : 1; + unsigned char visible : 1; int layer; Evas_Object *clipper; } cur, prev; @@ -349,23 +349,24 @@ struct _Evas_Object Evas_Object *parent; Evas_Object_List *contained; Evas_List *callbacks; - char deletions_waiting : 1; + unsigned char deletions_waiting : 1; } smart; int mouse_grabbed; - short store : 1; - short pass_events : 1; - short parent_pass_events : 1; - short parent_cache_valid : 1; - short repeat_events : 1; - short restack : 1; - short changed : 1; - short mouse_in : 1; - short pre_render_done : 1; - short intercepted : 1; - short focused : 1; - short in_layer : 1; + unsigned short store : 1; + unsigned short pass_events : 1; + unsigned short parent_pass_events : 1; + unsigned short parent_cache_valid : 1; + unsigned short repeat_events : 1; + unsigned short restack : 1; + unsigned short changed : 1; + unsigned short mouse_in : 1; + unsigned short pre_render_done : 1; + unsigned short intercepted : 1; + unsigned short focused : 1; + unsigned short in_layer : 1; + unsigned short no_propagate : 1; unsigned char delete_me; };