evas focus: Do not allow two objects focused by the same seat.
authorGuilherme Iscaro <iscaro@profusion.mobi>
Mon, 14 Nov 2016 18:24:47 +0000 (10:24 -0800)
committerCedric BAIL <cedric@osg.samsung.com>
Mon, 14 Nov 2016 18:24:57 +0000 (10:24 -0800)
Summary:
Before focusing an object, the intercept focus callback
is called. This callback may ask Evas to focus another object
instead, so it's necessary to check if the seat in question still
have a focused object event after a efl_canvas_object_seat_focus_del() call.

Reviewers: cedric, bdilly, barbieri, ProhtMeyhet, netstar

Subscribers: cedric, jpeg

Maniphest Tasks: T4864, T4886

Differential Revision: https://phab.enlightenment.org/D4396

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
src/lib/evas/canvas/evas_focus.c

index c09ba28..3245867 100644 (file)
@@ -153,6 +153,9 @@ _efl_canvas_object_seat_focus_add(Eo *eo_obj,
    if (current_focus)
      efl_canvas_object_seat_focus_del(current_focus, seat);
 
+   //In case intercept focus callback focused object we should return.
+   if (_current_focus_get(eo_obj, seat)) goto end;
+
    efl_event_callback_add(seat, EFL_EVENT_DEL, _evas_focus_device_del_cb, obj);
 
    obj->focused_by_seats = eina_list_append(obj->focused_by_seats, seat);