evas: error out when there appeared a object while a new one is focused

Summary:
this is on the one side error prone and race, as reacting to a focus out
with a new focused object leads to weird cases. On the other side we are
then using eina hash wrong which leads to later weirdness as the element
that is assosiated with &key is broken.

Reviewers: raster, zmike, stefan_schmidt, cedric

Reviewed By: zmike

Subscribers: cedric

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6158
This commit is contained in:
Marcel Hollerbach 2018-05-15 09:32:20 -04:00 committed by Mike Blumenkrantz
parent 542ee417c4
commit cfc66c08a1
1 changed files with 9 additions and 1 deletions

View File

@ -73,7 +73,15 @@ _evas_focus_set(Eo *evas_obj, Efl_Input_Device *key, Eina_Bool focus)
F_DBG("Focus moved in %d from (%p,%s) to (%p,%s)", efl_input_device_seat_id_get(key), DEBUG_TUPLE(eina_hash_find(edata->focused_objects, &key)), DEBUG_TUPLE(evas_obj));
if (focus)
eina_hash_add(edata->focused_objects, &key, evas_obj);
{
Eo *foc;
foc = eina_hash_set(edata->focused_objects, &key, evas_obj);
if (foc)
{
F_ERR("Element %p was focused while a other object was unfocused, this is not expected! No unfocus event will be sent to it", foc);
}
}
else
eina_hash_del_by_key(edata->focused_objects, &key);
}