unlock();
}
- void remote_delete_surrounding_text(int client, uint32 context_id, uint32 offset, uint32 len) {
+ void remote_delete_surrounding_text (int client, uint32 context_id, uint32 offset, uint32 len) {
SCIM_DEBUG_MAIN(4) << __FUNCTION__ << " (" << client << ")\n";
LOGD ("client id:%d\n", client);
m_send_trans.write_to_socket(socket_client);
unlock();
}
+
+ void set_prediction_allow (int client, uint32 context, String uuid, int mode) {
+ LOGD ("client id:%d\n", 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_ALLOW);
+ m_send_trans.put_data((uint32) mode);
+
+ Socket client_socket(client);
+ m_send_trans.write_to_socket(client_socket);
+ }
private:
static void send_fail_reply (int client_id)
isf_wsc_context_input_panel_layout_set (wsc_ctx,
wsc_context_input_panel_layout_get (wsc_ctx));
+ g_info_manager->set_prediction_allow (WAYLAND_MODULE_CLIENT_ID,
+ wsc_context_prediction_allow_get (wsc_ctx));
isf_wsc_context_autocapital_type_set (wsc_ctx, wsc_context_autocapital_type_get (wsc_ctx));
std::cerr << __func__ << " is failed!!!\n";
return false;
+ }
+
+ bool set_prediction_allow (int client, int mode) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || (m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)) {
+ 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_prediction_allow (it->second.id, ctx, m_current_helper_uuid, mode);
+ return true;
+ }
+ }
+
+ std::cerr << __func__ << " is failed!!!\n";
+ return false;
}
const String& get_focused_context (int& client, uint32& context, bool force_last_context = false) const {
return m_impl->set_autocapital_type (mode);
}
+void InfoManager::set_prediction_allow (int client, bool mode)
+{
+ m_impl->set_prediction_allow (client, mode);
+}
+
//////////////////////////////////Message function end/////////////////////////////////////////
bool set_autocapital_type (int mode);
+ void set_prediction_allow (int client, bool mode);
+
//////////////////////////////////Message function end/////////////////////////////////////////
uint32 m_auto_capital_type;
};
+/* ISM_TRANS_CMD_SET_PREDICTION_ALLOW */
+class MessageItemSetPredictionAllow : public MessageItemHelper
+{
+public:
+ MessageItemSetPredictionAllow() : m_prediction_allow(1) {}
+ virtual ~MessageItemSetPredictionAllow() {}
+
+ uint32& get_prediction_allow_ref() { return m_prediction_allow; }
+protected:
+ uint32 m_prediction_allow;
+};
+
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_ALLOW:
+ {
+ MessageItemSetPredictionAllow *message = alloc_message<MessageItemSetPredictionAllow>();
+ if (message) {
+ message->get_command_ref() = cmd;
+ if (transaction.get_data(message->get_prediction_allow_ref())) {
+ m_list_messages.push_back(message);
+ } else {
+ LOGW("wrong format of transaction\n");
+ dealloc_message<MessageItemSetPredictionAllow>(message);
+ }
+ }
+ break;
+ }
}
}
LOGD ("not implemented ");
}
+void PanelAgentBase::set_prediction_allow (int client, uint32 context, String uuid, int mode)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
} /* namespace scim */
/*
* @return none.
*/
virtual void remote_delete_surrounding_text (int client, uint32 context, uint32 offset, uint32 len);
+
+ /**
+ * @brief set_prediction_allow.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void set_prediction_allow (int client, uint32 context, String uuid, int mode);
};
/** @} */
_p->remote_delete_surrounding_text (id, context_id, offset, len);
}
+void PanelAgentManager::set_prediction_allow (int id, uint32 context_id, String uuid, int mode)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->set_prediction_allow (id, context_id, uuid, mode);
+}
+
} /* namespace scim */
/*
void remote_forward_key_event (int target_client, uint32 target_context, const KeyEvent &key);
void remote_commit_string (int target_client, uint32 target_context,const WideString& wstr);
void remote_delete_surrounding_text (int client, uint32 context_id, uint32 offset, uint32 len);
+ void set_prediction_allow (int id, uint32 context_id, String uuid, int mode);
};
/** @} */
if (!m_impl->si.null ()) m_impl->si->set_autocapital_type(subclass->get_auto_capital_type_ref());
break;
}
+ case ISM_TRANS_CMD_SET_PREDICTION_ALLOW:
+ {
+ MessageItemSetPredictionAllow *subclass = static_cast<MessageItemSetPredictionAllow*>(message);
+ if (!m_impl->si.null ()) m_impl->si->set_prediction_allow(subclass->get_prediction_allow_ref() == 0 ? false : true);
+ break;
+ }
default:
break;
}