summaryrefslogtreecommitdiff
path: root/src/bin/exactness/player.c
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2020-03-23 17:46:10 +0100
committerStefan Schmidt <s.schmidt@samsung.com>2020-03-24 12:24:07 +0100
commit912fbe79a2f3ee56f0e2c5e1fe5270cc12d64227 (patch)
treeee82e5bbbfe31100bafb396355003ad57d9a466e /src/bin/exactness/player.c
parent9da0235d74637b3ee0049eddd1a3ef2c44a3849e (diff)
exactness: switch from homegrown debug printf to eina_log
Use a full eina_log domain here for each executable. No need to have a own half baked ex_printf version here for such things. Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11558
Diffstat (limited to 'src/bin/exactness/player.c')
-rw-r--r--src/bin/exactness/player.c63
1 files changed, 36 insertions, 27 deletions
diff --git a/src/bin/exactness/player.c b/src/bin/exactness/player.c
index 54514ae0be..1d27863299 100644
--- a/src/bin/exactness/player.c
+++ b/src/bin/exactness/player.c
@@ -34,6 +34,11 @@
34#define IMAGE_FILENAME_EXT ".png" 34#define IMAGE_FILENAME_EXT ".png"
35#define PAUSE_KEY_STR "F2" 35#define PAUSE_KEY_STR "F2"
36 36
37#define DBG(...) EINA_LOG_DOM_DBG(_log_domain, __VA_ARGS__)
38#define INF(...) EINA_LOG_DOM_INFO(_log_domain, __VA_ARGS__)
39
40static int _log_domain = -1;
41
37typedef enum 42typedef enum
38{ 43{
39 FTYPE_UNKNOWN, 44 FTYPE_UNKNOWN,
@@ -136,7 +141,7 @@ _evas_render_post_cb(void *data EINA_UNUSED, const Efl_Event *event)
136 Eo *o = evas_object_image_add(event->object); 141 Eo *o = evas_object_image_add(event->object);
137 evas_object_image_size_set(o, ex_shot->w, ex_shot->h); 142 evas_object_image_size_set(o, ex_shot->w, ex_shot->h);
138 evas_object_image_data_set(o, ex_shot->pixels); 143 evas_object_image_data_set(o, ex_shot->pixels);
139 ex_printf(1, "Shot taken (%s).\n", filename); 144 INF("Shot taken (%s).\n", filename);
140 if (!evas_object_image_save(o, filename, NULL, NULL)) 145 if (!evas_object_image_save(o, filename, NULL, NULL))
141 { 146 {
142 printf("Cannot save widget to <%s>\n", filename); 147 printf("Cannot save widget to <%s>\n", filename);
@@ -148,7 +153,7 @@ _evas_render_post_cb(void *data EINA_UNUSED, const Efl_Event *event)
148 Exactness_Image *ex_img = e_data; 153 Exactness_Image *ex_img = e_data;
149 memcpy(ex_img, ex_shot, sizeof(Exactness_Image)); 154 memcpy(ex_img, ex_shot, sizeof(Exactness_Image));
150 ex_shot->pixels = NULL; 155 ex_shot->pixels = NULL;
151 ex_printf(1, "Shot taken (in %s).\n", _dest); 156 INF("Shot taken (in %s).\n", _dest);
152 } 157 }
153 else if (_dest_type == FTYPE_REMOTE) 158 else if (_dest_type == FTYPE_REMOTE)
154 { 159 {
@@ -279,23 +284,23 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
279 { 284 {
280 case EXACTNESS_ACTION_MOUSE_IN: 285 case EXACTNESS_ACTION_MOUSE_IN:
281 { 286 {
282 ex_printf(1, "Mouse in\n"); 287 INF("Mouse in\n");
283 ex_printf(2, "%s evas_event_feed_mouse_in n_evas=<%d>\n", __func__, n_evas); 288 DBG("%s evas_event_feed_mouse_in n_evas=<%d>\n", __func__, n_evas);
284 if (e) evas_event_feed_mouse_in(e, time(NULL), NULL); 289 if (e) evas_event_feed_mouse_in(e, time(NULL), NULL);
285 break; 290 break;
286 } 291 }
287 case EXACTNESS_ACTION_MOUSE_OUT: 292 case EXACTNESS_ACTION_MOUSE_OUT:
288 { 293 {
289 ex_printf(1, "Mouse out\n"); 294 INF("Mouse out\n");
290 ex_printf(2, "%s evas_event_feed_mouse_out n_evas=<%d>\n", __func__, n_evas); 295 DBG("%s evas_event_feed_mouse_out n_evas=<%d>\n", __func__, n_evas);
291 if (e) evas_event_feed_mouse_out(e, time(NULL), NULL); 296 if (e) evas_event_feed_mouse_out(e, time(NULL), NULL);
292 break; 297 break;
293 } 298 }
294 case EXACTNESS_ACTION_MOUSE_WHEEL: 299 case EXACTNESS_ACTION_MOUSE_WHEEL:
295 { 300 {
296 Exactness_Action_Mouse_Wheel *t = data; 301 Exactness_Action_Mouse_Wheel *t = data;
297 ex_printf(1, "Mouse wheel\n"); 302 INF("Mouse wheel\n");
298 ex_printf(2, "%s evas_event_feed_mouse_wheel n_evas=<%d>\n", __func__, n_evas); 303 DBG("%s evas_event_feed_mouse_wheel n_evas=<%d>\n", __func__, n_evas);
299 if (e) evas_event_feed_mouse_wheel(e, t->direction, t->z, time(NULL), NULL); 304 if (e) evas_event_feed_mouse_wheel(e, t->direction, t->z, time(NULL), NULL);
300 305
301 break; 306 break;
@@ -303,7 +308,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
303 case EXACTNESS_ACTION_MULTI_DOWN: 308 case EXACTNESS_ACTION_MULTI_DOWN:
304 { 309 {
305 Exactness_Action_Multi_Event *t = data; 310 Exactness_Action_Multi_Event *t = data;
306 ex_printf(2, "%s evas_event_feed_multi_down n_evas=<%d>\n", __func__, n_evas); 311 DBG("%s evas_event_feed_multi_down n_evas=<%d>\n", __func__, n_evas);
307 if (!t->d) 312 if (!t->d)
308 { 313 {
309 if (e) evas_event_feed_mouse_down(e, t->b, t->flags, time(NULL), NULL); 314 if (e) evas_event_feed_mouse_down(e, t->b, t->flags, time(NULL), NULL);
@@ -322,7 +327,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
322 case EXACTNESS_ACTION_MULTI_UP: 327 case EXACTNESS_ACTION_MULTI_UP:
323 { 328 {
324 Exactness_Action_Multi_Event *t = data; 329 Exactness_Action_Multi_Event *t = data;
325 ex_printf(2, "%s evas_event_feed_multi_up n_evas=<%d>\n", __func__, n_evas); 330 DBG("%s evas_event_feed_multi_up n_evas=<%d>\n", __func__, n_evas);
326 if (!t->d) 331 if (!t->d)
327 { 332 {
328 if (e) evas_event_feed_mouse_up(e, t->b, t->flags, time(NULL), NULL); 333 if (e) evas_event_feed_mouse_up(e, t->b, t->flags, time(NULL), NULL);
@@ -341,7 +346,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
341 case EXACTNESS_ACTION_MULTI_MOVE: 346 case EXACTNESS_ACTION_MULTI_MOVE:
342 { 347 {
343 Exactness_Action_Multi_Move *t = data; 348 Exactness_Action_Multi_Move *t = data;
344 ex_printf(2, "%s evas_event_feed_multi_move n_evas=<%d>\n", __func__, n_evas); 349 DBG("%s evas_event_feed_multi_move n_evas=<%d>\n", __func__, n_evas);
345 if (!t->d) 350 if (!t->d)
346 { 351 {
347 if (e) evas_event_feed_mouse_move(e, t->x, t->y, time(NULL), NULL); 352 if (e) evas_event_feed_mouse_move(e, t->x, t->y, time(NULL), NULL);
@@ -364,7 +369,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
364 case EXACTNESS_ACTION_KEY_DOWN: 369 case EXACTNESS_ACTION_KEY_DOWN:
365 { 370 {
366 Exactness_Action_Key_Down_Up *t = data; 371 Exactness_Action_Key_Down_Up *t = data;
367 ex_printf(2, "%s evas_event_feed_key_down n_evas=<%d>\n", __func__, n_evas); 372 DBG("%s evas_event_feed_key_down n_evas=<%d>\n", __func__, n_evas);
368 if (e) 373 if (e)
369 evas_event_feed_key_down_with_keycode(e, 374 evas_event_feed_key_down_with_keycode(e,
370 t->keyname, t->key, t->string, 375 t->keyname, t->key, t->string,
@@ -374,7 +379,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
374 case EXACTNESS_ACTION_KEY_UP: 379 case EXACTNESS_ACTION_KEY_UP:
375 { 380 {
376 Exactness_Action_Key_Down_Up *t = data; 381 Exactness_Action_Key_Down_Up *t = data;
377 ex_printf(2, "%s evas_event_feed_key_up n_evas=<%d>\n", __func__, n_evas); 382 DBG("%s evas_event_feed_key_up n_evas=<%d>\n", __func__, n_evas);
378 if (e) evas_event_feed_key_up_with_keycode(e, 383 if (e) evas_event_feed_key_up_with_keycode(e,
379 t->keyname, t->key, t->string, 384 t->keyname, t->key, t->string,
380 t->compose, time(NULL), NULL, t->keycode); 385 t->compose, time(NULL), NULL, t->keycode);
@@ -383,7 +388,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
383 } 388 }
384 case EXACTNESS_ACTION_TAKE_SHOT: 389 case EXACTNESS_ACTION_TAKE_SHOT:
385 { 390 {
386 ex_printf(2, "%s take shot n_evas=<%d>\n", __func__, n_evas); 391 DBG("%s take shot n_evas=<%d>\n", __func__, n_evas);
387 if (rect) evas_object_color_set(rect, 0, 0, 255, 255); 392 if (rect) evas_object_color_set(rect, 0, 0, 255, 255);
388 _cur_shot_id++; 393 _cur_shot_id++;
389 if (_dest_type != FTYPE_UNKNOWN && e) _shot_do(e); 394 if (_dest_type != FTYPE_UNKNOWN && e) _shot_do(e);
@@ -399,7 +404,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
399 Eo *o = efl_name_find(e, t->wdg_name); 404 Eo *o = efl_name_find(e, t->wdg_name);
400 if (o) 405 if (o)
401 { 406 {
402 ex_printf(2, "%s EFL event invoke %s on %s\n", 407 DBG("%s EFL event invoke %s on %s\n",
403 __func__, t->event_name, t->wdg_name); 408 __func__, t->event_name, t->wdg_name);
404 Efl_Event_Description d; 409 Efl_Event_Description d;
405 found = EINA_TRUE; 410 found = EINA_TRUE;
@@ -436,7 +441,7 @@ wdg_found:
436 Exactness_Action_Multi_Event *d_event = calloc(1, sizeof(*d_event)); 441 Exactness_Action_Multi_Event *d_event = calloc(1, sizeof(*d_event));
437 Exactness_Action *act, *prev_act = eina_list_data_get(_cur_event_list); 442 Exactness_Action *act, *prev_act = eina_list_data_get(_cur_event_list);
438 443
439 ex_printf(2, "%s click on %s\n", __func__, t->wdg_name); 444 DBG("%s click on %s\n", __func__, t->wdg_name);
440 act = calloc(1, sizeof(*act)); 445 act = calloc(1, sizeof(*act));
441 act->type = EXACTNESS_ACTION_MULTI_MOVE; 446 act->type = EXACTNESS_ACTION_MULTI_MOVE;
442 act->delay_ms = 100; 447 act->delay_ms = 100;
@@ -473,7 +478,7 @@ wdg_found:
473 } 478 }
474 case EXACTNESS_ACTION_STABILIZE: 479 case EXACTNESS_ACTION_STABILIZE:
475 { 480 {
476 ex_printf(2, "%s stabilize\n", __func__); 481 DBG("%s stabilize\n", __func__);
477 if (rect) evas_object_color_set(rect, 255, 165, 0, 255); 482 if (rect) evas_object_color_set(rect, 255, 165, 0, 255);
478 ecore_timer_add(0.1, _stabilization_timer_cb, NULL); 483 ecore_timer_add(0.1, _stabilization_timer_cb, NULL);
479 break; 484 break;
@@ -501,7 +506,7 @@ _feed_event_timer_cb(void *data EINA_UNUSED)
501 if (act->type != EXACTNESS_ACTION_STABILIZE) 506 if (act->type != EXACTNESS_ACTION_STABILIZE)
502 { 507 {
503 act = eina_list_data_get(_cur_event_list); 508 act = eina_list_data_get(_cur_event_list);
504 ex_printf(2, " %s timer_time=<%f>\n", __func__, act->delay_ms / 1000.0); 509 DBG(" %s timer_time=<%f>\n", __func__, act->delay_ms / 1000.0);
505 ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL); 510 ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL);
506 } 511 }
507 } 512 }
@@ -515,7 +520,7 @@ _stabilization_timer_cb(void *data EINA_UNUSED)
515 Evas *e; 520 Evas *e;
516#define STAB_MAX 5 521#define STAB_MAX 5
517 static int need_more = STAB_MAX; 522 static int need_more = STAB_MAX;
518 ex_printf(2, "Not stable yet!\n"); 523 DBG("Not stable yet!\n");
519 EINA_LIST_FOREACH(_evas_list, itr, e) 524 EINA_LIST_FOREACH(_evas_list, itr, e)
520 { 525 {
521 if (!e) continue; 526 if (!e) continue;
@@ -539,7 +544,7 @@ _stabilization_timer_cb(void *data EINA_UNUSED)
539 if (_src_type != FTYPE_REMOTE && !_pause_request) 544 if (_src_type != FTYPE_REMOTE && !_pause_request)
540 { 545 {
541 Exactness_Action *act = eina_list_data_get(_cur_event_list); 546 Exactness_Action *act = eina_list_data_get(_cur_event_list);
542 ex_printf(2, " %s timer_time=<%f>\n", __func__, act->delay_ms / 1000.0); 547 DBG(" %s timer_time=<%f>\n", __func__, act->delay_ms / 1000.0);
543 ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL); 548 ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL);
544 } 549 }
545 need_more = STAB_MAX; 550 need_more = STAB_MAX;
@@ -746,7 +751,7 @@ _src_feed(void *data EINA_UNUSED)
746 751
747 if (act && act->delay_ms) 752 if (act && act->delay_ms)
748 { 753 {
749 ex_printf(2, " Waiting <%f>\n", act->delay_ms / 1000.0); 754 DBG(" Waiting <%f>\n", act->delay_ms / 1000.0);
750 ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL); 755 ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL);
751 } 756 }
752 else 757 else
@@ -763,7 +768,7 @@ _src_open()
763 { 768 {
764 Eina_List *itr, *itr2; 769 Eina_List *itr, *itr2;
765 Exactness_Action *act; 770 Exactness_Action *act;
766 ex_printf(2, "<%s> Source file is <%s>\n", __func__, _src_filename); 771 DBG("<%s> Source file is <%s>\n", __func__, _src_filename);
767 if (_src_type == FTYPE_EXU) 772 if (_src_type == FTYPE_EXU)
768 { 773 {
769 _src_unit = exactness_unit_file_read(_src_filename); 774 _src_unit = exactness_unit_file_read(_src_filename);
@@ -832,10 +837,10 @@ _event_key_cb(void *data EINA_UNUSED, const Efl_Event *event)
832 if (!strcmp(key, PAUSE_KEY_STR) && efl_input_key_pressed_get(evk)) 837 if (!strcmp(key, PAUSE_KEY_STR) && efl_input_key_pressed_get(evk))
833 { 838 {
834 _pause_request = !_pause_request; 839 _pause_request = !_pause_request;
835 if (_pause_request) ex_printf(1, "Pausing scenario\n"); 840 if (_pause_request) INF("Pausing scenario\n");
836 else 841 else
837 { 842 {
838 ex_printf(1, "Playing scenario\n"); 843 INF("Playing scenario\n");
839 if (!_playing_status) 844 if (!_playing_status)
840 _feed_event_timer_cb(NULL); 845 _feed_event_timer_cb(NULL);
841 } 846 }
@@ -857,7 +862,7 @@ _my_evas_new(int w EINA_UNUSED, int h EINA_UNUSED)
857 e = _evas_new(); 862 e = _evas_new();
858 if (e) 863 if (e)
859 { 864 {
860 ex_printf(1, "New Evas\n"); 865 INF("New Evas\n");
861 _evas_list = eina_list_append(_evas_list, e); 866 _evas_list = eina_list_append(_evas_list, e);
862 efl_event_callback_array_add(e, _evas_callbacks(), NULL); 867 efl_event_callback_array_add(e, _evas_callbacks(), NULL);
863 } 868 }
@@ -927,6 +932,8 @@ int main(int argc, char **argv)
927 ECORE_GETOPT_VALUE_NONE 932 ECORE_GETOPT_VALUE_NONE
928 }; 933 };
929 934
935 _log_domain = eina_log_domain_register("exactness_player", NULL);
936
930 if (!ecore_evas_init()) 937 if (!ecore_evas_init())
931 return EXIT_FAILURE; 938 return EXIT_FAILURE;
932 939
@@ -1090,9 +1097,9 @@ int main(int argc, char **argv)
1090 { 1097 {
1091 argv[i - opt_args] = argv[0] + (argv[i] - argv[opt_args]); 1098 argv[i - opt_args] = argv[0] + (argv[i] - argv[opt_args]);
1092 } 1099 }
1093 ex_printf(1, "%s ", argv[i - opt_args]); 1100 INF("%s ", argv[i - opt_args]);
1094 } 1101 }
1095 ex_printf(1, "\n"); 1102 INF("\n");
1096 } 1103 }
1097 else 1104 else
1098 { 1105 {
@@ -1151,5 +1158,7 @@ int main(int argc, char **argv)
1151 1158
1152end: 1159end:
1153 ecore_evas_shutdown(); 1160 ecore_evas_shutdown();
1161 eina_log_domain_unregister(_log_domain);
1162 _log_domain = -1;
1154 return pret; 1163 return pret;
1155} 1164}