summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2018-05-15 09:32:20 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2018-05-15 09:32:20 -0400
commitcfc66c08a1148a0126c2fc80f3dbe95d914af704 (patch)
treef5f807c7158d2feb725c1dde639c0e5d169fb41d
parent542ee417c4c3523ccc8811d59b62c03c25662b0c (diff)
downloadefl-cfc66c08a1148a0126c2fc80f3dbe95d914af704.tar.gz
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
-rw-r--r--src/lib/evas/canvas/evas_focus.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/evas/canvas/evas_focus.c b/src/lib/evas/canvas/evas_focus.c
index 9af9734da5..af86268c96 100644
--- a/src/lib/evas/canvas/evas_focus.c
+++ b/src/lib/evas/canvas/evas_focus.c
@@ -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);
}