bdilly pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=e78390c4c5910cef98f0f931f162a19d3a83570b

commit e78390c4c5910cef98f0f931f162a19d3a83570b
Author: Bruno Dilly <bdi...@profusion.mobi>
Date:   Fri Dec 16 18:11:05 2016 -0200

    evas: remove focus when removed from filter whitelist
    
    It doesn't make sense to remove it when a seat is added
    to the list. It should be removed only when this seat
    is blocked.
    
    But when the list receives its first item, then
    it also should be checked if the focused seat
    is the one just added, otherwise the previous one
    must be removed.
---
 src/lib/evas/canvas/evas_object_main.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/lib/evas/canvas/evas_object_main.c 
b/src/lib/evas/canvas/evas_object_main.c
index a030505..a705bd4 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -942,14 +942,28 @@ 
_efl_canvas_object_efl_input_interface_seat_event_filter_set(Eo *eo_obj,
    if (add)
      {
         if (eina_list_data_find(obj->events_whitelist, seat)) return;
-        if (efl_canvas_object_seat_focus_check(eo_obj, seat))
-          efl_canvas_object_seat_focus_del(eo_obj, seat);
+        /* remove all previously focused seats, if any - it may happen
+           since there wasn't a whitelist in place (no restrictions) */
+        if ((!obj->events_whitelist) && (obj->layer) && (obj->layer->evas))
+          {
+             const Eina_List *devices, *l;
+             Efl_Input_Device *dev;
+
+             devices = obj->layer->evas->devices;
+             EINA_LIST_FOREACH(devices, l, dev)
+               {
+                  if ((efl_input_device_type_get(dev) ==
+                       EFL_INPUT_DEVICE_CLASS_SEAT) && (dev != seat))
+                    efl_canvas_object_seat_focus_del(eo_obj, dev);
+               }
+          }
         obj->events_whitelist = eina_list_append(obj->events_whitelist, seat);
         efl_event_callback_add(seat, EFL_EVENT_DEL,
                                _whitelist_events_device_remove_cb, obj);
      }
    else
      {
+        efl_canvas_object_seat_focus_del(eo_obj, seat);
         obj->events_whitelist = eina_list_remove(obj->events_whitelist, seat);
         efl_event_callback_del(seat, EFL_EVENT_DEL,
                                _whitelist_events_device_remove_cb, obj);

-- 


Reply via email to