From: Jihoon Kim Date: Tue, 21 Jan 2025 02:32:59 +0000 (+0900) Subject: ecore_device_ex: add API to set seatname in ecore_device X-Git-Tag: accepted/tizen/unified/20250319.072541~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F85%2F321185%2F1;p=platform%2Fupstream%2Fenlightenment.git ecore_device_ex: add API to set seatname in ecore_device Change-Id: I805ffea04bd085699ade51b0d71c6b241eb642f3 Signed-off-by: Jihoon Kim --- diff --git a/src/bin/Makefile.mk b/src/bin/Makefile.mk index 48126854a3..c092213fa6 100644 --- a/src/bin/Makefile.mk +++ b/src/bin/Makefile.mk @@ -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 \ diff --git a/src/bin/inputmgr/e_input_backend.c b/src/bin/inputmgr/e_input_backend.c index 1e2755ec27..22fc84fdeb 100644 --- a/src/bin/inputmgr/e_input_backend.c +++ b/src/bin/inputmgr/e_input_backend.c @@ -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 #include @@ -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); } } diff --git a/src/bin/inputmgr/e_input_evdev.c b/src/bin/inputmgr/e_input_evdev.c index 4f4b6d1f80..a142d663a7 100644 --- a/src/bin/inputmgr/e_input_evdev.c +++ b/src/bin/inputmgr/e_input_evdev.c @@ -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 #include @@ -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 index 0000000000..1101efba9a --- /dev/null +++ b/src/bin/inputmgr/ecore_device_ex.c @@ -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 index 0000000000..f9a1c81dd0 --- /dev/null +++ b/src/bin/inputmgr/ecore_device_ex_intern.h @@ -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 */