ecore_device_ex: add API to set seatname in ecore_device 85/321185/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 21 Jan 2025 02:32:59 +0000 (11:32 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 17 Mar 2025 04:25:41 +0000 (13:25 +0900)
Change-Id: I805ffea04bd085699ade51b0d71c6b241eb642f3
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/bin/Makefile.mk
src/bin/inputmgr/e_input_backend.c
src/bin/inputmgr/e_input_evdev.c
src/bin/inputmgr/ecore_device_ex.c [new file with mode: 0644]
src/bin/inputmgr/ecore_device_ex_intern.h [new file with mode: 0644]

index 48126854a347ad0df7cf220a4c901799c7b5d934..c092213fa69058dc57ae34fd06e54576167df768 100644 (file)
@@ -248,6 +248,7 @@ src/bin/inputmgr/e_input_evdev.c \
 src/bin/inputmgr/e_input_seat.c \
 src/bin/inputmgr/e_input_thread_client.c \
 src/bin/inputmgr/e_device.c \
+src/bin/inputmgr/ecore_device_ex.c \
 src/bin/inputmgr/e_devicemgr_keyboard_grab.c \
 src/bin/inputmgr/e_devicemgr_relative_motion_grab.c \
 src/bin/inputmgr/e_devicemgr.c \
index 1e2755ec27aaa09b5e0b912bc2027cf6357e27fc..22fc84fdeb8f9eb2751c14a19a1bd83b8e389d6b 100644 (file)
@@ -14,6 +14,7 @@
 #include "e_utils_intern.h"
 #include "e_input_seat_intern.h"
 #include "e_seat_intern.h"
+#include "ecore_device_ex_intern.h"
 
 #include <libudev.h>
 #include <glib.h>
@@ -35,6 +36,7 @@ typedef struct
    E_Input_Evdev *evdev;
    Ecore_Device_Class clas;
    Ecore_Device_Subclass subclas;
+   char *seatname;
 } E_Device_Info;
 
 #define TS_DO
@@ -320,6 +322,7 @@ _e_input_add_ecore_device_async_cb(void *data)
    ecore_device_identifier_set(dev, evdev->path);
    ecore_device_class_set(dev, clas);
    ecore_device_subclass_set(dev, subclas);
+   ecore_device_ex_seatname_set(dev, dev_info->seatname);
 
    if (!evdev->ecore_dev)
      {
@@ -346,6 +349,7 @@ _e_input_add_ecore_device_async_cb(void *data)
    _e_input_ecore_device_event(dev, e_input_seat_name_get(evdev->seat), EINA_TRUE);
 
 end:
+   E_FREE(dev_info->seatname);
    E_FREE(dev_info);
 }
 
@@ -448,6 +452,7 @@ _e_input_add_ecore_device(E_Input_Evdev *evdev, Ecore_Device_Class clas, Ecore_D
    dev_info->evdev = evdev;
    dev_info->clas = clas;
    dev_info->subclas = subclas;
+   dev_info->seatname = strdup(e_device_seatname_get(e_dev));
 
    ecore_main_loop_thread_safe_call_async(_e_input_add_ecore_device_async_cb, dev_info);
 
@@ -497,6 +502,7 @@ _e_input_remove_ecore_device_async_cb(void *cb_data)
                      }
                 }
               _e_input_ecore_device_event(dev, e_input_seat_name_get(evdev->seat), EINA_FALSE);
+              ecore_device_ex_seatname_del(dev);
               ecore_device_del(dev);
            }
       }
@@ -655,6 +661,7 @@ _ecore_device_remove_async_cb(void *cb_data)
                       _e_input_ecore_device_class_to_string(ecore_device_class_get(data)));
 
                   ecore_device_unref(data);
+                  ecore_device_ex_seatname_del(data);
                   ecore_device_del(data);
                }
           }
index 4f4b6d1f80f53017e46e6aef523b8e5ed1ca4ec0..a142d663a738f537cb0f4994a4660cba27e99243 100644 (file)
@@ -10,6 +10,7 @@
 #include "e_utils_intern.h"
 #include "e_display_intern.h"
 #include "e_input_seat_intern.h"
+#include "ecore_device_ex_intern.h"
 
 #include <glib.h>
 #include <ctype.h>
@@ -2541,10 +2542,15 @@ _evdev_device_destroy_async_cb(void *data)
    Ecore_Device *dev;
    E_Input_Pending_Event *ev;
 
-   if (evdev->ecore_dev) ecore_device_del(evdev->ecore_dev);
+   if (evdev->ecore_dev)
+     {
+        ecore_device_ex_seatname_del(evdev->ecore_dev);
+        ecore_device_del(evdev->ecore_dev);
+     }
    if (evdev->ecore_dev_list)
      EINA_LIST_FREE(evdev->ecore_dev_list, dev)
        {
+          ecore_device_ex_seatname_del(evdev->ecore_dev);
           ecore_device_del(dev);
        }
 
diff --git a/src/bin/inputmgr/ecore_device_ex.c b/src/bin/inputmgr/ecore_device_ex.c
new file mode 100644 (file)
index 0000000..1101efb
--- /dev/null
@@ -0,0 +1,19 @@
+#include "e_device_intern.h"
+
+EINTERN void
+ecore_device_ex_seatname_set(Ecore_Device *dev, const char *seatname)
+{
+   efl_key_data_set(dev, "seatname", eina_stringshare_add(seatname));
+}
+
+EINTERN char *
+ecore_device_ex_seatname_get(Ecore_Device *dev)
+{
+   return (char *)efl_key_data_get(dev, "seatname");
+}
+
+EINTERN void
+ecore_device_ex_seatname_del(Ecore_Device *dev)
+{
+   eina_stringshare_del(ecore_device_ex_seatname_get(dev));
+}
diff --git a/src/bin/inputmgr/ecore_device_ex_intern.h b/src/bin/inputmgr/ecore_device_ex_intern.h
new file mode 100644 (file)
index 0000000..f9a1c81
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef ECORE_DEVICE_EX_INTERN_H
+#define ECORE_DEVICE_EX_INTERN_H
+
+#include "e_intern.h"
+
+EINTERN void        ecore_device_ex_seatname_set(Ecore_Device *dev, const char *seatname);
+EINTERN char       *ecore_device_ex_seatname_get(Ecore_Device *dev);
+EINTERN char       *ecore_device_ex_seatname_del(Ecore_Device *dev);
+
+#endif /* end of include guard: ECORE_DEVICE_EX_INTERN_H */