diff --git a/legacy/edje/data/include/edje.inc b/legacy/edje/data/include/edje.inc index 2b8f7672dd..b22d824efd 100644 --- a/legacy/edje/data/include/edje.inc +++ b/legacy/edje/data/include/edje.inc @@ -82,4 +82,17 @@ native stop_programs_on (part_id); native set_min_size (part_id, Float:w, Float:h); native set_max_size (part_id, Float:w, Float:h); - +enum Msg_Type +{ + MSG_NONE = 0, + MSG_STRING = 2, + MSG_INT = 3, + MSG_FLOAT = 4, + MSG_STRING_SET = 5, + MSG_INT_SET = 6, + MSG_FLOAT_SET = 7, + MSG_STRING_INT = 8, + MSG_INT_FLOAT = 9, + MSG_STRING_INT_SET = 10, + MSG_INT_FLOAT_SET = 11 +}; diff --git a/legacy/edje/data/src/test.edc b/legacy/edje/data/src/test.edc index 0a2e1be9c5..484bb7003e 100644 --- a/legacy/edje/data/src/test.edc +++ b/legacy/edje/data/src/test.edc @@ -56,6 +56,40 @@ collections emit("SMELLY", "Fish"); } } + + tst() + { + return 0; + } + +// a special function for handling app messages - put it here if you want to +// handle messages from apps + public message(Msg_Type:type, id, ...) + { + if (type == MSG_NONE) + { + } + else if (type == MSG_STRING) + { + new str[100]; + + for (new j = 0; j < (sizeof(str) - 1); j++) + { + str[j] = getarg(2, j); + if (str[j] == 0) break; + } + } + else if (type == MSG_INT_SET) + { + for (new i = 2; i < numargs(); i++) + { + new val; + + val = getarg(i); + if (val > 9999) break; + } + } + } } parts { @@ -225,7 +259,7 @@ collections // for this group or functions exported script { - var i = 5; + new i = 5; while (i > 0) { diff --git a/legacy/edje/src/lib/Edje.h b/legacy/edje/src/lib/Edje.h index 2d49ad5706..1637f1cd6f 100644 --- a/legacy/edje/src/lib/Edje.h +++ b/legacy/edje/src/lib/Edje.h @@ -13,23 +13,23 @@ typedef enum _Edje_Queue typedef enum _Edje_Message_Type { - EDJE_MESSAGE_NONE, + EDJE_MESSAGE_NONE = 0, - EDJE_MESSAGE_SIGNAL, + EDJE_MESSAGE_SIGNAL = 1, - EDJE_MESSAGE_STRING, - EDJE_MESSAGE_INT, - EDJE_MESSAGE_FLOAT, + EDJE_MESSAGE_STRING = 2, + EDJE_MESSAGE_INT = 3, + EDJE_MESSAGE_FLOAT = 4, - EDJE_MESSAGE_STRING_SET, - EDJE_MESSAGE_INT_SET, - EDJE_MESSAGE_FLOAT_SET, + EDJE_MESSAGE_STRING_SET = 5, + EDJE_MESSAGE_INT_SET = 6, + EDJE_MESSAGE_FLOAT_SET = 7, - EDJE_MESSAGE_STRING_INT, - EDJE_MESSAGE_STRING_FLOAT, + EDJE_MESSAGE_STRING_INT = 8, + EDJE_MESSAGE_STRING_FLOAT = 9, - EDJE_MESSAGE_STRING_INT_SET, - EDJE_MESSAGE_STRING_FLOAT_SET + EDJE_MESSAGE_STRING_INT_SET = 10, + EDJE_MESSAGE_STRING_FLOAT_SET = 11 } Edje_Message_Type; #define EDJE_DRAG_DIR_NONE 0 diff --git a/legacy/edje/src/lib/edje_message_queue.c b/legacy/edje/src/lib/edje_message_queue.c index 5d9212f13c..5b4026e205 100644 --- a/legacy/edje/src/lib/edje_message_queue.c +++ b/legacy/edje/src/lib/edje_message_queue.c @@ -255,13 +255,16 @@ _edje_message_process(Edje_Message *em) Embryo_Function fn; _edje_embryo_script_reset(em->edje); - fn = embryo_program_function_find(em->edje->collection->script, "_msg"); + fn = embryo_program_function_find(em->edje->collection->script, "message"); if (fn != EMBRYO_FUNCTION_NONE) { void *pdata; Embryo_Cell cell; // embryo_parameter_string_push(em->edje->collection->script, sig); + /* first param is the message type - always */ + cell = em->type; + embryo_parameter_cell_push(em->edje->collection->script, cell); /* first param is the integer of the event id - always there */ cell = em->id; embryo_parameter_cell_push(em->edje->collection->script, cell);