e_input: move logic to enable keyboard
authorJihoon Kim <jihoon48.kim@samsung.com>
Fri, 5 Apr 2024 10:14:39 +0000 (19:14 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 9 Apr 2024 01:52:31 +0000 (10:52 +0900)
Change-Id: I68802b160dc3f87e246a55d4e4c0a3f2bc3a5b8d
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/bin/e_comp_screen.c
src/bin/e_input_inputs.c

index 1d547a4..c6bfbcb 100644 (file)
@@ -320,12 +320,6 @@ _e_comp_screen_cb_input_device_add(void *data, int type, void *event)
           }
         comp->wl_comp_data->ptr.num_devices++;
      }
-   else if (e->clas == ECORE_DEVICE_CLASS_KEYBOARD)
-     {
-        comp->wl_comp_data->kbd.num_devices++;
-        e_comp_input_key->kbd.num_devices++;
-        e_comp_wl_input_keyboard_enabled_set(EINA_TRUE);
-     }
    else if (e->clas == ECORE_DEVICE_CLASS_TOUCH)
      {
         e_comp_wl_input_touch_enabled_set(EINA_TRUE);
@@ -390,15 +384,6 @@ _e_comp_screen_cb_input_device_del(void *data, int type, void *event)
              _e_comp_screen_pointer_renew();
           }
      }
-   else if (e->clas == ECORE_DEVICE_CLASS_KEYBOARD)
-     {
-        comp->wl_comp_data->kbd.num_devices--;
-        e_comp_input_key->kbd.num_devices--;
-        if (comp->wl_comp_data->kbd.num_devices == 0)
-          {
-             e_comp_wl_input_keyboard_enabled_set(EINA_FALSE);
-          }
-     }
    else if (e->clas == ECORE_DEVICE_CLASS_TOUCH)
      {
         comp->wl_comp_data->touch.num_devices--;
index c873a8d..2220f5f 100644 (file)
@@ -8,6 +8,7 @@
 #include "e_device_intern.h"
 #include "e_comp_wl_input_intern.h"
 #include "e_main_intern.h"
+#include "e_comp_input_intern.h"
 #include <libudev.h>
 
 #include <glib.h>
@@ -314,6 +315,12 @@ _e_input_add_ecore_device(E_Input_Evdev *edev, Ecore_Device_Class clas, Ecore_De
    e_device_class_set(e_dev, clas);
    e_device_subclass_set(e_dev, subclas);
 
+   if (clas == ECORE_DEVICE_CLASS_KEYBOARD)
+     {
+        e_comp_input_key->kbd.num_devices++;
+        e_comp_wl_input_keyboard_enabled_set(EINA_TRUE);
+     }
+
    if (!edev->e_dev)
      {
         if (!edev->e_dev_list || (g_list_length(edev->e_dev_list) == 0))
@@ -405,6 +412,13 @@ _e_input_remove_ecore_device(E_Input_Evdev *edev, Ecore_Device_Class clas)
 
         if ((e_device_class_get(device) == clas) && (!strcmp(device_identifier, edev->path)))
           {
+             if (clas == ECORE_DEVICE_CLASS_KEYBOARD)
+               {
+                  e_comp_input_key->kbd.num_devices--;
+                  if (e_comp_input_key->kbd.num_devices == 0)
+                    e_comp_wl_input_keyboard_enabled_set(EINA_FALSE);
+               }
+
              device_remove_log = eina_stringshare_printf("[Remove Device] device name(%s), identifier(%s), class(%s)",
                                                          e_device_name_get(device),
                                                          device_identifier,