ecore_evas_wayland_common: check device class when device is added. 98/243598/2
authorHosang Kim <hosang12.kim@samsung.com>
Tue, 8 Sep 2020 10:32:19 +0000 (19:32 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Tue, 8 Sep 2020 10:48:34 +0000 (19:48 +0900)
Change-Id: I1d73f9cbf34bb46a01f2428dda4cf9443187c508

src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c

index d00555f..8466320 100644 (file)
@@ -1610,22 +1610,27 @@ _ecore_evas_wl_common_strcmp(const char *dst, const char *src)
 // TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
 
 static Eina_Bool
-_ecore_evas_wl_common_evas_device_find(Evas *evas, const char *identifier)
+_ecore_evas_wl_common_evas_device_find(Evas *evas, const char *name, const Evas_Device_Class clas, const char *identifier)
 {
    Eina_List *list, *l;
    Evas_Device *device;
+   const char *evas_device_name;
    const char *evas_device_description;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(evas, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
    EINA_SAFETY_ON_NULL_RETURN_VAL(identifier, EINA_FALSE);
 
    list = (Eina_List *)evas_device_list(evas, NULL);
    EINA_LIST_FOREACH(list, l, device)
      {
+        evas_device_name = evas_device_name_get(device);
         evas_device_description = evas_device_description_get(device);
-        if (!evas_device_description) continue;
+        if (!evas_device_name || !evas_device_description) continue;
 
-        if (_ecore_evas_wl_common_strcmp(evas_device_description, identifier))
+        if ((evas_device_class_get(device) == clas) &&
+            _ecore_evas_wl_common_strcmp(evas_device_name, name) &&
+            _ecore_evas_wl_common_strcmp(evas_device_description, identifier))
           {
              return EINA_TRUE;
           }
@@ -1678,7 +1683,7 @@ _ecore_evas_wl_common_cb_tizen_device_add(void *data EINA_UNUSED, int type EINA_
         wdata = ee->engine.data;
         if (display != wdata->display) continue;
 
-        if (_ecore_evas_wl_common_evas_device_find(ee->evas, ev->identifier)) continue;
+        if (_ecore_evas_wl_common_evas_device_find(ee->evas, ev->name, ev->clas, ev->identifier)) continue;
         seat = _ecore_evas_wl_common_default_seat_get(ee->evas);
 
         evas_device_add_full(ee->evas, ev->name,