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.
+ * @brief Called when a key event is received from external devices or ime_send_key_event().
*
* @details This function processes the key event before an associated text input UI control does.
*
* @privilege %http://tizen.org/privilege/ime
*
* @remarks If the key event is from the external device, @a dev_info will have its name, class and subclass information.
+ * @a dev_info should not be released by the application. The platform manages the handle and will release it when ime_process_key_event_cb() exits.
*
- * @param[in] keycode The key code to be sent
- * @param[in] keymask The modifier key mask
+ * @param[in] key_code The key code to be sent
+ * @param[in] key_mask 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.
+ * @return @c true if the event was processed, otherwise the event was not processed and was forwarded to the client application.
*
- * @pre The callback can be registered using ime_event_set_process_key_event_cb() function.
+ * @pre The callback should be registered using ime_event_set_process_key_event_cb() function.
*
* @see ime_event_set_process_key_event_cb()
* @see ime_device_info_get_name()
* @see ime_hide_preedit_string()
* @see 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);
+typedef bool (*ime_process_key_event_cb)(ime_key_code_e key_code, ime_key_mask_e key_mask, ime_device_info_h dev_info, void *user_data);
+
+/**
+ * @brief Called when a key event is received from external devices or ime_send_key_event().
+ * Provides the key code.
+ *
+ * @details This function processes the key event with keycode before an associated text input UI control does.
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @remarks If the key event is from the external device, @a dev_info will have its name, class and subclass information.
+ * @a dev_info should not be released by the application. The platform manages the handle and will release it when ime_process_key_event_with_keycode_cb() exits.
+ *
+ * @param[in] key_code The X11 key code to be sent
+ * @param[in] key_sym The key symbol to be sent
+ * @param[in] key_mask 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 was processed, otherwise the event was not processed and was forwarded to the client application.
+ *
+ * @pre The callback should be registered using ime_event_set_process_key_event_with_keycode_cb() function.
+ *
+ * @see ime_event_set_process_key_event_with_keycode_cb()
+ * @see ime_device_info_get_name()
+ * @see ime_device_info_get_class()
+ * @see ime_device_info_get_subclass()
+ * @see ime_send_key_event()
+ * @see ime_commit_string()
+ * @see ime_show_preedit_string()
+ * @see ime_hide_preedit_string()
+ * @see ime_update_preedit_string()
+ */
+typedef bool (*ime_process_key_event_with_keycode_cb)(unsigned int key_code, ime_key_code_e key_sym, ime_key_mask_e key_mask, ime_device_info_h dev_info, void *user_data);
/**
* @brief Called when the system display language is changed.
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_focus_in_cb()
* @see ime_run()
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_focus_out_cb()
* @see ime_run()
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_surrounding_text_updated_cb()
* @see ime_run()
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_input_context_reset_cb()
* @see ime_run()
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_cursor_position_updated_cb()
* @see ime_run()
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_language_requested_cb()
* @see ime_run()
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_language_set_cb()
* @see ime_run()
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_imdata_set_cb()
* @see ime_event_set_imdata_requested_cb()
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_imdata_requested_cb()
* @see ime_event_set_imdata_set_cb()
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_layout_set_cb()
* @see ime_run()
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_return_key_type_set_cb()
* @see ime_run()
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_return_key_state_set_cb()
* @see ime_run()
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_geometry_requested_cb()
* @see ime_run()
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_process_key_event_cb()
* @see ime_run()
int ime_event_set_process_key_event_cb(ime_process_key_event_cb callback_func, void *user_data);
/**
+ * @brief Sets @c process_key_event_whit_keycode event callback function.
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @remarks The ime_process_key_event_with_keycode_cb() callback function is called when the key event
+ * is received from external keyboard devices or ime_send_key_event().
+ *
+ * @param[in] callback_func @c process_key_event_with_keycode() 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 the IME application's main loop.
+ *
+ * @see ime_process_key_event_with_keycode_cb()
+ * @see ime_run()
+ */
+int ime_event_set_process_key_event_with_keycode_cb(ime_process_key_event_with_keycode_cb callback_func, void *user_data);
+
+/**
* @brief Sets @c display_language_changed event callback function.
*
* @since_tizen @if MOBILE 2.4 @else 3.0 @endif
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_display_language_changed_cb()
* @see ime_run()
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_rotation_degree_changed_cb()
* @see ime_run()
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_accessibility_state_changed_cb()
* @see ime_run()
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_option_window_created_cb()
* @see ime_run()
* @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.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_option_window_destroyed_cb()
* @see ime_run()
* @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
*
- * @post The ime_run() function should be called to start to run IME application's main loop.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_prediction_hint_set_cb()
* @see ime_run()
* @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
*
- * @post The ime_run() function should be called to start to run IME application's main loop.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_mime_type_set_request_cb()
* @see ime_run()
* @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
*
- * @post The ime_run() function should be called to start to run IME application's main loop.
+ * @post The ime_run() function should be called to start the IME application's main loop.
*
* @see ime_prediction_hint_data_set_cb()
* @see ime_run()
void on_set_return_key_disable(sclu32 disabled);
void on_set_layout(sclu32 layout);
void on_reset_input_context(sclint ic, const sclchar *uuid);
- void on_process_key_event(scim::KeyEvent &key, sclu32 *ret);
+ void on_process_key_event(scim::KeyEvent &key, sclu32 *ret, sclu32 keycode);
void on_set_display_language(const sclchar *language);
void on_set_rotation_degree(sclint degree);
void on_set_accessibility_state(sclboolean state);
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_process_key_event_with_keycode_cb process_key_event_with_keycode; /**< 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 */
void *return_key_state_set_user_data;
void *geometry_requested_user_data;
void *process_key_event_user_data;
+ void *process_key_event_with_keycode_user_data;
void *display_language_changed_user_data;
void *rotation_degree_changed_user_data;
void *accessibility_state_changed_user_data;
}
}
-void CCoreEventCallback::on_process_key_event(scim::KeyEvent &key, sclu32 *ret)
+void CCoreEventCallback::on_process_key_event(scim::KeyEvent &key, sclu32 *ret, sclu32 keycode)
{
- if (g_event_callback.process_key_event) {
+ if (g_event_callback.process_key_event_with_keycode || 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;
+ if (g_event_callback.process_key_event_with_keycode) {
+ bool processed = g_event_callback.process_key_event_with_keycode(keycode, 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 (g_event_callback.process_key_event) {
+ 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) {
return IME_ERROR_NONE;
}
+EXPORT_API int ime_event_set_process_key_event_with_keycode_cb(ime_process_key_event_with_keycode_cb callback_func, void *user_data)
+{
+ ime_error_e retVal = IME_ERROR_NONE;
+
+ if (!callback_func) {
+ LOGW("IME_ERROR_INVALID_PARAMETER");
+ return IME_ERROR_INVALID_PARAMETER;
+ }
+
+ retVal = _check_privilege();
+ if (retVal != IME_ERROR_NONE) return retVal;
+
+ g_event_callback.process_key_event_with_keycode = callback_func;
+ g_event_callback.process_key_event_with_keycode_user_data = user_data;
+
+ return IME_ERROR_NONE;
+}
+
EXPORT_API int ime_event_set_display_language_changed_cb(ime_display_language_changed_cb callback_func, void *user_data)
{
ime_error_e retVal = IME_ERROR_NONE;