ecore_wl2: avoid adding repeated devices

Summary:
After changes done on commit 9f8e2e0d9c
it was possible to have multiple devices with the same
id added throught the function
_ecore_evas_wl_common_cb_global_added().

To avoid such issue, let's check if the device was already
created first.

Reviewers: iscaro

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4428
This commit is contained in:
Bruno Dilly 2016-11-24 18:26:50 -02:00
parent 2a75a47b19
commit 1e62cd562e
1 changed files with 17 additions and 1 deletions

View File

@ -555,13 +555,29 @@ _ecore_evas_wl_common_cb_global_added(void *d EINA_UNUSED, int t EINA_UNUSED, vo
{
Ecore_Wl2_Event_Global *ev = event;
Ecore_Evas *ee;
Eina_List *l;
Eina_List *l, *ll;
EE_Wl_Device *device;
if ((!ev->interface) || (strcmp(ev->interface, "wl_seat")))
return ECORE_CALLBACK_PASS_ON;
EINA_LIST_FOREACH(ee_list, l, ee)
{
Eina_Bool already_present = EINA_FALSE;
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
EINA_LIST_FOREACH(wdata->devices_list, ll, device)
{
if (device->id == ev->id)
{
already_present = EINA_TRUE;
break;
}
}
if (already_present)
continue;
if (!_ecore_evas_wl_common_seat_add(ee, ev->id))
break;
}