From: Enlightenment S. <no-...@en...> - 2009-05-02 20:06:05
|
Log: Allow sending signals to GROUP sub-parts. Today signals emitted inside GROUP sub-parts are delivered to parent group as "part-name:original-source". This is good and allow edje groups to be reused. But no counter part to send events to inside sub-groups existed. This patch allows one to send a signal "signal" to inside a part "part" that is of type GROUP by prepending signal emission with part name: emission: "part:signal" source: "source" this is the same as: o = edje_object_part_swallow_get(ed); edje_object_signal_emit(o, "signal", "source"); but can be done all in themes, no need to go to application c/c++/python. Based on patch by Pieter, see mail list. Author: barbieri Date: 2009-05-02 13:05:53 -0700 (Sat, 02 May 2009) New Revision: 40489 Modified: trunk/edje/src/lib/edje_program.c Modified: trunk/edje/src/lib/edje_program.c =================================================================== --- trunk/edje/src/lib/edje_program.c 2009-05-02 19:02:09 UTC (rev 40488) +++ trunk/edje/src/lib/edje_program.c 2009-05-02 20:05:53 UTC (rev 40489) @@ -2,6 +2,7 @@ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ +#define _GNU_SOURCE #include <string.h> #include "edje_private.h" @@ -814,8 +815,43 @@ Edje_Message_Signal emsg; Eina_List *l; Evas_Object *obj; - + const char *sep; + if (ed->delete_me) return; + + sep = strchr(sig, ':'); + if (sep) + { + /* the signal contains a colon, split the signal into "group:signal", + * and deliver it to "group" + */ + char *part = strdupa(sig); + if (part) + { + char *newsig = part + (sep - sig); + int i; + *newsig = '\0'; + newsig++; + + for (i = 0; i < ed->table_parts_size; i++) + { + Edje_Real_Part *rp = ed->table_parts[i]; + if ((rp->part->type == EDJE_PART_TYPE_GROUP) && + (rp->swallowed_object) && + (rp->part) && (rp->part->name) && + (strcmp(rp->part->name, part) == 0)) + { + Edje *ed2 = _edje_fetch(rp->swallowed_object); + if (ed2) _edje_emit(ed2, newsig, src); + return; /* stop processing. + * XXX maybe let signal be processed anyway? + * XXX in this case, just comment this line + */ + } + } + } + } + emsg.sig = sig; emsg.src = src; _edje_message_send(ed, EDJE_QUEUE_SCRIPT, EDJE_MESSAGE_SIGNAL, 0, &emsg); |