static void panel_slot_set_selection (int context,
int start,
int end);
-
+static void panel_slot_send_private_command (int context,
+ const String &command);
static void panel_req_focus_in (EcoreIMFContextISF *ic);
static void panel_req_update_factory_info (EcoreIMFContextISF *ic);
static void panel_req_update_spot_location (EcoreIMFContextISF *ic);
static bool slot_set_selection (IMEngineInstanceBase *si,
int start,
int end);
-
static void slot_expand_candidate (IMEngineInstanceBase *si);
static void slot_contract_candidate (IMEngineInstanceBase *si);
static void slot_set_candidate_style (IMEngineInstanceBase *si,
ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line,
ISF_CANDIDATE_MODE_T mode);
+static void slot_send_private_command (IMEngineInstanceBase *si,
+ const String &command);
static void reload_config_callback (const ConfigPointer &config);
EcoreIMFContextISF *ic = find_ic (context);
- if (ic && ic->impl && _focused_ic == ic && ic->impl->si)
+ if (ic && ic->impl && ic->impl->si && _focused_ic == ic)
slot_set_selection (ic->impl->si, start, end);
}
{
EcoreIMFContextISF *ic = find_ic (context);
SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " number=" << number << " ic=" << ic << "\n";
- if (ic && ic->impl && _focused_ic == ic && ic->impl->si) {
+ if (ic && ic->impl && ic->impl->si && _focused_ic == ic) {
_panel_client.prepare (ic->id);
ic->impl->si->update_displayed_candidate_number (number);
_panel_client.send ();
{
EcoreIMFContextISF *ic = find_ic (context);
SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
- if (ic && ic->impl && _focused_ic == ic && ic->impl->si) {
+ if (ic && ic->impl && ic->impl->si && _focused_ic == ic) {
_panel_client.prepare (ic->id);
ic->impl->si->candidate_more_window_show ();
_panel_client.send ();
{
EcoreIMFContextISF *ic = find_ic (context);
SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
- if (ic && ic->impl && _focused_ic == ic && ic->impl->si) {
+ if (ic && ic->impl && ic->impl->si && _focused_ic == ic) {
_panel_client.prepare (ic->id);
ic->impl->si->candidate_more_window_hide ();
_panel_client.send ();
{
EcoreIMFContextISF *ic = find_ic (context);
SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " index=" << index << " ic=" << ic << "\n";
- if (ic && ic->impl && _focused_ic == ic && ic->impl->si) {
+ if (ic && ic->impl && ic->impl->si && _focused_ic == ic) {
_panel_client.prepare (ic->id);
ic->impl->si->longpress_candidate (index);
_panel_client.send ();
process_update_input_context (type, value);
}
+static void
+panel_slot_send_private_command (int context, const String &command)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = find_ic (context);
+
+ if (ic && ic->impl && ic->impl->si && _focused_ic == ic)
+ slot_send_private_command (ic->impl->si, command);
+}
+
/* Panel Requestion functions. */
static void
panel_req_show_help (EcoreIMFContextISF *ic)
_panel_client.signal_connect_longpress_candidate (slot (panel_slot_longpress_candidate));
_panel_client.signal_connect_update_ise_input_context (slot (panel_slot_update_ise_input_context));
_panel_client.signal_connect_update_isf_candidate_panel (slot (panel_slot_update_isf_candidate_panel));
+ _panel_client.signal_connect_send_private_command (slot (panel_slot_send_private_command));
if (!panel_initialize ()) {
std::cerr << "Ecore IM Module: Cannot connect to Panel!\n";
si->signal_connect_set_candidate_style (
slot (slot_set_candidate_style));
+
+ si->signal_connect_send_private_command (
+ slot (slot_send_private_command));
}
// Implementation of slot functions
EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
- if (ic && ic->impl && _focused_ic == ic) {
+ if (_focused_ic && _focused_ic == ic) {
Ecore_IMF_Event_Delete_Surrounding ev;
ev.ctx = _focused_ic->ctx;
ev.n_chars = len;
#ifdef _WEARABLE
EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
- if (ic && ic->impl && _focused_ic == ic) {
+ if (_focused_ic && _focused_ic == ic) {
char *selection = NULL;
if (ecore_imf_context_selection_get (_focused_ic->ctx, &selection)) {
SCIM_DEBUG_FRONTEND(2) << "Selection: " << selection <<"\n";
#ifdef _WEARABLE
EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
- if (ic && ic->impl && _focused_ic == ic) {
+ if (_focused_ic && _focused_ic == ic) {
Ecore_IMF_Event_Selection ev;
ev.ctx = _focused_ic->ctx;
ev.start = start;
_panel_client.set_candidate_style (ic->id, portrait_line, mode);
}
+static void
+slot_send_private_command (IMEngineInstanceBase *si,
+ const String &command)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
+
+ if (_focused_ic && _focused_ic == ic) {
+ ecore_imf_context_event_callback_call (_focused_ic->ctx, ECORE_IMF_CALLBACK_PRIVATE_COMMAND_SEND, (void *)command.c_str ());
+ }
+}
+
static void
reload_config_callback (const ConfigPointer &config)
{
return ret;
}
+void
+SocketFrontEnd::send_private_command (int id, const String &command)
+{
+ if (m_current_instance == id) {
+ m_send_trans.put_command (SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND);
+ m_temp_trans.put_data (command);
+ }
+}
+
void
SocketFrontEnd::expand_candidate (int id)
{
ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line,
ISF_CANDIDATE_MODE_T mode);
+ virtual void send_private_command (int id, const String &command);
+
public:
virtual void init (int argc, char **argv);
virtual void run ();
virtual bool get_selection (int siid, WideString &text);
virtual bool set_selection (int siid, int start, int end);
+ virtual void send_private_command (int siid, const String & command);
+
public:
virtual void init (int argc, char **argv);
virtual void run ();
cont = true;
break;
}
+ case SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND:
+ {
+ String command;
+ if (trans.get_data (command)) {
+ send_private_command (command);
+ }
+ break;
+ }
case ISM_TRANS_CMD_EXPAND_CANDIDATE:
{
SCIM_DEBUG_IMENGINE(3) << " expand_candidate ()\n";
m_orig->signal_connect_set_selection (
slot (this, &FilterInstanceBase::FilterInstanceBaseImpl::slot_set_selection));
+
+ m_orig->signal_connect_send_private_command (
+ slot (this, &FilterInstanceBase::FilterInstanceBaseImpl::slot_send_private_command));
}
}
bool slot_set_selection (IMEngineInstanceBase * si, int start, int end) {
return m_parent->filter_set_selection (start, end);
}
+
+ void slot_send_private_command (IMEngineInstanceBase * si, const String & command) {
+ m_parent->filter_send_private_command (command);
+ }
};
FilterInstanceBase::FilterInstanceBase (FilterFactoryBase *factory,
return set_selection (start, end);
}
+void
+FilterInstanceBase::filter_send_private_command (const String &command)
+{
+ send_private_command (command);
+}
+
} // namespace scim
/*
virtual bool filter_delete_surrounding_text (int offset, int len);
virtual bool filter_get_selection (WideString &text);
virtual bool filter_set_selection (int start, int end);
+ virtual void filter_send_private_command (const String &command);
/** @} */
};
m_frontend->set_candidate_style (si->get_id (), portrait_line, mode);
}
+ void slot_send_private_command(IMEngineInstanceBase * si, const String & command) {
+ m_frontend->send_private_command (si->get_id (), command);
+ }
+
void attach_instance (const IMEngineInstancePointer &si)
{
si->signal_connect_show_preedit_string (
si->signal_connect_set_candidate_style (
slot (this, &FrontEndBase::FrontEndBaseImpl::slot_set_candidate_style));
+
+ si->signal_connect_send_private_command (
+ slot (this, &FrontEndBase::FrontEndBaseImpl::slot_send_private_command));
}
};
{
}
void
+FrontEndBase::send_private_command (int id, const String & command)
+{
+}
+void
FrontEndBase::dump_instances (void)
{
SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
virtual void set_candidate_style (int id,
ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line,
ISF_CANDIDATE_MODE_T mode);
+
+ /**
+ * @brief Send a private command to an application.
+ *
+ * @param id the id of the IMEngine instance. It must have been focused in.
+ * @param command The private command
+ */
+ virtual void send_private_command (int id, const String &command);
+
/**
* @}
*/
}
/**
- * @brief Request to selected text.
+ * @brief Request to select text.
*
* @param start The start position in text.
* @param end The end position in text.
}
}
+/**
+ * @brief Send a private command to an application.
+ *
+ * @param command The private command sent from IME.
+ */
+void
+HelperAgent::send_private_command (const String &command) const
+{
+ if (m_impl->socket_active.is_connected ()) {
+ m_impl->send.clear ();
+ m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
+ m_impl->send.put_data (m_impl->magic_active);
+ m_impl->send.put_command (SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND);
+ m_impl->send.put_data (command);
+ m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
+ }
+}
+
/**
* @brief Request to get uuid list of all keyboard ISEs.
*
*/
void reset_keyboard_ise (void) const;
+ /**
+ * @brief Send a private command to an application
+ *
+ * @param command The private command sent from IME.
+ */
+ void send_private_command (const String &command) const;
+
public:
/**
* @brief Connect a slot to Helper exit signal.
IMEngineSignalCandidateStyle m_signal_set_candidate_style;
+ IMEngineSignalString m_signal_send_private_command;
+
int m_id;
void * m_frontend_data;
return m_impl->m_signal_set_candidate_style.connect (slot);
}
+Connection
+IMEngineInstanceBase::signal_connect_send_private_command (IMEngineSlotString *slot)
+{
+ return m_impl->m_signal_send_private_command.connect (slot);
+}
+
void
IMEngineInstanceBase::show_preedit_string ()
{
{
}
+void
+IMEngineInstanceBase::send_private_command (const String &command)
+{
+ m_impl->m_signal_send_private_command (this, command);
+}
+
// implementation of DummyIMEngine
DummyIMEngineFactory::DummyIMEngineFactory ()
{
SCIM_CLIENT_CAP_ONTHESPOT_PREEDIT = (1 << 0), /**< The client support OnTheSpot preedit (embed preedit string into client window) */
SCIM_CLIENT_CAP_SINGLE_LEVEL_PROPERTY = (1 << 1), /**< The client support displaying single level property, property tree may not be supported*/
SCIM_CLIENT_CAP_MULTI_LEVEL_PROPERTY = (1 << 2), /**< The client support displaying multiple level property, aka. property tree */
- SCIM_CLIENT_CAP_TRIGGER_PROPERTY = (1 << 3), /**< The client is capabile to trigger the IMEngine property. */
+ SCIM_CLIENT_CAP_TRIGGER_PROPERTY = (1 << 3), /**< The client is capable to trigger the IMEngine property. */
SCIM_CLIENT_CAP_HELPER_MODULE = (1 << 4), /**< The client support helper module */
SCIM_CLIENT_CAP_SURROUNDING_TEXT = (1 << 5), /**< The client support get/delete surrounding text operations */
SCIM_CLIENT_CAP_ALL_CAPABILITIES = 0x3F
Connection signal_connect_contract_candidate (IMEngineSlotVoid *slot);
Connection signal_connect_set_candidate_style (IMEngineSlotCandidateStyle *slot);
+
+ Connection signal_connect_send_private_command (IMEngineSlotString *slot);
/** @} */
public:
/**
* @brief Commit a string to the client application.
*
- * The preedit string should be hid before calling
+ * The preedit string should be hidden before calling
* this method. Otherwise the clients which use
* OnTheSpot input mode will flicker annoyingly.
*
*
* @param text location to store the context string around the insertion point.
* @param cursor location to store index of the insertion cursor within @text.
- * @param maxlen_before the maxmium length of context string to be retrieved
+ * @param maxlen_before the maximum length of context string to be retrieved
* before the cursor; -1 means unlimited.
- * @param maxlen_after the maxmium length of context string to be retrieved
+ * @param maxlen_after the maximum length of context string to be retrieved
* after the cursor; -1 means unlimited.
*
* @return true if surrounding text was provided.
void set_candidate_style (ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line = ONE_LINE_CANDIDATE,
ISF_CANDIDATE_MODE_T mode = FIXED_CANDIDATE_WINDOW);
+ void send_private_command (const String &command);
+
/** @} */
};
socket_helper_get_selection (client_id);
} else if (cmd == SCIM_TRANS_CMD_SET_SELECTION) {
socket_helper_set_selection (client_id);
+ } else if (cmd == SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND) {
+ socket_helper_send_private_command (client_id);
} else if (cmd == ISM_TRANS_CMD_UPDATE_ISE_EXIT) {
HelperInfoRepository::iterator hiit = m_helper_active_info_repository.find (client.get_id ());
if (hiit != m_helper_active_info_repository.end ()) {
}
}
+ void socket_helper_send_private_command (int client)
+ {
+ SCIM_DEBUG_MAIN(4) << __FUNCTION__ << " (" << client << ")\n";
+
+ String command;
+
+ if (m_recv_trans.get_data (command)) {
+ int focused_client;
+ uint32 focused_context;
+ String focused_uuid = get_focused_context (focused_client, focused_context);
+
+ ClientInfo client_info = socket_get_client_info (focused_client);
+ if (client_info.type == FRONTEND_CLIENT) {
+ Socket socket_client (focused_client);
+ lock ();
+ m_send_trans.clear ();
+ m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data (focused_context);
+ m_send_trans.put_command (SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND);
+ m_send_trans.put_data (command);
+ m_send_trans.write_to_socket (socket_client);
+ unlock ();
+ }
+ }
+ }
+
void socket_reset_helper_input_context (const String &uuid, int client, uint32 context)
{
HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
PanelClientSignalInt m_signal_longpress_candidate;
PanelClientSignalIntInt m_signal_update_ise_input_context;
PanelClientSignalIntInt m_signal_update_isf_candidate_panel;
+ PanelClientSignalString m_signal_send_private_command;
public:
PanelClientImpl ()
m_signal_update_isf_candidate_panel ((int) context, (int)type, (int)value);
}
break;
+ case SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND:
+ {
+ String str;
+ if (recv.get_data (str))
+ m_signal_send_private_command ((int) context, str);
+ }
+ break;
default:
break;
}
m_signal_longpress_candidate.reset();
m_signal_update_ise_input_context.reset();
m_signal_update_isf_candidate_panel.reset();
+ m_signal_send_private_command.reset();
}
Connection signal_connect_reload_config (PanelClientSlotVoid *slot)
return m_signal_hide_preedit_string.connect (slot);
}
- Connection signal_connect_update_preedit_string (PanelClientSlotStringAttrsInt *slot)
+ Connection signal_connect_update_preedit_string (PanelClientSlotStringAttrsInt *slot)
{
return m_signal_update_preedit_string.connect (slot);
}
return m_signal_delete_surrounding_text.connect (slot);
}
- Connection signal_connect_get_selection (PanelClientSlotVoid *slot)
+ Connection signal_connect_get_selection (PanelClientSlotVoid *slot)
{
return m_signal_get_selection.connect (slot);
}
return m_signal_update_isf_candidate_panel.connect (slot);
}
+ Connection signal_connect_send_private_command (PanelClientSlotString *slot)
+ {
+ return m_signal_send_private_command.connect (slot);
+ }
+
private:
void launch_panel (const String &config, const String &display) const
{
}
Connection
-PanelClient::signal_connect_get_selection (PanelClientSlotVoid *slot)
+PanelClient::signal_connect_get_selection (PanelClientSlotVoid *slot)
{
return m_impl->signal_connect_get_selection (slot);
}
return m_impl->signal_connect_update_isf_candidate_panel (slot);
}
+Connection
+PanelClient::signal_connect_send_private_command (PanelClientSlotString *slot)
+{
+ return m_impl->signal_connect_send_private_command (slot);
+}
+
} /* namespace scim */
/*
*/
Connection signal_connect_update_isf_candidate_panel (PanelClientSlotIntInt *slot);
+ /**
+ * @brief Signal: send private command
+ *
+ * slot prototype: void send_private_command (int context, const String & command);
+ */
+ Connection signal_connect_send_private_command (PanelClientSlotString *slot);
+
/** @} */
};
const int ISM_TRANS_CMD_TRANSACTION_CONTINUE = 173;
const int SCIM_TRANS_CMD_GET_SELECTION = 174;
const int SCIM_TRANS_CMD_SET_SELECTION = 175;
+const int SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND = 176;
// Socket IMEngine to Socket FrontEnd
const int SCIM_TRANS_CMD_NEW_INSTANCE = 200;