From: sungwook79.park Date: Tue, 5 Dec 2017 05:37:18 +0000 (+0900) Subject: Add internal API to set whether IME is called from dotnet X-Git-Tag: submit/tizen/20171207.060454~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1c7394772e0927926ac95185866059781b0d5ce0;p=platform%2Fcore%2Fapi%2Finputmethod.git Add internal API to set whether IME is called from dotnet Change-Id: I73c5a5d0d738ef38643673c996acc7d9b95447f4 Signed-off-by: sungwook79.park --- diff --git a/include/inputmethod_internal.h b/include/inputmethod_internal.h index a2a003a..4e9f74d 100644 --- a/include/inputmethod_internal.h +++ b/include/inputmethod_internal.h @@ -323,6 +323,20 @@ int ime_prepare(); */ int ime_finalize(); +/** + * @brief Set flag whether IME is called from dotnet + * + * @since_tizen 4.0 + * + * @privilege %http://tizen.org/privilege/ime + * + * @param[in] set Set with Dotnet mode + * @return 0 on success, otherwise a negative error value + * @retval #IME_ERROR_NONE No error + * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function + */ +int ime_set_dotnet_flag(bool set); + #ifdef __cplusplus } #endif diff --git a/src/inputmethod.cpp b/src/inputmethod.cpp index 6bb6765..5401456 100644 --- a/src/inputmethod.cpp +++ b/src/inputmethod.cpp @@ -480,6 +480,19 @@ ime_error_e _check_privilege() return ret; } +bool g_from_dotnet = false; +EXPORT_API int ime_set_dotnet_flag(bool set) +{ + ime_error_e retVal = IME_ERROR_NONE; + + retVal = _check_privilege(); + if (retVal != IME_ERROR_NONE) return retVal; + + g_from_dotnet = set; + + return retVal; +} + EXPORT_API int ime_run(ime_callback_s *basic_cb, void *user_data) { ime_error_e retVal = IME_ERROR_NONE; @@ -510,6 +523,11 @@ EXPORT_API int ime_run(ime_callback_s *basic_cb, void *user_data) g_user_data = user_data; g_running = true; + if (g_from_dotnet) { + LOGD("ime_run is called from dotnet"); + return IME_ERROR_NONE; + } + try { g_core.run(); } catch (...) { @@ -1374,6 +1392,7 @@ EXPORT_API int ime_initialize() if (retVal != IME_ERROR_NONE) return retVal; g_core.init(); + g_running = false; return retVal; } @@ -1405,6 +1424,10 @@ EXPORT_API int ime_finalize() if (retVal != IME_ERROR_NONE) return retVal; g_core.fini(); + g_running = false; + memset(&g_basic_callback, 0, sizeof(ime_callback_s)); + memset(&g_event_callback, 0, sizeof(ime_event_callback_s)); + g_user_data = NULL; return retVal; }