From: Inhong Han Date: Tue, 21 Jan 2025 02:13:56 +0000 (+0900) Subject: Use Idler to register vconf callback X-Git-Tag: accepted/tizen/9.0/unified/20250122.024608~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a8aecfd29cd00f06bb5ca10abaafec6de1076d79;p=platform%2Fcore%2Fuifw%2Fe-mod-tizen-wl-textinput.git Use Idler to register vconf callback Change-Id: I49d66b2b4608a42c8ae609d283a599cafe2020c4 --- diff --git a/src/e_mod_main.c b/src/e_mod_main.c index bd76073..c4ca9a3 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -145,6 +145,7 @@ static E_Client *client_surface_ec = NULL; static E_Text_Input *g_show_text_input = NULL; static struct wl_client *g_show_client = NULL; static Eina_Bool g_updated_geometry = EINA_FALSE; +static Ecore_Idler *g_vconf_idler = NULL; /* The candidate's show state that was requested by the application or IME */ static Eina_Bool g_show_state_candidate = EINA_FALSE; @@ -2368,6 +2369,19 @@ e_input_panel_show_request_flag_get() return g_text_input->input_panel_show_requested; } +static Eina_Bool +_vconf_idler_cb(void *user_data) +{ + LOGD(""); + + if (vconf_notify_key_changed(VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, _keyboard_mode_changed_cb, NULL) != 0) + LOGW ("Failed to register callback function for H/W keyboard input detection."); + + g_vconf_idler = NULL; + + return ECORE_CALLBACK_CANCEL; +} + E_API void * e_modapi_init(E_Module *m) { @@ -2391,8 +2405,7 @@ e_modapi_init(E_Module *m) E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_RESIZE, _e_text_input_method_context_cb_client_resize, NULL); - if (vconf_notify_key_changed(VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, _keyboard_mode_changed_cb, NULL) != 0) - LOGW ("Failed to register callback function for H/W keyboard input detection."); + g_vconf_idler = ecore_idler_add(_vconf_idler_cb, NULL); ecore_device_del_handler = ecore_event_handler_add(ECORE_EVENT_DEVICE_DEL, _e_mod_device_removed_cb, NULL); @@ -2423,6 +2436,12 @@ e_modapi_shutdown(E_Module *m EINA_UNUSED) ecore_device_del_handler = NULL; } + if (g_vconf_idler) + { + ecore_idler_del(g_vconf_idler); + g_vconf_idler = NULL; + } + _e_mod_text_input_shutdown(); e_input_panel_shutdown();