ecore_device: propagate a ecore_device's subclass 55/130755/6
authorJengHyun Kang <jhyuni.kang@samsung.com>
Wed, 24 May 2017 01:06:49 +0000 (10:06 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Thu, 1 Jun 2017 04:25:33 +0000 (04:25 +0000)
Change-Id: Ibbcaab69c50055cebfede968a213a29336333a24

src/lib/ecore_drm/ecore_drm_inputs.c
src/lib/ecore_input/Ecore_Input.h
src/lib/ecore_input_evas/ecore_input_evas.c
src/lib/ecore_wayland/ecore_wl_input.c

index 9280a8f..e547d92 100644 (file)
@@ -143,7 +143,7 @@ _ecore_drm_seat_cap_to_ecore_device_class(unsigned int cap)
 }
 
 void
-_ecore_drm_device_info_send(unsigned int window, Ecore_Drm_Evdev *edev, Ecore_Device_Class clas, Eina_Bool flag)
+_ecore_drm_device_info_send(unsigned int window, Ecore_Drm_Evdev *edev, Ecore_Device_Class clas, Ecore_Device_Subclass subclas, Eina_Bool flag)
 {
    Ecore_Event_Device_Info *e;
 
@@ -153,6 +153,7 @@ _ecore_drm_device_info_send(unsigned int window, Ecore_Drm_Evdev *edev, Ecore_De
    e->identifier = eina_stringshare_add(edev->path);
    e->seatname = eina_stringshare_add(edev->seat->name);
    e->clas = clas;
+   e->subclas = subclas;
    e->window = window;
 
    if (flag)
@@ -229,19 +230,19 @@ _ecore_drm_device_add(unsigned int window, Ecore_Drm_Evdev *edev)
      {
         clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_POINTER);
         ret = _ecore_drm_device_add_ecore_device(edev, clas);
-        if (ret) _ecore_drm_device_info_send(window, edev, clas, 1);
+        if (ret) _ecore_drm_device_info_send(window, edev, clas, ECORE_DEVICE_SUBCLASS_NONE, 1);
      }
    if (edev->seat_caps & EVDEV_SEAT_KEYBOARD)
      {
         clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_KEYBOARD);
         ret = _ecore_drm_device_add_ecore_device(edev, clas);
-        if (ret) _ecore_drm_device_info_send(window, edev, clas, 1);
+        if (ret) _ecore_drm_device_info_send(window, edev, clas, ECORE_DEVICE_SUBCLASS_NONE, 1);
      }
    if (edev->seat_caps & EVDEV_SEAT_TOUCH)
      {
         clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_TOUCH);
         ret = _ecore_drm_device_add_ecore_device(edev, clas);
-        if (ret) _ecore_drm_device_info_send(window, edev, clas, 1);
+        if (ret) _ecore_drm_device_info_send(window, edev, clas, ECORE_DEVICE_SUBCLASS_NONE, 1);
      }
 }
 
@@ -255,19 +256,19 @@ _ecore_drm_device_remove(unsigned int window, Ecore_Drm_Evdev *edev)
      {
         clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_POINTER);
         ret = _ecore_drm_device_del_ecore_device(edev, clas);
-        if (ret) _ecore_drm_device_info_send(window, edev, clas, 0);
+        if (ret) _ecore_drm_device_info_send(window, edev, clas, ECORE_DEVICE_SUBCLASS_NONE, 0);
      }
    if (edev->seat_caps & EVDEV_SEAT_KEYBOARD)
      {
         clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_KEYBOARD);
         ret = _ecore_drm_device_del_ecore_device(edev, clas);
-        if (ret) _ecore_drm_device_info_send(window, edev, clas, 0);
+        if (ret) _ecore_drm_device_info_send(window, edev, clas, ECORE_DEVICE_SUBCLASS_NONE, 0);
      }
    if (edev->seat_caps & EVDEV_SEAT_TOUCH)
      {
         clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_TOUCH);
         ret = _ecore_drm_device_del_ecore_device(edev, clas);
-        if (ret) _ecore_drm_device_info_send(window, edev, clas, 0);
+        if (ret) _ecore_drm_device_info_send(window, edev, clas, ECORE_DEVICE_SUBCLASS_NONE, 0);
      }
 }
 
index 029dbc5..00e1d2d 100644 (file)
@@ -151,6 +151,7 @@ extern "C" {
         const char *identifier;
         const char *seatname;
         Ecore_Device_Class clas;
+        Ecore_Device_Subclass subclas;
      };
 
    /**
index 7d366be..0b0ac13 100644 (file)
@@ -810,7 +810,7 @@ ecore_event_evas_axis_update(void *data EINA_UNUSED, int type EINA_UNUSED, void
 }
 
 static void
-_ecore_event_evas_add_evas_device(Evas *e, const char *name, const char *identifier, Ecore_Device_Class clas)
+_ecore_event_evas_add_evas_device(Evas *e, const char *name, const char *identifier, Ecore_Device_Class clas, Ecore_Device_Subclass subclas)
 {
    const Eina_List *dev_list = NULL;
    const Eina_List *l;
@@ -839,10 +839,11 @@ _ecore_event_evas_add_evas_device(Evas *e, const char *name, const char *identif
    evas_device_name_set(edev, name);
    evas_device_description_set(edev, identifier);
    evas_device_class_set(edev, (Evas_Device_Class)clas);
+   evas_device_subclass_set(edev, (Evas_Device_Subclass)subclas);
 }
 
 static void
-_ecore_event_evas_del_evas_device(Evas *e, const char *name EINA_UNUSED, const char *identifier, Ecore_Device_Class clas)
+_ecore_event_evas_del_evas_device(Evas *e, const char *name EINA_UNUSED, const char *identifier, Ecore_Device_Class clas, Ecore_Device_Subclass subclas)
 {
    const Eina_List *dev_list = NULL;
    const Eina_List *l;
@@ -860,7 +861,9 @@ _ecore_event_evas_del_evas_device(Evas *e, const char *name EINA_UNUSED, const c
         if (!edev) continue;
         edev_name = evas_device_description_get(edev);
         if (!edev_name) continue;
-        if ((evas_device_class_get(edev) == (Evas_Device_Class)clas) && (!strcmp(edev_name, identifier)))
+        if ((evas_device_class_get(edev) == (Evas_Device_Class)clas) &&
+            (evas_device_subclass_get(edev) == (Evas_Device_Subclass)subclas) &&
+            (!strcmp(edev_name, identifier)))
           {
              evas_device_del(edev);
              return;
@@ -879,7 +882,7 @@ ecore_event_evas_device_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *
    lookup = _ecore_event_window_match(e->window);
    if (!lookup) return ECORE_CALLBACK_PASS_ON;
 
-   _ecore_event_evas_add_evas_device(lookup->evas, e->name, e->identifier, e->clas);
+   _ecore_event_evas_add_evas_device(lookup->evas, e->name, e->identifier, e->clas, e->subclas);
 
    return ECORE_CALLBACK_PASS_ON;
 }
@@ -895,7 +898,7 @@ ecore_event_evas_device_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *
    lookup = _ecore_event_window_match(e->window);
    if (!lookup) return ECORE_CALLBACK_PASS_ON;
 
-   _ecore_event_evas_del_evas_device(lookup->evas, e->name, e->identifier, e->clas);
+   _ecore_event_evas_del_evas_device(lookup->evas, e->name, e->identifier, e->clas, e->subclas);
 
    return ECORE_CALLBACK_PASS_ON;
 }
index 8b804d4..605f009 100644 (file)
@@ -2056,7 +2056,7 @@ _ecore_wl_input_device_info_free(void *data EINA_UNUSED, void *ev)
 }
 
 void
-_ecore_wl_input_device_info_send(int win_id, const char *name,  const char *identifier, Ecore_Device_Class clas, Eina_Bool flag)
+_ecore_wl_input_device_info_send(int win_id, const char *name,  const char *identifier, Ecore_Device_Class clas, Ecore_Device_Subclass subclas, Eina_Bool flag)
 {
    Ecore_Event_Device_Info *e;
 
@@ -2066,6 +2066,7 @@ _ecore_wl_input_device_info_send(int win_id, const char *name,  const char *iden
    e->identifier = eina_stringshare_add(identifier);
    e->seatname = eina_stringshare_add(name);
    e->clas = clas;
+   e->subclas = subclas;
    e->window = win_id;
 
    if (flag)
@@ -2099,7 +2100,7 @@ _ecore_wl_input_get_ecore_device(Ecore_Wl_Input_Device *input_dev, Ecore_Device_
 }
 
 static Eina_Bool
-_ecore_wl_input_add_ecore_device(const char *name, const char *identifier, Ecore_Device_Class clas)
+_ecore_wl_input_add_ecore_device(const char *name, const char *identifier, Ecore_Device_Class clas, Ecore_Device_Subclass subclas)
 {
    const Eina_List *dev_list = NULL;
    const Eina_List *l;
@@ -2127,11 +2128,12 @@ _ecore_wl_input_add_ecore_device(const char *name, const char *identifier, Ecore
    ecore_device_description_set(dev, name);
    ecore_device_identifier_set(dev, identifier);
    ecore_device_class_set(dev, clas);
+   ecore_device_subclass_set(dev, subclas);
    return EINA_TRUE;
 }
 
 static Eina_Bool
-_ecore_wl_input_del_ecore_device(const char *name EINA_UNUSED, const char *identifier, Ecore_Device_Class clas)
+_ecore_wl_input_del_ecore_device(const char *name EINA_UNUSED, const char *identifier, Ecore_Device_Class clas, Ecore_Device_Subclass subclas)
 {
    const Eina_List *dev_list = NULL;
    const Eina_List *l;
@@ -2147,7 +2149,9 @@ _ecore_wl_input_del_ecore_device(const char *name EINA_UNUSED, const char *ident
          if (!dev) continue;
          ecdev_name = ecore_device_identifier_get(dev);
          if (!ecdev_name) continue;
-         if ((ecore_device_class_get(dev) == clas) && (!strcmp(ecdev_name, identifier)))
+         if ((ecore_device_class_get(dev) == clas) &&
+             (ecore_device_subclass_get(dev) == subclas) &&
+             (!strcmp(ecdev_name, identifier)))
            {
               ecore_device_del(dev);
               return EINA_TRUE;
@@ -2157,7 +2161,7 @@ _ecore_wl_input_del_ecore_device(const char *name EINA_UNUSED, const char *ident
 }
 
 void
-_ecore_wl_input_device_info_broadcast(const char *name, const char *identifier, Ecore_Device_Class clas, Eina_Bool flag)
+_ecore_wl_input_device_info_broadcast(const char *name, const char *identifier, Ecore_Device_Class clas, Ecore_Device_Subclass subclas, Eina_Bool flag)
 {
    Eina_Hash *windows = NULL;
    Eina_Iterator *itr;
@@ -2170,9 +2174,8 @@ _ecore_wl_input_device_info_broadcast(const char *name, const char *identifier,
    if (!name) return;
 
    if (flag)
-     ret = _ecore_wl_input_add_ecore_device(name, identifier, clas);
-   else
-     ret = _ecore_wl_input_del_ecore_device(name, identifier, clas);
+     ret = _ecore_wl_input_add_ecore_device(name, identifier, clas, subclas);
+
 
    if (!ret) return;
    if (windows)
@@ -2182,15 +2185,18 @@ _ecore_wl_input_device_info_broadcast(const char *name, const char *identifier,
           {
              win = data;
              has_win = EINA_TRUE;
-             _ecore_wl_input_device_info_send(win->id, name, identifier, clas, flag);
+             _ecore_wl_input_device_info_send(win->id, name, identifier, clas, subclas, flag);
           }
 
         eina_iterator_free(itr);
      }
    if (!has_win)
      {
-        _ecore_wl_input_device_info_send((uintptr_t)NULL, name, identifier, clas, flag);
+        _ecore_wl_input_device_info_send((uintptr_t)NULL, name, identifier, clas, subclas, flag);
      }
+
+    else
+     ret = _ecore_wl_input_del_ecore_device(name, identifier, clas, subclas);
 }
 
 static void
@@ -2256,9 +2262,9 @@ _ecore_wl_input_devices_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win)
 
    EINA_LIST_FOREACH(input->devices, l, dev)
      {
-        ret = _ecore_wl_input_add_ecore_device(dev->name, dev->identifier, dev->clas);
+        ret = _ecore_wl_input_add_ecore_device(dev->name, dev->identifier, dev->clas, dev->subclas);
         DBG("ecore_device added.. dev->name:%s, dev->identifier:%s, ret:%d", dev->name? : "NULL", dev->identifier? : "NULL", ret);
-        _ecore_wl_input_device_info_send(win->id, dev->name, dev->identifier, dev->clas, EINA_TRUE);
+        _ecore_wl_input_device_info_send(win->id, dev->name, dev->identifier, dev->clas, dev->subclas, EINA_TRUE);
      }
 }
 
@@ -2311,7 +2317,7 @@ _ecore_wl_input_device_manager_cb_device_remove(void *data EINA_UNUSED, struct t
         if (!dev->identifier) continue;
         if ((!strcmp(dev->identifier, identifier)) && (seat == dev->seat) && (device == dev->tz_device))
           {
-             _ecore_wl_input_device_info_broadcast(dev->name, dev->identifier, dev->clas, EINA_FALSE);
+             _ecore_wl_input_device_info_broadcast(dev->name, dev->identifier, dev->clas, dev->subclas, EINA_FALSE);
 
              _ecore_wl_input_device_last_device_unset(dev);
 
@@ -2350,7 +2356,7 @@ _ecore_wl_input_device_cb_device_info(void *data, struct tizen_input_device *tiz
    dev->clas = (Ecore_Device_Class)clas;
    dev->subclas = (Ecore_Device_Subclass)subclas;
    dev->name = eina_stringshare_add(name);
-   _ecore_wl_input_device_info_broadcast(dev->name, dev->identifier, dev->clas, EINA_TRUE);
+   _ecore_wl_input_device_info_broadcast(dev->name, dev->identifier, dev->clas, dev->subclas, EINA_TRUE);
 }
 
 static void