return EINA_FALSE;
}
+#ifdef _WEARABLE
+static Eina_Bool
+rotary_event_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+{
+ Ecore_Event_Detent_Rotate *ev = event;
+ if (!ev) return EINA_TRUE;
+
+ Ecore_IMF_Context *active_ctx = NULL;
+ if (_show_req_ctx)
+ active_ctx = _show_req_ctx;
+ else if (_focused_ctx)
+ active_ctx = _focused_ctx;
+
+ if (!active_ctx) return EINA_TRUE;
+
+ if (_input_panel_state == ECORE_IMF_INPUT_PANEL_STATE_HIDE)
+ return EINA_TRUE;
+
+ WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(active_ctx);
+ if (imcontext) {
+ wl_text_input_process_input_device_event(imcontext->text_input,
+ (unsigned int)ECORE_EVENT_DETENT_ROTATE, (char*)event, sizeof(Ecore_Event_Detent_Rotate));
+ }
+
+ return EINA_FALSE;
+}
+#endif
+
static Eina_Bool
_ecore_event_filter_cb(void *data, void *loop_data EINA_UNUSED, int type, void *event)
{
else if (type == ECORE_EVENT_KEY_UP) {
return key_up_cb(data, type, event);
}
+#ifdef _WEARABLE
+ /* The IME needs to process Rotary event prior to client application */
+ else if (type == ECORE_EVENT_DETENT_ROTATE) {
+ return rotary_event_cb(data, type, event);
+ }
+#endif
return EINA_TRUE;
}
m_send_trans.write_to_socket(client_socket);
}
+ bool process_input_device_event(int client, uint32 context, const String& uuid, uint32 type, const char *data, size_t len, _OUT_ uint32& result) {
+ LOGD("client id:%d\n", client);
+
+ Socket client_socket(client);
+
+ Transaction trans;
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_data(context);
+ trans.put_data(uuid);
+ trans.put_command(ISM_TRANS_CMD_PROCESS_INPUT_DEVICE_EVENT);
+ trans.put_data(type);
+ trans.put_data(data, len);
+ int cmd;
+
+ if (trans.write_to_socket(client_socket)
+ && trans.read_from_socket(client_socket)
+ && trans.get_command(cmd) && cmd == SCIM_TRANS_CMD_REPLY
+ && trans.get_data(result)) {
+ SCIM_DEBUG_MAIN(1) << __func__ << " success\n";
+ return true;
+ }
+ else {
+ LOGW("read failed\n");
+ }
+
+ return false;
+ }
+
void socket_update_surrounding_text(int client, uint32 context, const String& uuid, String& text, uint32 cursor) {
SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n";
LOGD ("client id:%d\n", client);
return 0;
}
+int _isf_wsc_context_process_input_device_event(int context, int type, const void* data, int len)
+{
+ uint32 result;
+ g_info_manager->process_input_device_event(context, (unsigned int)type, (const char*)data, (size_t)len, result);
+ return 0;
+}
/*
vi:ts=4:expandtab:nowrap
*/
int _isf_wsc_context_set_keyboard_mode (int context, scim::TOOLBAR_MODE_T mode);
int _isf_wsc_context_input_panel_send_candidate_will_hide_ack (int context);
+ int _isf_wsc_context_process_input_device_event(int context, int type, const void* data, int len);
#ifdef __cplusplus
}
{
_isf_wsc_context_input_panel_imdata_get (_get_context_id (ctx), imdata, len);
}
+
+void isf_wsc_context_process_input_device_event (WSCContextISF *ctx, uint32_t type, const char *data, uint32_t len)
+{
+ _isf_wsc_context_process_input_device_event (_get_context_id(ctx), type, data, len);
+}
void isf_wsc_context_input_panel_return_key_disabled_set (WSCContextISF *ctx, Eina_Bool disabled);
void isf_wsc_context_input_panel_imdata_set (WSCContextISF *ctx, const void *imdata, int len);
void isf_wsc_context_input_panel_imdata_get (WSCContextISF *ctx, void **imdata, int* len);
+ void isf_wsc_context_process_input_device_event (WSCContextISF *ctx, uint32_t type, const char *data, uint32_t len);
#ifdef __cplusplus
}
g_info_manager->socket_update_cursor_position (cursor_pos);
}
+static void
+_wsc_im_ctx_process_input_device_event(void *data, struct wl_input_method_context *im_ctx, uint32_t type, const char *input_data, uint32_t input_data_len)
+{
+ WSCContextISF *wsc_ctx = (WSCContextISF*)data;
+
+ LOGD("im_context = %p type = %d, data = (%p) %d\n", im_ctx, type, input_data, input_data_len);
+ if (!wsc_ctx) return;
+
+ isf_wsc_context_process_input_device_event(wsc_ctx, type, input_data, input_data_len);
+}
+
static const struct wl_input_method_context_listener wsc_im_context_listener = {
_wsc_im_ctx_reset,
_wsc_im_ctx_content_type,
_wsc_im_ctx_return_key_disabled,
_wsc_im_ctx_input_panel_data,
_wsc_im_ctx_bidi_direction,
- _wsc_im_ctx_cursor_position
+ _wsc_im_ctx_cursor_position,
+ _wsc_im_ctx_process_input_device_event
};
static void
return false;
}
+ //ISM_TRANS_CMD_PROCESS_INPUT_DEVICE_EVENT
+ bool process_input_device_event(int client_id, uint32 type, const char *data, size_t len, _OUT_ uint32& result) {
+ SCIM_DEBUG_MAIN(4) << "InfoManager::process_input_device_event ()\n";
+ HelperClientIndex::iterator it = m_helper_client_index.find(m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context(client, context);
+ ctx = get_helper_ic(client, context);
+ return m_panel_agent_manager.process_input_device_event(it->second.id, ctx, m_current_helper_uuid, type, data, len, result);
+ }
+
+ return false;
+ }
+
bool get_helper_geometry (String& uuid, struct rectinfo& info) {
HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
m_impl->focus_out (client_id, context);
}
+//ISM_TRANS_CMD_PROCESS_INPUT_DEVICE_EVENT
+bool InfoManager::process_input_device_event(int client, uint32 type, const char *data, size_t len, _OUT_ uint32& result)
+{
+ return m_impl->process_input_device_event(client, type, data, len, result);
+}
+
//ISM_TRANS_CMD_TURN_ON_LOG
void InfoManager::socket_turn_on_log (uint32 isOn)
{
//SCIM_TRANS_CMD_FOCUS_OUT
void focus_out (int client_id, uint32 context);
+ //ISM_TRANS_CMD_PROCESS_INPUT_DEVICE_EVENT
+ bool process_input_device_event(int client_id, uint32 type, const char *data, size_t len, _OUT_ uint32& result);
+
//ISM_TRANS_CMD_TURN_ON_LOG
void socket_turn_on_log (uint32 isOn);
LOGW ("not implemented for %s", m_name.c_str ());
}
+bool PanelAgentBase::process_input_device_event(int client, uint32 context, const String& uuid, uint32 type, const char *data, size_t len, _OUT_ uint32& result)
+{
+ LOGW("not implemented for %s", m_name.c_str());
+ return false;
+}
} /* namespace scim */
* @return none.
*/
virtual void hide_helper_ise (int client, uint32 context);
+
+ /**
+ * @brief process_input_device_event.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual bool process_input_device_event(int client, uint32 context, const String& uuid, uint32 type, const char *data, size_t len, _OUT_ uint32& result);
};
/** @} */
_p->process_helper_event (id, context_id, target_uuid, active_uuid, nest_trans);
}
+bool PanelAgentManager::process_input_device_event(int id, uint32 context_id, const String& uuid, uint32 type, const char *data, size_t len, _OUT_ uint32& result)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id(id);
+
+ if (!_p.null())
+ return _p->process_input_device_event(id, context_id, uuid, type, data, len, result);
+ return false;
+}
+
void PanelAgentManager::socket_helper_key_event (int id, uint32 context_id, int cmd , KeyEvent& key)
{
PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
void update_preedit_caret (int focused_client, uint32 focused_context, uint32 caret);
void helper_attach_input_context_and_update_screen (int client, std::vector < std::pair <uint32, String> >& helper_ic_index, uint32 current_screen);
void hide_helper_ise (int id, uint32 context);
+ bool process_input_device_event(int client, uint32 context, const String& uuid, uint32 type, const char *data, size_t len, _OUT_ uint32& result);
};
/** @} */
typedef Signal3<void, const HelperAgent *, KeyEvent &, uint32 &>
HelperAgentSignalKeyEventUint;
+typedef Signal5<void, const HelperAgent *, uint32 &, char *, size_t &, uint32 &>
+ HelperAgentSignalUintCharSizeUint;
+
class HelperAgent::HelperAgentImpl
{
public:
HelperAgentSignalUintVoid signal_update_bidi_direction;
HelperAgentSignalVoid signal_show_option_window;
HelperAgentSignalUintVoid signal_check_option_window;
+ HelperAgentSignalUintCharSizeUint signal_process_input_device_event;
public:
HelperAgentImpl (HelperAgent* thiz) : focused_ic ((uint32) -1), thiz (thiz),
m_impl->send.write_to_socket (m_impl->socket);
break;
}
+ case ISM_TRANS_CMD_PROCESS_INPUT_DEVICE_EVENT:
+ {
+ uint32 ret = 0;
+ uint32 type;
+ char *data = NULL;
+ size_t len;
+ if (m_impl->recv.get_data(type) &&
+ m_impl->recv.get_data(&data, len)) {
+ m_impl->signal_process_input_device_event(this, type, data, len, ret);
+ }
+ else
+ LOGW("wrong format of transaction\n");
+ m_impl->send.clear();
+ m_impl->send.put_command(SCIM_TRANS_CMD_REPLY);
+ m_impl->send.put_data(ret);
+ m_impl->send.write_to_socket(m_impl->socket);
+ break;
+ }
default:
break;
}
} /* namespace scim */
+/**
+ * @brief Connect a slot to Helper process unconventional input device event signal.
+ *
+ * This signal is used to send unconventional input device event to Helper ISE.
+ *
+ * The prototype of the slot is:
+ * void process_input_device_event (const HelperAgent *, uint32 &type, char *data, size_t &size, uint32 &ret);
+ */
+Connection
+HelperAgent::signal_connect_process_input_device_event (HelperAgentSlotUintCharSizeUint *slot)
+{
+ return m_impl->signal_process_input_device_event.connect (slot);
+}
+
/*
vi:ts=4:nowrap:ai:expandtab
*/
typedef Slot3<void, const HelperAgent *, KeyEvent &, uint32 &>
HelperAgentSlotKeyEventUint;
+typedef Slot5<void, const HelperAgent *, uint32 &, char *, size_t &, uint32 &>
+ HelperAgentSlotUintCharSizeUint;
+
/**
* @brief The accessory class to write a Helper object.
*
* void check_option_window (const HelperAgent *agent, uint32 &avail);
*/
Connection signal_connect_check_option_window (HelperAgentSlotUintVoid *slot);
+
+ /**
+ * @brief Connect a slot to Helper process unconventional input device event signal.
+ *
+ * The prototype of the slot is:
+ * void process_input_device_event (const HelperAgent *, uint32 &type, char *data, size_t &size, uint32 &ret);
+ */
+ Connection signal_connect_process_input_device_event (HelperAgentSlotUintCharSizeUint *slot);
};
/** @} */
const int ISM_TRANS_CMD_SET_INPUT_HINT = 1123;
const int ISM_TRANS_CMD_UPDATE_BIDI_DIRECTION = 1124;
const int ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW = 1125;
+const int ISM_TRANS_CMD_PROCESS_INPUT_DEVICE_EVENT = 1126;
/* ISE/Panel to IMControl */
const int ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT = 1151;