bdilly pushed a commit to branch master.

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

commit ecdf56de47d5c96711619e7c8dc1586a0dee7f90
Author: Bruno Dilly <bdi...@profusion.mobi>
Date:   Mon Dec 19 13:58:01 2016 -0200

    evas: improve logic regarding events filtering enablement
    
    Only the size of events_whitelist isn't enough, because in some
    cases the user may be disabling the usage of a specific seat.
    
    Considering the following scenario, the issue will easy to understand:
     - an application with two entries (one to be used by seat 1 and other
         by seat 2)
     - the first seat is announced - it is enabled for entry 1 and
         disabled for entry 2
     - the second seat is announced
    
    Before second seat is announced, the first seat would be able
    to input the entry 1, because the events_whitelist of such
    object will continue empty.
    
    So a flag will be used to identify an object with active
    filter.
    
    Reviewed By: iscaro
    
    Differential Revision: https://phab.enlightenment.org/D4498
---
 src/lib/evas/canvas/evas_object_main.c | 6 ++++--
 src/lib/evas/include/evas_private.h    | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/lib/evas/canvas/evas_object_main.c 
b/src/lib/evas/canvas/evas_object_main.c
index a705bd4..5da0192 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -915,8 +915,8 @@ 
_efl_canvas_object_efl_input_interface_seat_event_filter_get(Eo *eo_obj EINA_UNU
                                                              
Evas_Object_Protected_Data *obj,
                                                              Efl_Input_Device 
*seat)
 {
-   //If the list is empty this object accept events from any seat.
-   if (!obj->events_whitelist)
+   //It means this object accept events from any seat.
+   if (!obj->events_filter_enabled)
      return EINA_TRUE;
    return eina_list_data_find(obj->events_whitelist, seat) ?
      EINA_TRUE : EINA_FALSE;
@@ -939,6 +939,8 @@ 
_efl_canvas_object_efl_input_interface_seat_event_filter_set(Eo *eo_obj,
    EINA_SAFETY_ON_NULL_RETURN(seat);
 
    if (efl_input_device_type_get(seat) != EFL_INPUT_DEVICE_CLASS_SEAT) return;
+
+   obj->events_filter_enabled = EINA_TRUE;
    if (add)
      {
         if (eina_list_data_find(obj->events_whitelist, seat)) return;
diff --git a/src/lib/evas/include/evas_private.h 
b/src/lib/evas/include/evas_private.h
index 25e7a7d..c1f9388 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1118,7 +1118,6 @@ struct _Evas_Object_Protected_Data
    /*
       The list below contain the seats (Efl.Input.Devices) which this
       object allows events to be reported (Mouse, Keybord and focus events).
-      If this list is empty, this object will allow events from any seat.
     */
    Eina_List                  *events_whitelist;
 
@@ -1212,6 +1211,7 @@ struct _Evas_Object_Protected_Data
       Eina_Bool                src_invisible_valid : 1;
    } parent_cache;
 
+   Eina_Bool                   events_filter_enabled : 1;
 };
 
 struct _Evas_Data_Node

-- 


Reply via email to