Eina_Bool has_conformant;
char *prediction_hint;
+ char *mime_type;
//
};
set_autocapital (ctx);
+ if (strlen(imcontext->mime_type) > 0)
+ wl_text_input_set_mime_type(imcontext->text_input, imcontext->mime_type);
+
SECURE_LOGD ("ctx : %p, layout : %d, layout variation : %d\n", ctx,
layout, layout_variation);
SECURE_LOGD ("language : %d, cursor position : %d\n",
imcontext->prediction_hint = NULL;
}
+ if (imcontext->mime_type) {
+ free (imcontext->mime_type);
+ imcontext->mime_type = NULL;
+ }
+
if (imcontext->text_input)
wl_text_input_destroy (imcontext->text_input);
if (imcontext->prediction_hint)
wl_text_input_prediction_hint(imcontext->text_input, imcontext->prediction_hint);
+
+ if (strlen(imcontext->mime_type) > 0)
+ wl_text_input_set_mime_type(imcontext->text_input, imcontext->mime_type);
}
if (ecore_imf_context_input_panel_enabled_get(ctx))
}
}
+void
+wayland_im_context_mime_type_accept_set (Ecore_IMF_Context *ctx, const char *mime_type)
+{
+ WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx);
+ if (!imcontext) return;
+
+ imcontext->mime_type = strdup(mime_type);
+
+ if (imcontext->input && imcontext->text_input && (strlen(mime_type) > 0)) {
+ LOGD ("ctx : %p, mime_type : %s\n", ctx, imcontext->mime_type);
+ wl_text_input_set_mime_type(imcontext->text_input, imcontext->mime_type);
+ }
+}
+
WaylandIMContext *wayland_im_context_new (struct wl_text_input_manager *text_input_manager)
{
WaylandIMContext *context = calloc(1, sizeof(WaylandIMContext));
void
wayland_im_context_prediction_hint_set (Ecore_IMF_Context *ctx, const char *prediction_hint);
+void
+wayland_im_context_mime_type_accept_set (Ecore_IMF_Context *ctx, const char *mime_type);
+
WaylandIMContext *wayland_im_context_new (struct wl_text_input_manager *text_input_manager);
extern int _ecore_imf_wayland_log_dom;
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_prediction_hint_set /* prediction_hint_set */
+ wayland_im_context_prediction_hint_set, /* prediction_hint_set */
+ wayland_im_context_mime_type_accept_set /* mime_type_accept_set */
};
static struct wl_text_input_manager *text_input_manager = NULL;
m_send_trans.write_to_socket(client_socket);
}
+ void set_helper_mime_type (int client, uint32 context, const String& uuid, String& mime_type) {
+ 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_MIME_TYPE);
+ m_send_trans.put_data(mime_type);
+ 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);
WSCContextISF *get_focused_ic ();
void context_scim_imdata_get (WSCContextISF *wsc_ctx, void* data, int* length);
+void context_scim_mime_type_get (WSCContextISF *wsc_ctx, const char *mime_types);
void isf_wsc_context_add (WSCContextISF *wsc_ctx);
void isf_wsc_context_del (WSCContextISF *wsc_ctx);
g_info_manager->set_prediction_hint (get_panel_client_id (), String (prediction_hint));
return 0;
}
+
+int _isf_wsc_context_input_panel_mime_type_accept_set (int context, const char *mime_type)
+{
+ g_info_manager->set_ise_mime_type (get_panel_client_id (), String (mime_type));
+ 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);
+ int _isf_wsc_context_input_panel_mime_type_accept_set (int context, const char *mime_type);
#ifdef __cplusplus
}
int length = -1;
void *packet = NULL;
char imdata[1024] = {0};
+ char mime_type[1024] = {0};
bool input_panel_show = false;
input_panel_ctx = wsc_ctx;
Ise_Context iseContext;
/* set the size of imdata */
context_scim_imdata_get (wsc_ctx, (void *)imdata, &iseContext.imdata_size);
+ /* set the length of mime type */
+ context_scim_mime_type_get (wsc_ctx, mime_type);
+
/* set the cursor position of the editable widget */
wsc_context_surrounding_get (wsc_ctx, NULL, &iseContext.cursor_pos);
/* calculate packet size */
length = sizeof (iseContext);
length += iseContext.imdata_size;
+ length += strlen (mime_type);
/* create packet */
packet = calloc (1, length);
memcpy (packet, (void *)&iseContext, sizeof (iseContext));
memcpy ((void *)((char *)packet + sizeof (iseContext)), (void *)imdata, iseContext.imdata_size);
+ memcpy ((void *)((char *)packet + sizeof (iseContext) + iseContext.imdata_size), mime_type, strlen (mime_type));
int context_id = _get_context_id (wsc_ctx);
{
_isf_wsc_context_input_panel_prediction_hint_set (_get_context_id(ctx), prediction_hint);
}
+
+void isf_wsc_context_input_panel_mime_type_accept_set (WSCContextISF *ctx, const char *mime_type)
+{
+ _isf_wsc_context_input_panel_mime_type_accept_set (_get_context_id(ctx), mime_type);
+}
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);
+ void isf_wsc_context_input_panel_mime_type_accept_set (WSCContextISF *ctx, const char *mime_type);
#ifdef __cplusplus
}
Ecore_IMF_Input_Hints input_hint;
Ecore_IMF_BiDi_Direction bidi_direction;
Ecore_IMF_Input_Panel_Layout panel_layout;
+ String mime_type;
void *imdata;
int imdata_size;
int preedit_caret;
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;
+
+ LOGD ("im_context = %p, prediction hint = %s\n", im_ctx, prediction_hint);
if (!wsc_ctx) return;
isf_wsc_context_input_panel_prediction_hint_set (wsc_ctx, prediction_hint);
}
+static void
+_wsc_im_ctx_mime_type (void *data, struct wl_input_method_context *im_ctx, const char *mime_type)
+{
+ WSCContextISF *wsc_ctx = (WSCContextISF*)data;
+
+ LOGD ("im_context = %p, mime_type = %s\n", im_ctx, mime_type);
+ if (!wsc_ctx) return;
+
+ if (wsc_ctx->impl) {
+ wsc_ctx->impl->mime_type = strdup (mime_type);
+ }
+
+ isf_wsc_context_input_panel_mime_type_accept_set (wsc_ctx, mime_type);
+}
+
static const struct wl_input_method_context_listener wsc_im_context_listener = {
_wsc_im_ctx_reset,
_wsc_im_ctx_content_type,
_wsc_im_ctx_process_input_device_event,
_wsc_im_ctx_filter_key_event,
_wsc_im_ctx_captial_mode,
- _wsc_im_ctx_prediction_hint
+ _wsc_im_ctx_prediction_hint,
+ _wsc_im_ctx_mime_type
};
#if ENABLE_GRAB_KEYBOARD
rec->imdata_size = 0;
rec->parent = 0;
rec->client_window = 0;
+ rec->mime_type = String ();
rec->surrounding_text = WideString ();
rec->preedit_string = WideString ();
rec->preedit_attrlist.clear ();
}
}
+void context_scim_mime_type_get (WSCContextISF *wsc_ctx, const char *mime_type)
+{
+ WSCContextISF* context_scim = wsc_ctx;
+ LOGD ("");
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+
+ if (context_scim && context_scim->impl) {
+ if (!(context_scim->impl->mime_type).empty ())
+ memcpy ((void *)mime_type ,(context_scim->impl->mime_type).c_str (),
+ strlen ((context_scim->impl->mime_type).c_str ()));
+ }
+}
+
static char *
insert_text (const char *text, uint32_t offset, const char *insert)
{
return false;
}
+ bool set_helper_mime_type (const String& uuid, String mime_type) {
+ 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_MIME_TYPE message");
+ m_panel_agent_manager.set_helper_mime_type (it->second.id, ctx, uuid, mime_type);
+ return true;
+ }
+
+ return false;
+ }
+
//ISM_TRANS_CMD_SHOW_ISF_CONTROL
void show_isf_panel (int client_id) {
LOGD ("");
set_helper_prediction_hint (m_current_helper_uuid, prediction_hint);
}
+ //ISM_TRANS_CMD_SET_MIME_TYPE
+ void set_ise_mime_type (int client_id, String mime_type) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::set_mime_type ()\n";
+ LOGD ("");
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ set_helper_mime_type (m_current_helper_uuid, mime_type);
+ }
+
//ISM_TRANS_CMD_EXPAND_CANDIDATE
void expand_candidate () {
LOGD ("");
m_impl->set_prediction_hint (client_id, prediction_hint);
}
+//ISM_TRANS_CMD_SET_MIME_TYPE
+void InfoManager::set_ise_mime_type (int client_id, String mime_type)
+{
+ m_impl->set_ise_mime_type (client_id, mime_type);
+}
+
//ISM_TRANS_CMD_EXPAND_CANDIDATE
void InfoManager::expand_candidate ()
{
//ISM_TRANS_CMD_SET_PREDICTION_HINT
void set_prediction_hint (int client_id, String prediction_hint);
+ //ISM_TRANS_CMD_SET_MIME_TYPE
+ void set_ise_mime_type (int client_id, String mime_type);
+
//ISM_TRANS_CMD_EXPAND_CANDIDATE
void expand_candidate ();
MessageItemSetPredictionHint() {}
virtual ~MessageItemSetPredictionHint() {}
- String& get_message_ptr() { return m_prediction_hint; }
+ String& get_message_ref() { return m_prediction_hint; }
protected:
String m_prediction_hint;
};
+/* ISM_TRANS_CMD_SET_MIME_TYPE */
+class MessageItemSetMimeType : public MessageItemHelper
+{
+public:
+ MessageItemSetMimeType() {}
+ virtual ~MessageItemSetMimeType() {}
+
+ String& get_mime_type_ref() { return m_mime_type; }
+protected:
+ String m_mime_type;
+};
+
template <typename T>
inline T*
alloc_message() /* We could use memory pool in the future for performance enhancement */
MessageItemSetPredictionHint *message = alloc_message<MessageItemSetPredictionHint>();
if (message) {
message->get_command_ref() = cmd;
- if (transaction.get_data(message->get_message_ptr())) {
+ if (transaction.get_data(message->get_message_ref())) {
m_list_messages.push_back(message);
} else {
LOGW("wrong format of transaction\n");
}
break;
}
+ case ISM_TRANS_CMD_SET_MIME_TYPE:
+ {
+ MessageItemSetMimeType *message = alloc_message<MessageItemSetMimeType>();
+ if (message) {
+ message->get_command_ref() = cmd;
+ if (transaction.get_data(message->get_mime_type_ref())) {
+ m_list_messages.push_back(message);
+ } else {
+ LOGW("wrong format of transaction\n");
+ dealloc_message<MessageItemSetMimeType>(message);
+ }
+ }
+ break;
+ }
}
}
LOGW ("not implemented for %s", m_name.c_str ());
}
+void PanelAgentBase::set_helper_mime_type (int client, uint32 context, const String& uuid, String& mime_type)
+{
+ 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_prediction_hint (int client, uint32 context, const String& uuid, String& prediction_hint);
/**
+ * @brief set_helper_mime_type.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void set_helper_mime_type (int client, uint32 context, const String& uuid, String& mime_type);
+
+ /**
* @brief process_key_event.
*
* @param
_p->set_helper_prediction_hint (id, context_id, uuid, prediction_hint);
}
+void PanelAgentManager::set_helper_mime_type (int id, uint32 context_id, const String& uuid, String& mime_type)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->set_helper_mime_type (id, context_id, uuid, mime_type);
+}
+
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_mime_type (int client, uint32 context, const String& uuid, String& mime_type);
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);
HelperAgentSignalUintVoid signal_check_option_window;
HelperAgentSignalUintCharSizeUint signal_process_input_device_event;
HelperAgentSignalStringVoid signal_set_prediction_hint;
+ HelperAgentSignalStringVoid signal_set_mime_type;
public:
HelperAgentImpl (HelperAgent* thiz) : magic(0), magic_active(0), timeout(-1), focused_ic ((uint32) -1), thiz (thiz),
case ISM_TRANS_CMD_SET_PREDICTION_HINT:
{
MessageItemSetPredictionHint *subclass = static_cast<MessageItemSetPredictionHint*>(message);
- m_impl->signal_set_prediction_hint (this, subclass->get_message_ptr());
+ m_impl->signal_set_prediction_hint (this, subclass->get_message_ref());
+ break;
+ }
+ case ISM_TRANS_CMD_SET_MIME_TYPE:
+ {
+ MessageItemSetMimeType *subclass = static_cast<MessageItemSetMimeType*>(message);
+ if (m_impl->ise_show_flag || m_impl->hw_keyboard_mode) {
+ m_impl->signal_set_mime_type (this, subclass->get_mime_type_ref());
+ }
break;
}
default:
return m_impl->signal_set_prediction_hint.connect (slot);
}
+/**
+ * @brief Connect a slot to Helper set mime type signal.
+ *
+ * This signal is used to send mime type to Helper ISE.
+ *
+ * The prototype of the slot is:
+ * void set_mime_type (const HelperAgent *agent, char *mime_type);
+ */
+Connection
+HelperAgent::signal_connect_set_mime_type (HelperAgentSlotStringVoid *slot)
+{
+ return m_impl->signal_set_mime_type.connect (slot);
+}
+
} /* namespace scim */
/*
* void set_prediction_hint (const HelperAgent *agent, char *prediction_hint);
*/
Connection signal_connect_set_prediction_hint (HelperAgentSlotStringVoid *slot);
+
+ /**
+ * @brief Connect a slot to Helper set mime type signal.
+ *
+ * This signal is used to send mime type to Helper ISE.
+ *
+ * The prototype of the slot is:
+ * void set_mime_type (const HelperAgent *agent, char *mime_type);
+ */
+ Connection signal_connect_set_mime_type (HelperAgentSlotStringVoid *slot);
};
/** @} */
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;
+const int ISM_TRANS_CMD_SET_MIME_TYPE = 1130;
/* ISE/Panel to IMControl */
const int ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT = 1151;