From: Inhong Han Date: Tue, 21 Jan 2025 02:25:06 +0000 (+0900) Subject: Use Idler to register vconf callback X-Git-Tag: accepted/tizen/unified/20250121.155634~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b26710c8a234c75f9e54d8958053872f8d03215;p=platform%2Fcore%2Fuifw%2Fe-mod-tizen-wl-textinput.git Use Idler to register vconf callback Change-Id: If8f84b59645abf91f8b013c35cfaa2cc12a7e978 --- diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 992f59e..1648c88 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -145,6 +145,7 @@ 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 Eina_Bool g_fullscreen_mode = 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; @@ -2376,6 +2377,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) { @@ -2399,8 +2413,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); @@ -2431,6 +2444,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();