uint32_t reset_serial;
Eina_Bool has_conformant;
+ const char *prediction_hint;
//
};
}
//
+ if (imcontext->prediction_hint) {
+ free (imcontext->prediction_hint);
+ imcontext->prediction_hint = NULL;
+ }
+
if (imcontext->text_input)
wl_text_input_destroy (imcontext->text_input);
}
WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx);
- if (imcontext && imcontext->input && imcontext->text_input)
+ if (imcontext && imcontext->input && imcontext->text_input) {
wl_text_input_set_return_key_disabled(imcontext->text_input,
imcontext->return_key_disabled);
+ if (imcontext->prediction_hint)
+ wl_text_input_prediction_hint(imcontext->text_input, imcontext->prediction_hint);
+ }
+
if (ecore_imf_context_input_panel_enabled_get(ctx))
if (!ecore_imf_context_input_panel_show_on_demand_get (ctx))
show_input_panel(ctx);
return hw_keyboard_mode ? ECORE_IMF_INPUT_PANEL_HW_KEYBOARD_MODE : ECORE_IMF_INPUT_PANEL_SW_KEYBOARD_MODE;
}
+void
+wayland_im_context_prediction_hint_set (Ecore_IMF_Context *ctx, const char *prediction_hint)
+{
+ WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx);
+ if (!imcontext) return;
+
+ imcontext->prediction_hint = strdup(prediction_hint);
+
+ if (imcontext->input && imcontext->text_input) {
+ LOGD ("ctx : %p, prediction_hint : %s\n", ctx, imcontext->prediction_hint);
+ wl_text_input_prediction_hint(imcontext->text_input, imcontext->prediction_hint);
+ }
+}
+
WaylandIMContext *wayland_im_context_new (struct wl_text_input_manager *text_input_manager)
{
WaylandIMContext *context = calloc(1, sizeof(WaylandIMContext));
Ecore_IMF_Input_Panel_Keyboard_Mode
wayland_im_context_input_panel_keyboard_mode_get(Ecore_IMF_Context *ctx);
+void
+wayland_im_context_prediction_hint_set (Ecore_IMF_Context *ctx, const char *prediction_hint);
+
WaylandIMContext *wayland_im_context_new (struct wl_text_input_manager *text_input_manager);
extern int _ecore_imf_wayland_log_dom;
NULL, /* candidate_window_geometry_get */
wayland_im_context_input_hint_set, /* input_hint_set */
wayland_im_context_bidi_direction_set, /* bidi_direction_set */
- wayland_im_context_input_panel_keyboard_mode_get /* input_panel_keyboard_mode_get */
+ wayland_im_context_input_panel_keyboard_mode_get, /* input_panel_keyboard_mode_get */
+ wayland_im_context_prediction_hint_set /* prediction_hint_set */
};
static struct wl_text_input_manager *text_input_manager = NULL;
m_send_trans.write_to_socket(client_socket);
}
+ void set_helper_prediction_hint(int client, uint32 context, const String& uuid, String& prediction_hint) {
+ LOGD ("client id:%d\n", client);
+
+ 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);
+ m_send_trans.put_data(prediction_hint);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
bool process_key_event(int client, uint32 context, const String& uuid, KeyEvent& key, uint32 serial) {
LOGD ("client id:%d\n", client);
g_info_manager->process_input_device_event(context, (unsigned int)type, (const char*)data, (size_t)len, result);
return 0;
}
+
+int _isf_wsc_context_input_panel_prediction_hint_set (int context, const char *prediction_hint)
+{
+ g_info_manager->set_prediction_hint (get_panel_client_id (), String (prediction_hint));
+ return 0;
+}
/*
vi:ts=4:expandtab:nowrap
*/
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);
+ int _isf_wsc_context_input_panel_prediction_hint_set (int context, const char *prediction_hint);
#ifdef __cplusplus
}
{
_isf_wsc_context_process_input_device_event (_get_context_id(ctx), type, data, len);
}
+
+void isf_wsc_context_input_panel_prediction_hint_set (WSCContextISF *ctx, const char *prediction_hint)
+{
+ _isf_wsc_context_input_panel_prediction_hint_set (_get_context_id(ctx), prediction_hint);
+}
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);
+ void isf_wsc_context_input_panel_prediction_hint_set (WSCContextISF *ctx, const char *prediction_hint);
#ifdef __cplusplus
}
isf_wsc_context_input_panel_caps_mode_set (wsc_ctx, mode);
}
+static void
+_wsc_im_ctx_prediction_hint (void *data, struct wl_input_method_context *im_ctx, const char *prediction_hint)
+{
+ LOGD ("im_context = %p, prediction hint = %s\n", im_ctx, prediction_hint);
+ WSCContextISF *wsc_ctx = (WSCContextISF*)data;
+ if (!wsc_ctx) return;
+
+ isf_wsc_context_input_panel_prediction_hint_set (wsc_ctx, prediction_hint);
+}
+
static const struct wl_input_method_context_listener wsc_im_context_listener = {
_wsc_im_ctx_reset,
_wsc_im_ctx_content_type,
_wsc_im_ctx_cursor_position,
_wsc_im_ctx_process_input_device_event,
_wsc_im_ctx_filter_key_event,
- _wsc_im_ctx_captial_mode
+ _wsc_im_ctx_captial_mode,
+ _wsc_im_ctx_prediction_hint
};
#if ENABLE_GRAB_KEYBOARD
return false;
}
+ bool set_helper_prediction_hint (const String& uuid, String prediction_hint) {
+ 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);
+ LOGD ("Send ISM_TRANS_CMD_SET_PREDICTION_HINT message");
+ m_panel_agent_manager.set_helper_prediction_hint (it->second.id, ctx, uuid, prediction_hint);
+ return true;
+ }
+
+ return false;
+ }
+
//ISM_TRANS_CMD_SHOW_ISF_CONTROL
void show_isf_panel (int client_id) {
LOGD ("");
set_helper_keyboard_mode (m_current_helper_uuid, mode);
}
+ //ISM_TRANS_CMD_SET_PREDICTION_HINT
+ void set_prediction_hint (int client_id, String prediction_hint) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::set_prediction_hint ()\n";
+ LOGD ("");
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ set_helper_prediction_hint (m_current_helper_uuid, prediction_hint);
+ }
+
//ISM_TRANS_CMD_EXPAND_CANDIDATE
void expand_candidate () {
LOGD ("");
m_impl->set_ise_keyboard_mode (client_id, mode);
}
+//ISM_TRANS_CMD_SET_PREDICTION_HINT
+void InfoManager::set_prediction_hint (int client_id, String prediction_hint)
+{
+ m_impl->set_prediction_hint (client_id, prediction_hint);
+}
+
//ISM_TRANS_CMD_EXPAND_CANDIDATE
void InfoManager::expand_candidate ()
{
//ISM_TRANS_CMD_SET_KEYBOARD_MODE
void set_ise_keyboard_mode (int client_id, uint32 mode);
+ //ISM_TRANS_CMD_SET_PREDICTION_HINT
+ void set_prediction_hint (int client_id, String prediction_hint);
+
//ISM_TRANS_CMD_EXPAND_CANDIDATE
void expand_candidate ();
{
};
+/* ISM_TRANS_CMD_SET_PREDICTION_HINT */
+class MessageItemSetPredictionHint : public MessageItemHelper
+{
+public:
+ MessageItemSetPredictionHint() {}
+ virtual ~MessageItemSetPredictionHint() {}
+
+ String& get_message_ptr() { return m_prediction_hint; }
+protected:
+ String m_prediction_hint;
+};
+
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:
+ {
+ MessageItemSetPredictionHint *message = alloc_message<MessageItemSetPredictionHint>();
+ if (message) {
+ message->get_command_ref() = cmd;
+ if (transaction.get_data(message->get_message_ptr())) {
+ m_list_messages.push_back(message);
+ } else {
+ LOGW("wrong format of transaction\n");
+ dealloc_message<MessageItemSetPredictionHint>(message);
+ }
+ }
+ break;
+ }
}
}
LOGW ("not implemented for %s", m_name.c_str ());
}
+void PanelAgentBase::set_helper_prediction_hint (int client, uint32 context, const String& uuid, String& prediction_hint)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
bool PanelAgentBase::process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, uint32 serial)
{
LOGW ("not implemented for %s", m_name.c_str ());
virtual void set_helper_keyboard_mode (int client, uint32 context, const String& uuid, uint32& mode);
/**
+ * @brief set_helper_prediction_hint.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void set_helper_prediction_hint (int client, uint32 context, const String& uuid, String& prediction_hint);
+
+ /**
* @brief process_key_event.
*
* @param
_p->set_helper_keyboard_mode (id, context_id, uuid, mode);
}
+void PanelAgentManager::set_helper_prediction_hint (int id, uint32 context_id, const String& uuid, String& prediction_hint)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->set_helper_prediction_hint (id, context_id, uuid, prediction_hint);
+}
+
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 show_helper_option_window (int client, uint32 context, const String& uuid);
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);
bool process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, uint32 serial);
bool get_helper_geometry (int client, uint32 context, String& uuid, _OUT_ struct rectinfo& info);
void get_helper_imdata (int client, uint32 context, String& uuid, _OUT_ char** imdata, _OUT_ size_t& len);
typedef Signal5<void, const HelperAgent *, uint32 &, char *, size_t &, uint32 &>
HelperAgentSignalUintCharSizeUint;
+typedef Signal2<void, const HelperAgent *, const String &>
+ HelperAgentSignalStringVoid;
+
class HelperAgent::HelperAgentImpl
{
public:
HelperAgentSignalVoid signal_resume_option_window;
HelperAgentSignalUintVoid signal_check_option_window;
HelperAgentSignalUintCharSizeUint signal_process_input_device_event;
+ HelperAgentSignalStringVoid signal_set_prediction_hint;
public:
HelperAgentImpl (HelperAgent* thiz) : magic(0), magic_active(0), timeout(-1), focused_ic ((uint32) -1), thiz (thiz),
m_impl->hw_keyboard_mode = true;
break;
}
+ case ISM_TRANS_CMD_SET_PREDICTION_HINT:
+ {
+ MessageItemSetPredictionHint *subclass = static_cast<MessageItemSetPredictionHint*>(message);
+ LOGD("prediction_hint : %s\n", strdup (subclass->get_message_ptr().c_str ()));
+ m_impl->signal_set_prediction_hint (this, subclass->get_message_ptr());
+ break;
+ }
default:
break;
}
return m_impl->signal_process_input_device_event.connect (slot);
}
+/**
+ * @brief Connect a slot to Helper set prediction hint signal.
+ *
+ * This signal is used to send prediction hint to Helper ISE.
+ *
+ * The prototype of the slot is:
+ * void set_prediction_hint (const HelperAgent *agent, char *prediction_hint);
+ */
+Connection
+HelperAgent::signal_connect_set_prediction_hint (HelperAgentSlotStringVoid *slot)
+{
+ return m_impl->signal_set_prediction_hint.connect (slot);
+}
+
} /* namespace scim */
/*
typedef Slot5<void, const HelperAgent *, uint32 &, char *, size_t &, uint32 &>
HelperAgentSlotUintCharSizeUint;
+typedef Slot2<void, const HelperAgent *, const String &>
+ HelperAgentSlotStringVoid;
+
/**
* @brief The accessory class to write a Helper object.
*
* 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);
+
+ /**
+ * @brief Connect a slot to Helper set prediction hint signal.
+ *
+ * This signal is used to send prediction hint to Helper ISE.
+ *
+ * The prototype of the slot is:
+ * void set_prediction_hint (const HelperAgent *agent, char *prediction_hint);
+ */
+ Connection signal_connect_set_prediction_hint (HelperAgentSlotStringVoid *slot);
};
/** @} */
const int ISM_TRANS_CMD_PROCESS_INPUT_DEVICE_EVENT = 1126;
const int ISM_TRANS_CMD_RESUME_ISE_OPTION_WINDOW = 1127;
const int ISM_TRANS_CMD_SET_KEYBOARD_MODE = 1128;
+const int ISM_TRANS_CMD_SET_PREDICTION_HINT = 1129;
/* ISE/Panel to IMControl */
const int ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT = 1151;