From 1551b5358f7b04b1381220406c9999f35d0b4440 Mon Sep 17 00:00:00 2001 From: Daniel Zaoui Date: Wed, 11 Jul 2018 12:09:19 +0300 Subject: [PATCH] Player: enable shots (silently) even if disabled in the command line A bug appears in "box vert" test. If --disable-screenshots is set, and no other optional such as -v, the application will receive only 4 clicked events instead of 8. The bug doesn't appear if -v is set or if the application is shown on the screen. It seems that the buffer engine doesn't want to consume the events because no damage/shot request is "reported". The solution for that bug is to enable the screenshots process, just without saving the outputs. @fix --- src/bin/player.c | 50 +++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/src/bin/player.c b/src/bin/player.c index cca8f7b..72b9d40 100644 --- a/src/bin/player.c +++ b/src/bin/player.c @@ -200,25 +200,28 @@ _evas_render_post_cb(void *data EINA_UNUSED, const Efl_Event *event) efl_key_data_set(event->object, "_last_shot", NULL); - if (_dest_type == FTYPE_DIR) + if (e_data) { - char *filename = e_data; - Eo *o = evas_object_image_add(event->object); - evas_object_image_size_set(o, ex_shot->w, ex_shot->h); - evas_object_image_data_set(o, ex_shot->pixels); - _printf(1, "Shot taken (%s).\n", filename); - if (!evas_object_image_save(o, filename, NULL, NULL)) + if (_dest_type == FTYPE_DIR) { - printf("Cannot save widget to <%s>\n", filename); + char *filename = e_data; + Eo *o = evas_object_image_add(event->object); + evas_object_image_size_set(o, ex_shot->w, ex_shot->h); + evas_object_image_data_set(o, ex_shot->pixels); + _printf(1, "Shot taken (%s).\n", filename); + if (!evas_object_image_save(o, filename, NULL, NULL)) + { + printf("Cannot save widget to <%s>\n", filename); + } + free(filename); + } + else if (_dest_type == FTYPE_EXU) + { + Exactness_Image *ex_img = e_data; + memcpy(ex_img, ex_shot, sizeof(Exactness_Image)); + ex_shot->pixels = NULL; + _printf(1, "Shot taken (in %s).\n", _dest); } - free(filename); - } - else if (_dest_type == FTYPE_EXU) - { - Exactness_Image *ex_img = e_data; - memcpy(ex_img, ex_shot, sizeof(Exactness_Image)); - ex_shot->pixels = NULL; - _printf(1, "Shot taken (in %s).\n", _dest); } exactness_image_free(ex_shot); efl_key_data_set(event->object, "_shot", NULL); @@ -234,12 +237,11 @@ _evas_render_post_cb(void *data EINA_UNUSED, const Efl_Event *event) static void _shot_do(Evas *e) { + void *e_data = NULL; if (!e) return; if (!_disable_shots) { - void *e_data = NULL; - if (_dest_type == FTYPE_DIR) { int dir_name_len; @@ -260,13 +262,13 @@ _shot_do(Evas *e) _dest_unit->nb_shots++; e_data = ex_img; } - efl_key_data_set(e, "_shot", e_data); - _shot_needed = EINA_TRUE; - Efl_Event ev; - ev.info = NULL; - ev.object = e; - _evas_render_post_cb(NULL, &ev); } + efl_key_data_set(e, "_shot", e_data); + _shot_needed = EINA_TRUE; + Efl_Event ev; + ev.info = NULL; + ev.object = e; + _evas_render_post_cb(NULL, &ev); if (_scan_objects && _dest_type == FTYPE_EXU) {