sachiel pushed a commit to branch master.
commit 0a3087c0d55a9dfbee2480e3fbae829410dcc7e5
Author: Iván Briano <[email protected]>
Date: Tue Mar 26 23:11:32 2013 -0300
Add mouse_events option on the group level
No runtime changes. This makes it possible to set mouse_events on a
group, and it will use this value as the default for mouse_events on
every part of that group. It defaults to 1 if not set, to keep things
working as they do now.
That is, instead of setting mouse_events: 0; on every single part you
don't want to receive events, it's now possible to set it for the group
and only use mouse_events: 1; explicitly on those that should handle
events.
---
src/bin/edje/edje_cc.h | 7 +++++++
src/bin/edje/edje_cc_handlers.c | 42 ++++++++++++++++++++++++++++++++++++++---
2 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/src/bin/edje/edje_cc.h b/src/bin/edje/edje_cc.h
index 49c0bc4..accccd0 100644
--- a/src/bin/edje/edje_cc.h
+++ b/src/bin/edje/edje_cc.h
@@ -53,6 +53,7 @@ typedef struct _SrcFile_List SrcFile_List;
typedef struct _Edje_Program_Parser Edje_Program_Parser;
typedef struct _Edje_Pack_Element_Parser Edje_Pack_Element_Parser;
typedef struct _Edje_Part_Parser Edje_Part_Parser;
+typedef struct _Edje_Part_Collection_Parser
Edje_Part_Collection_Parser;
struct _New_Object_Handler
{
@@ -139,6 +140,12 @@ struct _Edje_Part_Parser
Eina_Bool can_override;
};
+struct _Edje_Part_Collection_Parser
+{
+ Edje_Part_Collection common;
+ Eina_Bool default_mouse_events;
+};
+
/* global fn calls */
void data_setup(void);
void data_write(void);
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index 5381280..dccb59c 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -190,6 +190,7 @@ static void st_collections_group_max(void);
static void st_collections_group_broadcast_signal(void);
static void st_collections_group_data_item(void);
static void st_collections_group_orientation(void);
+static void st_collections_group_mouse_events(void);
static void st_collections_group_limits_vertical(void);
static void st_collections_group_limits_horizontal(void);
@@ -437,6 +438,7 @@ New_Statement_Handler statement_handlers[] =
{"collections.group.max", st_collections_group_max},
{"collections.group.broadcast_signal",
st_collections_group_broadcast_signal},
{"collections.group.orientation", st_collections_group_orientation},
+ {"collections.group.mouse_events", st_collections_group_mouse_events},
{"collections.group.data.item", st_collections_group_data_item},
{"collections.group.limits.horizontal",
st_collections_group_limits_horizontal},
{"collections.group.limits.vertical",
st_collections_group_limits_vertical},
@@ -2411,6 +2413,7 @@ static void
ob_collections_group(void)
{
Edje_Part_Collection *pc;
+ Edje_Part_Collection_Parser *pcp;
Code *cd;
if (current_de && !current_de->entry)
@@ -2424,7 +2427,7 @@ ob_collections_group(void)
eina_hash_add(edje_collections_lookup, ¤t_de->id, current_de);
- pc = mem_alloc(SZ(Edje_Part_Collection));
+ pc = mem_alloc(SZ(Edje_Part_Collection_Parser));
edje_collections = eina_list_append(edje_collections, pc);
pc->id = current_de->id;
pc->broadcast_signal = EINA_TRUE; /* This was the behaviour by default in
Edje 1.1 */
@@ -2432,6 +2435,9 @@ ob_collections_group(void)
cd = mem_alloc(SZ(Code));
codes = eina_list_append(codes, cd);
+ pcp = (Edje_Part_Collection_Parser *)pc;
+ pcp->default_mouse_events = 1;
+
#ifdef HAVE_EPHYSICS
pc->physics.world.gravity.x = 0;
pc->physics.world.gravity.y = 294;
@@ -2535,6 +2541,7 @@ static void
st_collections_group_inherit(void)
{
Edje_Part_Collection *pc, *pc2;
+ Edje_Part_Collection_Parser *pcp, *pcp2;
Edje_Part *ep, *ep2;
Edje_Part_Parser *epp, *epp2;
Edje_Pack_Element *item, *item2;
@@ -2631,6 +2638,10 @@ st_collections_group_inherit(void)
pc->lua_script_only = pc2->lua_script_only;
+ pcp = (Edje_Part_Collection_Parser *)pc;
+ pcp2 = (Edje_Part_Collection_Parser *)pc2;
+ pcp->default_mouse_events = pcp2->default_mouse_events;
+
#define STRDUP(x) x ? strdup(x) : NULL
for (i = 0 ; i < pc2->parts_count ; i++)
{
@@ -3070,6 +3081,28 @@ st_collections_group_orientation(void)
}
/**
+ @page edcref
+ @property
+ mouse_events
+ @parameters
+ [1 or 0]
+ @effect
+ Change the default value of mouse_events for every part in this group.
+ Defaults to 1 if not set, to maintain compatibility.
+ @endproperty
+ */
+static void
+st_collections_group_mouse_events(void)
+{
+ Edje_Part_Collection_Parser *pcp;
+
+ check_arg_count(1);
+
+ pcp = eina_list_data_get(eina_list_last(edje_collections));
+ pcp->default_mouse_events = parse_bool(0);
+}
+
+/**
@edcsubsection{collections_group_limits,Limits}
*/
@@ -3247,6 +3280,7 @@ static Edje_Part *
edje_cc_handlers_part_make(void)
{ /* Doing ob_collections_group_parts_part() job, without hierarchy */
Edje_Part_Collection *pc;
+ Edje_Part_Collection_Parser *pcp;
Edje_Part *ep;
Edje_Part_Parser *epp;
@@ -3261,10 +3295,11 @@ edje_cc_handlers_part_make(void)
exit(-1);
}
current_part = pc->parts[pc->parts_count - 1] = ep;
+ pcp = (Edje_Part_Collection_Parser *)pc;
ep->id = pc->parts_count - 1;
ep->type = EDJE_PART_TYPE_IMAGE;
- ep->mouse_events = 1;
+ ep->mouse_events = pcp->default_mouse_events;
ep->repeat_events = 0;
ep->ignore_flags = EVAS_EVENT_FLAG_NONE;
ep->scale = 0;
@@ -3593,7 +3628,8 @@ st_collections_group_parts_part_insert_after(void)
@effect
Specifies whether the part will emit signals, although it is named
"mouse_events", disabling it (0) will prevent the part from emitting
- any type of signal at all. It's set to 1 by default.
+ any type of signal at all. It's set to 1 by default, or to the value
+ set to "mouse_events" at the group level, if any.
@endproperty
*/
static void
--
------------------------------------------------------------------------------
Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game
on Steam. $5K grand prize plus 10 genre and skill prizes.
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d