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
This commit is contained in:
Bruno Dilly 2016-12-19 13:58:01 -02:00
parent e78390c4c5
commit ecdf56de47
2 changed files with 5 additions and 3 deletions

View File

@ -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;

View File

@ -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