e_keyrouter: remove duplicated code for registering event handler 71/304871/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Thu, 25 Jan 2024 01:44:31 +0000 (10:44 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Thu, 25 Jan 2024 04:30:38 +0000 (13:30 +0900)
Change-Id: If33b63e7171c14a9ef1e6867f36752c2aebf84a8
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/bin/e_keyrouter.c

index d4c1582..3353b1e 100644 (file)
@@ -346,8 +346,6 @@ _e_keyrouter_client_cb_remove(void *data, int type, void *event)
 static void
 _e_keyrouter_init_handlers(void)
 {
-   E_Input_Event_Source *input_event_source = NULL;
-
    E_LIST_HANDLER_APPEND(krt->handlers, E_EVENT_CLIENT_STACK, _e_keyrouter_client_cb_stack, NULL);
    E_LIST_HANDLER_APPEND(krt->handlers, E_EVENT_CLIENT_REMOVE, _e_keyrouter_client_cb_remove, NULL);
 
@@ -358,19 +356,7 @@ _e_keyrouter_init_handlers(void)
      }
    else
      {
-        input_event_source = e_input_event_source_get();
-        if (input_event_source)
-          {
-             g_mutex_lock(&krt->event_handler_mutex);
-
-             if (!krt->_key_down_handler)
-               krt->_key_down_handler = e_input_event_handler_add(input_event_source, ECORE_EVENT_KEY_DOWN, _e_keyrouter_cb_key_down, NULL);
-
-             if (!krt->_key_up_handler)
-               krt->_key_up_handler = e_input_event_handler_add(input_event_source, ECORE_EVENT_KEY_UP, _e_keyrouter_cb_key_up, NULL);
-
-             g_mutex_unlock(&krt->event_handler_mutex);
-          }
+        e_keyrouter_input_handler_add();
      }
 
    e_info_server_hook_set("keyrouter", _e_keyrouter_info_print, NULL);
@@ -799,4 +785,4 @@ void e_keyrouter_keygrab_list_lock()
 void e_keyrouter_keygrab_list_unlock()
 {
    g_rec_mutex_unlock(&krt->grab_key_mutex);
-}
\ No newline at end of file
+}