Event: modify the way the events are triggered.

Summary:
The way it was done until now doesn't involve all the EFL layers, such
as Edje.
Now, we support the click event that is converted to a series of three actions { move,
up, down } appended to the played actions list.

Reviewers: jsuya

Reviewed By: jsuya

Subscribers: bowonryu, akanad, myoungwoon, YOhoho

Differential Revision: https://phab.enlightenment.org/D7386
master
Daniel Zaoui 4 years ago
parent 82c93f8714
commit 3b05bf5786
  1. 13
      src/bin/injector.c
  2. 15
      src/bin/inspect.c
  3. 69
      src/bin/player.c
  4. 10
      src/lib/Exactness.h
  5. 16
      src/lib/unit.c

@ -114,6 +114,7 @@ static int _key_down_op = EINA_DEBUG_OPCODE_INVALID;
static int _key_up_op = EINA_DEBUG_OPCODE_INVALID;
static int _take_shot_op = EINA_DEBUG_OPCODE_INVALID;
static int _efl_event_op = EINA_DEBUG_OPCODE_INVALID;
static int _click_on_op = EINA_DEBUG_OPCODE_INVALID;
static int _stabilize_op = EINA_DEBUG_OPCODE_INVALID;
static int _finish_op = EINA_DEBUG_OPCODE_INVALID;
@ -132,6 +133,7 @@ EINA_DEBUG_OPCODES_ARRAY_DEFINE(_debug_ops,
{"Exactness/Actions/Key Up", &_key_up_op, NULL},
{"Exactness/Actions/Take Shot", &_take_shot_op, NULL},
{"Exactness/Actions/EFL Event", &_efl_event_op, NULL},
{"Exactness/Actions/Click On", &_click_on_op, NULL},
{"Exactness/Actions/Stabilize", &_stabilize_op, NULL},
{"Exactness/Actions/Finish", &_finish_op, NULL},
{NULL, NULL, NULL}
@ -270,6 +272,17 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
eina_debug_session_send(_session, _cid, _efl_event_op, buf, len);
break;
}
case EXACTNESS_ACTION_CLICK_ON:
{
Exactness_Action_Click_On *t = data;
int len = 0;
len += t->wdg_name ? strlen(t->wdg_name) : 0;
char *buf = malloc(len), *tmp = buf;
_printf(2, "%s %s\n", __func__, "Click On");
STORE_STRING(tmp, t->wdg_name);
eina_debug_session_send(_session, _cid, _click_on_op, buf, len);
break;
}
case EXACTNESS_ACTION_STABILIZE:
{
_printf(2, "%s stabilize\n", __func__);

@ -71,6 +71,7 @@ _action_name_get(Exactness_Action *act)
case EXACTNESS_ACTION_KEY_UP: return "Key Up";
case EXACTNESS_ACTION_TAKE_SHOT: return "Take shot";
case EXACTNESS_ACTION_EFL_EVENT: return "EFL Event";
case EXACTNESS_ACTION_CLICK_ON: return "Click On";
case EXACTNESS_ACTION_STABILIZE: return "Stabilize";
default: return NULL;
}
@ -93,6 +94,8 @@ _event_struct_len_get(Exactness_Action_Type type)
return sizeof(Exactness_Action_Key_Down_Up);
case EXACTNESS_ACTION_EFL_EVENT:
return sizeof(Exactness_Action_Efl_Event);
case EXACTNESS_ACTION_CLICK_ON:
return sizeof(Exactness_Action_Click_On);
default: return 0;
}
}
@ -141,6 +144,12 @@ _action_specific_info_get(const Exactness_Action *act, char output[1024])
sprintf(output, "Widget %s Event %s", t->wdg_name, t->event_name);
break;
}
case EXACTNESS_ACTION_CLICK_ON:
{
Exactness_Action_Click_On *t = act->data;
sprintf(output, "Widget %s", t->wdg_name);
break;
}
default:
{
output[0] = '\0';
@ -183,6 +192,12 @@ _are_scenario_entries_different(Exactness_Action *act1, Exactness_Action *act2)
return (!!strcmp(e1->wdg_name, e2->wdg_name) ||
!!strcmp(e1->event_name, e2->event_name));
}
case EXACTNESS_ACTION_CLICK_ON:
{
Exactness_Action_Click_On *e1 = act1->data;
Exactness_Action_Click_On *e2 = act2->data;
return (!!strcmp(e1->wdg_name, e2->wdg_name));
}
default:
return EINA_FALSE;
}

@ -523,6 +523,64 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
if (!found) fprintf(stderr, "Failed finding %s.\n", t->wdg_name);
break;
}
case EXACTNESS_ACTION_CLICK_ON:
{
Exactness_Action_Click_On *t = data;
Eina_List *itr;
Eo *o;
n_evas = 0;
EINA_LIST_FOREACH(_evas_list, itr, e)
{
o = efl_name_find(e, t->wdg_name);
if (o) goto wdg_found;
n_evas++;
}
o = NULL;
wdg_found:
if (o)
{
Eina_Size2D sz = efl_gfx_entity_size_get(o);
Eina_Position2D pos = efl_gfx_entity_position_get(o);
int x = pos.x + (sz.w / 2);
int y = pos.y + (sz.h / 2);
Exactness_Action_Multi_Move *d_move = calloc(1, sizeof(*d_move));
Exactness_Action_Multi_Event *d_event = calloc(1, sizeof(*d_event));
Exactness_Action *act, *prev_act = eina_list_data_get(_cur_event_list);
_printf(2, "%s click on %s\n", __func__, t->wdg_name);
act = calloc(1, sizeof(*act));
act->type = EXACTNESS_ACTION_MULTI_MOVE;
act->delay_ms = 100;
act->n_evas = n_evas;
act->data = d_move;
d_move->x = x;
d_move->y = y;
_cur_event_list = eina_list_append_relative(_cur_event_list,
act, prev_act);
prev_act = act;
act = calloc(1, sizeof(*act));
act->type = EXACTNESS_ACTION_MULTI_DOWN;
act->delay_ms = 100;
act->n_evas = n_evas;
act->data = d_event;
d_event->b = 1;
_cur_event_list = eina_list_append_relative(_cur_event_list,
act, prev_act);
prev_act = act;
act = calloc(1, sizeof(*act));
act->type = EXACTNESS_ACTION_MULTI_UP;
act->delay_ms = 100;
act->n_evas = n_evas;
d_event = calloc(1, sizeof(*d_event));
act->data = d_event;
d_event->b = 1;
_cur_event_list = eina_list_append_relative(_cur_event_list,
act, prev_act);
}
else fprintf(stderr, "Failed finding %s.\n", t->wdg_name);
}
case EXACTNESS_ACTION_STABILIZE:
{
_printf(2, "%s stabilize\n", __func__);
@ -735,6 +793,15 @@ _main_loop_efl_event_cb(Eina_Debug_Session *session EINA_UNUSED, int srcid EINA_
_feed_event(EXACTNESS_ACTION_EFL_EVENT, 0, &t);
}
static void
_main_loop_click_on_cb(Eina_Debug_Session *session EINA_UNUSED, int srcid EINA_UNUSED, void *buffer, int size EINA_UNUSED)
{
char *buf = buffer;
Exactness_Action_Click_On t;
t.wdg_name = EXTRACT_STRING(buf);
_feed_event(EXACTNESS_ACTION_CLICK_ON, 0, &t);
}
static void
_main_loop_stabilize_cb(Eina_Debug_Session *session EINA_UNUSED, int srcid EINA_UNUSED, void *buffer EINA_UNUSED, int size EINA_UNUSED)
{
@ -757,6 +824,7 @@ WRAPPER_TO_XFER_MAIN_LOOP(_key_down_cb)
WRAPPER_TO_XFER_MAIN_LOOP(_key_up_cb)
WRAPPER_TO_XFER_MAIN_LOOP(_take_shot_cb)
WRAPPER_TO_XFER_MAIN_LOOP(_efl_event_cb)
WRAPPER_TO_XFER_MAIN_LOOP(_click_on_cb)
WRAPPER_TO_XFER_MAIN_LOOP(_stabilize_cb)
WRAPPER_TO_XFER_MAIN_LOOP(_finish_cb)
@ -771,6 +839,7 @@ EINA_DEBUG_OPCODES_ARRAY_DEFINE(_debug_ops,
{"Exactness/Actions/Key Up", NULL, &_key_up_cb},
{"Exactness/Actions/Take Shot", &_take_shot_op, &_take_shot_cb},
{"Exactness/Actions/EFL Event", NULL, &_efl_event_cb},
{"Exactness/Actions/Click On", NULL, &_click_on_cb},
{"Exactness/Actions/Stabilize", NULL, &_stabilize_cb},
{"Exactness/Actions/Finish", NULL, &_finish_cb},
{NULL, NULL, NULL}

@ -57,6 +57,7 @@ typedef enum
EXACTNESS_ACTION_KEY_UP,
EXACTNESS_ACTION_TAKE_SHOT,
EXACTNESS_ACTION_EFL_EVENT,
EXACTNESS_ACTION_CLICK_ON,
EXACTNESS_ACTION_STABILIZE,
EXACTNESS_ACTION_LAST = EXACTNESS_ACTION_STABILIZE
/* Add any supported actions here and update _LAST */
@ -133,6 +134,15 @@ typedef struct
char *event_name;
} Exactness_Action_Efl_Event;
/**
* @typedef Exactness_Action_Click_On
* The type for the Exactness Click on (widget) action.
*/
typedef struct
{
char *wdg_name;
} Exactness_Action_Click_On;
/**
* @typedef Exactness_Action
* The type for the Exactness action.

@ -116,6 +116,19 @@ _efl_event_desc_make(void)
return _d;
}
static Eet_Data_Descriptor *
_click_on_desc_make(void)
{
Eet_Data_Descriptor_Class eddc;
Eet_Data_Descriptor *_d;
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Exactness_Action_Click_On);
_d = eet_data_descriptor_stream_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Click_On, "wdg_name", wdg_name, EET_T_STRING);
return _d;
}
static Eet_Data_Descriptor *
_dummy_desc_make(void)
{
@ -141,6 +154,7 @@ static const char *_mapping[] =
"exactness_action_key_up",
"exactness_action_take_shot",
"exactness_action_efl_event",
"exactness_action_click_on",
"exactness_action_stabilize"
};
@ -238,6 +252,8 @@ _unit_desc_make(void)
_mapping[EXACTNESS_ACTION_TAKE_SHOT], _dummy_desc_make());
EET_DATA_DESCRIPTOR_ADD_MAPPING(action_variant_d,
_mapping[EXACTNESS_ACTION_EFL_EVENT], _efl_event_desc_make());
EET_DATA_DESCRIPTOR_ADD_MAPPING(action_variant_d,
_mapping[EXACTNESS_ACTION_CLICK_ON], _click_on_desc_make());
EET_DATA_DESCRIPTOR_ADD_MAPPING(action_variant_d,
_mapping[EXACTNESS_ACTION_STABILIZE], _dummy_desc_make());

Loading…
Cancel
Save