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
This commit is contained in:
Daniel Zaoui 2018-07-11 12:09:19 +03:00
parent d8315ffdc7
commit 1551b5358f
1 changed files with 26 additions and 24 deletions

View File

@ -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); efl_key_data_set(event->object, "_last_shot", NULL);
if (_dest_type == FTYPE_DIR) if (e_data)
{ {
char *filename = e_data; if (_dest_type == FTYPE_DIR)
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); 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); exactness_image_free(ex_shot);
efl_key_data_set(event->object, "_shot", NULL); 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 static void
_shot_do(Evas *e) _shot_do(Evas *e)
{ {
void *e_data = NULL;
if (!e) return; if (!e) return;
if (!_disable_shots) if (!_disable_shots)
{ {
void *e_data = NULL;
if (_dest_type == FTYPE_DIR) if (_dest_type == FTYPE_DIR)
{ {
int dir_name_len; int dir_name_len;
@ -260,13 +262,13 @@ _shot_do(Evas *e)
_dest_unit->nb_shots++; _dest_unit->nb_shots++;
e_data = ex_img; 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) if (_scan_objects && _dest_type == FTYPE_EXU)
{ {