# Check tzplatform-config library
PKG_CHECK_MODULES(TZPLATFORM_CONFIG, [libtzplatform-config])
+PKG_CHECK_MODULES(APPFW_APPLICATION, [capi-appfw-application])
+
# Check dlog library
PKG_CHECK_MODULES(DLOG, [dlog >= 0])
@ECORE_WL_CFLAGS@ \
@WL_TEXT_INPUT_CFLAGS@ \
@DLOG_CFLAGS@ \
- @VCONF_CFLAGS@
+ @VCONF_CFLAGS@ \
+ @APPFW_APPLICATION_CFLAGS@
module_la_LDFLAGS = -rpath $(moduledir) \
-avoid-version \
@WL_TEXT_INPUT_LIBS@ \
@DLOG_LIBS@ \
@VCONF_LIBS@ \
+ @APPFW_APPLICATION_LIBS@ \
$(top_builddir)/ism/src/libprofile.la
#include <Ecore_Wayland.h>
#include <dlog.h>
#include <wctype.h>
+#include <app_common.h>
#ifdef HAVE_VCONF
#include <vconf.h>
#endif
wayland_im_context_add(Ecore_IMF_Context *ctx)
{
WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx);
+ char *appid = NULL;
LOGD("ctx : %p", ctx);
if (imcontext->text_input)
wl_text_input_add_listener(imcontext->text_input,
&text_input_listener, imcontext);
+
+ app_get_id(&appid);
+ LOGD("app id : %s\n", appid);
+
+ ecore_imf_context_prediction_hint_hash_set(ctx, "appid", appid ? appid : "");
+
+ if (appid)
+ free (appid);
}
void
imcontext->reset_serial = imcontext->serial;
}
+static Eina_Bool
+_prediction_hint_data_foreach_cb(const Eina_Hash *hash, const void *key,
+ void *data, void *fdata)
+{
+ const char *key_str = key;
+ const char *value = data;
+ Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)fdata;
+ WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx);
+
+ SECURE_LOGD("key : %s, value : %s\n", key_str, value);
+
+ if (imcontext && imcontext->text_input)
+ wl_text_input_prediction_hint_data(imcontext->text_input, key_str, value);
+
+ return EINA_TRUE;
+}
+
void
wayland_im_context_focus_in(Ecore_IMF_Context *ctx)
{
if (imcontext->input_panel_position.x >= 0 && imcontext->input_panel_position.y >= 0)
wl_text_input_set_input_panel_position(imcontext->text_input,
imcontext->input_panel_position.x, imcontext->input_panel_position.y);
+
+ const Eina_Hash *hash = ecore_imf_context_prediction_hint_hash_get(ctx);
+ if (hash)
+ eina_hash_foreach(hash, _prediction_hint_data_foreach_cb, ctx);
}
if (ecore_imf_context_input_panel_enabled_get(ctx))
m_send_trans.write_to_socket(client_socket);
}
+ void set_helper_prediction_hint_data(int client, uint32 context, const String& uuid, String& key, String &value) {
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_SET_PREDICTION_HINT_DATA);
+ m_send_trans.put_data(key);
+ m_send_trans.put_data(value);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
void finalize_content_helper(int client, uint32 context, const String& uuid, String& text, uint32& cursor_pos) {
LOGD("client id:%d", client);
g_info_manager->finalize_content (get_panel_client_id (), String (text), cursor_pos);
return 0;
}
+
+int _isf_wsc_context_input_panel_prediction_hint_data_set (int context, const char *key, const char *value)
+{
+ g_info_manager->set_prediction_hint_data (get_panel_client_id (), String (key), String (value));
+ return 0;
+}
+
/*
vi:ts=4:expandtab:nowrap
*/
int _isf_wsc_context_input_panel_prediction_hint_set (int context, const char *prediction_hint);
int _isf_wsc_context_input_panel_mime_type_accept_set (int context, const char *mime_type);
int _isf_wsc_context_input_panel_finalize_content (int context, const char *text, int cursor_pos);
+ int _isf_wsc_context_input_panel_prediction_hint_data_set (int context, const char *key, const char *value);
#ifdef __cplusplus
}
{
_isf_wsc_context_input_panel_finalize_content (_get_context_id(ctx), text, cursor_pos);
}
+
+void isf_wsc_context_input_panel_prediction_hint_data_set (WSCContextISF *ctx, const char *key, const char *value)
+{
+ _isf_wsc_context_input_panel_prediction_hint_data_set (_get_context_id(ctx), key, value);
+}
void isf_wsc_context_input_panel_prediction_hint_set (WSCContextISF *ctx, const char *prediction_hint);
void isf_wsc_context_input_panel_mime_type_accept_set (WSCContextISF *ctx, const char *mime_type);
void isf_wsc_context_input_panel_finalize_content (WSCContextISF *ctx, const char *text, int cursor_pos);
+ void isf_wsc_context_input_panel_prediction_hint_data_set (WSCContextISF *ctx, const char *key, const char *value);
#ifdef __cplusplus
}
isf_wsc_context_input_panel_finalize_content (wsc_ctx, text, cursor_pos);
}
+static void
+_wsc_im_ctx_prediction_hint_data (void *data, struct wl_input_method_context *im_ctx, const char *key, const char * value)
+{
+ WSCContextISF *wsc_ctx = (WSCContextISF*)data;
+ if (!wsc_ctx) return;
+
+ isf_wsc_context_input_panel_prediction_hint_data_set (wsc_ctx, key, value);
+}
+
static const struct wl_input_method_context_listener wsc_im_context_listener = {
_wsc_im_ctx_reset,
_wsc_im_ctx_content_type,
_wsc_im_ctx_capital_mode,
_wsc_im_ctx_prediction_hint,
_wsc_im_ctx_mime_type,
- _wsc_im_ctx_finalized_content
+ _wsc_im_ctx_finalized_content,
+ _wsc_im_ctx_prediction_hint_data
};
#if ENABLE_GRAB_KEYBOARD
return false;
}
+ bool set_helper_prediction_hint_data (const String& uuid, String key, String value) {
+ 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);
+ m_panel_agent_manager.set_helper_prediction_hint_data (it->second.id, ctx, uuid, key, value);
+ return true;
+ }
+
+ return false;
+ }
+
//ISM_TRANS_CMD_SHOW_ISF_CONTROL
void show_isf_panel (int client_id) {
SCIM_DEBUG_MAIN (4) << "InfoManager::show_isf_panel ()\n";
finalize_content_helper (m_current_helper_uuid, text, cursor_pos);
}
+ //ISM_TRANS_CMD_SET_PREDICTION_HINT_DATA
+ void set_prediction_hint_data (int client_id, String key, String value) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::set_prediction_hint_data ()\n";
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ set_helper_prediction_hint_data (m_current_helper_uuid, key, value);
+ }
+
//ISM_TRANS_CMD_EXPAND_CANDIDATE
void expand_candidate () {
LOGD ("");
m_impl->get_candidate_window_geometry (client_id, info);
}
-
//ISM_TRANS_CMD_GET_ISE_LANGUAGE_LOCALE
void InfoManager::get_ise_language_locale (int client_id, _OUT_ char** data, _OUT_ size_t& len)
{
m_impl->finalize_content (client_id, text, cursor_pos);
}
+//ISM_TRANS_CMD_SET_PREDICTION_HINT_DATA
+void InfoManager::set_prediction_hint_data (int client_id, String key, String value)
+{
+ m_impl->set_prediction_hint_data (client_id, key, value);
+}
+
//ISM_TRANS_CMD_EXPAND_CANDIDATE
void InfoManager::expand_candidate ()
{
//ISM_TRANS_CMD_FINALIZE_CONTENT
void finalize_content(int client_id, String text, uint32 cursor_pos);
+ //ISM_TRANS_CMD_SET_PREDICTION_HINT_DATA
+ void set_prediction_hint_data (int client_id, String key, String value);
+
//ISM_TRANS_CMD_EXPAND_CANDIDATE
void expand_candidate ();
uint32 m_cursor_pos;
};
+/* ISM_TRANS_CMD_SET_PREDICTION_HINT_DATA */
+class MessageItemSetPredictionHintData : public MessageItemHelper
+{
+public:
+ MessageItemSetPredictionHintData() {}
+ virtual ~MessageItemSetPredictionHintData() {}
+
+ String& get_key_ref() { return m_key; }
+ String& get_value_ref() { return m_value; }
+protected:
+ String m_key;
+ String m_value;
+};
+
template <typename T>
inline T*
alloc_message() /* We could use memory pool in the future for performance enhancement */
}
break;
}
+ case ISM_TRANS_CMD_SET_PREDICTION_HINT_DATA:
+ {
+ MessageItemSetPredictionHintData *message = alloc_message<MessageItemSetPredictionHintData>();
+ if (message) {
+ message->get_command_ref() = cmd;
+ if (transaction.get_data(message->get_key_ref()) &&
+ transaction.get_data(message->get_value_ref())) {
+ m_list_messages.push_back(message);
+ } else {
+ LOGW("wrong format of transaction\n");
+ dealloc_message<MessageItemSetPredictionHintData>(message);
+ }
+ }
+ break;
+ }
}
}
{
}
+void PanelAgentBase::set_helper_prediction_hint_data (int client, uint32 context, const String& uuid, String& key, String& value)
+{
+}
+
bool PanelAgentBase::process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, uint32 serial)
{
return false;
virtual void finalize_content_helper (int client, uint32 context, const String& uuid, String& text, uint32& cursor_pos);
/**
+ * @brief set_helper_prediction_hint_data.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void set_helper_prediction_hint_data (int client, uint32 context, const String& uuid, String& key, String &value);
+
+ /**
* @brief process_key_event.
*
* @param
_p->finalize_content_helper (id, context_id, uuid, text, cursor_pos);
}
+void PanelAgentManager::set_helper_prediction_hint_data (int id, uint32 context_id, const String& uuid, String& key, String& value)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->set_helper_prediction_hint_data (id, context_id, uuid, key, value);
+}
+
bool PanelAgentManager::process_key_event (int id, uint32 context_id, const String& uuid, KeyEvent& key, uint32 serial)
{
PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
void resume_helper_option_window (int client, uint32 context, const String& uuid);
void set_helper_keyboard_mode (int client, uint32 context, const String& uuid, uint32& mode);
void set_helper_prediction_hint (int client, uint32 context, const String& uuid, String& prediction_hint);
+ void set_helper_prediction_hint_data (int id, uint32 context_id, const String& uuid, String& key, String& value);
void set_helper_mime_type (int client, uint32 context, const String& uuid, String& mime_type);
void finalize_content_helper (int client, uint32 context, const String& uuid, String& text, uint32& cursor_pos);
bool process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, uint32 serial);
HelperAgentSignalUintCharSizeUint signal_process_input_device_event;
HelperAgentSignalStringVoid signal_set_prediction_hint;
HelperAgentSignalStringVoid signal_set_mime_type;
+ HelperAgentSignalString signal_set_prediction_hint_data;
public:
HelperAgentImpl (HelperAgent* thiz) : magic(0), magic_active(0), timeout(-1), focused_ic ((uint32) -1), thiz (thiz),
}
break;
}
+ case ISM_TRANS_CMD_SET_PREDICTION_HINT_DATA:
+ {
+ MessageItemSetPredictionHintData *subclass = static_cast<MessageItemSetPredictionHintData*>(message);
+ m_impl->signal_set_prediction_hint_data (this, 0, subclass->get_key_ref(), subclass->get_value_ref());
+ break;
+ }
default:
break;
}
return m_impl->signal_set_mime_type.connect (slot);
}
+/**
+ * @brief Connect a slot to Helper set prediction hint data signal.
+ *
+ * This signal is used to send prediction hint data to Helper ISE.
+ *
+ * The prototype of the slot is:
+ * void set_prediction_hint_data (const HelperAgent *agent, char *key, char *value);
+ */
+Connection
+HelperAgent::signal_connect_set_prediction_hint_data (HelperAgentSlotString *slot)
+{
+ return m_impl->signal_set_prediction_hint_data.connect (slot);
+}
+
} /* namespace scim */
/*
* void set_mime_type (const HelperAgent *agent, char *mime_type);
*/
Connection signal_connect_set_mime_type (HelperAgentSlotStringVoid *slot);
+
+ /**
+ * @brief Connect a slot to Helper set prediction hint data signal.
+ *
+ * This signal is used to send prediction hint data to Helper ISE.
+ *
+ * The prototype of the slot is:
+ * void set_prediction_hint_data (const HelperAgent *agent, char *key, char *value);
+ */
+ Connection signal_connect_set_prediction_hint_data (HelperAgentSlotString *slot);
};
/** @} */
const int ISM_TRANS_CMD_SET_PREDICTION_HINT = 1129;
const int ISM_TRANS_CMD_SET_MIME_TYPE = 1130;
const int ISM_TRANS_CMD_FINALIZE_CONTENT = 1131;
+const int ISM_TRANS_CMD_SET_PREDICTION_HINT_DATA = 1132;
/* ISE/Panel to IMControl */
const int ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT = 1151;