e_input_backend: defer setting seat's 'kbd.enabled' variable in main thread 57/325057/1
authorduna.oh <duna.oh@samsung.com>
Thu, 29 May 2025 04:31:09 +0000 (13:31 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 2 Jun 2025 06:50:36 +0000 (15:50 +0900)
Change-Id: I0c0fb70c8716213e7c8d509f953a933c60287d6e

src/bin/e_comp_screen.c
src/bin/inputmgr/e_input_backend.c

index 5f97821603912175807b9e63162eae6ee841b46d..9227424a6497ad671ea555810a41a0ee56da94f1 100644 (file)
@@ -327,19 +327,23 @@ _e_comp_screen_cb_input_device_add(void *data, int type, void *event)
      }
    else if (e->clas == ECORE_DEVICE_CLASS_KEYBOARD)
      {
-        if (!e_input_thread_mode_get())
+        if (e_seat_keyboard_device_count(seat) == 0)
           {
              e_seat_keyboard_enabled_set(seat, EINA_TRUE);
-             e_seat_keyboard_device_count_increase(seat);
           }
+        e_seat_keyboard_device_count_increase(seat);
      }
    else if (e->clas == ECORE_DEVICE_CLASS_TOUCH)
      {
+        if (e_seat_touch_device_count(seat) == 0)
+          {
+             e_seat_touch_enabled_set(seat, EINA_TRUE);
+          }
+        e_seat_touch_device_count_increase(seat);
+
         E_Comp_Screen *comp_screen = e_comp_screen_get();
-        e_seat_touch_enabled_set(seat, EINA_TRUE);
         if (comp_screen)
           _e_comp_screen_input_rotation_set(comp_screen->rotation);
-        e_seat_touch_device_count_increase(seat);
      }
 
 end:
@@ -416,6 +420,14 @@ _e_comp_screen_cb_input_device_del(void *data, int type, void *event)
              e_seat_touch_enabled_set(seat, EINA_FALSE);
           }
      }
+   else if (e->clas == ECORE_DEVICE_CLASS_KEYBOARD)
+     {
+        e_seat_keyboard_device_count_decrease(seat);
+        if (e_seat_keyboard_device_count(seat) == 0)
+          {
+             e_seat_keyboard_enabled_set(seat, EINA_FALSE);
+          }
+     }
 
 end:
 
index dfb254909709d603cffcb9ad0df9a5b3d98c4a77..da070f67d850a231d2e7a3d2513e764c0815388c 100644 (file)
@@ -385,18 +385,6 @@ _e_input_device_event_add(const char *name, const char *identifier, const char *
    e_input_event_add(input_event_source, flag ? ECORE_EVENT_DEVICE_ADD : ECORE_EVENT_DEVICE_DEL, ecore_dev_info, _e_input_ecore_device_info_free, NULL);
 }
 
-static void
-_e_input_add_ecore_device_keyboard_async_cb(void *data)
-{
-   E_Seat *seat;
-   const char *seatname = data;
-
-   seat = e_seat_find(seatname);
-   if (!seat) return;
-   e_seat_keyboard_device_count_increase(seat);
-   e_seat_keyboard_enabled_set(seat, EINA_TRUE);
-}
-
 static Eina_Bool
 _e_input_add_ecore_device(E_Input_Evdev *evdev, Ecore_Device_Class clas, Ecore_Device_Subclass subclas)
 {
@@ -440,14 +428,6 @@ _e_input_add_ecore_device(E_Input_Evdev *evdev, Ecore_Device_Class clas, Ecore_D
    e_device_subclass_set(e_dev, subclas);
    e_device_seatname_set(e_dev, seat_name);
 
-   if (e_input_thread_mode_get())
-     {
-        if (clas == ECORE_DEVICE_CLASS_KEYBOARD)
-          {
-             ecore_main_loop_thread_safe_call_async(_e_input_add_ecore_device_keyboard_async_cb, (void *)seat_name);
-          }
-     }
-
    if (!evdev->e_dev)
      {
         if (!evdev->e_dev_list || (g_list_length(evdev->e_dev_list) == 0))
@@ -539,20 +519,6 @@ end:
    E_FREE(dev_info);
 }
 
-
-static void
-_e_input_remove_ecore_device_keyboard_async_cb(void *data)
-{
-   E_Seat *seat;
-   const char *seatname = data;
-
-   seat = e_seat_find(seatname);
-   if (!seat) return;
-   e_seat_keyboard_device_count_decrease(seat);
-   if (e_seat_keyboard_device_count(seat) == 0)
-     e_seat_keyboard_enabled_set(seat, EINA_FALSE);
-}
-
 static Eina_Bool
 _e_input_remove_ecore_device(E_Input_Evdev *evdev, Ecore_Device_Class clas)
 {
@@ -579,11 +545,6 @@ _e_input_remove_ecore_device(E_Input_Evdev *evdev, Ecore_Device_Class clas)
 
         if ((e_device_class_get(device) == clas) && (!strcmp(device_identifier, evdev->path)))
           {
-             if (clas == ECORE_DEVICE_CLASS_KEYBOARD)
-               {
-                  ecore_main_loop_thread_safe_call_async(_e_input_remove_ecore_device_keyboard_async_cb, (void *)seat_name);
-               }
-
              device_remove_log = eina_stringshare_printf("[Remove Device] device name(%s), identifier(%s), class(%s), subclass(%d), seatname(%s)",
                                                          e_device_name_get(device),
                                                          device_identifier,