summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjk7744.park <jk7744.park@samsung.com>2015-10-26 15:42:50 +0900
committerjk7744.park <jk7744.park@samsung.com>2015-10-26 15:42:50 +0900
commitc2aa914c8fb6df01525f4b0bd65820a44818994c (patch)
tree522286d5ab6f49f4a4986fc3cef2deabf21135dc
parentfd39cb122420e32e729590d92a2abce154d607d4 (diff)
downloadinputmethod-accepted/tizen/2.4/mobile/20151029.034750.tar.gz
inputmethod-accepted/tizen/2.4/mobile/20151029.034750.tar.bz2
inputmethod-accepted/tizen/2.4/mobile/20151029.034750.zip
-rw-r--r--AUTHORS4
-rw-r--r--CMakeLists.txt137
-rw-r--r--LICENSE204
-rw-r--r--capi-ui-inputmethod.manifest5
-rw-r--r--capi-ui-inputmethod.pc.in14
-rw-r--r--doc/inputmethod_doc.h36
-rw-r--r--include/inputmethod.h1995
-rw-r--r--include/inputmethod_keydef.h301
-rw-r--r--include/inputmethod_private.h45
-rw-r--r--packaging/capi-ui-inputmethod.spec70
-rw-r--r--src/inputmethod.cpp1363
11 files changed, 4174 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..6fbb84d
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,4 @@
+Sungmin Kwak <sungmin.kwak@samsung.com>
+Ji-hoon Lee <dalton.lee@samsung.com>
+Jihoon Kim <jihoon48.kim@samsung.com>
+Jae Yong Lee <jaeyong911.lee@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..a188959
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,137 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+SET(project_prefix "capi")
+SET(prefix "/usr")
+SET(version "0.0.1")
+SET(maintainer "Ji-hoon Lee <dalton.lee@samsung.com>")
+SET(description "Input Method APIs")
+SET(service "ui")
+SET(submodule "inputmethod")
+SET(dependents "capi-base-common dlog elementary ecore-imf libscl-core isf libsmack")
+SET(LIBDIR ${LIB_INSTALL_DIR})
+
+SET(Services
+ "application"
+ "base"
+ "content"
+ "location"
+ "media"
+ "messaging"
+ "network"
+ "social"
+ "telephony"
+ "system"
+ "ui"
+ )
+
+#FILE(STRINGS config.cfg configs REGEX "^ *[^#]")
+FOREACH(lines ${configs})
+# MESSAGE(${lines})
+ IF(${lines} MATCHES "([^=]*)=['\"](.*)['\"]")
+ SET(key ${CMAKE_MATCH_1})
+ SET(value ${CMAKE_MATCH_2})
+# MESSAGE("${key} -> ${value}")
+ SET(${key} "${value}")
+ ENDIF()
+ENDFOREACH(lines ${configs})
+
+LIST(FIND Services ${service} sfind)
+
+IF( ${sfind} EQUAL -1 )
+ MESSAGE(FATAL_ERROR "Service must be one of ")
+ FOREACH( s IN ${Services} )
+ MESSAGE(FATAL_ERROR "[${s}]")
+ ENDFOREACH( s IN ${Services} )
+ENDIF( ${sfind} EQUAL -1 )
+
+SET(fw_name "${project_prefix}-${service}-${submodule}")
+
+PROJECT(${fw_name} CXX)
+
+SET(CMAKE_INSTALL_PREFIX ${prefix})
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(VERSION ${version})
+
+SET(INC_DIR include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${dependents})
+FOREACH(flag ${${fw_name}_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -fpermissive")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+ ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DTIZEN_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+
+aux_source_directory(src SOURCES)
+ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
+
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+
+SET_TARGET_PROPERTIES(${fw_name}
+ PROPERTIES
+ VERSION ${FULLVER}
+ SOVERSION ${MAJORVER}
+ CLEAN_DIRECT_OUTPUT 1
+)
+
+INSTALL(TARGETS ${fw_name} DESTINATION ${LIBDIR})
+INSTALL(
+ DIRECTORY ${INC_DIR}/ DESTINATION include
+ FILES_MATCHING
+ PATTERN "*_private.h" EXCLUDE
+ PATTERN "${INC_DIR}/*.h"
+ )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${dependents})
+SET(PC_LDFLAGS -l${fw_name})
+
+CONFIGURE_FILE(
+ capi-ui-inputmethod.pc.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+ @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIBDIR}/pkgconfig)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME capi-ui-inputmethod)
+
+IF(UNIX)
+
+ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
+ADD_CUSTOM_COMMAND(
+ DEPENDS clean
+ COMMENT "distribution clean"
+ COMMAND find
+ ARGS .
+ -not -name config.cmake -and \(
+ -name tester.c -or
+ -name Testing -or
+ -name CMakeFiles -or
+ -name cmake.depends -or
+ -name cmake.check_depends -or
+ -name CMakeCache.txt -or
+ -name cmake.check_cache -or
+ -name *.cmake -or
+ -name Makefile -or
+ -name core -or
+ -name core.* -or
+ -name gmon.out -or
+ -name install_manifest.txt -or
+ -name *.pc -or
+ -name *~ \)
+ | grep -v TC | xargs rm -rf
+ TARGET distclean
+ VERBATIM
+)
+
+ENDIF(UNIX)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..de266fb
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,204 @@
+Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
diff --git a/capi-ui-inputmethod.manifest b/capi-ui-inputmethod.manifest
new file mode 100644
index 0000000..dfdc35c
--- /dev/null
+++ b/capi-ui-inputmethod.manifest
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
diff --git a/capi-ui-inputmethod.pc.in b/capi-ui-inputmethod.pc.in
new file mode 100644
index 0000000..76f4d7e
--- /dev/null
+++ b/capi-ui-inputmethod.pc.in
@@ -0,0 +1,14 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=/usr/lib
+includedir=/usr/include
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
+
diff --git a/doc/inputmethod_doc.h b/doc/inputmethod_doc.h
new file mode 100644
index 0000000..3e4af55
--- /dev/null
+++ b/doc/inputmethod_doc.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TIZEN_UIX_INPUTMETHOD_DOC_H__
+#define __TIZEN_UIX_INPUTMETHOD_DOC_H__
+
+/**
+ * @ingroup CAPI_UIX_FRAMEWORK
+ * @defgroup CAPI_UIX_INPUTMETHOD_MODULE Input Method
+ * @brief The @ref CAPI_UIX_INPUTMETHOD_MODULE API provides the functions for starting IME application lifecycle,
+ * methods to interact with current UI state of IME, and getting attributes/events.
+ *
+ * @section CAPI_UIX_INPUTMETHOD_MODULE_HEADER Required Header
+ * \#include <inputmethod.h>
+ *
+ * @section CAPI_UIX_INPUTMETHOD_MODULE_OVERVIEW Overview
+ * Input method editor (IME) is an input panel that lets users provide input and the platform receive the text data entered.
+ * Custom keyboards can be built according to the application's necessity by these API sets.
+ * Tizen provides a framework to create such input method editors. Such extra input methods can be selected from Settings.
+ */
+
+#endif // __TIZEN_UIX_INPUTMETHOD_DOC_H__
+
diff --git a/include/inputmethod.h b/include/inputmethod.h
new file mode 100644
index 0000000..ff310c4
--- /dev/null
+++ b/include/inputmethod.h
@@ -0,0 +1,1995 @@
+/*
+ * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TIZEN_UIX_INPUTMETHOD_H__
+#define __TIZEN_UIX_INPUTMETHOD_H__
+
+/**
+ * @file inputmethod.h
+ * @brief This file contains input method APIs and related enumeration.
+ */
+
+#include <tizen.h>
+#include "inputmethod_keydef.h"
+
+#include <Ecore_IMF.h>
+#include <Evas.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup CAPI_UIX_INPUTMETHOD_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration for input method function error
+ *
+ * @since_tizen 2.4
+ */
+typedef enum
+{
+ IME_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ IME_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ IME_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+ IME_ERROR_NO_CALLBACK_FUNCTION = TIZEN_ERROR_IME | 0x0001, /**< Necessary callback function is not set */
+ IME_ERROR_NOT_RUNNING = TIZEN_ERROR_IME | 0x0002, /**< IME main loop isn't started yet */
+ IME_ERROR_OPERATION_FAILED = TIZEN_ERROR_IME | 0x0003, /**< Operation failed */
+} ime_error_e;
+
+/**
+ * @brief Enumeration of the option window type
+ *
+ * @since_tizen 2.4
+ *
+ * @see ime_option_window_created_cb
+ */
+typedef enum
+{
+ IME_OPTION_WINDOW_TYPE_KEYBOARD, /**< Open from Keyboard */
+ IME_OPTION_WINDOW_TYPE_SETTING_APPLICATION, /**< Open from Setting application */
+} ime_option_window_type_e;
+
+/**
+ * @brief Enumeration of layout variation
+ *
+ * @since_tizen 2.4
+ *
+ * @see ime_context_get_layout_variation
+ */
+typedef enum
+{
+ IME_LAYOUT_NORMAL_VARIATION_NORMAL = 0, /**< The plain normal layout */
+ IME_LAYOUT_NORMAL_VARIATION_FILENAME, /**< Filename layout; symbols such as '/', '*', '\', '|', '&lt;', '&gt;', '?', '&quot;' and ':' should be disabled */
+ IME_LAYOUT_NORMAL_VARIATION_PERSON_NAME, /**< The name of a person */
+ IME_LAYOUT_NUMBERONLY_VARIATION_NORMAL = 0, /**< The plain normal number layout */
+ IME_LAYOUT_NUMBERONLY_VARIATION_SIGNED, /**< The number layout to allow a negative sign */
+ IME_LAYOUT_NUMBERONLY_VARIATION_DECIMAL, /**< The number layout to allow decimal point to provide fractional value */
+ IME_LAYOUT_NUMBERONLY_VARIATION_SIGNED_AND_DECIMAL, /**< The number layout to allow decimal point and negative sign */
+ IME_LAYOUT_PASSWORD_VARIATION_NORMAL = 0, /**< The normal password layout */
+ IME_LAYOUT_PASSWORD_VARIATION_NUMBERONLY, /**< The password layout to allow only number */
+} ime_layout_variation_e;
+
+/**
+ * @brief Enumeration of string attribute type
+ *
+ * @remarks Currently, a font style is available to use.
+ *
+ * @since_tizen 2.4
+ *
+ * @see ime_preedit_attribute, ime_update_preedit_string
+ */
+typedef enum
+{
+ IME_ATTR_NONE, /**< No attribute */
+ IME_ATTR_FONTSTYLE, /**< A font style attribute, e.g., underline, etc. */
+} ime_attribute_type;
+
+/**
+ * @brief Value for #IME_ATTR_FONTSTYLE. Draw a line under the text.
+ * @since_tizen 2.4
+ */
+#define IME_ATTR_FONTSTYLE_UNDERLINE 1
+
+/**
+ * @brief Value for #IME_ATTR_FONTSTYLE. Draw text in highlighted color.
+ * @since_tizen 2.4
+ */
+#define IME_ATTR_FONTSTYLE_HIGHLIGHT 2
+
+/**
+ * @brief Value for #IME_ATTR_FONTSTYLE. Draw text in reversal color.
+ * @since_tizen 2.4
+ */
+#define IME_ATTR_FONTSTYLE_REVERSAL 4
+
+/**
+ * @brief The structure type to contain the attributes for preedit string.
+ *
+ * @remarks A preedit string may have one or more different attributes. This structure describes each attribute of the string.
+ *
+ * @since_tizen 2.4
+ *
+ * @see ime_update_preedit_string, ime_attribute_type
+ */
+typedef struct
+{
+ unsigned int start; /**< The start position in the string of this attribute */
+ unsigned int length; /**< The character length of this attribute, the range is [start, start+length] */
+ ime_attribute_type type; /**< The type of this attribute */
+ unsigned int value; /**< The value of this attribute */
+} ime_preedit_attribute;
+
+/**
+ * @brief Handle of an associated text input UI control's input context.
+ *
+ * @details This is one of parameters of ime_show_cb() callback function. IME application
+ * should configure its input panel with this structure information.
+ *
+ * @since_tizen 2.4
+ *
+ * @see ime_context_get_layout, ime_context_get_layout_variation, ime_context_get_cursor_position,
+ * ime_context_get_autocapital_type, ime_context_get_return_key_type, ime_context_get_return_key_state,
+ * ime_context_get_prediction_mode, ime_context_get_password_mode, ime_context_get_input_hint,
+ * ime_context_get_bidi_direction, ime_context_get_language
+ */
+typedef struct _ime_context *ime_context_h;
+
+/**
+ * @brief Handle of the device information of the key event.
+ *
+ * @details This is one of parameters of ime_process_key_event_cb() callback function. IME application
+ * may distinguish the key event by using this if necessary.
+ *
+ * @since_tizen 2.4
+ *
+ * @see ime_process_key_event_cb, ime_device_info_get_name, ime_device_info_get_class, ime_device_info_get_subclass
+ */
+typedef struct _ime_device_info *ime_device_info_h;
+
+/**
+ * @brief Called when the input panel is created.
+ *
+ * @remarks This callback function is mandatory and must be registered using ime_run(). The
+ * ime_get_main_window() can be used to get the created input panel window.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @pre The ime_run() function calls this callback function.
+ *
+ * @see ime_run, ime_set_size, ime_get_main_window
+ */
+typedef void (*ime_create_cb)(void *user_data);
+
+/**
+ * @brief Called when the input panel is terminated.
+ *
+ * @remarks This callback function is mandatory and must be registered using ime_run(). The
+ * ime_get_main_window() can be used to get the created input panel window.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @see ime_run, ime_get_main_window
+ */
+typedef void (*ime_terminate_cb)(void *user_data);
+
+/**
+ * @brief Called when an associated text input UI control requests the input panel to show itself.
+ *
+ * @remarks This callback function is mandatory and must be registered using ime_run().
+ * IME application should configure its input panel with #ime_context_h structure information.
+ * The ime_get_main_window() can be used to get the created input panel window.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] context_id The input context identification value of an associated text input UI control
+ * @param[in] context The input context information handle
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @see ime_run, ime_get_main_window, ime_context_get_layout,
+ * ime_context_get_layout_variation, ime_context_get_cursor_position,
+ * ime_context_get_autocapital_type, ime_context_get_return_key_type,
+ * ime_context_get_return_key_state, ime_context_get_prediction_mode,
+ * ime_context_get_password_mode, ime_context_get_input_hint,
+ * ime_context_get_bidi_direction, ime_context_get_language
+ */
+typedef void (*ime_show_cb)(int context_id, ime_context_h context, void *user_data);
+
+/**
+ * @brief Called when an associated text input UI control requests the input panel to hide itself.
+ *
+ * @remarks This callback function is mandatory and must be registered using ime_run(). The
+ * ime_get_main_window() can be used to get the created input panel window.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] context_id The input context identification value of an associated text input UI control
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @see ime_run, ime_get_main_window
+ */
+typedef void (*ime_hide_cb)(int context_id, void *user_data);
+
+/**
+ * @brief Called when an associated text input UI control has focus.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] context_id The input context identification value of an associated text input UI control
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @pre The callback can be registered using ime_event_set_focus_in_cb() function.
+ *
+ * @see ime_event_set_focus_in_cb
+ */
+typedef void (*ime_focus_in_cb)(int context_id, void *user_data);
+
+/**
+ * @brief Called when an associated text input UI control loses focus.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] context_id The input context identification value of an associated text input UI control
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @pre The callback can be registered using ime_event_set_focus_out_cb() function.
+ *
+ * @see ime_event_set_focus_out_cb
+ */
+typedef void (*ime_focus_out_cb)(int context_id, void *user_data);
+
+/**
+ * @brief Called when an associated text input UI control responds to a request with the surrounding text.
+ *
+ * @remarks The ime_request_surrounding_text() must be called to invoke this callback function, asynchronously.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] context_id The input context identification value of an associated text input UI control
+ * @param[in] text The UTF-8 string requested
+ * @param[in] cursor_pos The cursor position
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @pre The callback can be registered using ime_event_set_surrounding_text_updated_cb() function.
+ *
+ * @see ime_event_set_surrounding_text_updated_cb, ime_request_surrounding_text
+ */
+typedef void (*ime_surrounding_text_updated_cb)(int context_id, const char *text, int cursor_pos, void *user_data);
+
+/**
+ * @brief Called to reset the input context of an associated text input UI control.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @pre The callback can be registered using ime_event_set_input_context_reset_cb() function.
+ *
+ * @see ime_event_set_input_context_reset_cb
+ */
+typedef void (*ime_input_context_reset_cb)(void *user_data);
+
+/**
+ * @brief Called when the position of the cursor in an associated text input UI control changes.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] cursor_pos The cursor position
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @pre The callback can be registered using ime_event_set_cursor_position_updated_cb() function.
+ *
+ * @see ime_event_set_cursor_position_updated_cb
+ */
+typedef void (*ime_cursor_position_updated_cb)(int cursor_pos, void *user_data);
+
+/**
+ * @brief Called when an associated text input UI control requests the language from the input panel.
+ *
+ * @remarks The allocated @a lang_code will be released internally.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] user_data User data to be passed from the callback registration function
+ * @param[out] lang_code Input panel's current input language code (e.g., &quot;en_US&quot;)
+ *
+ * @pre The callback can be registered using ime_event_set_language_requested_cb() function.
+ *
+ * @see ime_event_set_language_requested_cb
+ */
+typedef void (*ime_language_requested_cb)(void *user_data, char **lang_code);
+
+/**
+ * @brief Called to set the preferred language to the input panel.
+ *
+ * @remarks @a language information is already set to the input panel when it is shown
+ * through #ime_context_h. This callback function will be only called when the client
+ * application changes the edit field's language attribute after the input panel is shown.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] language The preferred language that the client application wants
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @pre The callback can be registered using ime_event_set_language_set_cb() function.
+ *
+ * @see ime_event_set_language_set_cb
+ */
+typedef void (*ime_language_set_cb)(Ecore_IMF_Input_Panel_Lang language, void *user_data);
+
+/**
+ * @brief Called to set the application specific data to deliver to the input panel.
+ *
+ * @details This API is used by the applications to deliver the specific data to the input panel.
+ * The data format MUST be negotiated by both application and input panel.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] data The specific data to be set to the input panel
+ * @param[in] data_length The length of data, in bytes, to send to the input panel
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @pre The callback can be registered using ime_event_set_imdata_set_cb() function.
+ *
+ * @see ime_event_set_imdata_set_cb
+ */
+typedef void (*ime_imdata_set_cb)(void *data, unsigned int data_length, void *user_data);
+
+/**
+ * @brief Called when an associated text input UI control requests the application specific data from the input panel.
+ *
+ * @details This API is used by the applications to request the specific data from the input panel.
+ * The data format MUST be negotiated by both application and input panel.
+ *
+ * @remarks The allocated @a data will be released internally.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] user_data User data to be passed from the callback registration function
+ * @param[out] data Input panel's data to be set to the application
+ * @paran[out] data_length The length of data, in bytes, to send to the application
+ *
+ * @pre The callback can be registered using ime_event_set_imdata_requested_cb() function.
+ *
+ * @see ime_event_set_imdata_requested_cb
+ */
+typedef void (*ime_imdata_requested_cb)(void *user_data, void **data, unsigned int *data_length);
+
+/**
+ * @brief Called when an associated text input UI control requests the input panel to set its layout.
+ *
+ * @remarks @a layout information is already set to the input panel when it is shown
+ * through #ime_context_h. This callback function will be only called when the client
+ * application changes the edit field's layout attribute after the input panel is shown.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] layout The input panel layout
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @pre The callback can be registered using ime_event_set_layout_set_cb() function.
+ *
+ * @see ime_event_set_layout_set_cb
+ */
+typedef void (*ime_layout_set_cb)(Ecore_IMF_Input_Panel_Layout layout, void *user_data);
+
+/**
+ * @brief Called when an associated text input UI control requests the input panel to set the @c Return key label.
+ * The input panel can show text or image on the @c Return button according to the @c Return key action.
+ *
+ * @remarks @a type information is already set to the input panel when it is shown
+ * through #ime_context_h. This callback function will be only called when the client
+ * application changes the edit field's @c Return key type attribute after the input panel
+ * is shown.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] type The type of @c Return key on the input panel
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @pre The callback can be registered using ime_event_set_return_key_type_set_cb() function.
+ *
+ * @see ime_event_set_return_key_type_set_cb
+ */
+typedef void (*ime_return_key_type_set_cb)(Ecore_IMF_Input_Panel_Return_Key_Type type, void *user_data);
+
+/**
+ * @brief Called when an associated text input UI control requests the input panel to enable
+ * or disable the @c Return key state.
+ *
+ * @remarks @a disabled information is already set to the input panel when it is shown
+ * through #ime_context_h. This callback function will be only called when the client
+ * application changes the edit field's @c Return key disable attribute after the input panel
+ * is shown.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] disabled The Boolean state to disable @c Return key. The @c Return key is enabled by default
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @pre The callback can be registered using ime_event_set_return_key_state_set_cb() function.
+ *
+ * @see ime_event_set_return_key_state_set_cb
+ */
+typedef void (*ime_return_key_state_set_cb)(bool disabled, void *user_data);
+
+/**
+ * @brief Called when an associated text input UI control requests the position and size from the input panel.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] user_data User data to be passed from the callback registration function
+ * @param[out] x The x position in screen
+ * @param[out] y The y position in screen
+ * @param[out] w The window width
+ * @param[out] h The window height
+ *
+ * @pre The callback can be registered using ime_event_set_geometry_requested_cb() function.
+ *
+ * @see ime_event_set_geometry_requested_cb
+ */
+typedef void (*ime_geometry_requested_cb)(void *user_data, int *x, int *y, int *w, int *h);
+
+/**
+ * @brief Called when the key event is received from the external devices or ime_send_key_event() function.
+ *
+ * @details This function processes the key event before an associated text input UI control does.
+ *
+ * @remarks If the key event is from the external device, @a dev_info will have its name, class and subclass information.
+ *
+ * @param[in] keycode The key code to be sent
+ * @param[in] keymask The modifier key mask
+ * @param[in] dev_info The device information handle
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @return @c true if the event is processed, otherwise the event is not processed and is forwarded to the client application.
+ *
+ * @pre The callback can be registered using ime_event_set_process_key_event_cb() function.
+ *
+ * @see ime_event_set_process_key_event_cb, ime_device_info_get_name, ime_device_info_get_class, ime_device_info_get_subclass,
+ * ime_send_key_event, ime_commit_string, ime_show_preedit_string, ime_hide_preedit_string, ime_update_preedit_string
+ */
+typedef bool (*ime_process_key_event_cb)(ime_key_code_e keycode, ime_key_mask_e keymask, ime_device_info_h dev_info, void *user_data);
+
+/**
+ * @brief Called when the system display language is changed.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] language The language code
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @pre The callback can be registered using ime_event_set_display_language_changed_cb() function.
+ *
+ * @see ime_event_set_display_language_changed_cb
+ */
+typedef void (*ime_display_language_changed_cb)(const char *language, void *user_data);
+
+/**
+ * @brief Called when the device is rotated.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] degree The rotation degree
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @pre The callback can be registered using ime_event_set_rotation_degree_changed_cb() function.
+ *
+ * @see ime_event_set_rotation_degree_changed_cb
+ */
+typedef void (*ime_rotation_degree_changed_cb)(int degree, void *user_data);
+
+/**
+ * @brief Called when Accessibility in Settings application is on or off.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] state Accessibility option state
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @pre The callback can be registered using ime_event_set_accessibility_state_changed_cb() function.
+ *
+ * @see ime_event_set_accessibility_state_changed_cb
+ */
+typedef void (*ime_accessibility_state_changed_cb)(bool state, void *user_data);
+
+/**
+ * @brief Called to create the option window.
+ *
+ * @remarks if Input panel requests to open the option window, @a type will be #IME_OPTION_WINDOW_TYPE_KEYBOARD.
+ * And if Settings application requests to open it, @a type will be #IME_OPTION_WINDOW_TYPE_SETTING_APPLICATION.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] window The created window object
+ * @param[in] type The type of option window
+ * @param[in] user_data User data to be passed from the callback registration function
+ *
+ * @pre The callback can be registered using ime_event_set_option_window_created_cb() function. The
+ * ime_create_option_window() calls this callback function or Settings application can call this callback function.
+ *
+ * @see ime_event_set_option_window_created_cb, ime_create_option_window
+ */
+typedef void (*ime_option_window_created_cb)(Evas_Object *window, ime_option_window_type_e type, void *user_data);
+
+/**
+ * @brief Called to destroy the option window.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] window The window object to destroy
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @pre The callback can be registered using ime_event_set_option_window_destroyed_cb() function.
+ * ime_destroy_option_window() calls this callback function.
+ *
+ * @see ime_event_set_option_window_destroyed_cb
+ */
+typedef void (*ime_option_window_destroyed_cb)(Evas_Object *window, void *user_data);
+
+/**
+ * @brief The structure type to contain the set of the essential callback functions for IME application lifecycle and appearance.
+ *
+ * @remarks These four callback functions are mandatory for IME application.
+ *
+ * @since_tizen 2.4
+ *
+ * @see ime_run
+ */
+typedef struct
+{
+ ime_create_cb create; /**< Called when the input panel is created */
+ ime_terminate_cb terminate; /**< Called when the input panel is terminated */
+ ime_show_cb show; /**< Called when the input panel is requested to show itself */
+ ime_hide_cb hide; /**< Called when the input panel is requested to hide itself */
+} ime_callback_s;
+
+/**
+ * @brief Runs the main loop of IME application.
+ *
+ * @details This function starts to run IME application's main loop. The ime_create_cb()
+ * callback function is called to initialize IME application before the main loop starts up. And
+ * the ime_terminate_cb() callback function is called when IME application is terminated.
+ *
+ * @remarks IME application MUST implement ime_app_main() function which is the main
+ * entry point of IME application. In ime_app_main() function, the ime_run()
+ * function MUST be called with the necessary callback functions; ime_create_cb(),
+ * ime_terminate_cb(), ime_show_cb(), and ime_hide_cb() callback functions
+ * are mandatory for IME application.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] basic_cb The structure pointer of the essential callback functions
+ * @param[in] user_data User data to be passed to the callback functions
+ *
+ * @return 0 if IME application ends successfully, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NO_CALLBACK_FUNCTION Necessary callback function is not set
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @pre The ime_event_set_***() functions can be called to set the event handling callback functions.
+ *
+ * @see ime_callback_s, ime_event_set_focus_in_cb, ime_event_set_focus_out_cb,
+ * ime_event_set_surrounding_text_updated_cb, ime_event_set_input_context_reset_cb,
+ * ime_event_set_cursor_position_updated_cb, ime_event_set_language_requested_cb,
+ * ime_event_set_language_set_cb, ime_event_set_imdata_set_cb, ime_event_set_layout_set_cb,
+ * ime_event_set_return_key_type_set_cb, ime_event_set_return_key_state_set_cb,
+ * ime_event_set_geometry_requested_cb, ime_event_set_display_language_changed_cb,
+ * ime_event_set_rotation_degree_changed_cb, ime_event_set_accessibility_state_changed_cb,
+ * ime_event_set_option_window_created_cb, ime_event_set_option_window_destroyed_cb
+ *
+ * @code
+ static void inputmethod_create_cb(void *user_data);
+ static void inputmethod_terminate_cb(void *user_data);
+ static void inputmethod_show_cb(int context_id, ime_context_h context, void *user_data);
+ static void inputmethod_hide_cb(int context_id, void *user_data);
+ static void inputmethod_focus_in_cb(int context_id, void *user_data);
+ static void inputmethod_focus_out_cb(int context_id, void *user_data);
+ static void inputmethod_cursor_position_updated_cb(int cursor_pos, void *user_data);
+
+ static void inputmethod_create_cb(void *user_data)
+ {
+ Evas_Object *ime_win = NULL;
+
+ ime_set_size(480, 400, 800, 400);
+ ime_win = ime_get_main_window();
+ if (ime_win) {
+ // Prepare before showing IME window.
+ }
+ }
+
+ static void inputmethod_show_cb(int context_id, ime_context_h context, void *user_data)
+ {
+ Ecore_IMF_Input_Panel_Layout layout;
+ ime_layout_variation_e layout_variation;
+ Evas_Object *ime_win;
+
+ ime_context_get_layout(context, &layout);
+ ime_context_get_layout_variation(context, &layout_variation);
+
+ ime_win = ime_get_main_window();
+ if (ime_win) {
+ // Compose IME UI properly with the context information and show.
+
+ evas_object_show(ime_win);
+ }
+ }
+
+ static void inputmethod_hide_cb(int context_id, void *user_data)
+ {
+ Evas_Object *ime_win = ime_get_main_window();
+ if (ime_win) {
+ evas_object_hide(ime_win);
+ }
+ }
+
+ void ime_app_main(int argc, char **argv)
+ {
+ ime_callback_s basic_callback = {
+ inputmethod_create_cb,
+ inputmethod_terminate_cb,
+ inputmethod_show_cb,
+ inputmethod_hide_cb,
+ };
+
+ ime_event_set_focus_in_cb(inputmethod_focus_in_cb, NULL);
+ ime_event_set_focus_out_cb(inputmethod_focus_out_cb, NULL);
+ ime_event_set_cursor_position_updated_cb(inputmethod_cursor_position_updated_cb, NULL);
+
+ ime_run(&basic_callback, NULL);
+ }
+ * @endcode
+ */
+EXPORT_API int ime_run(ime_callback_s *basic_cb, void *user_data);
+
+/**
+ * @brief Sets @c focus_in event callback function.
+ *
+ * @remarks The ime_focus_in_cb() callback function is called when an associated text input
+ * UI control has focus.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c focus_in event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_focus_in_cb, ime_run
+ */
+EXPORT_API int ime_event_set_focus_in_cb(ime_focus_in_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets @c focus_out event callback function.
+ *
+ * @remarks The ime_focus_out_cb() callback function is called when an associated text input
+ * UI control loses focus.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c focus_out event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_focus_out_cb, ime_run
+ */
+EXPORT_API int ime_event_set_focus_out_cb(ime_focus_out_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets @c surrounding_text_updated event callback function.
+ *
+ * @remarks The ime_surrounding_text_updated_cb() callback function is called when an
+ * associated text input UI control responds to a request with the surrounding text.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c surrounding_text_updated event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_surrounding_text_updated_cb, ime_run
+ */
+EXPORT_API int ime_event_set_surrounding_text_updated_cb(ime_surrounding_text_updated_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets #c input_context_reset event callback function.
+ *
+ * @remarks The ime_input_context_reset_cb() callback function is called to reset the input
+ * context of an associated text input UI control.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c input_context_reset event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_input_context_reset_cb, ime_run
+ */
+EXPORT_API int ime_event_set_input_context_reset_cb(ime_input_context_reset_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets @c cursor_position_updated event callback function.
+ *
+ * @remarks The ime_cursor_position_updated_cb() callback function is called when the position
+ * of the cursor in an associated text input UI control changes.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c cursor_position_updated event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_cursor_position_updated_cb, ime_run
+ */
+EXPORT_API int ime_event_set_cursor_position_updated_cb(ime_cursor_position_updated_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets @c language_requested event callback function.
+ *
+ * @remarks The ime_language_requested_cb() callback function is called when an associated
+ * text input UI control requests the language from the input panel.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c language_requested event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_language_requested_cb, ime_run
+ */
+EXPORT_API int ime_event_set_language_requested_cb(ime_language_requested_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets @c language_set event callback function.
+ *
+ * @remarks The ime_language_set_cb() callback function is called to set the preferred
+ * language to the input panel.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c language_set event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_language_set_cb, ime_run
+ */
+EXPORT_API int ime_event_set_language_set_cb(ime_language_set_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets @c imdata_set event callback function.
+ *
+ * @remarks The ime_imdata_set_cb() callback function is called to set the application
+ * specific data to deliver to the input panel.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c imdata_set event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_imdata_set_cb, ime_event_set_imdata_requested_cb, ime_run
+ */
+EXPORT_API int ime_event_set_imdata_set_cb(ime_imdata_set_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets @c imdata_requested event callback function.
+ *
+ * @remarks The ime_imdata_requested_cb() callback function is called when an associated
+ * text input UI control requests the application specific data from the input panel.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c imdata_requested event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_imdata_requested_cb, ime_event_set_imdata_set_cb, ime_run
+ */
+EXPORT_API int ime_event_set_imdata_requested_cb(ime_imdata_requested_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets @c layout_set event callback function.
+ *
+ * @remarks The ime_layout_set_cb() callback function is called when an associated text input
+ * UI control requests the input panel to set its layout.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c layout_set event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_layout_set_cb, ime_run
+ */
+EXPORT_API int ime_event_set_layout_set_cb(ime_layout_set_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets @c return_key_type_set event callback function.
+ *
+ * @remarks The ime_return_key_type_set_cb() callback function is called when an associated
+ * text input UI control requests the input panel to set the @c Return key label.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c return_key_type_set event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_return_key_type_set_cb, ime_run
+ */
+EXPORT_API int ime_event_set_return_key_type_set_cb(ime_return_key_type_set_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets @c return_key_state_set event callback function.
+ *
+ * @remarks The ime_return_key_state_set_cb() callback function is called when an associated
+ * text input UI control requests the input panel to enable or disable the @c Return key state.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c return_key_state_set event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_return_key_state_set_cb, ime_run
+ */
+EXPORT_API int ime_event_set_return_key_state_set_cb(ime_return_key_state_set_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets @c geometry_requested event callback function.
+ *
+ * @remarks The ime_geometry_requested_cb() callback function is called when an associated
+ * text input UI control requests the position and size from the input panel.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c geometry_requested event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_geometry_requested_cb, ime_run
+ */
+EXPORT_API int ime_event_set_geometry_requested_cb(ime_geometry_requested_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets @c process_key_event event callback function.
+ *
+ * @remarks The ime_process_key_event_cb() callback function is called when the key event
+ * is received from the external keyboard devices or ime_send_key_event() function.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c process_key_event event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_process_key_event_cb, ime_run
+ *
+ * @code
+ static void inputmethod_create_cb(void *user_data);
+ static void inputmethod_terminate_cb(void *user_data);
+ static void inputmethod_show_cb(int context_id, ime_context_h context, void *user_data);
+ static void inputmethod_hide_cb(int context_id, void *user_data);
+
+ static bool inputmethod_process_key_event_cb(ime_key_code_e keycode, ime_key_mask_e keymask, void *user_data);
+ {
+ if (keymask & IME_KEY_MASK_CONTROL) {
+ return false; // e.g., Cotrol+C key event would be forwarded to UI control of the client application
+ }
+ if (keymask & IME_KEY_MASK_ALT) {
+ return false;
+ }
+
+ if (!(keymask & IME_KEY_MASK_RELEASED)) { // The key is pressed
+ if (keycode == IME_KEY_1) {
+ ime_update_preedit_string("1"); // Show "1" preedit string
+ return true;
+ }
+ else if (keycode == IME_KEY_2) {
+ ime_commit_string("12"); // Input "12" string
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ void ime_app_main(int argc, char **argv)
+ {
+ ime_callback_s basic_callback = {
+ inputmethod_create_cb,
+ inputmethod_terminate_cb,
+ inputmethod_show_cb,
+ inputmethod_hide_cb,
+ };
+
+ ime_event_set_process_key_event_cb(inputmethod_process_key_event_cb, NULL);
+
+ ime_run(&basic_callback, NULL);
+ }
+ * @endcode
+ */
+EXPORT_API int ime_event_set_process_key_event_cb(ime_process_key_event_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets @c display_language_changed event callback function.
+ *
+ * @remarks The ime_display_language_changed_cb() callback function is called when the system
+ * display language is changed.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c display_language_changed event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_display_language_changed_cb, ime_run
+ */
+EXPORT_API int ime_event_set_display_language_changed_cb(ime_display_language_changed_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets #c rotation_degree_changed event callback function.
+ *
+ * @remarks The ime_rotation_degree_changed_cb() callback function is called when the device
+ * is rotated.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c rotation_degree_changed event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_rotation_degree_changed_cb, ime_run
+ */
+EXPORT_API int ime_event_set_rotation_degree_changed_cb(ime_rotation_degree_changed_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets @c accessibility_state_changed event callback function.
+ *
+ * @remarks The ime_accessibility_state_changed_cb() callback function is called when
+ * Accessibility in Settings application is on or off.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c accessibility_state_changed event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_accessibility_state_changed_cb, ime_run
+ */
+EXPORT_API int ime_event_set_accessibility_state_changed_cb(ime_accessibility_state_changed_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets @c option_window_created event callback function.
+ *
+ * @remarks The ime_option_window_created_cb() callback function is called to create the option window.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c option_window_created event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_option_window_created_cb, ime_run
+ */
+EXPORT_API int ime_event_set_option_window_created_cb(ime_option_window_created_cb callback_func, void *user_data);
+
+/**
+ * @brief Sets @c option_window_destroyed event callback function.
+ *
+ * @remarks The ime_option_window_destroyed_cb() callback function is called to destroy the option window.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] callback_func @c option_window_destroyed event callback function
+ * @param[in] user_data User data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post The ime_run() function should be called to start to run IME application's main loop.
+ *
+ * @see ime_option_window_destroyed_cb, ime_run
+ */
+EXPORT_API int ime_event_set_option_window_destroyed_cb(ime_option_window_destroyed_cb callback_func, void *user_data);
+
+/**
+ * @brief Sends a key event to the associated text input UI control.
+ *
+ * @details This function sends key down or up event with key mask to the client application.
+ * If @a forward_key is @c true, this key event goes to the edit filed directly. And if @a forward_key
+ * is @c false, the ime_process_key_event_cb() callback function receives the key event before the edit field.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] keycode The key code to be sent
+ * @param[in] keymask The modifier key mask
+ * @param[in] forward_key The flag to send the key event directly to the edit field
+ *
+ * @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
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @post If @a forward_key is @c false, the ime_process_key_event_cb() callback function can compose the text with the key events.
+ *
+ * @see ime_key_code_e, ime_key_mask_e, ime_process_key_event_cb
+ */
+EXPORT_API int ime_send_key_event(ime_key_code_e keycode, ime_key_mask_e keymask, bool forward_key);
+
+/**
+ * @brief Sends the text to the associated text input UI control.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] str The UTF-8 string to be committed
+ *
+ * @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
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @see ime_show_preedit_string, ime_hide_preedit_string, ime_update_preedit_string
+ */
+EXPORT_API int ime_commit_string(const char *str);
+
+/**
+ * @brief Requests to show preedit string.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @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
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @see ime_commit_string, ime_hide_preedit_string, ime_update_preedit_string
+ */
+EXPORT_API int ime_show_preedit_string(void);
+
+/**
+ * @brief Requests to hide preedit string.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @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
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @see ime_commit_string, ime_show_preedit_string, ime_update_preedit_string
+ */
+EXPORT_API int ime_hide_preedit_string(void);
+
+/**
+ * @brief Updates a new preedit string.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] str The UTF-8 string to be updated in preedit
+ * @paran[in] attrs The Eina_List which has #ime_preedit_attribute lists; @a str can be composed of multiple
+ * string attributes: underline, highlight color and reversal color. The @a attrs will be released internally
+ * on success and it can be NULL if no attributes to set
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @post This function is supposed to be followed by the ime_show_preedit_string() function.
+ *
+ * @see ime_preedit_attribute, ime_commit_string, ime_show_preedit_string, ime_hide_preedit_string
+ *
+ * @code
+ {
+ int ret;
+ Eina_List *list = NULL;
+
+ ime_preedit_attribute *attr = calloc(1, sizeof (ime_preedit_attribute));
+ attr->start = 0;
+ attr->length = 1;
+ attr->type = IME_ATTR_FONTSTYLE;
+ attr->value = IME_ATTR_FONTSTYLE_UNDERLINE;
+ list = eina_list_append(list, attr);
+
+ attr = calloc(1, sizeof (ime_preedit_attribute));
+ attr->start = 1;
+ attr->length = 1;
+ attr->type = IME_ATTR_FONTSTYLE;
+ attr->value = IME_ATTR_FONTSTYLE_HIGHLIGHT;
+ list = eina_list_append(list, attr);
+
+ attr = calloc(1, sizeof (ime_preedit_attribute));
+ attr->start = 2;
+ attr->length = 1;
+ attr->type = IME_ATTR_FONTSTYLE;
+ attr->value = IME_ATTR_FONTSTYLE_REVERSAL;
+ list = eina_list_append(list, attr);
+
+ ret = ime_update_preedit_string("abcd", list);
+ if (ret != IME_ERROR_NONE) {
+ EINA_LIST_FREE(list, attr)
+ free(attr);
+ }
+ }
+ * @endcode
+ */
+EXPORT_API int ime_update_preedit_string(const char *str, Eina_List *attrs);
+
+/**
+ * @brief Requests the surrounding text from the position of the cursor, asynchronously.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] maxlen_before The maximum length of string to be retrieved before the cursor; -1 means unlimited
+ * @param[in] maxlen_after The maximum length of string to be retrieved after the cursor; -1 means unlimited
+ *
+ * @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
+ * @retval #IME_ERROR_NO_CALLBACK_FUNCTION Necessary callback function is not set
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @pre The ime_surrounding_text_updated_cb() callback function MUST be set by ime_event_set_surrounding_text_updated_cb().
+ *
+ * @post The requested surrounding text can be received using the ime_surrounding_text_updated_cb() callback function.
+ *
+ * @see ime_delete_surrounding_text, ime_event_set_surrounding_text_updated_cb, ime_surrounding_text_updated_cb
+ */
+EXPORT_API int ime_request_surrounding_text(int maxlen_before, int maxlen_after);
+
+/**
+ * @brief Requests to delete surrounding text.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] offset The offset value from the cursor position
+ * @param[in] len The length of the text to delete
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @see ime_request_surrounding_text
+ */
+EXPORT_API int ime_delete_surrounding_text(int offset, int len);
+
+/**
+ * @brief This API returns the pointer of input panel main window.
+ *
+ * @remarks The specific error code can be obtained using the get_last_result() method if this function returns NULL.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @return The input panel main window object on success, otherwise NULL
+ *
+ * @exception #IME_ERROR_NONE Successful
+ * #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ * #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @see ime_create_cb, ime_terminate_cb, ime_show_cb, ime_hide_cb
+ */
+EXPORT_API Evas_Object* ime_get_main_window(void);
+
+/**
+ * @brief This API updates the input panel window's size information.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] portrait_width The width in portrait mode
+ * @param[in] portrait_height The height in portrait mode
+ * @param[in] landscape_width The width in landscape mode
+ * @param[in] landscape_height The height in landscape 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
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @see ime_create_cb
+ */
+EXPORT_API int ime_set_size(int portrait_width, int portrait_height, int landscape_width, int landscape_height);
+
+/**
+ * @brief Requests to create an option window from the input panel.
+ *
+ * @details The input panel can call this function to open the option window. This
+ * function calls ime_option_window_created_cb() callback function with
+ * #IME_OPTION_WINDOW_TYPE_KEYBOARD parameter.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @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
+ * @retval #IME_ERROR_NO_CALLBACK_FUNCTION Necessary callback function is not set
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ * @retval #IME_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @pre The ime_option_window_created_cb() and ime_option_window_destroyed_cb()
+ * callback functions MUST be set by ime_event_set_option_window_created_cb() and
+ * ime_event_set_option_window_destroyed_cb() respectively.
+ *
+ * @post This function calls ime_option_window_created_cb() callback function to
+ * create the option window. And ime_destroy_option_window() function can be called
+ * to close the option window.
+ *
+ * @see ime_event_set_option_window_created_cb, ime_option_window_created_cb, ime_destroy_option_window
+ */
+EXPORT_API int ime_create_option_window(void);
+
+/**
+ * @brief Requests to destroy an option window.
+ *
+ * @details The input panel can call this function to close the option window which
+ * is created from either the input panel or Settings application.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] window The option window to destroy
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NO_CALLBACK_FUNCTION Necessary callback function is not set
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @pre The ime_option_window_created_cb() and ime_option_window_destroyed_cb()
+ * callback functions MUST be set by ime_event_set_option_window_created_cb() and
+ * ime_event_set_option_window_destroyed_cb() respectively.
+ *
+ * @post This function calls ime_option_window_destroyed_cb() callback function
+ * to destroy the option window.
+ *
+ * @see ime_event_set_option_window_destroyed_cb, ime_option_window_destroyed_cb, ime_create_option_window
+ */
+EXPORT_API int ime_destroy_option_window(Evas_Object *window);
+
+/**
+ * @brief Gets the layout information from the given input context.
+ *
+ * @details Each edit field has various attributes for input panel. This function can be
+ * called to get the layout information in ime_show_cb() callback function.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] context The input context information of an associated text input UI control
+ * @param[out] layout Layout information
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @post Input panel UI should be drawn or operated by this information accordingly.
+ *
+ * @see ime_show_cb, ime_layout_set_cb
+ */
+EXPORT_API int ime_context_get_layout(ime_context_h context, Ecore_IMF_Input_Panel_Layout *layout);
+
+/**
+ * @brief Gets the layout variation information from the given input context.
+ *
+ * @details Each edit field has various attributes for input panel. This function can be
+ * called to get the layout variation information in ime_show_cb() callback function.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] context The input context information of an associated text input UI control
+ * @param[out] layout_variation Layout variation information
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @post Input panel UI should be drawn or operated by this information accordingly.
+ *
+ * @see ime_show_cb, ime_layout_variation_e
+ */
+EXPORT_API int ime_context_get_layout_variation(ime_context_h context, ime_layout_variation_e *layout_variation);
+
+/**
+ * @brief Gets the cursor position information from the given input context.
+ *
+ * @details Each edit field has various attributes for input panel. This function can be
+ * called to get the cursor position information in ime_show_cb() callback function.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] context The input context information of an associated text input UI control
+ * @param[out] cursor_pos Cursor position information
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @post Input panel UI should be drawn or operated by this information accordingly.
+ *
+ * @see ime_show_cb, ime_cursor_position_updated_cb
+ */
+EXPORT_API int ime_context_get_cursor_position(ime_context_h context, int *cursor_pos);
+
+/**
+ * @brief Gets the autocapital type information from the given input context.
+ *
+ * @details Each edit field has various attributes for input panel. This function can be
+ * called to get the autocapital type information in ime_show_cb() callback function.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] context The input context information of an associated text input UI control
+ * @param[out] autocapital_type Autocapital type information
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @post Input panel UI should be drawn or operated by this information accordingly.
+ *
+ * @see ime_show_cb
+ */
+EXPORT_API int ime_context_get_autocapital_type(ime_context_h context, Ecore_IMF_Autocapital_Type *autocapital_type);
+
+/**
+ * @brief Gets the @c Return key label type information from the given input context.
+ *
+ * @details Each edit field has various attributes for input panel. This function can be
+ * called to get the @c Return key label type information in ime_show_cb() callback function.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] context The input context information of an associated text input UI control
+ * @param[out] return_key_type The @c Return key label type information
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @post Input panel UI should be drawn or operated by this information accordingly.
+ *
+ * @see ime_show_cb, ime_return_key_type_set_cb
+ */
+EXPORT_API int ime_context_get_return_key_type(ime_context_h context, Ecore_IMF_Input_Panel_Return_Key_Type *return_key_type);
+
+/**
+ * @brief Gets the @c Return key state information from the given input context.
+ *
+ * @details Each edit field has various attributes for input panel. This function can be
+ * called to get the @c Return key state information in ime_show_cb() callback function.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] context The input context information of an associated text input UI control
+ * @param[out] return_key_state The @c Return key state information \n @c true to enable @c Return key
+ * button, @c false to disable @c Return key button
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @post Input panel UI should be drawn or operated by this information accordingly.
+ *
+ * @see ime_show_cb, ime_return_key_state_set_cb
+ */
+EXPORT_API int ime_context_get_return_key_state(ime_context_h context, bool *return_key_state);
+
+/**
+ * @brief Gets the prediction mode information from the given input context.
+ *
+ * @details Each edit field has various attributes for input panel. This function can be
+ * called to get the prediction mode information in ime_show_cb() callback function.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] context The input context information of an associated text input UI control
+ * @param[out] prediction_mode Prediction mode information \n @c true to allow the predictive
+ * text feature if available, @c false to disable the predictive text feature
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @post Input panel UI should be drawn or operated by this information accordingly.
+ *
+ * @see ime_show_cb
+ */
+EXPORT_API int ime_context_get_prediction_mode(ime_context_h context, bool *prediction_mode);
+
+/**
+ * @brief Gets the password mode information from the given input context.
+ *
+ * @details Each edit field has various attributes for input panel. This function can be
+ * called to get the password mode information in ime_show_cb() callback function.
+ *
+ * @remarks If @a password_mode is @c true, the input panel is advised not to support the predictive text.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] context The input context information of an associated text input UI control
+ * @param[out] password_mode Password mode information \n @c true to indicate that a password being inputted,
+ * @c false to indicate non-password edit field.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @post Input panel UI should be drawn or operated by this information accordingly.
+ *
+ * @see ime_show_cb
+ */
+EXPORT_API int ime_context_get_password_mode(ime_context_h context, bool *password_mode);
+
+/**
+ * @brief Gets the input hint information from the given input context.
+ *
+ * @details Each edit field has various attributes for input panel. This function can be
+ * called to get the input hint information in ime_show_cb() callback function.
+ *
+ * @remarks @a input_hint is a bit-wise value which recommends the input panel provide
+ * an auto completion and so on if it is capable of supporting such features.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] context The input context information of an associated text input UI control
+ * @param[out] input_hint Input hint information
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @post Input panel UI should be drawn or operated by this information accordingly.
+ *
+ * @see ime_show_cb
+ */
+EXPORT_API int ime_context_get_input_hint(ime_context_h context, Ecore_IMF_Input_Hints *input_hint);
+
+/**
+ * @brief Gets the text bidirectional information from the given input context.
+ *
+ * @details Each edit field has various attributes for input panel. This function can be
+ * called to get the bidirectional information in ime_show_cb() callback function.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] context The input context information of an associated text input UI control
+ * @param[out] bidi Text bidirectional information
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @post Input panel UI should be drawn or operated by this information accordingly.
+ *
+ * @see ime_show_cb
+ */
+EXPORT_API int ime_context_get_bidi_direction(ime_context_h context, Ecore_IMF_BiDi_Direction *bidi);
+
+/**
+ * @brief Gets the preferred language information from the given input context.
+ *
+ * @details Each edit field has various attributes for input panel. This function can be
+ * called to get the preferred language information in ime_show_cb() callback function.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] context The input context information of an associated text input UI control
+ * @param[out] language Preferred language information
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @post Input panel UI should be drawn or operated by this information accordingly.
+ *
+ * @see ime_show_cb
+ */
+EXPORT_API int ime_context_get_language(ime_context_h context, Ecore_IMF_Input_Panel_Lang *language);
+
+/**
+ * @brief Gets the device name of the key event.
+ *
+ * @remarks @a dev_name must be released using free().
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] dev_info The device information from the key event
+ * @param[out] dev_name The name of key input device. This can be an empty string if the device name is not available
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @see ime_process_key_event_cb, ime_device_info_get_class, ime_device_info_get_subclass
+ */
+EXPORT_API int ime_device_info_get_name(ime_device_info_h dev_info, char **dev_name);
+
+/**
+ * @brief Gets the device class of the key event.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] dev_info The device information from the key event
+ * @param[out] dev_class The class of key input device. This can be #ECORE_IMF_DEVICE_CLASS_NONE if the device class is not available
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @see ime_process_key_event_cb, ime_device_info_get_name, ime_device_info_get_subclass
+ */
+EXPORT_API int ime_device_info_get_class(ime_device_info_h dev_info, Ecore_IMF_Device_Class *dev_class);
+/**
+ * @brief Gets the device subclass of the key event.
+ *
+ * @since_tizen 2.4
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] dev_info The device information from the key event
+ * @param[out] dev_subclass The subclass of key input device. This can be #ECORE_IMF_DEVICE_SUBCLASS_NONE if the device subclass is not available
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @see ime_process_key_event_cb, ime_device_info_get_name, ime_device_info_get_class
+ */
+EXPORT_API int ime_device_info_get_subclass(ime_device_info_h dev_info, Ecore_IMF_Device_Subclass *dev_subclass);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __TIZEN_UIX_INPUTMETHOD_H__
+
diff --git a/include/inputmethod_keydef.h b/include/inputmethod_keydef.h
new file mode 100644
index 0000000..cd32bb1
--- /dev/null
+++ b/include/inputmethod_keydef.h
@@ -0,0 +1,301 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TIZEN_UIX_INPUTMETHOD_KEYDEF_H__
+#define __TIZEN_UIX_INPUTMETHOD_KEYDEF_H__
+
+/**
+ * @file inputmethod_keydef.h
+ * @brief This file contains key code and mask enumeration.
+ */
+
+/**
+ * @addtogroup CAPI_UIX_INPUTMETHOD_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration of the key codes.
+ *
+ * If keycode & 0xff000000 == 0x01000000 then this key code is directly encoded 24-bit UCS character.
+ * The UCS value is keycode & 0x00ffffff.
+ *
+ * @details Defines the list of keys supported by the system.
+ * Note that certain keys may not be available on all devices.
+ *
+ * @since_tizen 2.4
+ */
+typedef enum
+{
+ IME_KEY_BackSpace = 0xFF08, /**< The backspace key */
+ IME_KEY_Tab = 0xFF09, /**< The tab key */
+ IME_KEY_Linefeed = 0xFF0A, /**< The linefeed key */
+ IME_KEY_Clear = 0xFF0B, /**< The clear key */
+ IME_KEY_Return = 0xFF0D, /**< The return key */
+ IME_KEY_Pause = 0xFF13, /**< The pause key */
+ IME_KEY_Scroll_Lock = 0xFF14, /**< The scroll lock key */
+ IME_KEY_Sys_Req = 0xFF15, /**< The sys req key */
+ IME_KEY_Escape = 0xFF1B, /**< The escape key */
+ IME_KEY_Delete = 0xFFFF, /**< The delete key */
+
+ /* Cursor control & motion */
+ IME_KEY_Home = 0xFF50, /**< The home key */
+ IME_KEY_Left = 0xFF51, /**< The left directional key */
+ IME_KEY_Up = 0xFF52, /**< The up directional key */
+ IME_KEY_Right = 0xFF53, /**< The right directional key */
+ IME_KEY_Down = 0xFF54, /**< The down directional key */
+ IME_KEY_Prior = 0xFF55, /**< The prior, previous key */
+ IME_KEY_Page_Up = 0xFF55, /**< The page up key */
+ IME_KEY_Next = 0xFF56, /**< The next key */
+ IME_KEY_Page_Down = 0xFF56, /**< The page down key */
+ IME_KEY_End = 0xFF57, /**< The end key */
+ IME_KEY_Begin = 0xFF58, /**< The begin key */
+
+ /* Misc Functions */
+ IME_KEY_Select = 0xFF60, /**< The select key */
+ IME_KEY_Print = 0xFF61, /**< The print key */
+ IME_KEY_Execute = 0xFF62, /**< The execute, run, do key */
+ IME_KEY_Insert = 0xFF63, /**< The insert key */
+ IME_KEY_Undo = 0xFF65, /**< The undo key */
+ IME_KEY_Redo = 0xFF66, /**< The redo key */
+ IME_KEY_Menu = 0xFF67, /**< The menu key */
+ IME_KEY_Find = 0xFF68, /**< The find key */
+ IME_KEY_Cancel = 0xFF69, /**< The cancel, stop, abort, exit key */
+ IME_KEY_Help = 0xFF6A, /**< The help key */
+ IME_KEY_Break = 0xFF6B, /**< The break key */
+ IME_KEY_Mode_switch = 0xFF7E, /**< The character set switch key */
+ IME_KEY_Num_Lock = 0xFF7F, /**< The num lock key */
+
+ /* Keypad */
+ IME_KEY_KP_Space = 0xFF80, /**< The Numpad space key */
+ IME_KEY_KP_Tab = 0xFF89, /**< The Numpad tab key */
+ IME_KEY_KP_Enter = 0xFF8D, /**< The Numpad enter key */
+ IME_KEY_KP_F1 = 0xFF91, /**< The Numpad function 1 key */
+ IME_KEY_KP_F2 = 0xFF92, /**< The Numpad function 2 key */
+ IME_KEY_KP_F3 = 0xFF93, /**< The Numpad function 3 key */
+ IME_KEY_KP_F4 = 0xFF94, /**< The Numpad function 4 key */
+ IME_KEY_KP_Home = 0xFF95, /**< The Numpad home key */
+ IME_KEY_KP_Left = 0xFF96, /**< The Numpad left key */
+ IME_KEY_KP_Up = 0xFF97, /**< The Numpad up key */
+ IME_KEY_KP_Right = 0xFF98, /**< The Numpad right key */
+ IME_KEY_KP_Down = 0xFF99, /**< The Numpad down key */
+ IME_KEY_KP_Prior = 0xFF9A, /**< The Numpad prior, previous key */
+ IME_KEY_KP_Page_Up = 0xFF9A, /**< The Numpad page up key */
+ IME_KEY_KP_Next = 0xFF9B, /**< The Numpad next key */
+ IME_KEY_KP_Page_Down = 0xFF9B, /**< The Numpad page down key */
+ IME_KEY_KP_End = 0xFF9C, /**< The Numpad end key */
+ IME_KEY_KP_Begin = 0xFF9D, /**< The Numpad begin key */
+ IME_KEY_KP_Insert = 0xFF9E, /**< The Numpad insert key */
+ IME_KEY_KP_Delete = 0xFF9F, /**< The Numpad delete key */
+ IME_KEY_KP_Equal = 0xFFBD, /**< The Numpad equal key */
+ IME_KEY_KP_Multiply = 0xFFAA, /**< The Numpad multiply key */
+ IME_KEY_KP_Add = 0xFFAB, /**< The Numpad add key */
+ IME_KEY_KP_Separator = 0xFFAC, /**< The Numpad separator key */
+ IME_KEY_KP_Subtract = 0xFFAD, /**< The Numpad subtract key */
+ IME_KEY_KP_Decimal = 0xFFAE, /**< The Numpad decimal key */
+ IME_KEY_KP_Divide = 0xFFAF, /**< The Numpad divide key */
+
+ IME_KEY_KP_0 = 0xFFB0, /**< The Numpad 0 key */
+ IME_KEY_KP_1 = 0xFFB1, /**< The Numpad 1 key */
+ IME_KEY_KP_2 = 0xFFB2, /**< The Numpad 2 key */
+ IME_KEY_KP_3 = 0xFFB3, /**< The Numpad 3 key */
+ IME_KEY_KP_4 = 0xFFB4, /**< The Numpad 4 key */
+ IME_KEY_KP_5 = 0xFFB5, /**< The Numpad 5 key */
+ IME_KEY_KP_6 = 0xFFB6, /**< The Numpad 6 key */
+ IME_KEY_KP_7 = 0xFFB7, /**< The Numpad 7 key */
+ IME_KEY_KP_8 = 0xFFB8, /**< The Numpad 8 key */
+ IME_KEY_KP_9 = 0xFFB9, /**< The Numpad 9 key */
+
+ /* Auxilliary Functions */
+ IME_KEY_F1 = 0xFFBE, /**< The function 1 key */
+ IME_KEY_F2 = 0xFFBF, /**< The function 2 key */
+ IME_KEY_F3 = 0xFFC0, /**< The function 3 key */
+ IME_KEY_F4 = 0xFFC1, /**< The function 4 key */
+ IME_KEY_F5 = 0xFFC2, /**< The function 5 key */
+ IME_KEY_F6 = 0xFFC3, /**< The function 6 key */
+ IME_KEY_F7 = 0xFFC4, /**< The function 7 key */
+ IME_KEY_F8 = 0xFFC5, /**< The function 8 key */
+ IME_KEY_F9 = 0xFFC6, /**< The function 9 key */
+ IME_KEY_F10 = 0xFFC7, /**< The function 10 key */
+ IME_KEY_F11 = 0xFFC8, /**< The function 11 key */
+ IME_KEY_F12 = 0xFFC9, /**< The function 12 key */
+ IME_KEY_F13 = 0xFFCA, /**< The function 13 key */
+ IME_KEY_F14 = 0xFFCB, /**< The function 14 key */
+ IME_KEY_F15 = 0xFFCC, /**< The function 15 key */
+ IME_KEY_F16 = 0xFFCD, /**< The function 16 key */
+ IME_KEY_F17 = 0xFFCE, /**< The function 17 key */
+ IME_KEY_F18 = 0xFFCF, /**< The function 18 key */
+ IME_KEY_F19 = 0xFFD0, /**< The function 19 key */
+ IME_KEY_F20 = 0xFFD1, /**< The function 20 key */
+ IME_KEY_F21 = 0xFFD2, /**< The function 21 key */
+ IME_KEY_F22 = 0xFFD3, /**< The function 22 key */
+ IME_KEY_F23 = 0xFFD4, /**< The function 23 key */
+ IME_KEY_F24 = 0xFFD5, /**< The function 24 key */
+ IME_KEY_F25 = 0xFFD6, /**< The function 25 key */
+ IME_KEY_F26 = 0xFFD7, /**< The function 26 key */
+ IME_KEY_F27 = 0xFFD8, /**< The function 27 key */
+ IME_KEY_F28 = 0xFFD9, /**< The function 28 key */
+ IME_KEY_F29 = 0xFFDA, /**< The function 29 key */
+ IME_KEY_F30 = 0xFFDB, /**< The function 30 key */
+ IME_KEY_F31 = 0xFFDC, /**< The function 31 key */
+ IME_KEY_F32 = 0xFFDD, /**< The function 32 key */
+ IME_KEY_F33 = 0xFFDE, /**< The function 33 key */
+ IME_KEY_F34 = 0xFFDF, /**< The function 34 key */
+ IME_KEY_F35 = 0xFFE0, /**< The function 35 key */
+
+ /* Modifier keys */
+ IME_KEY_Shift_L = 0xFFE1, /**< The left shift key */
+ IME_KEY_Shift_R = 0xFFE2, /**< The right shift key */
+ IME_KEY_Control_L = 0xFFE3, /**< The left control key */
+ IME_KEY_Control_R = 0xFFE4, /**< The right control key */
+ IME_KEY_Caps_Lock = 0xFFE5, /**< The caps lock key */
+ IME_KEY_Shift_Lock = 0xFFE6, /**< The shift lock key */
+
+ IME_KEY_Meta_L = 0xFFE7, /**< The left meta key */
+ IME_KEY_Meta_R = 0xFFE8, /**< The right meta key */
+ IME_KEY_Alt_L = 0xFFE9, /**< The left alt key */
+ IME_KEY_Alt_R = 0xFFEA, /**< The right alt key */
+ IME_KEY_Super_L = 0xFFEB, /**< The left super key */
+ IME_KEY_Super_R = 0xFFEC, /**< The right super key */
+ IME_KEY_Hyper_L = 0xFFED, /**< The left hyper key */
+ IME_KEY_Hyper_R = 0xFFEE, /**< The right hyper key */
+
+ /* Latin 1 */
+ IME_KEY_space = 0x020, /**< The space key */
+ IME_KEY_exclam = 0x021, /**< The exclamation key */
+ IME_KEY_quotedbl = 0x022, /**< The quotedbl key */
+ IME_KEY_numbersign = 0x023, /**< The number sign key */
+ IME_KEY_dollar = 0x024, /**< The dollar key */
+ IME_KEY_percent = 0x025, /**< The percent key */
+ IME_KEY_ampersand = 0x026, /**< The ampersand key */
+ IME_KEY_apostrophe = 0x027, /**< The apostrophe key */
+ IME_KEY_parenleft = 0x028, /**< The parenleft key */
+ IME_KEY_parenright = 0x029, /**< The parenright key */
+ IME_KEY_asterisk = 0x02a, /**< The asterisk key */
+ IME_KEY_plus = 0x02b, /**< The plus key */
+ IME_KEY_comma = 0x02c, /**< The comma key */
+ IME_KEY_minus = 0x02d, /**< The minus key */
+ IME_KEY_period = 0x02e, /**< The period key */
+ IME_KEY_slash = 0x02f, /**< The slash key */
+ IME_KEY_0 = 0x030, /**< The 0 key */
+ IME_KEY_1 = 0x031, /**< The 1 key */
+ IME_KEY_2 = 0x032, /**< The 2 key */
+ IME_KEY_3 = 0x033, /**< The 3 key */
+ IME_KEY_4 = 0x034, /**< The 4 key */
+ IME_KEY_5 = 0x035, /**< The 5 key */
+ IME_KEY_6 = 0x036, /**< The 6 key */
+ IME_KEY_7 = 0x037, /**< The 7 key */
+ IME_KEY_8 = 0x038, /**< The 8 key */
+ IME_KEY_9 = 0x039, /**< The 9 key */
+ IME_KEY_colon = 0x03a, /**< The colon key */
+ IME_KEY_semicolon = 0x03b, /**< The semicolon key */
+ IME_KEY_less = 0x03c, /**< The less key */
+ IME_KEY_equal = 0x03d, /**< The equal key */
+ IME_KEY_greater = 0x03e, /**< The greater key */
+ IME_KEY_question = 0x03f, /**< The question key */
+ IME_KEY_at = 0x040, /**< The at key */
+ IME_KEY_A = 0x041, /**< The A key */
+ IME_KEY_B = 0x042, /**< The B key */
+ IME_KEY_C = 0x043, /**< The C key */
+ IME_KEY_D = 0x044, /**< The D key */
+ IME_KEY_E = 0x045, /**< The E key */
+ IME_KEY_F = 0x046, /**< The F key */
+ IME_KEY_G = 0x047, /**< The G key */
+ IME_KEY_H = 0x048, /**< The H key */
+ IME_KEY_I = 0x049, /**< The I key */
+ IME_KEY_J = 0x04a, /**< The J key */
+ IME_KEY_K = 0x04b, /**< The K key */
+ IME_KEY_L = 0x04c, /**< The L key */
+ IME_KEY_M = 0x04d, /**< The M key */
+ IME_KEY_N = 0x04e, /**< The N key */
+ IME_KEY_O = 0x04f, /**< The O key */
+ IME_KEY_P = 0x050, /**< The P key */
+ IME_KEY_Q = 0x051, /**< The Q key */
+ IME_KEY_R = 0x052, /**< The R key */
+ IME_KEY_S = 0x053, /**< The S key */
+ IME_KEY_T = 0x054, /**< The T key */
+ IME_KEY_U = 0x055, /**< The U key */
+ IME_KEY_V = 0x056, /**< The V key */
+ IME_KEY_W = 0x057, /**< The W key */
+ IME_KEY_X = 0x058, /**< The X key */
+ IME_KEY_Y = 0x059, /**< The Y key */
+ IME_KEY_Z = 0x05a, /**< The Z key */
+ IME_KEY_bracketleft = 0x05b, /**< The left bracket key */
+ IME_KEY_backslash = 0x05c, /**< The backslash key */
+ IME_KEY_bracketright = 0x05d, /**< The right bracket key */
+ IME_KEY_asciicircum = 0x05e, /**< The circumflex key */
+ IME_KEY_underscore = 0x05f, /**< The underscore key */
+ IME_KEY_grave = 0x060, /**< The grave key */
+ IME_KEY_a = 0x061, /**< The a key */
+ IME_KEY_b = 0x062, /**< The b key */
+ IME_KEY_c = 0x063, /**< The c key */
+ IME_KEY_d = 0x064, /**< The d key */
+ IME_KEY_e = 0x065, /**< The e key */
+ IME_KEY_f = 0x066, /**< The f key */
+ IME_KEY_g = 0x067, /**< The g key */
+ IME_KEY_h = 0x068, /**< The h key */
+ IME_KEY_i = 0x069, /**< The i key */
+ IME_KEY_j = 0x06a, /**< The j key */
+ IME_KEY_k = 0x06b, /**< The k key */
+ IME_KEY_l = 0x06c, /**< The l key */
+ IME_KEY_m = 0x06d, /**< The m key */
+ IME_KEY_n = 0x06e, /**< The n key */
+ IME_KEY_o = 0x06f, /**< The o key */
+ IME_KEY_p = 0x070, /**< The p key */
+ IME_KEY_q = 0x071, /**< The q key */
+ IME_KEY_r = 0x072, /**< The r key */
+ IME_KEY_s = 0x073, /**< The s key */
+ IME_KEY_t = 0x074, /**< The t key */
+ IME_KEY_u = 0x075, /**< The u key */
+ IME_KEY_v = 0x076, /**< The v key */
+ IME_KEY_w = 0x077, /**< The w key */
+ IME_KEY_x = 0x078, /**< The x key */
+ IME_KEY_y = 0x079, /**< The y key */
+ IME_KEY_z = 0x07a, /**< The z key */
+ IME_KEY_braceleft = 0x07b, /**< The left brace key */
+ IME_KEY_bar = 0x07c, /**< The bar key */
+ IME_KEY_braceright = 0x07d, /**< The right brace key */
+ IME_KEY_asciitilde = 0x07e, /**< The tilde key */
+} ime_key_code_e;
+
+/**
+ * @brief Enumeration of the key masks.
+ *
+ * The key masks indicate which modifier keys is pressed down during the keyboard hit.
+ * The special IME_KEY_MASK_RELEASED indicates the key release event.
+ *
+ * @since_tizen 2.4
+ */
+typedef enum
+{
+ IME_KEY_MASK_PRESSED = 0, /**< Key press event without modifier key */
+ IME_KEY_MASK_SHIFT = (1<<0), /**< The Shift key is pressed down */
+ IME_KEY_MASK_CAPSLOCK = (1<<1), /**< The CapsLock key is pressed down */
+ IME_KEY_MASK_CONTROL = (1<<2), /**< The Control key is pressed down */
+ IME_KEY_MASK_ALT = (1<<3), /**< The Alt key is pressed down */
+ IME_KEY_MASK_META = (1<<4), /**< The Meta key is pressed down */
+ IME_KEY_MASK_WIN = (1<<5), /**< The Win (between Control and Alt) is pressed down */
+ IME_KEY_MASK_HYPER = (1<<6), /**< The Hyper key is pressed down */
+ IME_KEY_MASK_NUMLOCK = (1<<7), /**< The NumLock key is pressed down */
+ IME_KEY_MASK_RELEASED = (1<<15) /**< Key release event */
+} ime_key_mask_e;
+
+/**
+ * @}
+ */
+
+#endif // __TIZEN_UIX_INPUTMETHOD_KEYDEF_H__
+
diff --git a/include/inputmethod_private.h b/include/inputmethod_private.h
new file mode 100644
index 0000000..570cba6
--- /dev/null
+++ b/include/inputmethod_private.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TIZEN_UIX_INPUTMETHOD_PRIVATE_H__
+#define __TIZEN_UIX_INPUTMETHOD_PRIVATE_H__
+
+struct _ime_context
+{
+ Ecore_IMF_Input_Panel_Layout layout; /**< Input panel (keyboard) layout types */
+ int layout_variation; /**< Layout variation */
+ int cursor_pos; /**< Cursor position in edit field */
+ Ecore_IMF_Autocapital_Type autocapital_type; /**< Auto capital mode */
+ Ecore_IMF_Input_Panel_Return_Key_Type return_key_type; /**< "Return" key types */
+ Eina_Bool return_key_disabled; /**< The state of "Return" key */
+ Eina_Bool prediction_allow; /**< Boolean to allow predictive text */
+ Eina_Bool password_mode; /**< Password input mode of edit field */
+ int imdata_size; /**< The size of application specific data to input panel */
+ Ecore_IMF_Input_Hints input_hint; /**< Edit field hint */
+ Ecore_IMF_BiDi_Direction bidi_direction;/**< Bidirectional mode */
+ Ecore_IMF_Input_Panel_Lang language; /**< Preferred input language */
+ unsigned int client_window; /**< Client application window object */
+};
+
+struct _ime_device_info
+{
+ const char *dev_name; /**< The device name */
+ Ecore_IMF_Device_Class dev_class; /**< The device class */
+ Ecore_IMF_Device_Subclass dev_subclass; /**< The device subclass */
+};
+
+#endif // __TIZEN_UIX_INPUTMETHOD_PRIVATE_H__
+
diff --git a/packaging/capi-ui-inputmethod.spec b/packaging/capi-ui-inputmethod.spec
new file mode 100644
index 0000000..5c7e2be
--- /dev/null
+++ b/packaging/capi-ui-inputmethod.spec
@@ -0,0 +1,70 @@
+Name: capi-ui-inputmethod
+Summary: Input Method Library
+Version: 0.0.4
+Release: 1
+Group: Graphics & UI Framework/Input
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: cmake
+BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(ecore-imf)
+BuildRequires: pkgconfig(libscl-core)
+BuildRequires: pkgconfig(isf)
+BuildRequires: pkgconfig(libsmack)
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description
+Input Method Library
+
+
+%package devel
+Summary: Input Method Library (Development)
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+Input Method Library (Development)
+
+
+
+%prep
+%setup -q
+
+
+%build
+export CFLAGS+=" -DTIZEN_DEBUG_ENABLE -fPIC -fvisibility=hidden"
+export CXXFLAGS+=" -DTIZEN_DEBUG_ENABLE -fPIC -fvisibility=hidden"
+export FFLAGS+=" -DTIZEN_DEBUG_ENABLE -fPIC -fvisibility=hidden"
+
+rm -rf CMakeFiles
+rm -rf CMakeCache.txt
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DLIB_INSTALL_DIR:PATH=%{_libdir}
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/%{name}
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%manifest capi-ui-inputmethod.manifest
+%{_libdir}/libcapi-ui-inputmethod.so*
+/usr/share/license/capi-ui-inputmethod
+
+%files devel
+%{_includedir}/inputmethod*.h
+%{_libdir}/pkgconfig/*.pc
+%{_libdir}/libcapi-ui-inputmethod.so
+
+
diff --git a/src/inputmethod.cpp b/src/inputmethod.cpp
new file mode 100644
index 0000000..14963c2
--- /dev/null
+++ b/src/inputmethod.cpp
@@ -0,0 +1,1363 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlog.h>
+#include <sclcore.h>
+#include <sys/smack.h>
+#include "inputmethod_private.h"
+#include <inputmethod.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "INPUTMETHOD"
+
+using namespace scl;
+
+class CCoreEventCallback : public ISCLCoreEventCallback
+{
+ void on_init();
+ void on_run(int argc, char **argv);
+ void on_exit();
+ void on_update_cursor_position(sclint ic, const sclchar *ic_uuid, sclint cursor_pos);
+ void on_update_surrounding_text(sclint ic, const sclchar *text, sclint cursor);
+ void on_focus_out(sclint ic, const sclchar *ic_uuid);
+ void on_focus_in(sclint ic, const sclchar *ic_uuid);
+ void on_ise_show(sclint ic, const int degree, Ise_Context &context);
+ void on_ise_hide(sclint ic, const sclchar *ic_uuid);
+ void on_get_geometry(sclu32 *pos_x, sclu32 *pos_y, sclu32 *width, sclu32 *height);
+ void on_set_language(Ecore_IMF_Input_Panel_Lang language);
+ void on_set_imdata(sclchar *buf, sclu32 len);
+ void on_get_imdata(sclchar **buf, sclu32 *len);
+ void on_get_language_locale(sclint ic, sclchar **locale);
+ void on_set_return_key_type(Ecore_IMF_Input_Panel_Return_Key_Type type);
+ void on_set_return_key_disable(bool disabled);
+ void on_set_layout(Ecore_IMF_Input_Panel_Layout layout);
+ void on_reset_input_context(sclint ic, const sclchar *uuid);
+ void on_process_key_event(scim::KeyEvent &key, sclu32 *ret);
+ void on_set_display_language(const sclchar *language);
+ void on_set_rotation_degree(sclint degree);
+ void on_set_accessibility_state(sclboolean state);
+ void on_create_option_window(sclwindow window, SCLOptionWindowType type);
+ void on_destroy_option_window(sclwindow window);
+ void on_check_option_window_availability(sclboolean *ret);
+};
+
+typedef struct
+{
+ ime_focus_in_cb focus_in; /**< Called when an edit field has focus */
+ ime_focus_out_cb focus_out; /**< Called when an edit field loses focus */
+ ime_surrounding_text_updated_cb surrounding_text_updated; /**< Called when an edit field responds to a request with the surrounding text */
+ ime_input_context_reset_cb input_context_reset; /**< Called to reset the input context of an edit field */
+ ime_cursor_position_updated_cb cursor_position_updated; /**< Called when the position of the cursor in an edit field changes */
+ ime_language_requested_cb language_requested; /**< Called when an edit field requests the language from the input panel */
+ ime_language_set_cb language_set; /**< Called to set the preferred language to the input panel */
+ ime_imdata_set_cb imdata_set; /**< Called to set the application specific data to deliver to the input panel */
+ ime_imdata_requested_cb imdata_requested; /**< Called when an associated text input UI control requests the application specific data from the input panel */
+ ime_layout_set_cb layout_set; /**< Called when an edit field requests the input panel to set its layout */
+ ime_return_key_type_set_cb return_key_type_set; /**< Called when an edit field requests the input panel to set the "return" key label */
+ ime_return_key_state_set_cb return_key_state_set; /**< Called when an edit field requests the input panel to enable or disable the "return" key state */
+ ime_geometry_requested_cb geometry_requested; /**< Called when an edit field requests the position and size from the input panel */
+ ime_process_key_event_cb process_key_event; /**< Called when the key event is received from the external keyboard devices */
+ ime_display_language_changed_cb display_language_changed; /**< Called when the system display language is changed */
+ ime_rotation_degree_changed_cb rotation_degree_changed; /**< Called when the device is rotated */
+ ime_accessibility_state_changed_cb accessibility_state_changed; /**< Called when Accessibility in Settings application is on or off */
+ ime_option_window_created_cb option_window_created; /**< Called to create the option window */
+ ime_option_window_destroyed_cb option_window_destroyed; /**< Called to destroy the option window */
+ void *focus_in_user_data;
+ void *focus_out_user_data;
+ void *surrounding_text_updated_user_data;
+ void *input_context_reset_user_data;
+ void *cursor_position_updated_user_data;
+ void *language_requested_user_data;
+ void *language_set_user_data;
+ void *imdata_set_user_data;
+ void *imdata_requested_user_data;
+ void *layout_set_user_data;
+ void *return_key_type_set_user_data;
+ void *return_key_state_set_user_data;
+ void *geometry_requested_user_data;
+ void *process_key_event_user_data;
+ void *display_language_changed_user_data;
+ void *rotation_degree_changed_user_data;
+ void *accessibility_state_changed_user_data;
+ void *option_window_created_user_data;
+ void *option_window_destroyed_user_data;
+} ime_event_callback_s;
+
+static ime_callback_s g_basic_callback = {NULL};
+static ime_event_callback_s g_event_callback = {NULL};
+static void *g_user_data = NULL;
+static bool g_running = false;
+
+static CCoreEventCallback g_core_event_callback;
+CSCLCore g_core(&g_core_event_callback);
+
+extern "C" {
+ extern void ime_app_main(int argc, char **argv);
+}
+
+void CCoreEventCallback::on_init()
+{
+ if (g_basic_callback.create) {
+ g_basic_callback.create(g_user_data);
+ }
+}
+
+void CCoreEventCallback::on_run(int argc, char **argv)
+{
+ LOGD ("on_run");
+ ime_app_main(argc, argv);
+}
+
+void CCoreEventCallback::on_exit()
+{
+ LOGD ("on_exit");
+ if (g_basic_callback.terminate) {
+ g_basic_callback.terminate(g_user_data);
+ }
+}
+
+void CCoreEventCallback::on_update_cursor_position(sclint ic, const sclchar *ic_uuid, sclint cursor_pos)
+{
+ if (g_event_callback.cursor_position_updated) {
+ g_event_callback.cursor_position_updated(cursor_pos, g_event_callback.cursor_position_updated_user_data);
+ }
+}
+
+void CCoreEventCallback::on_update_surrounding_text(sclint ic, const sclchar *text, sclint cursor)
+{
+ if (g_event_callback.surrounding_text_updated) {
+ g_event_callback.surrounding_text_updated(ic, text, cursor, g_event_callback.surrounding_text_updated_user_data);
+ }
+}
+
+void CCoreEventCallback::on_focus_out(sclint ic, const sclchar *ic_uuid)
+{
+ if (g_event_callback.focus_out) {
+ g_event_callback.focus_out(ic, g_event_callback.focus_out_user_data);
+ }
+}
+
+void CCoreEventCallback::on_focus_in(sclint ic, const sclchar *ic_uuid)
+{
+ if (g_event_callback.focus_in) {
+ g_event_callback.focus_in(ic, g_event_callback.focus_in_user_data);
+ }
+}
+
+void CCoreEventCallback::on_ise_show(sclint ic, const int degree, Ise_Context &context)
+{
+ if (g_basic_callback.show) {
+ struct _ime_context input_context;
+
+ memset(&input_context, 0, sizeof(struct _ime_context));
+ input_context.layout = context.layout;
+ input_context.layout_variation = context.layout_variation;
+ input_context.cursor_pos = context.cursor_pos;
+ input_context.autocapital_type = context.autocapital_type;
+ input_context.return_key_type = context.return_key_type;
+ input_context.return_key_disabled = context.return_key_disabled;
+ input_context.prediction_allow = context.prediction_allow;
+ input_context.password_mode = context.password_mode;
+ input_context.imdata_size = context.imdata_size;
+ input_context.input_hint = context.input_hint;
+ input_context.bidi_direction = context.bidi_direction;
+ input_context.language = context.language;
+ input_context.client_window = context.client_window;
+
+ g_basic_callback.show(ic, static_cast<ime_context_h>(&input_context), g_user_data);
+ }
+}
+
+void CCoreEventCallback::on_ise_hide(sclint ic, const sclchar *ic_uuid)
+{
+ if (g_basic_callback.hide) {
+ g_basic_callback.hide(ic, g_user_data);
+ }
+}
+
+void CCoreEventCallback::on_get_geometry(sclu32 *pos_x, sclu32 *pos_y, sclu32 *width, sclu32 *height)
+{
+ int geometry_pos_x = 0;
+ int geometry_pos_y = 0;
+ int geometry_width = 0;
+ int geometry_height = 0;
+
+ if (g_event_callback.geometry_requested) {
+ g_event_callback.geometry_requested(g_event_callback.geometry_requested_user_data, &geometry_pos_x, &geometry_pos_y, &geometry_width, &geometry_height);
+ }
+
+ if (pos_x)
+ *pos_x = geometry_pos_x;
+
+ if (pos_y)
+ *pos_y = geometry_pos_y;
+
+ if (width)
+ *width = geometry_width;
+
+ if (height)
+ *height = geometry_height;
+}
+
+void CCoreEventCallback::on_set_language(Ecore_IMF_Input_Panel_Lang language)
+{
+ if (g_event_callback.language_set) {
+ g_event_callback.language_set(language, g_event_callback.language_set_user_data);
+ }
+}
+
+void CCoreEventCallback::on_set_imdata(sclchar *buf, sclu32 len)
+{
+ if (g_event_callback.imdata_set) {
+ g_event_callback.imdata_set((void *)buf, len, g_event_callback.imdata_set_user_data);
+ }
+}
+
+void CCoreEventCallback::on_get_imdata(sclchar **buf, sclu32 *len)
+{
+ if (g_event_callback.imdata_requested) {
+ g_event_callback.imdata_requested(g_event_callback.imdata_set_user_data, (void **)buf, len);
+ }
+}
+
+void CCoreEventCallback::on_get_language_locale(sclint ic, sclchar **locale)
+{
+ if (g_event_callback.language_requested) {
+ g_event_callback.language_requested(g_event_callback.language_requested_user_data, locale);
+ }
+}
+
+void CCoreEventCallback::on_set_return_key_type(Ecore_IMF_Input_Panel_Return_Key_Type type)
+{
+ if (g_event_callback.return_key_type_set) {
+ g_event_callback.return_key_type_set(type, g_event_callback.return_key_type_set_user_data);
+ }
+}
+
+void CCoreEventCallback::on_set_return_key_disable(bool disabled)
+{
+ if (g_event_callback.return_key_state_set) {
+ g_event_callback.return_key_state_set(disabled, g_event_callback.return_key_state_set_user_data);
+ }
+}
+
+void CCoreEventCallback::on_set_layout(Ecore_IMF_Input_Panel_Layout layout)
+{
+ if (g_event_callback.layout_set) {
+ g_event_callback.layout_set(layout, g_event_callback.layout_set_user_data);
+ }
+}
+
+void CCoreEventCallback::on_reset_input_context(sclint ic, const sclchar *uuid)
+{
+ if (g_event_callback.input_context_reset) {
+ g_event_callback.input_context_reset(g_event_callback.input_context_reset_user_data);
+ }
+}
+
+void CCoreEventCallback::on_process_key_event(scim::KeyEvent &key, sclu32 *ret)
+{
+ if (g_event_callback.process_key_event) {
+ struct _ime_device_info dev_info = {key.dev_name.c_str(),
+ static_cast<Ecore_IMF_Device_Class>(key.dev_class), static_cast<Ecore_IMF_Device_Subclass>(key.dev_subclass)};
+ bool processed = g_event_callback.process_key_event(static_cast<ime_key_code_e>(key.code), static_cast<ime_key_mask_e>(key.mask),
+ static_cast<ime_device_info_h>(&dev_info), g_event_callback.process_key_event_user_data);
+
+ if (ret) {
+ if (processed)
+ *ret = 1;
+ else
+ *ret = 0;
+ }
+ }
+ else {
+ if (ret) {
+ *ret = 0;
+ }
+ }
+}
+
+void CCoreEventCallback::on_set_display_language(const sclchar *language)
+{
+ if (g_event_callback.display_language_changed) {
+ g_event_callback.display_language_changed(language, g_event_callback.display_language_changed_user_data);
+ }
+}
+
+void CCoreEventCallback::on_set_rotation_degree(sclint degree)
+{
+ if (g_event_callback.rotation_degree_changed) {
+ g_event_callback.rotation_degree_changed(degree, g_event_callback.rotation_degree_changed_user_data);
+ }
+}
+
+void CCoreEventCallback::on_set_accessibility_state(sclboolean state)
+{
+ if (g_event_callback.accessibility_state_changed) {
+ g_event_callback.accessibility_state_changed(state, g_event_callback.accessibility_state_changed_user_data);
+ }
+}
+
+void CCoreEventCallback::on_create_option_window(sclwindow window, SCLOptionWindowType type)
+{
+ if (g_event_callback.option_window_created) {
+ g_event_callback.option_window_created(static_cast<Evas_Object*>(window), static_cast<ime_option_window_type_e>(type), g_event_callback.option_window_created_user_data);
+ }
+}
+
+void CCoreEventCallback::on_destroy_option_window(sclwindow window)
+{
+ if (g_event_callback.option_window_destroyed) {
+ g_event_callback.option_window_destroyed(static_cast<Evas_Object*>(window), g_event_callback.option_window_destroyed_user_data);
+ }
+}
+
+void CCoreEventCallback::on_check_option_window_availability(sclboolean *ret)
+{
+ if (ret) {
+ if (g_event_callback.option_window_created) // Instead of each 3rd party keyboard, inputmethod will reply the availability of the option (setting).
+ *ret = true;
+ else
+ *ret = false;
+ }
+}
+
+static ime_error_e _check_privilege (void)
+{
+ char *label = NULL;
+ int ret = 0;
+
+ ret = smack_new_label_from_self(&label);
+ if (ret == 0) {
+ ret = smack_have_access(label, "isf::ime", "rw");
+ if (ret != 1) {
+ if (label)
+ free(label);
+ return IME_ERROR_PERMISSION_DENIED;
+ }
+
+ ret = smack_have_access(label, "isf", "rwx");
+ if (ret != 1) {
+ if (label)
+ free(label);
+ return IME_ERROR_PERMISSION_DENIED;
+ }
+ }
+ else {
+ LOGE("smack_new_label_from_self failed (%d)", ret);
+ if (label)
+ free(label);
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ if (label)
+ free(label);
+
+ return IME_ERROR_NONE;
+}
+
+int ime_run(ime_callback_s *basic_cb, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (g_running) {
+ LOGE("inputmethod main loop is already running.");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ if (!basic_cb) {
+ LOGE("basic callbacks pointer is null.");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_basic_callback = *basic_cb;
+
+ if (!g_basic_callback.create || !g_basic_callback.terminate ||
+ !g_basic_callback.show || !g_basic_callback.hide) {
+ LOGE("mandatory callback funtions are not set");
+ memset(&g_basic_callback, 0, sizeof(ime_callback_s));
+ memset(&g_event_callback, 0, sizeof(ime_event_callback_s));
+ return IME_ERROR_NO_CALLBACK_FUNCTION;
+ }
+
+ g_user_data = user_data;
+ g_running = true;
+
+ g_core.run();
+
+ memset(&g_basic_callback, 0, sizeof(ime_callback_s));
+ memset(&g_event_callback, 0, sizeof(ime_event_callback_s));
+ g_user_data = NULL;
+ g_running = false;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_focus_in_cb(ime_focus_in_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.focus_in = callback_func;
+ g_event_callback.focus_in_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_focus_out_cb(ime_focus_out_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.focus_out = callback_func;
+ g_event_callback.focus_out_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_surrounding_text_updated_cb(ime_surrounding_text_updated_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.surrounding_text_updated = callback_func;
+ g_event_callback.surrounding_text_updated_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_input_context_reset_cb(ime_input_context_reset_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.input_context_reset = callback_func;
+ g_event_callback.input_context_reset_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_cursor_position_updated_cb(ime_cursor_position_updated_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.cursor_position_updated = callback_func;
+ g_event_callback.cursor_position_updated_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_language_requested_cb(ime_language_requested_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.language_requested = callback_func;
+ g_event_callback.language_requested_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_language_set_cb(ime_language_set_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.language_set = callback_func;
+ g_event_callback.language_set_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_imdata_set_cb(ime_imdata_set_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.imdata_set = callback_func;
+ g_event_callback.imdata_set_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_imdata_requested_cb(ime_imdata_requested_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.imdata_requested = callback_func;
+ g_event_callback.imdata_requested_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_layout_set_cb(ime_layout_set_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.layout_set = callback_func;
+ g_event_callback.layout_set_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_return_key_type_set_cb(ime_return_key_type_set_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.return_key_type_set = callback_func;
+ g_event_callback.return_key_type_set_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_return_key_state_set_cb(ime_return_key_state_set_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.return_key_state_set = callback_func;
+ g_event_callback.return_key_state_set_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_geometry_requested_cb(ime_geometry_requested_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.geometry_requested = callback_func;
+ g_event_callback.geometry_requested_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_process_key_event_cb(ime_process_key_event_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.process_key_event = callback_func;
+ g_event_callback.process_key_event_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_display_language_changed_cb(ime_display_language_changed_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.display_language_changed = callback_func;
+ g_event_callback.display_language_changed_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_rotation_degree_changed_cb(ime_rotation_degree_changed_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.rotation_degree_changed = callback_func;
+ g_event_callback.rotation_degree_changed_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_accessibility_state_changed_cb(ime_accessibility_state_changed_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.accessibility_state_changed = callback_func;
+ g_event_callback.accessibility_state_changed_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_option_window_created_cb(ime_option_window_created_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.option_window_created = callback_func;
+ g_event_callback.option_window_created_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_event_set_option_window_destroyed_cb(ime_option_window_destroyed_cb callback_func, void *user_data)
+{
+ ime_error_e ret = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (g_running) {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+
+ ret = _check_privilege();
+ if (ret != IME_ERROR_NONE) {
+ LOGE("_check_privilege returned %d.", ret);
+ return ret;
+ }
+
+ g_event_callback.option_window_destroyed = callback_func;
+ g_event_callback.option_window_destroyed_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_send_key_event(ime_key_code_e keycode, ime_key_mask_e keymask, bool forward_key)
+{
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ if (forward_key)
+ g_core.forward_key_event(-1, NULL, (sclu32)keycode, (sclu16)keymask);
+ else
+ g_core.send_key_event(-1, NULL, (sclu32)keycode, (sclu16)keymask);
+
+ return IME_ERROR_NONE;
+}
+
+int ime_commit_string(const char *str)
+{
+ if (!str) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ g_core.commit_string(-1, NULL, str);
+
+ return IME_ERROR_NONE;
+}
+
+int ime_show_preedit_string(void)
+{
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ g_core.show_preedit_string(-1, NULL);
+
+ return IME_ERROR_NONE;
+}
+
+int ime_hide_preedit_string(void)
+{
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ g_core.hide_preedit_string(-1, NULL);
+
+ return IME_ERROR_NONE;
+}
+
+int ime_update_preedit_string(const char *str, Eina_List *attrs)
+{
+ if (!str) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ scim::AttributeList attrv;
+ ime_preedit_attribute *attr = NULL;
+
+ if (attrs) {
+ EINA_LIST_FREE(attrs, attr) {
+ if (attr) {
+ attrv.push_back(scim::Attribute(attr->start, attr->length, (scim::AttributeType)attr->type, attr->value));
+ free(attr);
+ }
+ }
+ }
+
+ g_core.update_preedit_string(-1, NULL, str, attrv);
+
+ return IME_ERROR_NONE;
+}
+
+int ime_request_surrounding_text(int maxlen_before, int maxlen_after)
+{
+ if (!g_event_callback.surrounding_text_updated) {
+ LOGW("IME_ERROR_NO_CALLBACK_FUNCTION");
+ return IME_ERROR_NO_CALLBACK_FUNCTION;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ g_core.get_surrounding_text(NULL, maxlen_before, maxlen_after);
+
+ return IME_ERROR_NONE;
+}
+
+int ime_delete_surrounding_text(int offset, int len)
+{
+ if (len <= 0) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ g_core.delete_surrounding_text(offset, len);
+
+ return IME_ERROR_NONE;
+}
+
+Evas_Object* ime_get_main_window(void)
+{
+ Evas_Object *win = NULL;
+
+ if (!g_running) {
+ set_last_result(IME_ERROR_NOT_RUNNING);
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return NULL;
+ }
+
+ win = static_cast<Evas_Object*>(g_core.get_main_window());
+ if (win) {
+ set_last_result(IME_ERROR_NONE);
+ }
+ else {
+ set_last_result(IME_ERROR_OPERATION_FAILED);
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ }
+
+ return win;
+}
+
+int ime_set_size(int portrait_width, int portrait_height, int landscape_width, int landscape_height)
+{
+ SclSize portrait_size, landscape_size;
+
+ if (portrait_width < 1 || portrait_height < 1 || landscape_width < 1 || landscape_height < 1) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ portrait_size.width = portrait_width;
+ portrait_size.height = portrait_height;
+
+ landscape_size.width = landscape_width;
+ landscape_size.height = landscape_height;
+
+ g_core.set_keyboard_size_hints(portrait_size, landscape_size);
+
+ return IME_ERROR_NONE;
+}
+
+int ime_create_option_window(void)
+{
+ if (!g_event_callback.option_window_created || !g_event_callback.option_window_destroyed) {
+ LOGW("ime_create_option_window_cb() and ime_destroy_option_window_cb() callback functions are not set.");
+ return IME_ERROR_NO_CALLBACK_FUNCTION;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ if (g_core.create_option_window())
+ return IME_ERROR_NONE;
+ else {
+ LOGW("IME_ERROR_OPERATION_FAILED");
+ return IME_ERROR_OPERATION_FAILED;
+ }
+}
+
+int ime_destroy_option_window(Evas_Object *window)
+{
+ if (!g_event_callback.option_window_created || !g_event_callback.option_window_destroyed) {
+ LOGW("ime_create_option_window_cb() and ime_destroy_option_window_cb() callback functions are not set.");
+ return IME_ERROR_NO_CALLBACK_FUNCTION;
+ }
+
+ if (!window) {
+ LOGW("Window pointer is null.");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ g_core.destroy_option_window(window);
+
+ return IME_ERROR_NONE;
+}
+
+int ime_context_get_layout(ime_context_h context, Ecore_IMF_Input_Panel_Layout *layout)
+{
+ if (!context || !layout) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ *layout = context->layout;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_context_get_layout_variation(ime_context_h context, ime_layout_variation_e *layout_variation)
+{
+ if (!context || !layout_variation) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ *layout_variation = static_cast<ime_layout_variation_e>(context->layout_variation);
+
+ return IME_ERROR_NONE;
+}
+
+int ime_context_get_cursor_position(ime_context_h context, int *cursor_pos)
+{
+ if (!context || !cursor_pos) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ *cursor_pos = context->cursor_pos;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_context_get_autocapital_type(ime_context_h context, Ecore_IMF_Autocapital_Type *autocapital_type)
+{
+ if (!context || !autocapital_type) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ *autocapital_type = context->autocapital_type;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_context_get_return_key_type(ime_context_h context, Ecore_IMF_Input_Panel_Return_Key_Type *return_key_type)
+{
+ if (!context || !return_key_type) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ *return_key_type = context->return_key_type;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_context_get_return_key_state(ime_context_h context, bool *return_key_state)
+{
+ if (!context || !return_key_state) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ *return_key_state = static_cast<bool>(context->return_key_disabled);
+
+ return IME_ERROR_NONE;
+}
+
+int ime_context_get_prediction_mode(ime_context_h context, bool *prediction_mode)
+{
+ if (!context || !prediction_mode) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ *prediction_mode = static_cast<bool>(context->prediction_allow);
+
+ return IME_ERROR_NONE;
+}
+
+int ime_context_get_password_mode(ime_context_h context, bool *password_mode)
+{
+ if (!context || !password_mode) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ *password_mode = static_cast<bool>(context->password_mode);
+
+ return IME_ERROR_NONE;
+}
+
+int ime_context_get_input_hint(ime_context_h context, Ecore_IMF_Input_Hints *input_hint)
+{
+ if (!context || !input_hint) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ *input_hint = context->input_hint;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_context_get_bidi_direction(ime_context_h context, Ecore_IMF_BiDi_Direction *bidi)
+{
+ if (!context || !bidi) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ *bidi = context->bidi_direction;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_context_get_language(ime_context_h context, Ecore_IMF_Input_Panel_Lang *language)
+{
+ if (!context || !language) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ *language = context->language;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_device_info_get_name(ime_device_info_h dev_info, char **dev_name)
+{
+ if (!dev_info || !dev_name) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ if (!dev_info->dev_name)
+ *dev_name = strdup("");
+ else
+ *dev_name = strdup(dev_info->dev_name);
+
+ return IME_ERROR_NONE;
+}
+
+int ime_device_info_get_class(ime_device_info_h dev_info, Ecore_IMF_Device_Class *dev_class)
+{
+ if (!dev_info || !dev_class) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ *dev_class = dev_info->dev_class;
+
+ return IME_ERROR_NONE;
+}
+
+int ime_device_info_get_subclass(ime_device_info_h dev_info, Ecore_IMF_Device_Subclass *dev_subclass)
+{
+ if (!dev_info || !dev_subclass) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!g_running) {
+ LOGW("IME_ERROR_NOT_RUNNING");
+ return IME_ERROR_NOT_RUNNING;
+ }
+
+ *dev_subclass = dev_info->dev_subclass;
+
+ return IME_ERROR_NONE;
+}
+
+