From: Jihoon Kim Date: Tue, 3 Dec 2024 07:50:41 +0000 (+0900) Subject: e_input_backend: add ecore device for seat asynchronously X-Git-Tag: accepted/tizen/9.0/unified/20241205.174745~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2231180033a617617764f99f41b607bbb94ddd9d;p=platform%2Fupstream%2Fenlightenment.git e_input_backend: add ecore device for seat asynchronously Change-Id: Ie157549f170c85c30a01c970219dc13ee070ac3a Signed-off-by: Jihoon Kim --- diff --git a/src/bin/inputmgr/e_input_backend.c b/src/bin/inputmgr/e_input_backend.c index c424fd9189..094a495f7f 100644 --- a/src/bin/inputmgr/e_input_backend.c +++ b/src/bin/inputmgr/e_input_backend.c @@ -165,35 +165,43 @@ _e_input_ecore_device_event(Ecore_Device *dev, const char* seat_name, Eina_Bool ecore_event_add(ECORE_EVENT_DEVICE_DEL, e, _e_input_ecore_device_info_free, NULL); } -static E_Input_Seat * -_seat_create(E_Input_Backend *input, const char *seat) +static void +_e_input_seat_ecore_device_create_async_cb(void *data) { - E_Input_Seat *s; + E_Input_Seat *s = data; Ecore_Device *ecore_dev = NULL; - E_Device *e_dev = NULL; - - ecore_thread_main_loop_begin(); /* create an evas device of a seat */ ecore_dev = ecore_device_add(); if (!ecore_dev) { ERR("Failed to create an ecore device for a seat !\n"); - ecore_thread_main_loop_end(); - return NULL; + return; } - ecore_device_name_set(ecore_dev, seat); + ecore_device_name_set(ecore_dev, s->name); ecore_device_identifier_set(ecore_dev, "Enlightenment seat"); ecore_device_class_set(ecore_dev, ECORE_DEVICE_CLASS_SEAT); ecore_device_subclass_set(ecore_dev, ECORE_DEVICE_SUBCLASS_NONE); + s->ecore_dev = ecore_dev; + + ecore_event_add(E_INPUT_EVENT_SEAT_ADD, NULL, NULL, NULL); + + _e_input_ecore_device_event(ecore_dev, s->name, EINA_TRUE); +} + +static E_Input_Seat * +_seat_create(E_Input_Backend *input, const char *seat) +{ + E_Input_Seat *s = NULL; + E_Device *e_dev = NULL; + /* create an e device of a seat */ e_dev = e_device_new(); if (!e_dev) { ERR("Failed to create an ecore device for a seat !\n"); - ecore_thread_main_loop_end(); return NULL; } @@ -205,24 +213,19 @@ _seat_create(E_Input_Backend *input, const char *seat) /* try to allocate space for new seat */ if (!(s = calloc(1, sizeof(E_Input_Seat)))) { - ecore_device_del(ecore_dev); - ecore_thread_main_loop_end(); return NULL; } s->input = input; s->name = eina_stringshare_add(seat); - s->ecore_dev = ecore_dev; + s->ecore_dev = NULL; s->e_dev = e_dev; /* add this new seat to list */ input->dev->seats = eina_list_append(input->dev->seats, s); s->dev = input->dev; - ecore_event_add(E_INPUT_EVENT_SEAT_ADD, NULL, NULL, NULL); - - _e_input_ecore_device_event(ecore_dev, seat, EINA_TRUE); - ecore_thread_main_loop_end(); + ecore_main_loop_thread_safe_call_async(_e_input_seat_ecore_device_create_async_cb, s); return s; }