Set vconf key when detecting H/W key event 68/317168/3
authorJihoon Kim <jihoon48.kim@samsung.com>
Thu, 26 Dec 2024 07:32:11 +0000 (16:32 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 30 Dec 2024 00:30:53 +0000 (09:30 +0900)
Change-Id: Id4011fad603977531f8b7a6e90aadd24a9839b5c
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/e_mod_main.c

index bd76073fe2a18a2c0f7b045bc3b9067acf482f0e..eb730305776f5706c2452fd9388cfb113eecac2e 100644 (file)
@@ -69,7 +69,6 @@ tizen_profile_t _get_tizen_profile()
 }
 
 static Eina_Bool _e_text_input_method_context_cb_client_resize(void *data EINA_UNUSED, int type, void *event);
-static void set_soft_keyboard_mode();
 
 typedef struct _E_Text_Input E_Text_Input;
 typedef struct _E_Text_Input_Mgr E_Text_Input_Mgr;
@@ -169,6 +168,16 @@ static void _e_text_input_deactivate(E_Text_Input *text_input, E_Input_Method *i
 static Eina_Bool _e_text_input_method_create_context(struct wl_client *client, E_Input_Method *input_method, E_Text_Input *text_input, Eina_Bool need_focus_in);
 static void send_hide_input_panel(E_Input_Method *input_method);
 
+static void
+set_hw_keyboard_mode(bool hwmode)
+{
+   g_disable_show_panel = hwmode;
+
+   int val = 0;
+   if (vconf_get_bool(VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, &val) == 0 && val != hwmode)
+     vconf_set_bool(VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, hwmode);
+}
+
 E_Client *
 e_text_input_client_surface_get(void)
 {
@@ -1031,10 +1040,12 @@ _e_text_input_method_context_cb_resource_destroy(struct wl_resource *resource)
 }
 
 static void
-_input_panel_hide_async_cb(void *data)
+_change_hw_keyboard_mode_async_cb(void *data)
 {
    if (g_text_input && g_text_input->resource && g_client)
      _input_panel_hide(g_client, g_text_input->resource, EINA_FALSE);
+
+   set_hw_keyboard_mode(true);
 }
 
 static Eina_Bool
@@ -1090,7 +1101,7 @@ _e_mod_ecore_key_down_cb(void *data, int type, void *event)
 
    SECURE_LOGI("Hide IME (key : %s)", ev->key);
 
-   ecore_main_loop_thread_safe_call_async(_input_panel_hide_async_cb, NULL);
+   ecore_main_loop_thread_safe_call_async(_change_hw_keyboard_mode_async_cb, NULL);
 
    g_disable_show_panel = EINA_TRUE;
 
@@ -1271,7 +1282,7 @@ _e_text_input_cb_activate(struct wl_client *client, struct wl_resource *resource
      WRN("no inputmethod resource");
 
    if (_TV || _WEARABLE)
-     set_soft_keyboard_mode();
+     set_hw_keyboard_mode(false);
 
    if (text_input->resource)
      wl_text_input_send_enter(text_input->resource, surface);
@@ -2218,17 +2229,6 @@ _e_mod_text_input_shutdown(void)
 
 E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Text_Input" };
 
-static void
-set_soft_keyboard_mode()
-{
-   g_disable_show_panel = EINA_FALSE;
-
-   /* switch to S/W keyboard mode */
-   int val = 0;
-   if (vconf_get_bool(VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, &val) == 0 && val != 0)
-     vconf_set_bool(VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, 0);
-}
-
 static Eina_Bool
 _e_mod_device_removed_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
 {
@@ -2241,7 +2241,7 @@ _e_mod_device_removed_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *eve
      }
 
    if (ev->clas == ECORE_DEVICE_CLASS_KEYBOARD)
-     set_soft_keyboard_mode();
+     set_hw_keyboard_mode(false);
 
    return ECORE_CALLBACK_PASS_ON;
 }