Refactor structures and make them public

The exu doesn't contain the old scenario entries (Variant_st) but the new
(Exactness_Action).
The recorder doesn't create old rec file but only exu.
The player/inspector support rec files by converting them to the new
format internally.
The structures have been tried to be simpler.
master
Daniel Zaoui 5 years ago
parent ffe0659fbe
commit dc891a41e1
  1. 6
      src/bin/Makefile.am
  2. 284
      src/bin/inspect.c
  3. 226
      src/bin/player.c
  4. 163
      src/bin/recorder.c
  5. 209
      src/lib/Exactness.h
  6. 6
      src/lib/Makefile.am
  7. 5
      src/lib/exactness_private.h
  8. 176
      src/lib/tsuite_common.c
  9. 358
      src/lib/tsuite_file_data.c
  10. 56
      src/lib/tsuite_file_data.h
  11. 300
      src/lib/unit.c

@ -4,11 +4,11 @@ bin_PROGRAMS = exactness exactness_inspect exactness_play exactness_record
exactness_SOURCES = exactness.c ../lib/tsuite_file_data.c ../lib/tsuite_common.c
exactness_inspect_SOURCES = inspect.c ../lib/tsuite_file_data.c ../lib/tsuite_common.c
exactness_inspect_SOURCES = inspect.c ../lib/tsuite_file_data.c ../lib/tsuite_common.c ../lib/file.c
exactness_play_SOURCES = player.c ../lib/tsuite_file_data.c ../lib/tsuite_common.c
exactness_play_SOURCES = player.c ../lib/tsuite_file_data.c ../lib/tsuite_common.c ../lib/file.c
exactness_record_SOURCES = recorder.c ../lib/tsuite_file_data.c ../lib/tsuite_common.c
exactness_record_SOURCES = recorder.c ../lib/tsuite_file_data.c ../lib/tsuite_common.c ../lib/file.c
exactness_LDADD = @EFL_LIBS@

@ -8,9 +8,9 @@
#include <Ecore_Getopt.h>
#include <Ecore_Evas.h>
#include <Elementary.h>
#include <Exactness.h>
#include "tsuite_file_data.h"
#include "exactness_private.h"
#define LDIFF(x) "<b><color=#F0F>"#x"</color></b>"
#define RDIFF(x) "<b><color=#0FF>"#x"</color></b>"
@ -48,89 +48,67 @@ static Eina_Bool _show_only_diffs = EINA_FALSE;
static Eina_List *_comp_vvs = NULL;
static const char *
_event_name_get(const Variant_st *v)
_action_name_get(Exactness_Action *act)
{
if (!v) return NULL;
switch(tsuite_event_mapping_type_get(v->t.type))
if (!act) return NULL;
switch(act->type)
{
case TSUITE_EVENT_MOUSE_IN: return "Mouse In";
case TSUITE_EVENT_MOUSE_OUT: return "Mouse Out";
case TSUITE_EVENT_MOUSE_DOWN: return "Mouse Down";
case TSUITE_EVENT_MOUSE_UP: return "Mouse Up";
case TSUITE_EVENT_MOUSE_MOVE: return "Mouse Move";
case TSUITE_EVENT_MOUSE_WHEEL: return "Mouse Wheel";
case TSUITE_EVENT_MULTI_DOWN: return "Multi Down";
case TSUITE_EVENT_MULTI_UP: return "Multi Up";
case TSUITE_EVENT_MULTI_MOVE: return "Multi Move";
case TSUITE_EVENT_KEY_DOWN: return "Key Down";
case TSUITE_EVENT_KEY_UP: return "Key Up";
case TSUITE_EVENT_KEY_DOWN_WITH_KEYCODE: return "Key Down with Keycode";
case TSUITE_EVENT_KEY_UP_WITH_KEYCODE: return "Key Up with Keycode";
case TSUITE_EVENT_TAKE_SHOT: return "Take shot";
case EXACTNESS_ACTION_MOUSE_IN: return "Mouse In";
case EXACTNESS_ACTION_MOUSE_OUT: return "Mouse Out";
case EXACTNESS_ACTION_MOUSE_WHEEL: return "Mouse Wheel";
case EXACTNESS_ACTION_MULTI_DOWN: return "Multi Down";
case EXACTNESS_ACTION_MULTI_UP: return "Multi Up";
case EXACTNESS_ACTION_MULTI_MOVE: return "Multi Move";
case EXACTNESS_ACTION_KEY_DOWN: return "Key Down";
case EXACTNESS_ACTION_KEY_UP: return "Key Up";
case EXACTNESS_ACTION_TAKE_SHOT: return "Take shot";
default: return NULL;
}
}
static int
_event_struct_len_get(Tsuite_Event_Type type)
_event_struct_len_get(Exactness_Action_Type type)
{
switch(type)
{
case TSUITE_EVENT_MOUSE_IN: case TSUITE_EVENT_MOUSE_OUT: return sizeof(mouse_in_mouse_out);
case TSUITE_EVENT_MOUSE_DOWN: case TSUITE_EVENT_MOUSE_UP: return sizeof(mouse_down_mouse_up);
case TSUITE_EVENT_MOUSE_MOVE: return sizeof(mouse_move);
case TSUITE_EVENT_MOUSE_WHEEL: return sizeof(mouse_wheel);
case TSUITE_EVENT_MULTI_DOWN: case TSUITE_EVENT_MULTI_UP: return sizeof(multi_move);
case TSUITE_EVENT_MULTI_MOVE: return sizeof(multi_event);
case TSUITE_EVENT_KEY_DOWN: case TSUITE_EVENT_KEY_UP: return sizeof(key_down_key_up);
case TSUITE_EVENT_KEY_DOWN_WITH_KEYCODE: case TSUITE_EVENT_KEY_UP_WITH_KEYCODE: return sizeof(key_down_key_up_with_keycode);
case TSUITE_EVENT_TAKE_SHOT: return sizeof(take_screenshot);
case EXACTNESS_ACTION_MOUSE_WHEEL:
return sizeof(Exactness_Action_Mouse_Wheel);
case EXACTNESS_ACTION_MULTI_DOWN:
case EXACTNESS_ACTION_MULTI_UP:
return sizeof(Exactness_Action_Multi_Event);
case EXACTNESS_ACTION_MULTI_MOVE:
return sizeof(Exactness_Action_Multi_Move);
case EXACTNESS_ACTION_KEY_DOWN:
case EXACTNESS_ACTION_KEY_UP:
return sizeof(Exactness_Action_Key_Down_Up);
default: return 0;
}
}
static void
_event_specific_info_get(const Variant_st *v, char output[1024])
_action_specific_info_get(const Exactness_Action *act, char output[1024])
{
switch(tsuite_event_mapping_type_get(v->t.type))
switch(act->type)
{
case TSUITE_EVENT_MOUSE_DOWN:
{
mouse_down_mouse_up *t = v->data;
sprintf(output, "Button %d Flags %d", t->b, t->flags);
break;
}
case TSUITE_EVENT_MOUSE_UP:
{
mouse_down_mouse_up *t = v->data;
sprintf(output, "Button %d Flags %d", t->b, t->flags);
break;
}
case TSUITE_EVENT_MOUSE_MOVE:
{
mouse_move *t = v->data;
sprintf(output, "X %d Y %d", t->x, t->y);
break;
}
case TSUITE_EVENT_MOUSE_WHEEL:
case EXACTNESS_ACTION_MOUSE_WHEEL:
{
mouse_wheel *t = v->data;
Exactness_Action_Mouse_Wheel *t = act->data;
sprintf(output, "Direction %d Z %d", t->direction, t->z);
break;
}
case TSUITE_EVENT_MULTI_DOWN: case TSUITE_EVENT_MULTI_UP:
case EXACTNESS_ACTION_MULTI_UP: case EXACTNESS_ACTION_MULTI_DOWN:
{
multi_event *t = v->data;
Exactness_Action_Multi_Event *t = act->data;
if (!t->d)
sprintf(output, "Button %d Flags %d", t->b, t->flags);
else
sprintf(output, "D %d X %d Y %d Rad %f RadX %f RadY %f Pres %f Ang %f FX %f FY %f Flags %d",
t->d, t->x, t->y, t->rad, t->radx, t->rady, t->pres, t->ang, t->fx, t->fy, t->flags);
break;
}
case TSUITE_EVENT_MULTI_MOVE:
}
case EXACTNESS_ACTION_MULTI_MOVE:
{
multi_move *t = v->data;
Exactness_Action_Multi_Move *t = act->data;
if (!t->d)
sprintf(output, "X %d Y %d", t->x, t->y);
else
@ -138,16 +116,9 @@ _event_specific_info_get(const Variant_st *v, char output[1024])
t->d, t->x, t->y, t->rad, t->radx, t->rady, t->pres, t->ang, t->fx, t->fy);
break;
}
case TSUITE_EVENT_KEY_UP: case TSUITE_EVENT_KEY_DOWN:
case EXACTNESS_ACTION_KEY_UP: case EXACTNESS_ACTION_KEY_DOWN:
{
key_down_key_up *t = v->data;
sprintf(output, "Keyname %s Key %s String %s Compose %s",
t->keyname, t->key, t->string, t->compose);
break;
}
case TSUITE_EVENT_KEY_DOWN_WITH_KEYCODE: case TSUITE_EVENT_KEY_UP_WITH_KEYCODE:
{
key_down_key_up_with_keycode *t = v->data;
Exactness_Action_Key_Down_Up *t = act->data;
sprintf(output, "Keyname %s Key %s String %s Compose %s Keycode %d",
t->keyname, t->key, t->string, t->compose, t->keycode);
break;
@ -161,38 +132,32 @@ _event_specific_info_get(const Variant_st *v, char output[1024])
}
static Eina_Bool
_is_hook_duplicate(const Variant_st *cur_v, const Variant_st *prev_v)
_is_hook_duplicate(const Exactness_Action *cur_act, const Exactness_Action *prev_act)
{
if (!prev_v) return EINA_FALSE;
Tsuite_Event_Type cur_type = tsuite_event_mapping_type_get(cur_v->t.type);
Tsuite_Event_Type prev_type = tsuite_event_mapping_type_get(prev_v->t.type);
if (cur_type == prev_type &&
!memcmp(cur_v->data, prev_v->data, _event_struct_len_get(cur_type))) return EINA_TRUE;
if (!prev_act) return EINA_FALSE;
if (cur_act->type == prev_act->type)
{
int len = _event_struct_len_get(cur_act->type);
return (!len || !memcmp(cur_act->data, prev_act->data, len));
}
return EINA_FALSE;
}
static Eina_Bool
_are_scenario_entries_different(Variant_st *v1, Variant_st *v2)
_are_scenario_entries_different(Exactness_Action *act1, Exactness_Action *act2)
{
if (!v1 ^ !v2) return EINA_TRUE;
if (strcmp(v1->t.type, v2->t.type)) return EINA_TRUE;
switch(tsuite_event_mapping_type_get(v1->t.type))
if (!act1 ^ !act2) return EINA_TRUE;
if (act1->type != act2->type) return EINA_TRUE;
switch(act1->type)
{
case TSUITE_EVENT_MOUSE_UP:
case TSUITE_EVENT_MOUSE_DOWN:
return !!memcmp(v1->data, v2->data, sizeof(mouse_down_mouse_up));
case TSUITE_EVENT_MOUSE_MOVE:
return !!memcmp(v1->data, v2->data, sizeof(mouse_move));
case TSUITE_EVENT_MOUSE_WHEEL:
return !!memcmp(v1->data, v2->data, sizeof(mouse_wheel));
case TSUITE_EVENT_MULTI_DOWN: case TSUITE_EVENT_MULTI_UP:
return !!memcmp(v1->data, v2->data, sizeof(multi_event));
case TSUITE_EVENT_MULTI_MOVE:
return !!memcmp(v1->data, v2->data, sizeof(multi_move));
case TSUITE_EVENT_KEY_UP: case TSUITE_EVENT_KEY_DOWN:
return !!memcmp(v1->data, v2->data, sizeof(key_down_key_up));
case TSUITE_EVENT_KEY_DOWN_WITH_KEYCODE: case TSUITE_EVENT_KEY_UP_WITH_KEYCODE:
return !!memcmp(v1->data, v2->data, sizeof(key_down_key_up_with_keycode));
case EXACTNESS_ACTION_MOUSE_WHEEL:
return !!memcmp(act1->data, act2->data, sizeof(Exactness_Action_Mouse_Wheel));
case EXACTNESS_ACTION_MULTI_DOWN: case EXACTNESS_ACTION_MULTI_UP:
return !!memcmp(act1->data, act2->data, sizeof(Exactness_Action_Multi_Event));
case EXACTNESS_ACTION_MULTI_MOVE:
return !!memcmp(act1->data, act2->data, sizeof(Exactness_Action_Multi_Move));
case EXACTNESS_ACTION_KEY_UP: case EXACTNESS_ACTION_KEY_DOWN:
return !!memcmp(act1->data, act2->data, sizeof(Exactness_Action_Key_Down_Up));
default:
return EINA_FALSE;
}
@ -390,26 +355,22 @@ _scn_text_get(void *data, Evas_Object *gl, const char *part EINA_UNUSED)
if (compare)
{
_Compare_Item_Data *vv = data;
Variant_st *v1 = vv->p1;
Variant_st *v2 = vv->p2;
int tm1 = evt_time_get(0, v1);
int tm2 = evt_time_get(0, v2);
Tsuite_Event_Type t1 = v1 ? tsuite_event_mapping_type_get(v1->t.type) : TSUITE_EVENT_NOT_SUPPORTED;
Tsuite_Event_Type t2 = v2 ? tsuite_event_mapping_type_get(v2->t.type) : TSUITE_EVENT_NOT_SUPPORTED;
if (tm1 != tm2) eina_strbuf_append_printf(buf, "["LDIFF(%.3f)"/"RDIFF(%.3f)"]: ", tm1/1000.0, tm2/1000.0);
else eina_strbuf_append_printf(buf, "%.3f: ", tm1 / 1000.0);
if (t1 != t2)
eina_strbuf_append_printf(buf, "["LDIFF(%s)"/"RDIFF(%s)"] - XXXXXX", _event_name_get(v1), _event_name_get(v2));
Exactness_Action *a1 = vv->p1;
Exactness_Action *a2 = vv->p2;
if (a1->timestamp != a2->timestamp) eina_strbuf_append_printf(buf, "["LDIFF(%.3f)"/"RDIFF(%.3f)"]: ", a1->timestamp/1000.0, a2->timestamp/1000.0);
else eina_strbuf_append_printf(buf, "%.3f: ", a1->timestamp / 1000.0);
if (a1->type != a2->type)
eina_strbuf_append_printf(buf, "["LDIFF(%s)"/"RDIFF(%s)"] - XXXXXX", _action_name_get(a1), _action_name_get(a2));
else
{
char params1[1024];
char params2[2024];
_event_specific_info_get(v1, params1);
_event_specific_info_get(v2, params2);
_action_specific_info_get(a1, params1);
_action_specific_info_get(a2, params2);
eina_strbuf_append_printf(buf, "%s", _event_name_get(v1));
eina_strbuf_append_printf(buf, "%s", _action_name_get(a1));
if (*params1 || *params2)
{
if (strcmp(params1, params2))
@ -421,14 +382,13 @@ _scn_text_get(void *data, Evas_Object *gl, const char *part EINA_UNUSED)
}
else
{
Variant_st *v = data;
unsigned int timestamp = evt_time_get(0, v);
Exactness_Action *act = data;
char specific_output[1024];
if (v)
if (act)
{
eina_strbuf_append_printf(buf, "%.3f: ", timestamp / 1000.0);
eina_strbuf_append_printf(buf, "%s", _event_name_get(v));
_event_specific_info_get(v, specific_output);
eina_strbuf_append_printf(buf, "%.3f: ", act->timestamp / 1000.0);
eina_strbuf_append_printf(buf, "%s", _action_name_get(act));
_action_specific_info_get(act, specific_output);
if (*specific_output) eina_strbuf_append_printf(buf, " - %s", specific_output);
}
else
@ -441,17 +401,17 @@ _scn_text_get(void *data, Evas_Object *gl, const char *part EINA_UNUSED)
}
static int
_unit_shot_no_get(Exactness_Unit *unit, Variant_st *v_ref)
_unit_shot_no_get(Exactness_Unit *unit, Exactness_Action *act_ref)
{
Eina_List *itr;
Variant_st *v;
Exactness_Action *act;
int ret = 0;
if (!unit) return -1;
EINA_LIST_FOREACH(unit->events, itr, v)
EINA_LIST_FOREACH(unit->actions, itr, act)
{
if (tsuite_event_mapping_type_get(v->t.type) == TSUITE_EVENT_TAKE_SHOT)
if (act->type == EXACTNESS_ACTION_TAKE_SHOT)
{
if (v == v_ref) return ret;
if (act == act_ref) return ret;
ret++;
}
}
@ -505,10 +465,10 @@ _scn_content_get(void *data, Evas_Object *gl, const char *part)
if (!strcmp(part, "elm.swallow.end"))
{
_Compare_Item_Data *vv = data;
Variant_st *v1 = vv->p1;
Variant_st *v2 = vv->p2;
if (tsuite_event_mapping_type_get(v1->t.type) == TSUITE_EVENT_TAKE_SHOT &&
tsuite_event_mapping_type_get(v2->t.type) == TSUITE_EVENT_TAKE_SHOT)
Exactness_Action *v1 = vv->p1;
Exactness_Action *v2 = vv->p2;
if (v1->type == EXACTNESS_ACTION_TAKE_SHOT &&
v2->type == EXACTNESS_ACTION_TAKE_SHOT)
{
Eo *gl1 = eina_list_nth(_gls, 0);
Eo *gl2 = eina_list_nth(_gls, 1);
@ -548,7 +508,7 @@ _scn_content_get(void *data, Evas_Object *gl, const char *part)
{
if (!strcmp(part, "elm.swallow.end"))
{
Variant_st *v = data;
Exactness_Action *v = data;
Exactness_Unit *unit = efl_key_data_get(gl, "unit");
int shot_no = _unit_shot_no_get(unit, v);
Exactness_Image *ex_img = shot_no != -1 ? eina_list_nth(unit->imgs, shot_no) : NULL;
@ -988,8 +948,8 @@ _gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2)
}
_itc_init();
itr1 = unit1 ? unit1->events : NULL;
itr2 = unit2 ? unit2->events : NULL;
itr1 = unit1 ? unit1->actions : NULL;
itr2 = unit2 ? unit2->actions : NULL;
if (itr1)
elm_genlist_item_append(gl1, _grp_itc, (void *)EX_SCENARIO, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
@ -1000,8 +960,8 @@ _gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2)
}
while (itr1 || itr2)
{
Variant_st *v1 = itr1 ? eina_list_data_get(itr1) : NULL;
Variant_st *v2 = itr2 ? eina_list_data_get(itr2) : NULL;
Exactness_Action *v1 = itr1 ? eina_list_data_get(itr1) : NULL;
Exactness_Action *v2 = itr2 ? eina_list_data_get(itr2) : NULL;
if (!_show_only_diffs || _are_scenario_entries_different(v1, v2))
{
_Item_Info *ii = calloc(1, sizeof(*ii));
@ -1145,11 +1105,11 @@ static const Ecore_Getopt optdesc = {
0,
{
ECORE_GETOPT_STORE_USHORT('d', "delay", "Delay the given recording by a given time (in milliseconds)."),
ECORE_GETOPT_STORE_TRUE('c', "clean", "Clean the given recording from wrong events."),
ECORE_GETOPT_STORE_TRUE('l', "list", "List the events of the given recording."),
ECORE_GETOPT_STORE_TRUE('c', "clean", "Clean the given recording from wrong actions."),
ECORE_GETOPT_STORE_TRUE('l', "list", "List the actions of the given recording."),
ECORE_GETOPT_STORE_TRUE('C', "compare", "Compare given files (images files or objects eet files)."),
ECORE_GETOPT_STORE_TRUE(0, "show-only-diffs", "Show only differences during comparison."),
ECORE_GETOPT_STORE_STR('o', "compare_output", "Output of the comparison."),
ECORE_GETOPT_STORE_STR('o', "output", "Output."),
ECORE_GETOPT_STORE_USHORT('s', "shot", "Select a specific shot (1 = 1st shot...)."),
ECORE_GETOPT_LICENSE('L', "license"),
@ -1165,19 +1125,21 @@ main(int argc, char *argv[])
{
const char *ext = NULL;
const char *rec_file = NULL;
char *compare_output = NULL;
char *output = NULL;
Exactness_Unit *unit = NULL;
int ret = 1, args = 0;
unsigned short delay = 0, shot = 0;
Eina_Bool write_file = EINA_FALSE;
Eina_Bool want_quit, clean = EINA_FALSE, list_get = EINA_FALSE, compare_files = EINA_FALSE;
Eina_Bool show_only_diffs = EINA_FALSE, gui_needed = EINA_TRUE;
Ecore_Getopt_Value values[] = {
ECORE_GETOPT_VALUE_USHORT(delay),
ECORE_GETOPT_VALUE_BOOL(clean),
ECORE_GETOPT_VALUE_BOOL(list_get),
ECORE_GETOPT_VALUE_BOOL(compare_files),
ECORE_GETOPT_VALUE_BOOL(show_only_diffs),
ECORE_GETOPT_VALUE_STR(compare_output),
ECORE_GETOPT_VALUE_STR(output),
ECORE_GETOPT_VALUE_USHORT(shot),
ECORE_GETOPT_VALUE_BOOL(want_quit),
@ -1225,25 +1187,23 @@ main(int argc, char *argv[])
fprintf(stderr, "--show-only-diffs is available with --compare only");
goto end;
}
if (show_only_diffs && compare_output)
if (show_only_diffs && output)
{
fprintf(stderr, "--show-only-diffs works in GUI only");
goto end;
}
_show_only_diffs = show_only_diffs;
Lists_st *list = NULL;
if (clean || delay || list_get)
{
rec_file = argv[args];
Timer_Data td;
gui_needed = EINA_FALSE;
list = read_events(rec_file, &td);
unit = legacy_rec_file_read(rec_file);
}
else
{
int arg;
if (compare_output) gui_needed = EINA_FALSE;
if (output) gui_needed = EINA_FALSE;
for (arg = args; arg < argc; arg++)
{
if (!ext) ext = strrchr(argv[arg], '.');
@ -1254,20 +1214,17 @@ main(int argc, char *argv[])
}
if (!strcmp(ext, ".exu"))
{
Exactness_Unit *ex_unit= unit_eet_read(argv[arg]);
Exactness_Unit *ex_unit = exactness_unit_file_read(argv[arg]);
_units = eina_list_append(_units, ex_unit);
}
else if (!strcmp(ext, ".rec"))
{
Exactness_Unit *ex_unit = calloc(1, sizeof(*ex_unit));
Timer_Data td;
list = read_events(argv[arg], &td);
if (!list)
Exactness_Unit *ex_unit = legacy_rec_file_read(argv[arg]);
if (!ex_unit)
{
fprintf(stderr, "Issue while reading %s\n", argv[arg]);
goto end;
}
ex_unit->events = list->variant_list;
_units = eina_list_append(_units, ex_unit);
}
else if (!strcmp(ext, ".png"))
@ -1287,16 +1244,16 @@ main(int argc, char *argv[])
if (clean)
{
Variant_st *v;
Exactness_Action *act;
Eina_List *itr, *itr2;
EINA_LIST_FOREACH_SAFE(list->variant_list, itr, itr2, v)
EINA_LIST_FOREACH_SAFE(unit->actions, itr, itr2, act)
{
if (!evt_time_get(0, v))
list->variant_list = eina_list_remove_list(list->variant_list, itr);
if (!act->timestamp)
unit->actions = eina_list_remove_list(unit->actions, itr);
else
{
if (_is_hook_duplicate(v, eina_list_data_get(eina_list_prev(itr))))
list->variant_list = eina_list_remove_list(list->variant_list, itr);
if (_is_hook_duplicate(act, eina_list_data_get(eina_list_prev(itr))))
unit->actions = eina_list_remove_list(unit->actions, itr);
}
}
write_file = EINA_TRUE;
@ -1306,26 +1263,20 @@ main(int argc, char *argv[])
{
if (!shot)
{
if (!list->first_timestamp)
{
list->first_timestamp = evt_time_get(0, eina_list_data_get(list->variant_list));
}
list->first_timestamp -= delay;
}
else
{
Variant_st *v;
Exactness_Action *act;
Eina_List *itr;
unsigned int cur_shot = 0;
EINA_LIST_FOREACH(list->variant_list, itr, v)
EINA_LIST_FOREACH(unit->actions, itr, act)
{
if (tsuite_event_mapping_type_get(v->t.type) == TSUITE_EVENT_TAKE_SHOT)
if (act->type == EXACTNESS_ACTION_TAKE_SHOT)
{
cur_shot++;
if (cur_shot == shot)
{
take_screenshot *t = v->data;
t->timestamp += delay;
act->timestamp += delay;
break;
}
}
@ -1336,24 +1287,23 @@ main(int argc, char *argv[])
if (list_get)
{
Variant_st *v;
Exactness_Action *act;
Eina_List *itr;
EINA_LIST_FOREACH(list->variant_list, itr, v)
EINA_LIST_FOREACH(unit->actions, itr, act)
{
char specific_output[1024];
unsigned int timestamp = evt_time_get(0, v);
printf("%.3f: %s", timestamp / 1000.0, _event_name_get(v));
_event_specific_info_get(v, specific_output);
unsigned int timestamp = act->timestamp;
printf("%.3f: %s", timestamp / 1000.0, _action_name_get(act));
_action_specific_info_get(act, specific_output);
if (*specific_output) printf(" - %s", specific_output);
printf("\n");
}
}
if (compare_files && compare_output)
if (compare_files && output)
{
Exactness_Unit *unit1 = NULL, *unit2 = NULL;
Eina_List *itr;
Exactness_Unit *unit;
EINA_LIST_FOREACH(_units, itr, unit)
{
if (!unit1) unit1 = unit;
@ -1381,7 +1331,7 @@ main(int argc, char *argv[])
img = evas_object_image_add(e);
evas_object_image_size_set(img, ex_imgO->w, ex_imgO->h);
evas_object_image_data_set(img, ex_imgO->pixels);
evas_object_image_save(img, compare_output, NULL, NULL);
evas_object_image_save(img, output, NULL, NULL);
ecore_evas_free(ee);
goto end;
}
@ -1389,12 +1339,12 @@ main(int argc, char *argv[])
}
ret = 0;
if (rec_file && write_file) write_events(rec_file, list);
if (output && write_file) exactness_unit_file_write(unit, output);
if (gui_needed)
{
Eina_List *itr;
Exactness_Unit *unit, *unit1 = NULL, *unit2 = NULL;
Exactness_Unit *unit1 = NULL, *unit2 = NULL;
Eina_Bool need_compare = compare_files && eina_list_count(_units) == 2;
_item_infos_hash = eina_hash_pointer_new(NULL);
_gui_win_create();

@ -20,8 +20,8 @@
#include <Ecore_File.h>
#include <Ecore_Con.h>
#include <Elementary.h>
#include <Exactness.h>
#include "tsuite_file_data.h"
#include "exactness_private.h"
#define MAX_PATH 1024
@ -173,97 +173,58 @@ _shot_do(Evas *e)
static Eina_Bool
_feed_event(void *data EINA_UNUSED)
{
time_t evt_time;
static Evas_Object *rect = NULL;
static unsigned int rect_evas;
Exactness_Action *act = eina_list_data_get(_cur_event_list);
Eo *e = eina_list_nth(_evas_list, act->n_evas);
time_t evt_time = act->timestamp;
if (rect && rect_evas != act->n_evas)
{
efl_del(rect);
rect = NULL;
}
if (_verbose && !rect)
{
rect = evas_object_rectangle_add(eina_list_data_get(_evas_list));
rect = evas_object_rectangle_add(e);
evas_object_repeat_events_set(rect, EINA_TRUE);
evas_object_color_set(rect, 255, 0, 0, 255);
evas_object_resize(rect, 15, 15);
evas_object_layer_set(rect, 100);
evas_object_show(rect);
rect_evas = act->n_evas;
}
Variant_st *v = eina_list_data_get(_cur_event_list);
switch(tsuite_event_mapping_type_get(v->t.type))
switch (act->type)
{
case TSUITE_EVENT_MOUSE_IN:
case EXACTNESS_ACTION_MOUSE_IN:
{
mouse_in_mouse_out *t = v->data;
Eo *e = eina_list_nth(_evas_list, t->n_evas);
evt_time = t->timestamp;
_printf(1, "Mouse in\n");
_printf(2, "%s evas_event_feed_mouse_in timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
_printf(2, "%s evas_event_feed_mouse_in timestamp=<%u> n_evas=<%d>\n", __func__, act->timestamp, act->n_evas);
if (e) evas_event_feed_mouse_in(e, time(NULL), NULL);
break;
}
case TSUITE_EVENT_MOUSE_OUT:
case EXACTNESS_ACTION_MOUSE_OUT:
{
mouse_in_mouse_out *t = v->data;
Eo *e = eina_list_nth(_evas_list, t->n_evas);
evt_time = t->timestamp;
_printf(1, "Mouse out\n");
_printf(2, "%s evas_event_feed_mouse_out timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
_printf(2, "%s evas_event_feed_mouse_out timestamp=<%u> n_evas=<%d>\n", __func__, act->timestamp,act->n_evas);
if (e) evas_event_feed_mouse_out(e, time(NULL), NULL);
break;
}
case TSUITE_EVENT_MOUSE_DOWN:
case EXACTNESS_ACTION_MOUSE_WHEEL:
{
mouse_down_mouse_up *t = v->data;
Eo *e = eina_list_nth(_evas_list, t->n_evas);
evt_time = t->timestamp;
_printf(1, "Mouse down\n");
_printf(2, "%s evas_event_feed_mouse_down timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
if (rect) evas_object_color_set(rect, 255, 255, 0, 255);
if (e) evas_event_feed_mouse_down(e, t->b, t->flags, time(NULL), NULL);
break;
}
case TSUITE_EVENT_MOUSE_UP:
{
mouse_down_mouse_up *t = v->data;
Eo *e = eina_list_nth(_evas_list, t->n_evas);
evt_time = t->timestamp;
_printf(1, "Mouse up\n");
_printf(2, "%s evas_event_feed_mouse_up timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
if (e) evas_event_feed_mouse_up(e, t->b, t->flags, time(NULL), NULL);
if (rect) evas_object_color_set(rect, 255, 0, 0, 255);
break;
}
case TSUITE_EVENT_MOUSE_MOVE:
{
mouse_move *t = v->data;
Eo *e = eina_list_nth(_evas_list, t->n_evas);
evt_time = t->timestamp;
_printf(2, "%s evas_event_feed_mouse_move (x,y)=(%d,%d) timestamp=<%u> t->n_evas=<%d>\n", __func__, t->x, t->y, t->timestamp,t->n_evas);
if (e) evas_event_feed_mouse_move(e, t->x, t->y, time(NULL), NULL);
if (rect)
{
evas_object_move(rect, t->x, t->y);
evas_object_color_set(rect, 255, 0, 0, 255);
}
break;
}
case TSUITE_EVENT_MOUSE_WHEEL:
{
mouse_wheel *t = v->data;
Eo *e = eina_list_nth(_evas_list, t->n_evas);
evt_time = t->timestamp;
Exactness_Action_Mouse_Wheel *t = act->data;
_printf(1, "Mouse wheel\n");
_printf(2, "%s evas_event_feed_mouse_wheel timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
_printf(2, "%s evas_event_feed_mouse_wheel timestamp=<%u> n_evas=<%d>\n", __func__, act->timestamp, act->n_evas);
if (e) evas_event_feed_mouse_wheel(e, t->direction, t->z, time(NULL), NULL);
break;
}
case TSUITE_EVENT_MULTI_DOWN:
case EXACTNESS_ACTION_MULTI_DOWN:
{
multi_event *t = v->data;
Eo *e = eina_list_nth(_evas_list, t->n_evas);
evt_time = t->timestamp;
_printf(2, "%s evas_event_feed_multi_down timestamp=<%u>, t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
Exactness_Action_Multi_Event *t = act->data;
_printf(2, "%s evas_event_feed_multi_down timestamp=<%u>, n_evas=<%d>\n", __func__, act->timestamp, act->n_evas);
if (!t->d)
{
if (e) evas_event_feed_mouse_down(e, t->b, t->flags, time(NULL), NULL);
@ -279,12 +240,10 @@ _feed_event(void *data EINA_UNUSED)
break;
}
case TSUITE_EVENT_MULTI_UP:
case EXACTNESS_ACTION_MULTI_UP:
{
multi_event *t = v->data;
Eo *e = eina_list_nth(_evas_list, t->n_evas);
evt_time = t->timestamp;
_printf(2, "%s evas_event_feed_multi_up timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
Exactness_Action_Multi_Event *t = act->data;
_printf(2, "%s evas_event_feed_multi_up timestamp=<%u> n_evas=<%d>\n", __func__, act->timestamp,act->n_evas);
if (!t->d)
{
if (e) evas_event_feed_mouse_up(e, t->b, t->flags, time(NULL), NULL);
@ -300,12 +259,10 @@ _feed_event(void *data EINA_UNUSED)
break;
}
case TSUITE_EVENT_MULTI_MOVE:
case EXACTNESS_ACTION_MULTI_MOVE:
{
multi_move *t = v->data;
Eo *e = eina_list_nth(_evas_list, t->n_evas);
evt_time = t->timestamp;
_printf(2, "%s evas_event_feed_multi_move timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
Exactness_Action_Multi_Move *t = act->data;
_printf(2, "%s evas_event_feed_multi_move timestamp=<%u> n_evas=<%d>\n", __func__, act->timestamp, act->n_evas);
if (!t->d)
{
if (e) evas_event_feed_mouse_move(e, t->x, t->y, time(NULL), NULL);
@ -325,138 +282,91 @@ _feed_event(void *data EINA_UNUSED)
break;
}
case TSUITE_EVENT_KEY_DOWN:
{
key_down_key_up *t = v->data;
Eo *e = eina_list_nth(_evas_list, t->n_evas);
evt_time = t->timestamp;
_printf(2, "%s evas_event_feed_key_down timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
if (e) evas_event_feed_key_down(e,
t->keyname, t->key, t->string,
t->compose, time(NULL), NULL);
break;
}
case TSUITE_EVENT_KEY_UP:
case EXACTNESS_ACTION_KEY_DOWN:
{
key_down_key_up *t = v->data;
Eo *e = eina_list_nth(_evas_list, t->n_evas);
evt_time = t->timestamp;
_printf(2, "%s evas_event_feed_key_up timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
if (e) evas_event_feed_key_up(e,
t->keyname, t->key, t->string,
t->compose, time(NULL), NULL);
Exactness_Action_Key_Down_Up *t = act->data;
_printf(2, "%s evas_event_feed_key_down timestamp=<%u> n_evas=<%d>\n", __func__, act->timestamp, act->n_evas);
if (e)
evas_event_feed_key_down_with_keycode(e,
t->keyname, t->key, t->string,
t->compose, time(NULL), NULL, t->keycode);
break;
}
case TSUITE_EVENT_KEY_DOWN_WITH_KEYCODE:
case EXACTNESS_ACTION_KEY_UP:
{
key_down_key_up_with_keycode *t = v->data;
Eo *e = eina_list_nth(_evas_list, t->n_evas);
evt_time = t->timestamp;
_printf(2, "%s evas_event_feed_key_down_with_keycode timestamp=<%u> t->n_evas=<%d> t->keycode=<%u>\n", __func__, t->timestamp, t->n_evas, t->keycode);
if (e) evas_event_feed_key_down_with_keycode(e,
Exactness_Action_Key_Down_Up *t = act->data;
_printf(2, "%s evas_event_feed_key_up timestamp=<%u> n_evas=<%d>\n", __func__, act->timestamp, act->n_evas);
if (e) evas_event_feed_key_up_with_keycode(e,
t->keyname, t->key, t->string,
t->compose, time(NULL), NULL, t->keycode);
break;
}
case TSUITE_EVENT_KEY_UP_WITH_KEYCODE:
case EXACTNESS_ACTION_TAKE_SHOT:
{
key_down_key_up_with_keycode *t = v->data;
Eo *e = eina_list_nth(_evas_list, t->n_evas);
evt_time = t->timestamp;
_printf(2, "%s evas_event_feed_key_up_with_keycode timestamp=<%u> t->n_evas=<%d> t->keycode=<%u>\n", __func__, t->timestamp, t->n_evas, t->keycode);
if (e) evas_event_feed_key_up(e,
t->keyname, t->key, t->string,
t->compose, time(NULL), NULL);
break;
}
case TSUITE_EVENT_TAKE_SHOT:
{
take_screenshot *t = v->data;
Eo *e = eina_list_nth(_evas_list, t->n_evas);
evt_time = t->timestamp;
_printf(2, "%s take shot timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
_printf(2, "%s take shot timestamp=<%u> n_evas=<%d>\n", __func__, act->timestamp, act->n_evas);
if (rect) evas_object_color_set(rect, 0, 0, 255, 255);
_cur_shot_id++;
if (_dest_type != FTYPE_UNKNOWN && e) _shot_do(e);
break;
}
default: /* All non-input events are not handeled */
evt_time = _last_event_time;
break;
}
double timer_time;
_cur_event_list = eina_list_next(_cur_event_list);
if (!_cur_event_list)
{ /* Finished reading all events */
ecore_main_loop_quit();
return ECORE_CALLBACK_CANCEL;
}
else
{
double timer_time;
Exactness_Action *cur_act = eina_list_data_get(_cur_event_list);
unsigned int current_event_time = cur_act->timestamp;
_last_event_time = evt_time;
_last_event_time = evt_time;
unsigned int current_event_time = evt_time_get(evt_time, eina_list_data_get(_cur_event_list));
if (current_event_time < _last_event_time) /* Could happen with refeed event */
current_event_time = _last_event_time;
_printf(2, " %s _last_event_time=<%u> current_event_time=<%u>\n", __func__, _last_event_time, current_event_time);
timer_time = (current_event_time - _last_event_time) / 1000.0;
if (current_event_time < _last_event_time) /* Could happen with refeed event */
current_event_time = _last_event_time;
if (!_last_event_time) timer_time = 0.0;
_printf(2, " %s _last_event_time=<%u> current_event_time=<%u>\n", __func__, _last_event_time, current_event_time);
timer_time = (current_event_time - _last_event_time) / 1000.0;
_printf(2, " %s timer_time=<%f>\n", __func__, timer_time);
ecore_timer_add(timer_time, _feed_event, NULL);
if (!_last_event_time) timer_time = 0.0;
_printf(2, " %s timer_time=<%f>\n", __func__, timer_time);
ecore_timer_add(timer_time, _feed_event, NULL);
}
return ECORE_CALLBACK_CANCEL;
}
static Eina_Bool
_src_open()
{
unsigned int first_tm = 0;
double diff_time = 0; /* Time to wait before feeding the first event */
_printf(2, "<%s> Source file is <%s>\n", __func__, _src_filename);
if (_src_type == FTYPE_EXU)
{
_src_unit = unit_eet_read(_src_filename);
_src_unit = exactness_unit_file_read(_src_filename);
}
else if (_src_type == FTYPE_REC)
{
_src_unit = calloc(1, sizeof(*_src_unit));
Lists_st *events_list = read_events(_src_filename, NULL);
if (!events_list)
{
free(_src_unit);
_src_unit = NULL;
}
else
{
_src_unit->events = events_list->variant_list;
first_tm = events_list->first_timestamp;
}
_src_unit = legacy_rec_file_read(_src_filename);
}
if (!_src_unit) return EINA_FALSE;
_cur_event_list = _src_unit->events;
Variant_st *v = eina_list_data_get(_cur_event_list);
_cur_event_list = _src_unit->actions;
Exactness_Action *act = eina_list_data_get(_cur_event_list);
/* Calculate the time to wait before feeding the first event */
unsigned int current_event_time = evt_time_get(0, v);
if (current_event_time > first_tm)
diff_time = (current_event_time - first_tm) / 1000.0;
unsigned int current_event_time = act->timestamp;
_printf(2, "%s first_time_stamp=<%u> current_event_time=<%u>\n", __func__, first_tm, current_event_time);
_printf(2, "%s current_event_time=<%u>\n", __func__, current_event_time);
if (diff_time)
if (current_event_time)
{
_printf(2, " Waiting <%f>\n", diff_time);
ecore_timer_add(diff_time, _feed_event, NULL);
ecore_timer_add(current_event_time / 1000.0, _feed_event, NULL);
}
else
{
@ -759,8 +669,8 @@ int main(int argc, char **argv)
if (_dest && _dest_unit)
{
_dest_unit->events = _src_unit->events;
unit_eet_write(_dest_unit, _dest);
_dest_unit->actions = _src_unit->actions;
exactness_unit_file_write(_dest_unit, _dest);
}
end:

@ -20,8 +20,8 @@
#include <Ecore_Getopt.h>
#include <Ecore_Con.h>
#include <Elementary.h>
#include <Exactness.h>
#include "tsuite_file_data.h"
#include "exactness_private.h"
#define MAX_PATH 1024
@ -34,11 +34,12 @@ static const char *_test_name = NULL;
static int _verbose = 0;
static Eina_List *_evas_list = NULL;
static int _last_evas_id = 0;
static unsigned int _last_evas_id = 0;
static Lists_st *_events_list = NULL;
static Exactness_Unit *_unit = NULL;
static char *_shot_key = NULL;
static unsigned int _first_timestamp = 0.0;
static void
_printf(int verbose, const char *fmt, ...)
@ -51,88 +52,54 @@ _printf(int verbose, const char *fmt, ...)
va_end(ap);
}
static Tsuite_Event_Type
static Exactness_Action_Type
_event_pointer_type_get(Efl_Pointer_Action t)
{
switch(t)
{
case EFL_POINTER_ACTION_IN: return TSUITE_EVENT_MOUSE_IN;
case EFL_POINTER_ACTION_OUT: return TSUITE_EVENT_MOUSE_OUT;
case EFL_POINTER_ACTION_DOWN: return TSUITE_EVENT_MULTI_DOWN;
case EFL_POINTER_ACTION_UP: return TSUITE_EVENT_MULTI_UP;
case EFL_POINTER_ACTION_MOVE: return TSUITE_EVENT_MULTI_MOVE;
case EFL_POINTER_ACTION_WHEEL: return TSUITE_EVENT_MOUSE_WHEEL;
default:
return TSUITE_EVENT_NOT_SUPPORTED;
}
}
static const char *
_event_name_get(Tsuite_Event_Type type)
{
switch(type)
{
case TSUITE_EVENT_MOUSE_IN: return "Mouse In";
case TSUITE_EVENT_MOUSE_OUT: return "Mouse Out";
case TSUITE_EVENT_MOUSE_DOWN: return "Mouse Down";
case TSUITE_EVENT_MOUSE_UP: return "Mouse Up";
case TSUITE_EVENT_MOUSE_MOVE: return "Mouse Move";
case TSUITE_EVENT_MOUSE_WHEEL: return "Mouse Wheel";
case TSUITE_EVENT_MULTI_DOWN: return "Multi Down";
case TSUITE_EVENT_MULTI_UP: return "Multi Up";
case TSUITE_EVENT_MULTI_MOVE: return "Multi Move";
case TSUITE_EVENT_KEY_DOWN: return "Key Down";
case TSUITE_EVENT_KEY_UP: return "Key Up";
case TSUITE_EVENT_KEY_DOWN_WITH_KEYCODE: return "Key Down with Keycode";
case TSUITE_EVENT_KEY_UP_WITH_KEYCODE: return "Key Up with Keycode";
case TSUITE_EVENT_TAKE_SHOT: return "Take shot";
default: return NULL;
case EFL_POINTER_ACTION_IN: return EXACTNESS_ACTION_MOUSE_IN;
case EFL_POINTER_ACTION_OUT: return EXACTNESS_ACTION_MOUSE_OUT;
case EFL_POINTER_ACTION_DOWN: return EXACTNESS_ACTION_MULTI_DOWN;
case EFL_POINTER_ACTION_UP: return EXACTNESS_ACTION_MULTI_UP;
case EFL_POINTER_ACTION_MOVE: return EXACTNESS_ACTION_MULTI_MOVE;
case EFL_POINTER_ACTION_WHEEL: return EXACTNESS_ACTION_MOUSE_WHEEL;
default: return EXACTNESS_ACTION_UNKNOWN;
}
}
static Eina_Bool
_is_hook_duplicate(const Variant_st *v, Tsuite_Event_Type ev_type, const void *info, int len)
static void
_output_write()
{
if (v->t.type == tsuite_event_mapping_type_str_get(ev_type) &&
!memcmp(v->data, info, len)) return EINA_TRUE;
return EINA_FALSE;
if (_unit) exactness_unit_file_write(_unit, _out_filename);
}
static void
_output_write()
_add_to_list(Exactness_Action_Type type, unsigned int n_evas, unsigned int timestamp, void *data, int len)
{
if (!strcmp(_out_filename + strlen(_out_filename) - 4,".exu"))
{
Exactness_Unit unit;
unit.imgs = NULL;
unit.events = _events_list->variant_list;
unit_eet_write(&unit, _out_filename);
}
else if (!strcmp(_out_filename + strlen(_out_filename) - 4,".rec"))
if (_unit)
{
write_events(_out_filename, _events_list);
const Exactness_Action *prev_v = eina_list_last_data_get(_unit->actions);
if (prev_v)
{
if (prev_v->type == type &&
prev_v->timestamp + _first_timestamp == timestamp &&
prev_v->n_evas == n_evas &&
(!len || !memcmp(prev_v->data, data, len))) return;
}
_printf(1, "Recording %s\n", _exactness_action_type_to_string_get(type));
Exactness_Action *act = malloc(sizeof(*act));
act->type = type;
act->n_evas = n_evas;
act->timestamp = timestamp - _first_timestamp;
if (len)
{
act->data = malloc(len);
memcpy(act->data, data, len);
}
_unit->actions = eina_list_append(_unit->actions, act);
}
}
/* Adding variant to list, this list is later written to EET file */
#define ADD_TO_LIST(EVT_TYPE, INFO) \
do { /* This macro will add event to EET data list */ \
if (_events_list) \
{ \
const Variant_st *prev_v = eina_list_last_data_get(_events_list->variant_list); \
if (!prev_v || !_is_hook_duplicate(prev_v, EVT_TYPE, &INFO, sizeof(INFO))) \
{ \
_printf(1, "Recording %s\n", tsuite_event_mapping_type_str_get(EVT_TYPE)); \
Variant_st *v = malloc(sizeof(Variant_st)); \
v->data = malloc(sizeof(INFO)); \
_variant_type_set(tsuite_event_mapping_type_str_get(EVT_TYPE), \
&v->t, EINA_FALSE); \
memcpy(v->data, &INFO, sizeof(INFO)); \
_events_list->variant_list = eina_list_append(_events_list->variant_list, v); \
} \
} \
} while (0)
static int
_evas_id_get(Evas *e)
{
@ -149,11 +116,11 @@ _event_pointer_cb(void *data, const Efl_Event *event)
int timestamp = efl_input_timestamp_get(evp);
int n_evas = _evas_id_get(eo_e);
Efl_Pointer_Action action = efl_input_pointer_action_get(evp);
Tsuite_Event_Type evt = _event_pointer_type_get(action);
Exactness_Action_Type evt = _event_pointer_type_get(action);
if (!timestamp) return;
_printf(2, "Calling \"%s\" timestamp=<%u>\n", _event_name_get(evt), timestamp);
_printf(2, "Calling \"%s\" timestamp=<%u>\n", _exactness_action_type_to_string_get(evt), timestamp);
switch (action)
{
@ -162,8 +129,8 @@ _event_pointer_cb(void *data, const Efl_Event *event)
double rad = 0, radx = 0, rady = 0, pres = 0, ang = 0, fx = 0, fy = 0;
int tool = efl_input_pointer_tool_get(evp);
Eina_Position2D pos = efl_input_pointer_position_get(evp);
multi_move t = { tool, pos.x, pos.y, rad, radx, rady, pres, ang, fx, fy, timestamp, n_evas };
if (t.n_evas >= 0) ADD_TO_LIST(evt, t);
Exactness_Action_Multi_Move t = { tool, pos.x, pos.y, rad, radx, rady, pres, ang, fx, fy };
if (n_evas >= 0) _add_to_list(evt, n_evas, timestamp, &t, sizeof(t));
break;
}
case EFL_POINTER_ACTION_DOWN: case EFL_POINTER_ACTION_UP:
@ -173,23 +140,22 @@ _event_pointer_cb(void *data, const Efl_Event *event)
int tool = efl_input_pointer_tool_get(evp);
Eina_Position2D pos = efl_input_pointer_position_get(evp);
Efl_Pointer_Flags flags = efl_input_pointer_button_flags_get(evp);
multi_event t = { tool, b, pos.x, pos.y, rad, radx, rady, pres, ang,
fx, fy, flags, timestamp, n_evas };
if (t.n_evas >= 0) ADD_TO_LIST(evt, t);
Exactness_Action_Multi_Event t = { tool, b, pos.x, pos.y, rad, radx, rady, pres, ang,
fx, fy, flags };
if (n_evas >= 0) _add_to_list(evt, n_evas, timestamp, &t, sizeof(t));
break;
}
case EFL_POINTER_ACTION_IN: case EFL_POINTER_ACTION_OUT:
{
mouse_in_mouse_out t = { timestamp, n_evas };
if (t.n_evas >= 0) ADD_TO_LIST(evt, t);
if (n_evas >= 0) _add_to_list(evt, n_evas, timestamp, NULL, 0);
break;
}
case EFL_POINTER_ACTION_WHEEL:
{
Eina_Bool horiz = efl_input_pointer_wheel_horizontal_get(evp);
int z = efl_input_pointer_wheel_delta_get(evp);
mouse_wheel t = { horiz, z, timestamp, n_evas };
if (t.n_evas >= 0) ADD_TO_LIST(evt, t);
Exactness_Action_Mouse_Wheel t = { horiz, z };
if (n_evas >= 0) _add_to_list(evt, n_evas, timestamp, &t, sizeof(t));
break;
}
default:
@ -206,41 +172,37 @@ _event_key_cb(void *data, const Efl_Event *event)
const char *key = efl_input_key_name_get(evk);
int timestamp = efl_input_timestamp_get(evk);
unsigned int n_evas = _evas_id_get(eo_e);
Tsuite_Event_Type evt = TSUITE_EVENT_KEY_UP_WITH_KEYCODE;
Exactness_Action_Type evt = EXACTNESS_ACTION_KEY_UP;
if (efl_input_key_pressed_get(evk))
{
if (!strcmp(key, _shot_key))
{
_printf(2, "Take Screenshot: %s timestamp=<%u>\n", __func__, timestamp);
take_screenshot t = { timestamp, n_evas };
if (t.n_evas >= 0) ADD_TO_LIST(TSUITE_EVENT_TAKE_SHOT, t);
if (n_evas >= 0) _add_to_list(EXACTNESS_ACTION_TAKE_SHOT, n_evas, timestamp, NULL, 0);
return;
}
if (!strcmp(key, SAVE_KEY_STR))
{
if (_events_list)
_output_write();
_output_write();
_printf(2, "Save events: %s timestamp=<%u>\n", __func__, timestamp);
return;
}
evt = TSUITE_EVENT_KEY_DOWN_WITH_KEYCODE;
evt = EXACTNESS_ACTION_KEY_DOWN;
}
else
{
if (!strcmp(key, _shot_key) || !strcmp(key, SAVE_KEY_STR)) return;
}
if (_events_list)
if (_unit)
{ /* Construct duplicate strings, free them when list if freed */
key_down_key_up_with_keycode t;
t.timestamp = timestamp;
Exactness_Action_Key_Down_Up t;
t.keyname = eina_stringshare_add(key);
t.key = eina_stringshare_add(efl_input_key_get(evk));
t.string = eina_stringshare_add(efl_input_key_string_get(evk));
t.compose = eina_stringshare_add(efl_input_key_compose_get(evk));
t.keycode = efl_input_key_code_get(evk);
t.n_evas = n_evas;
if (t.n_evas >= 0) ADD_TO_LIST(evt, t);
if (n_evas >= 0) _add_to_list(evt, n_evas, timestamp, &t, sizeof(t));
}
}
@ -465,6 +427,11 @@ int main(int argc, char **argv)
*slash = '/';
}
}
if (strcmp(_out_filename + strlen(_out_filename) - 4,".exu"))
{
fprintf(stderr, "A file with a exu extension is required - %s invalid\n", _out_filename);
goto end;
}
if (strcmp(_out_filename + strlen(_out_filename) - 4,".exu"))
{
@ -499,22 +466,20 @@ int main(int argc, char **argv)
if (!_shot_key) _shot_key = getenv("SHOT_KEY");
if (!_shot_key) _shot_key = SHOT_KEY_STR;
if (!_events_list)
if (!_unit)
{
struct sysinfo s_info;
sysinfo(&s_info);
_events_list = calloc(1, sizeof(*_events_list));
_events_list->first_timestamp = s_info.uptime * 1000;
_printf(2, "Uptime=<%u>\n", _events_list->first_timestamp);
_unit = calloc(1, sizeof(*_unit));
}
ecore_evas_callback_new_set(_my_evas_new);
_first_timestamp = ecore_time_get() * 1000;
pret = _prg_invoke(_prg_full_path_guess(argv[0]), argc - opt_args, argv);
_output_write();
free_events(_events_list, EINA_TRUE);
_events_list = NULL;
//free_events(_events_list, EINA_TRUE);
//_events_list = NULL;
pret = 0;
end:
eina_shutdown();
return pret;

<
@ -0,0 +1,209 @@
#ifndef _EXACTNESS_H
#define _EXACTNESS_H
#ifdef EAPI
# undef EAPI
#endif
#ifdef _WIN32
# ifdef EXACTNESS_BUILD
# ifdef DLL_EXPORT
# define EAPI __declspec(dllexport)
# else
# define EAPI
# endif /* ! DLL_EXPORT */
# else
# define EAPI __declspec(dllimport)
# endif /* ! EXACTNESS_BUILD */