summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2016-11-24 18:26:50 -0200
committerBruno Dilly <bdilly@profusion.mobi>2016-11-24 18:31:23 -0200
commit1e62cd562ee2f35e867e59f640e5ee5f2a7e0f29 (patch)
tree78742d2a97ff2503bc6b50319fb3ed9df78cce8f
parent2a75a47b192df7ceef36fe92305bf00d222b4db2 (diff)
downloadefl-1e62cd562ee2f35e867e59f640e5ee5f2a7e0f29.tar.gz
ecore_wl2: avoid adding repeated devices
Summary: After changes done on commit 9f8e2e0d9c9b4150 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
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
index 2053c2167b..232d96b0cb 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
@@ -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;
}