1 /** @file scim_helper.cpp
2 * @brief Implementation of class HelperAgent.
5 /* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
8 * Smart Common Input Method
10 * Copyright (c) 2004-2005 James Su <suzhe@tsinghua.org.cn>
11 * Copyright (c) 2012-2015 Samsung Electronics Co., Ltd.
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2 of the License, or (at your option) any later version.
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License for more details.
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this program; if not, write to the
26 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
27 * Boston, MA 02111-1307 USA
29 * Modifications by Samsung Electronics Co., Ltd.
30 * 1. Add new interface APIs for keyboard ISE
31 * a. expand_candidate (), contract_candidate () and set_candidate_style ()
32 * b. set_keyboard_ise_by_uuid () and reset_keyboard_ise ()
33 * c. get_surrounding_text () and delete_surrounding_text ()
34 * d. show_preedit_string (), hide_preedit_string (), update_preedit_string () and update_preedit_caret ()
35 * e. show_candidate_string (), hide_candidate_string () and update_candidate_string ()
37 * $Id: scim_helper.cpp,v 1.13 2005/05/24 12:22:51 suzhe Exp $
41 #define Uses_SCIM_TRANSACTION
42 #define Uses_SCIM_TRANS_COMMANDS
43 #define Uses_SCIM_HELPER
44 #define Uses_SCIM_SOCKET
45 #define Uses_SCIM_EVENT
46 #define Uses_SCIM_BACKEND
47 #define Uses_SCIM_IMENGINE_MODULE
52 #include <Ecore_IMF.h>
54 #include "scim_private.h"
56 #include <scim_panel_common.h>
57 #include "isf_query_utility.h"
59 #include "isf_debug.h"
60 #include "isf_message_queue.h"
61 #include "tizen_profile.h"
62 #ifdef HAVE_PKGMGR_INFO
63 #include <pkgmgr-info.h>
64 #endif // HAVE_PKGMGR_INFO
65 #include "isf_device_event.h"
70 #define LOG_TAG "SCIM_HELPER"
73 //FIXME: remove this definitions
74 #define SHIFT_MODE_OFF 0xffe1
75 #define SHIFT_MODE_ON 0xffe2
76 #define SHIFT_MODE_LOCK 0xffe6
77 #define SHIFT_MODE_ENABLE 0x9fe7
78 #define SHIFT_MODE_DISABLE 0x9fe8
82 typedef Signal3<void, const HelperAgent *, int, const String &>
83 HelperAgentSignalVoid;
85 typedef Signal4<void, const HelperAgent *, int, const String &, const String &>
86 HelperAgentSignalString;
88 typedef Signal4<void, const HelperAgent *, int, const String &, const std::vector<String> &>
89 HelperAgentSignalStringVector;
91 typedef Signal5<void, const HelperAgent *, int, const String &, const String &, const String &>
92 HelperAgentSignalString2;
94 typedef Signal4<void, const HelperAgent *, int, const String &, int>
97 typedef Signal5<void, const HelperAgent *, int, const String &, int, int>
98 HelperAgentSignalIntInt;
100 typedef Signal4<void, const HelperAgent *, int, const String &, const Transaction &>
101 HelperAgentSignalTransaction;
103 typedef Signal4<void, const HelperAgent *, int, const String &, const rectinfo &>
104 HelperAgentSignalRect;
106 typedef Signal2<void, const HelperAgent *, struct rectinfo &>
107 HelperAgentSignalSize;
109 typedef Signal2<void, const HelperAgent *, uint32 &>
110 HelperAgentSignalUintVoid;
112 typedef Signal3<void, const HelperAgent *, int, uint32 &>
113 HelperAgentSignalIntUint;
115 typedef Signal3 <void, const HelperAgent *, char *, size_t &>
116 HelperAgentSignalRawVoid;
118 typedef Signal3 <void, const HelperAgent *, char **, size_t &>
119 HelperAgentSignalGetRawVoid;
121 typedef Signal4 <void, const HelperAgent *, int, char *, size_t &>
122 HelperAgentSignalIntRawVoid;
124 typedef Signal3 <void, const HelperAgent *, int, char **>
125 HelperAgentSignalIntGetStringVoid;
127 typedef Signal2<void, const HelperAgent *, const std::vector<uint32> &>
128 HelperAgentSignalUintVector;
130 typedef Signal2<void, const HelperAgent *, LookupTable &>
131 HelperAgentSignalLookupTable;
133 typedef Signal3<void, const HelperAgent *, KeyEvent &, uint32 &>
134 HelperAgentSignalKeyEventUint;
136 typedef Signal4<void, const HelperAgent *, KeyEvent &, uint32 &, uint32>
137 HelperAgentSignalKeyEventUintUint;
139 typedef Signal5<void, const HelperAgent *, uint32 &, char *, size_t &, uint32 &>
140 HelperAgentSignalUintCharSizeUint;
142 typedef Signal2<void, const HelperAgent *, const String &>
143 HelperAgentSignalStringVoid;
145 class HelperAgent::HelperAgentImpl
149 SocketClient socket_active;
158 IMEngineInstancePointer si;
159 ConfigPointer m_config;
160 IMEngineModule engine_module;
162 char* surrounding_text;
163 char* selection_text;
165 int need_update_surrounding_text;
166 int need_update_selection_text;
169 bool need_update_entry_metadata;
171 char* finalized_text;
172 uint32 finalized_cursor_pos;
174 HelperAgentSignalVoid signal_exit;
175 HelperAgentSignalVoid signal_attach_input_context;
176 HelperAgentSignalVoid signal_detach_input_context;
177 HelperAgentSignalVoid signal_reload_config;
178 HelperAgentSignalInt signal_update_screen;
179 HelperAgentSignalIntInt signal_update_spot_location;
180 HelperAgentSignalInt signal_update_cursor_position;
181 HelperAgentSignalInt signal_update_surrounding_text;
182 HelperAgentSignalVoid signal_update_selection;
183 HelperAgentSignalString signal_trigger_property;
184 HelperAgentSignalTransaction signal_process_imengine_event;
185 HelperAgentSignalVoid signal_focus_out;
186 HelperAgentSignalVoid signal_focus_in;
187 HelperAgentSignalIntRawVoid signal_ise_show;
188 HelperAgentSignalVoid signal_ise_hide;
189 HelperAgentSignalVoid signal_candidate_show;
190 HelperAgentSignalVoid signal_candidate_hide;
191 HelperAgentSignalSize signal_get_geometry;
192 HelperAgentSignalUintVoid signal_set_mode;
193 HelperAgentSignalUintVoid signal_set_language;
194 HelperAgentSignalRawVoid signal_set_imdata;
195 HelperAgentSignalGetRawVoid signal_get_imdata;
196 HelperAgentSignalIntGetStringVoid signal_get_language_locale;
197 HelperAgentSignalUintVoid signal_set_return_key_type;
198 HelperAgentSignalUintVoid signal_get_return_key_type;
199 HelperAgentSignalUintVoid signal_set_return_key_disable;
200 HelperAgentSignalUintVoid signal_get_return_key_disable;
201 HelperAgentSignalUintVoid signal_set_layout;
202 HelperAgentSignalUintVoid signal_get_layout;
203 HelperAgentSignalUintVoid signal_set_caps_mode;
204 HelperAgentSignalVoid signal_reset_input_context;
205 HelperAgentSignalIntInt signal_update_candidate_ui;
206 HelperAgentSignalRect signal_update_candidate_geometry;
207 HelperAgentSignalString2 signal_update_keyboard_ise;
208 HelperAgentSignalStringVector signal_update_keyboard_ise_list;
209 HelperAgentSignalVoid signal_candidate_more_window_show;
210 HelperAgentSignalVoid signal_candidate_more_window_hide;
211 HelperAgentSignalLookupTable signal_update_lookup_table;
212 HelperAgentSignalInt signal_select_aux;
213 HelperAgentSignalInt signal_select_candidate;
214 HelperAgentSignalVoid signal_candidate_table_page_up;
215 HelperAgentSignalVoid signal_candidate_table_page_down;
216 HelperAgentSignalInt signal_update_candidate_table_page_size;
217 HelperAgentSignalUintVector signal_update_candidate_item_layout;
218 HelperAgentSignalInt signal_select_associate;
219 HelperAgentSignalVoid signal_associate_table_page_up;
220 HelperAgentSignalVoid signal_associate_table_page_down;
221 HelperAgentSignalInt signal_update_associate_table_page_size;
222 HelperAgentSignalVoid signal_reset_ise_context;
223 HelperAgentSignalUintVoid signal_turn_on_log;
224 HelperAgentSignalInt signal_update_displayed_candidate_number;
225 HelperAgentSignalInt signal_longpress_candidate;
226 HelperAgentSignalKeyEventUint signal_process_key_event;
227 HelperAgentSignalKeyEventUintUint signal_process_key_event_with_keycode;
228 HelperAgentSignalUintVoid signal_set_input_mode;
229 HelperAgentSignalUintVoid signal_set_input_hint;
230 HelperAgentSignalUintVoid signal_update_bidi_direction;
231 HelperAgentSignalVoid signal_show_option_window;
232 HelperAgentSignalVoid signal_resume_option_window;
233 HelperAgentSignalUintVoid signal_check_option_window;
234 HelperAgentSignalUintCharSizeUint signal_process_input_device_event;
235 HelperAgentSignalStringVoid signal_set_prediction_hint;
236 HelperAgentSignalStringVoid signal_set_mime_type;
237 HelperAgentSignalString signal_set_prediction_hint_data;
238 HelperAgentSignalUintVoid signal_set_optimization_hint;
239 HelperAgentSignalKeyEventUint signal_process_key_event_with_imengine;
240 HelperAgentSignalUintVoid signal_set_autocapital_type;
241 HelperAgentSignalUintVoid signal_set_prediction_allow;
244 HelperAgentImpl (HelperAgent* thiz) : magic(0), magic_active(0), timeout(-1), focused_ic ((uint32) -1), thiz (thiz),
245 surrounding_text (NULL), selection_text (NULL), cursor_pos (0),
246 need_update_surrounding_text (0), need_update_selection_text (0),
247 layout (0), ise_show_flag (false), need_update_entry_metadata (true), ise_focus_flag (false),
248 finalized_text(NULL), finalized_cursor_pos(0) {
251 ~HelperAgentImpl () {
256 if (surrounding_text != NULL)
257 free (surrounding_text);
259 if (finalized_text != NULL)
260 free(finalized_text);
262 if (selection_text != NULL)
263 free (selection_text);
265 if (engine_module.valid ()) {
266 engine_module.unload ();
270 // Implementation of slot functions
272 slot_show_preedit_string (IMEngineInstanceBase *si)
274 thiz->show_preedit_string (focused_ic, "");
278 slot_show_aux_string (IMEngineInstanceBase *si)
280 thiz->show_aux_string ();
284 slot_show_lookup_table (IMEngineInstanceBase *si)
286 thiz->show_candidate_string ();
290 slot_hide_preedit_string (IMEngineInstanceBase *si)
292 thiz->hide_preedit_string (focused_ic, "");
296 slot_hide_aux_string (IMEngineInstanceBase *si)
298 thiz->hide_aux_string ();
302 slot_hide_lookup_table (IMEngineInstanceBase *si)
304 thiz->hide_candidate_string ();
308 slot_update_preedit_caret (IMEngineInstanceBase *si, int caret)
310 thiz->update_preedit_caret (caret);
314 slot_update_preedit_string (IMEngineInstanceBase *si,
315 const WideString & str,
316 const AttributeList & attrs,
319 thiz->update_preedit_string (-1, "", str, attrs, caret);
323 slot_update_preedit_string_with_commit (IMEngineInstanceBase *si,
324 const WideString & preedit,
325 const WideString & commit,
326 const AttributeList & attrs,
329 thiz->update_preedit_string (-1, "", preedit, commit, attrs, caret);
333 slot_update_aux_string (IMEngineInstanceBase *si,
334 const WideString & str,
335 const AttributeList & attrs)
337 thiz->update_aux_string (utf8_wcstombs(str), attrs);
341 slot_commit_string (IMEngineInstanceBase *si,
342 const WideString & str)
344 thiz->commit_string (-1, "", str);
348 slot_recapture_string (IMEngineInstanceBase *si,
351 const WideString & preedit,
352 const WideString & commit,
353 const AttributeList & attrs)
355 thiz->recapture_string (-1, "", offset, len, preedit, commit, attrs);
359 slot_forward_key_event (IMEngineInstanceBase *si,
360 const KeyEvent & key)
362 thiz->forward_key_event (-1, "", key);
366 slot_update_lookup_table (IMEngineInstanceBase *si,
367 const LookupTable & table)
369 thiz->update_candidate_string (table);
373 slot_register_properties (IMEngineInstanceBase *si,
374 const PropertyList & properties)
376 thiz->register_properties (properties);
380 slot_update_property (IMEngineInstanceBase *si,
381 const Property & property)
383 thiz->update_property (property);
387 slot_beep (IMEngineInstanceBase *si)
393 slot_start_helper (IMEngineInstanceBase *si,
394 const String &helper_uuid)
396 LOGW ("deprecated function");
400 slot_stop_helper (IMEngineInstanceBase *si,
401 const String &helper_uuid)
403 LOGW ("deprecated function");
407 slot_send_helper_event (IMEngineInstanceBase *si,
408 const String &helper_uuid,
409 const Transaction &trans)
411 signal_process_imengine_event (thiz, focused_ic, helper_uuid, trans);
415 slot_get_surrounding_text (IMEngineInstanceBase *si,
422 thiz->get_surrounding_text (maxlen_before, maxlen_after, _text, cursor);
423 text = utf8_mbstowcs(_text);
428 slot_delete_surrounding_text (IMEngineInstanceBase *si,
433 thiz->delete_surrounding_text (offset, len);
438 slot_get_selection (IMEngineInstanceBase *si,
442 thiz->get_selection_text (_text);
443 text = utf8_mbstowcs (_text);
448 slot_set_selection (IMEngineInstanceBase *si,
452 thiz->set_selection (start, end);
457 slot_expand_candidate (IMEngineInstanceBase *si)
459 thiz->expand_candidate ();
463 slot_contract_candidate (IMEngineInstanceBase *si)
465 thiz->contract_candidate ();
469 slot_set_candidate_style (IMEngineInstanceBase *si, ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line, ISF_CANDIDATE_MODE_T mode)
471 thiz->set_candidate_style (portrait_line, mode);
475 slot_send_private_command (IMEngineInstanceBase *si,
476 const String &command)
478 thiz->send_private_command (command);
482 slot_commit_content (IMEngineInstanceBase *si,
483 const String &content,
484 const String &description,
485 const String &mime_types)
488 thiz->commit_content (content, description, mime_types);
494 si->signal_connect_show_preedit_string (
495 slot (this, &HelperAgent::HelperAgentImpl::slot_show_preedit_string));
496 si->signal_connect_show_aux_string (
497 slot (this, &HelperAgent::HelperAgentImpl::slot_show_aux_string));
498 si->signal_connect_show_lookup_table (
499 slot (this, &HelperAgent::HelperAgentImpl::slot_show_lookup_table));
501 si->signal_connect_hide_preedit_string (
502 slot (this, &HelperAgent::HelperAgentImpl::slot_hide_preedit_string));
503 si->signal_connect_hide_aux_string (
504 slot (this, &HelperAgent::HelperAgentImpl::slot_hide_aux_string));
505 si->signal_connect_hide_lookup_table (
506 slot (this, &HelperAgent::HelperAgentImpl::slot_hide_lookup_table));
508 si->signal_connect_update_preedit_caret (
509 slot (this, &HelperAgent::HelperAgentImpl::slot_update_preedit_caret));
510 si->signal_connect_update_preedit_string (
511 slot (this, &HelperAgent::HelperAgentImpl::slot_update_preedit_string));
512 si->signal_connect_update_preedit_string_with_commit (
513 slot (this, &HelperAgent::HelperAgentImpl::slot_update_preedit_string_with_commit));
514 si->signal_connect_recapture_string (
515 slot (this, &HelperAgent::HelperAgentImpl::slot_recapture_string));
517 si->signal_connect_update_aux_string (
518 slot (this, &HelperAgent::HelperAgentImpl::slot_update_aux_string));
519 si->signal_connect_update_lookup_table (
520 slot (this, &HelperAgent::HelperAgentImpl::slot_update_lookup_table));
522 si->signal_connect_commit_string (
523 slot (this, &HelperAgent::HelperAgentImpl::slot_commit_string));
525 si->signal_connect_forward_key_event (
526 slot (this, &HelperAgent::HelperAgentImpl::slot_forward_key_event));
528 si->signal_connect_register_properties (
529 slot (this, &HelperAgent::HelperAgentImpl::slot_register_properties));
531 si->signal_connect_update_property (
532 slot (this, &HelperAgent::HelperAgentImpl::slot_update_property));
534 si->signal_connect_beep (
535 slot (this, &HelperAgent::HelperAgentImpl::slot_beep));
537 si->signal_connect_start_helper (
538 slot (this, &HelperAgent::HelperAgentImpl::slot_start_helper));
540 si->signal_connect_stop_helper (
541 slot (this, &HelperAgent::HelperAgentImpl::slot_stop_helper));
543 si->signal_connect_send_helper_event (
544 slot (this, &HelperAgent::HelperAgentImpl::slot_send_helper_event));
546 si->signal_connect_get_surrounding_text (
547 slot (this, &HelperAgent::HelperAgentImpl::slot_get_surrounding_text));
549 si->signal_connect_delete_surrounding_text (
550 slot (this, &HelperAgent::HelperAgentImpl::slot_delete_surrounding_text));
552 si->signal_connect_get_selection (
553 slot (this, &HelperAgent::HelperAgentImpl::slot_get_selection));
555 si->signal_connect_set_selection (
556 slot (this, &HelperAgent::HelperAgentImpl::slot_set_selection));
558 si->signal_connect_expand_candidate (
559 slot (this, &HelperAgent::HelperAgentImpl::slot_expand_candidate));
560 si->signal_connect_contract_candidate (
561 slot (this, &HelperAgent::HelperAgentImpl::slot_contract_candidate));
563 si->signal_connect_set_candidate_style (
564 slot (this, &HelperAgent::HelperAgentImpl::slot_set_candidate_style));
566 si->signal_connect_send_private_command (
567 slot (this, &HelperAgent::HelperAgentImpl::slot_send_private_command));
570 void process_key_event_done (KeyEvent &key, uint32 ret, uint32 serial) {
571 LOGD ("ret: %d, serial: %d", ret, serial);
572 if (socket_active.is_connected ()) {
574 send.put_command (SCIM_TRANS_CMD_REQUEST);
575 send.put_data (magic_active);
576 send.put_command (ISM_TRANS_CMD_PROCESS_KEY_EVENT_DONE);
579 send.put_data (serial);
580 send.write_to_socket (socket_active, magic_active);
584 void request_ise_hide () {
585 if (socket_active.is_connected ()) {
587 send.put_command (SCIM_TRANS_CMD_REQUEST);
588 send.put_data (magic_active);
589 send.put_command (ISM_TRANS_CMD_REQUEST_ISE_HIDE);
590 send.write_to_socket (socket_active, magic_active);
594 HelperAgentImpl () : magic (0), magic_active (0), timeout (-1), focused_ic ((uint32) -1), thiz (NULL), surrounding_text (NULL), selection_text (NULL), cursor_pos (0), need_update_surrounding_text (0), need_update_selection_text (0), layout (0), ise_show_flag (false), need_update_entry_metadata (true), ise_focus_flag (false), finalized_text (NULL), finalized_cursor_pos (0) { }
597 static MessageQueue message_queue;
599 HelperAgent::HelperAgent ()
600 : m_impl (new HelperAgentImpl (this))
602 message_queue.create();
605 HelperAgent::~HelperAgent ()
607 message_queue.destroy();
612 * @brief Open socket connection to the Panel.
614 * @param info The information of this Helper object.
615 * @param display The display which this Helper object should run on.
617 * @return The connection socket id. -1 means failed to create
621 HelperAgent::open_connection (const HelperInfo &info,
622 const String &display)
624 if (m_impl->socket.is_connected ())
627 SocketAddress address (scim_get_default_panel_socket_address (display));
628 int timeout = m_impl->timeout = scim_get_default_socket_timeout ();
631 if (!address.valid ())
635 std::cerr << " Connecting to PanelAgent server.";
636 ISF_LOG (" Connecting to PanelAgent server.\n");
637 while (!m_impl->socket.connect (address)) {
639 scim_usleep (100000);
641 std::cerr << "m_impl->socket.connect () is failed!!!\n";
642 ISF_LOG ("m_impl->socket.connect () is failed!!!\n");
646 std::cerr << " Connected :" << i << "\n";
647 ISF_LOG (" Connected :%d\n", i);
648 LOGD ("Connection to PanelAgent succeeded, %d", i);
650 /* Let's retry 10 times when failed */
651 int open_connection_retries = 0;
652 while (!scim_socket_open_connection (magic,
657 if (++open_connection_retries > 10) {
658 m_impl->socket.close ();
659 std::cerr << "scim_socket_open_connection () is failed!!!\n";
660 ISF_LOG ("scim_socket_open_connection () is failed!!!\n");
661 ISF_SAVE_LOG ("scim_socket_open_connection failed, %d", timeout);
666 /* Retry after re-connecting the socket */
667 if (m_impl->socket.is_connected ())
670 /* This time, just retry atmost 2 seconds */
672 while (!m_impl->socket.connect (address) && ++i < 10) {
673 scim_usleep (200000);
677 ISF_LOG ("scim_socket_open_connection () is successful.\n");
678 LOGD ("scim_socket_open_connection successful");
680 m_impl->send.clear ();
681 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
682 m_impl->send.put_data (magic);
683 m_impl->send.put_command (SCIM_TRANS_CMD_PANEL_REGISTER_HELPER);
684 m_impl->send.put_data (info.uuid);
685 m_impl->send.put_data (info.name);
686 m_impl->send.put_data (info.icon);
687 m_impl->send.put_data (info.description);
688 m_impl->send.put_data (info.option);
690 if (!m_impl->send.write_to_socket (m_impl->socket, magic)) {
691 m_impl->socket.close ();
696 if (m_impl->recv.read_from_socket (m_impl->socket, timeout) &&
697 m_impl->recv.get_command (cmd) && cmd == SCIM_TRANS_CMD_REPLY &&
698 m_impl->recv.get_command (cmd) && cmd == SCIM_TRANS_CMD_OK) {
699 m_impl->magic = magic;
701 while (m_impl->recv.get_command (cmd)) {
703 case SCIM_TRANS_CMD_HELPER_ATTACH_INPUT_CONTEXT:
707 while (m_impl->recv.get_data (ic) && m_impl->recv.get_data (ic_uuid))
708 m_impl->signal_attach_input_context (this, ic, ic_uuid);
711 case SCIM_TRANS_CMD_UPDATE_SCREEN:
714 if (m_impl->recv.get_data (screen))
715 m_impl->signal_update_screen (this, (uint32) -1, String (""), (int) screen);
723 //FIXME: Attaching input context is needed for desktop environment
724 LOGW ("Attach input context and update screen failed");
727 ISF_SAVE_LOG ("Trying connect() with Helper_Active");
729 /* connect to the panel agent as the active helper client */
730 if (!m_impl->socket_active.connect (address)) return -1;
731 open_connection_retries = 0;
732 while (!scim_socket_open_connection (magic,
733 String ("Helper_Active"),
735 m_impl->socket_active,
737 if (++open_connection_retries > 10) {
738 m_impl->socket_active.close ();
739 std::cerr << "Helper_Active scim_socket_open_connection () is failed!!!\n";
740 ISF_LOG ("Helper_Active scim_socket_open_connection () is failed!!!\n");
741 ISF_SAVE_LOG ("Helper_Active scim_socket_open_connection failed, %d", timeout);
746 /* Retry after re-connecting the socket */
747 if (m_impl->socket_active.is_connected ())
748 m_impl->socket_active.close ();
750 /* This time, just retry atmost 2 seconds */
752 while (!m_impl->socket_active.connect (address) && ++i < 10) {
753 scim_usleep (200000);
757 m_impl->magic_active = magic;
759 m_impl->send.clear ();
760 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
761 m_impl->send.put_data (magic);
762 m_impl->send.put_command (SCIM_TRANS_CMD_PANEL_REGISTER_ACTIVE_HELPER);
763 m_impl->send.put_data (info.uuid);
764 m_impl->send.put_data (info.name);
765 m_impl->send.put_data (info.icon);
766 m_impl->send.put_data (info.description);
767 m_impl->send.put_data (info.option);
769 if (!m_impl->send.write_to_socket (m_impl->socket_active, magic)) {
770 ISF_SAVE_LOG ("Helper_Active write_to_socket() failed");
771 m_impl->socket_active.close ();
774 m_impl->m_config = ConfigBase::get (false, "socket");
776 return m_impl->socket.get_id ();
780 * @brief Close the socket connection to Panel.
783 HelperAgent::close_connection ()
785 m_impl->socket.close ();
786 m_impl->socket_active.close ();
787 m_impl->send.clear ();
788 m_impl->recv.clear ();
790 m_impl->magic_active = 0;
795 * @brief Get the connection id previously returned by open_connection().
797 * @return the connection id
800 HelperAgent::get_connection_number () const
802 if (m_impl->socket.is_connected ())
803 return m_impl->socket.get_id ();
808 * @brief Check whether this HelperAgent has been connected to a Panel.
810 * Return true when it is connected to panel, otherwise return false.
813 HelperAgent::is_connected () const
815 return m_impl->socket.is_connected ();
819 * @brief Check if there are any events available to be processed.
821 * If it returns true then Helper object should call
822 * HelperAgent::filter_event() to process them.
824 * @return true if there are any events available.
827 HelperAgent::has_pending_event () const
829 if (m_impl->socket.is_connected () && m_impl->socket.wait_for_data (0) > 0)
832 if (message_queue.has_pending_message())
839 * @brief Process the pending events.
841 * This function will emit the corresponding signals according
844 * @return false if the connection is broken, otherwise return true.
847 HelperAgent::filter_event ()
849 if (!m_impl->socket.is_connected ()) {
850 LOGW("Connection lost, returning false");
854 if (m_impl->recv.read_from_socket (m_impl->socket, m_impl->timeout)) {
855 message_queue.read_from_transaction(m_impl->recv);
857 while (message_queue.has_pending_message()) {
858 MessageItem *message = message_queue.get_pending_message();
859 handle_message(message);
860 message_queue.remove_message(message);
863 LOGD("read_from_socket() failed but continuing");
871 * @brief Read messages from socket buffer, and see if there is a message with the given cmd.
873 * @return false if the connection is broken, or no message available with given cmd. Otherwise return true.
876 HelperAgent::wait_for_message(int cmd, int timeout)
878 struct timeval t0 = { 0, 0 };
879 struct timeval t1 = { 0, 0 };
880 struct timeval t2 = { 0, 0 };
882 gettimeofday(&t0, NULL);
885 if (!m_impl->socket.is_connected() || !m_impl->recv.read_from_socket(m_impl->socket, timeout))
888 message_queue.read_from_transaction(m_impl->recv);
889 if (message_queue.has_pending_message_by_cmd(cmd)) {
893 gettimeofday(&t1, NULL);
894 timersub(&t1, &t0, &t2);
895 } while (t2.tv_sec < timeout);
901 * @brief Process one message that is in our message queue.
903 * This function will emit the corresponding signals according
906 * @param message The message that needs to be handled.
908 * @return false if the connection is broken, otherwise return true.
911 HelperAgent::handle_message (MessageItem *message)
916 int cmd = message->get_command_ref();
917 LOGD ("HelperAgent::cmd = %d", cmd);
919 case SCIM_TRANS_CMD_EXIT:
921 MessageItemExit *subclass = static_cast<MessageItemExit*>(message);
922 ISF_SAVE_LOG ("Helper ISE received SCIM_TRANS_CMD_EXIT message");
923 m_impl->signal_exit(this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
926 case SCIM_TRANS_CMD_RELOAD_CONFIG:
928 MessageItemReloadConfig *subclass = static_cast<MessageItemReloadConfig*>(message);
929 m_impl->signal_reload_config (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
930 if (!m_impl->m_config.null())
931 m_impl->m_config->ConfigBase::reload();
934 case SCIM_TRANS_CMD_UPDATE_SCREEN:
936 MessageItemUpdateScreen *subclass = static_cast<MessageItemUpdateScreen*>(message);
937 m_impl->signal_update_screen (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
938 subclass->get_screen_ref());
941 case SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION:
943 MessageItemUpdateSpotLocation *subclass = static_cast<MessageItemUpdateSpotLocation*>(message);
944 m_impl->signal_update_spot_location (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
945 subclass->get_x_ref(), subclass->get_y_ref());
948 case ISM_TRANS_CMD_UPDATE_CURSOR_POSITION:
950 MessageItemUpdateCursorPosition *subclass = static_cast<MessageItemUpdateCursorPosition*>(message);
951 m_impl->cursor_pos = subclass->get_cursor_pos_ref();
952 LOGD ("update cursor position %d", subclass->get_cursor_pos_ref());
953 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
954 m_impl->signal_update_cursor_position (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
955 subclass->get_cursor_pos_ref());
957 if (!m_impl->si.null ()) m_impl->si->update_cursor_position(subclass->get_cursor_pos_ref());
960 case ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT:
962 MessageItemUpdateSurroundingText *subclass = static_cast<MessageItemUpdateSurroundingText*>(message);
963 if (m_impl->surrounding_text != NULL)
964 free (m_impl->surrounding_text);
965 m_impl->surrounding_text = strdup (subclass->get_text_ref().c_str ());
966 m_impl->cursor_pos = subclass->get_cursor_ref();
967 SECURE_LOGD ("surrounding text: %s, %d", m_impl->surrounding_text, subclass->get_cursor_ref());
968 while (m_impl->need_update_surrounding_text > 0) {
969 m_impl->need_update_surrounding_text--;
970 m_impl->signal_update_surrounding_text (this, subclass->get_ic_ref(),
971 subclass->get_text_ref(), subclass->get_cursor_ref());
975 case ISM_TRANS_CMD_UPDATE_SELECTION:
977 MessageItemUpdateSelection *subclass = static_cast<MessageItemUpdateSelection*>(message);
978 if (m_impl->selection_text != NULL)
979 free (m_impl->selection_text);
981 m_impl->selection_text = strdup (subclass->get_text_ref().c_str ());
982 SECURE_LOGD ("selection text: %s", m_impl->selection_text);
984 while (m_impl->need_update_selection_text > 0) {
985 m_impl->need_update_selection_text--;
986 m_impl->signal_update_selection (this, subclass->get_ic_ref(), subclass->get_text_ref());
990 case SCIM_TRANS_CMD_TRIGGER_PROPERTY:
992 MessageItemTriggerProperty *subclass = static_cast<MessageItemTriggerProperty*>(message);
993 m_impl->signal_trigger_property (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
994 subclass->get_property_ref());
995 if (!m_impl->si.null ()) m_impl->si->trigger_property(subclass->get_property_ref());
998 case SCIM_TRANS_CMD_HELPER_PROCESS_IMENGINE_EVENT:
1000 MessageItemHelperProcessImengineEvent *subclass = static_cast<MessageItemHelperProcessImengineEvent*>(message);
1001 m_impl->signal_process_imengine_event (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1002 subclass->get_transaction_ref());
1005 case SCIM_TRANS_CMD_HELPER_ATTACH_INPUT_CONTEXT:
1007 MessageItemHelperAttachInputContext *subclass = static_cast<MessageItemHelperAttachInputContext*>(message);
1008 m_impl->signal_attach_input_context (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1011 case SCIM_TRANS_CMD_HELPER_DETACH_INPUT_CONTEXT:
1013 MessageItemHelperDetachInputContext *subclass = static_cast<MessageItemHelperDetachInputContext*>(message);
1014 m_impl->signal_detach_input_context (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1017 case SCIM_TRANS_CMD_FOCUS_OUT:
1019 MessageItemFocusOut *subclass = static_cast<MessageItemFocusOut*>(message);
1020 m_impl->ise_focus_flag = false;
1021 m_impl->signal_focus_out (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1022 m_impl->focused_ic = (uint32) -1;
1023 if (!m_impl->si.null ()) m_impl->si->focus_out();
1025 m_impl->ise_show_flag = false;
1028 case SCIM_TRANS_CMD_FOCUS_IN:
1030 MessageItemFocusIn *subclass = static_cast<MessageItemFocusIn*>(message);
1031 m_impl->ise_focus_flag = true;
1033 m_impl->need_update_entry_metadata = false;
1034 m_impl->signal_focus_in (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1035 m_impl->focused_ic = subclass->get_ic_ref();
1036 if (m_impl->finalized_text != NULL)
1037 free(m_impl->finalized_text);
1038 m_impl->finalized_text = NULL;
1039 m_impl->finalized_cursor_pos = 0;
1040 if (!m_impl->si.null ()) m_impl->si->focus_in();
1043 case ISM_TRANS_CMD_SHOW_ISE_PANEL:
1045 MessageItemShowISEPanel *subclass = static_cast<MessageItemShowISEPanel*>(message);
1046 LOGD ("Helper ISE received ISM_TRANS_CMD_SHOW_ISE_PANEL message");
1048 m_impl->signal_ise_show (this, subclass->get_ic_ref(), *(subclass->get_data_ptr()),
1049 subclass->get_len_ref());
1050 m_impl->ise_show_flag = true;
1053 case ISM_TRANS_CMD_HIDE_ISE_PANEL:
1055 MessageItemHideISEPanel *subclass = static_cast<MessageItemHideISEPanel*>(message);
1056 LOGD ("Helper ISE received ISM_TRANS_CMD_HIDE_ISE_PANEL message");
1057 m_impl->signal_ise_hide (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1058 m_impl->ise_show_flag = false;
1061 case ISM_TRANS_CMD_GET_ACTIVE_ISE_GEOMETRY:
1063 struct rectinfo info = {0, 0, 0, 0};
1064 m_impl->signal_get_geometry (this, info);
1065 m_impl->send.clear ();
1066 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
1067 m_impl->send.put_data (info.pos_x);
1068 m_impl->send.put_data (info.pos_y);
1069 m_impl->send.put_data (info.width);
1070 m_impl->send.put_data (info.height);
1071 m_impl->send.write_to_socket (m_impl->socket);
1074 case ISM_TRANS_CMD_SET_ISE_MODE:
1076 MessageItemSetISEMode *subclass = static_cast<MessageItemSetISEMode*>(message);
1077 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1078 m_impl->signal_set_mode (this, subclass->get_mode_ref());
1082 case ISM_TRANS_CMD_SET_ISE_LANGUAGE:
1084 MessageItemSetISELanguage *subclass = static_cast<MessageItemSetISELanguage*>(message);
1085 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1086 m_impl->signal_set_language (this, subclass->get_language_ref());
1090 case ISM_TRANS_CMD_SET_ISE_IMDATA:
1092 MessageItemSetISEImData *subclass = static_cast<MessageItemSetISEImData*>(message);
1093 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1094 m_impl->signal_set_imdata (this, *(subclass->get_imdata_ptr()), subclass->get_len_ref());
1096 if (!m_impl->si.null ()) m_impl->si->set_imdata(*(subclass->get_imdata_ptr()),
1097 subclass->get_len_ref());
1100 case ISM_TRANS_CMD_GET_ISE_IMDATA:
1105 m_impl->signal_get_imdata (this, &buf, len);
1106 LOGD ("send ise imdata len = %zu", len);
1107 m_impl->send.clear ();
1108 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
1109 m_impl->send.put_data (buf, len);
1110 m_impl->send.write_to_socket (m_impl->socket);
1115 case ISM_TRANS_CMD_GET_ISE_LANGUAGE_LOCALE:
1117 MessageItemGetISELanguageLocale *subclass = static_cast<MessageItemGetISELanguageLocale*>(message);
1119 m_impl->signal_get_language_locale (this, subclass->get_ic_ref(), &buf);
1120 m_impl->send.clear ();
1121 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
1123 m_impl->send.put_data (buf, strlen (buf));
1124 m_impl->send.write_to_socket (m_impl->socket);
1129 case ISM_TRANS_CMD_SET_RETURN_KEY_TYPE:
1131 MessageItemSetReturnKeyType *subclass = static_cast<MessageItemSetReturnKeyType*>(message);
1132 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1133 m_impl->signal_set_return_key_type (this, subclass->get_type_ref());
1137 case ISM_TRANS_CMD_GET_RETURN_KEY_TYPE:
1140 m_impl->signal_get_return_key_type (this, type);
1141 m_impl->send.clear ();
1142 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
1143 m_impl->send.put_data (type);
1144 m_impl->send.write_to_socket (m_impl->socket);
1147 case ISM_TRANS_CMD_SET_RETURN_KEY_DISABLE:
1149 MessageItemSetReturnKeyDisable *subclass = static_cast<MessageItemSetReturnKeyDisable*>(message);
1150 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1151 m_impl->signal_set_return_key_disable (this, subclass->get_disabled_ref());
1155 case ISM_TRANS_CMD_GET_RETURN_KEY_DISABLE:
1157 uint32 disabled = 0;
1158 m_impl->signal_get_return_key_type (this, disabled);
1159 m_impl->send.clear ();
1160 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
1161 m_impl->send.put_data (disabled);
1162 m_impl->send.write_to_socket (m_impl->socket);
1165 case SCIM_TRANS_CMD_PROCESS_KEY_EVENT:
1167 MessageItemProcessKeyEvent *subclass = static_cast<MessageItemProcessKeyEvent*>(message);
1169 uint32 keycode_ret = 0;
1170 m_impl->signal_process_key_event(this, subclass->get_key_ref(), ret);
1171 m_impl->signal_process_key_event_with_keycode(this, subclass->get_key_ref(), keycode_ret, subclass->get_keycode_ref());
1172 if (ret == 0 && keycode_ret == 0) {
1173 if (!m_impl->si.null ()) {
1174 if (!(subclass->get_key_ref().get_key_string().compare("KeyRelease+XF86Back") == 0 ||
1175 subclass->get_key_ref().get_key_string().compare("XF86Back") == 0)) {
1176 ret = m_impl->si->process_key_event (subclass->get_key_ref());
1177 SECURE_LOGD ("imengine(%s) process key %d return %d", m_impl->si->get_factory_uuid().c_str(),
1178 subclass->get_key_ref().code, ret);
1181 if (!(subclass->get_key_ref().get_key_string().compare("KeyRelease+XF86Back") == 0 ||
1182 subclass->get_key_ref().get_key_string().compare("XF86Back") == 0)) {
1183 m_impl->signal_process_key_event_with_imengine(this, subclass->get_key_ref(), ret);
1184 SECURE_LOGD ("imengine process key %d return %d", subclass->get_key_ref().code, ret);
1188 if (ret != keycode_ret)
1190 m_impl->process_key_event_done (subclass->get_key_ref(), ret, subclass->get_serial_ref());
1193 case ISM_TRANS_CMD_SET_LAYOUT:
1195 MessageItemSetLayout *subclass = static_cast<MessageItemSetLayout*>(message);
1196 m_impl->layout = subclass->get_layout_ref();
1197 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1198 m_impl->signal_set_layout (this, subclass->get_layout_ref());
1200 if (!m_impl->si.null ()) m_impl->si->set_layout(subclass->get_layout_ref());
1203 case ISM_TRANS_CMD_GET_LAYOUT:
1207 m_impl->signal_get_layout (this, layout);
1208 m_impl->send.clear ();
1209 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
1210 m_impl->send.put_data (layout);
1211 m_impl->send.write_to_socket (m_impl->socket);
1214 case ISM_TRANS_CMD_SET_INPUT_MODE:
1216 MessageItemSetInputMode *subclass = static_cast<MessageItemSetInputMode*>(message);
1217 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1218 m_impl->signal_set_input_mode (this, subclass->get_input_mode_ref());
1222 case ISM_TRANS_CMD_SET_CAPS_MODE:
1224 MessageItemSetCapsMode *subclass = static_cast<MessageItemSetCapsMode*>(message);
1225 m_impl->signal_set_caps_mode (this, subclass->get_mode_ref());
1228 case SCIM_TRANS_CMD_PANEL_RESET_INPUT_CONTEXT:
1230 MessageItemPanelResetInputContext *subclass = static_cast<MessageItemPanelResetInputContext*>(message);
1231 m_impl->signal_reset_input_context (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1232 if (!m_impl->si.null ()) m_impl->si->reset();
1235 case ISM_TRANS_CMD_UPDATE_CANDIDATE_UI:
1237 MessageItemUpdateCandidateUI *subclass = static_cast<MessageItemUpdateCandidateUI*>(message);
1238 m_impl->signal_update_candidate_ui (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1239 subclass->get_style_ref(), subclass->get_mode_ref());
1242 case ISM_TRANS_CMD_UPDATE_CANDIDATE_GEOMETRY:
1244 MessageItemUpdateCandidateGeometry *subclass = static_cast<MessageItemUpdateCandidateGeometry*>(message);
1245 m_impl->signal_update_candidate_geometry (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1246 subclass->get_rectinfo_ref());
1249 case ISM_TRANS_CMD_UPDATE_KEYBOARD_ISE:
1251 MessageItemUpdateKeyboardISE *subclass = static_cast<MessageItemUpdateKeyboardISE*>(message);
1252 m_impl->signal_update_keyboard_ise (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1253 subclass->get_name_ref(), subclass->get_uuid_ref());
1256 case ISM_TRANS_CMD_UPDATE_KEYBOARD_ISE_LIST:
1258 MessageItemUpdateKeyboardISEList *subclass = static_cast<MessageItemUpdateKeyboardISEList*>(message);
1259 m_impl->signal_update_keyboard_ise_list (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1260 subclass->get_list_ref());
1263 case ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_SHOW:
1265 MessageItemCandidateMoreWindowShow *subclass = static_cast<MessageItemCandidateMoreWindowShow*>(message);
1266 m_impl->signal_candidate_more_window_show (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1267 if (!m_impl->si.null ()) m_impl->si->candidate_more_window_show();
1270 case ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_HIDE:
1272 MessageItemCandidateMoreWindowHide *subclass = static_cast<MessageItemCandidateMoreWindowHide*>(message);
1273 m_impl->signal_candidate_more_window_hide (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1274 if (!m_impl->si.null ()) m_impl->si->candidate_more_window_hide();
1277 case ISM_TRANS_CMD_SELECT_AUX:
1279 MessageItemSelectAux *subclass = static_cast<MessageItemSelectAux*>(message);
1280 m_impl->signal_select_aux (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1281 subclass->get_item_ref());
1282 if (!m_impl->si.null ()) m_impl->si->select_aux(subclass->get_item_ref());
1285 case SCIM_TRANS_CMD_SELECT_CANDIDATE: //FIXME:remove if useless
1287 MessageItemSelectCandidate *subclass = static_cast<MessageItemSelectCandidate*>(message);
1288 m_impl->signal_select_candidate (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1289 subclass->get_item_ref());
1290 if (!m_impl->si.null ()) m_impl->si->select_candidate(subclass->get_item_ref());
1293 case SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_UP: //FIXME:remove if useless
1295 MessageItemLookupTablePageUp *subclass = static_cast<MessageItemLookupTablePageUp*>(message);
1296 m_impl->signal_candidate_table_page_up (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1297 if (!m_impl->si.null ()) m_impl->si->lookup_table_page_up();
1300 case SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_DOWN: //FIXME:remove if useless
1302 MessageItemLookupTablePageDown *subclass = static_cast<MessageItemLookupTablePageDown*>(message);
1303 m_impl->signal_candidate_table_page_down (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1304 if (!m_impl->si.null ()) m_impl->si->lookup_table_page_down();
1307 case SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE_PAGE_SIZE:
1309 MessageItemUpdateLookupTablePageSize *subclass = static_cast<MessageItemUpdateLookupTablePageSize*>(message);
1310 m_impl->signal_update_candidate_table_page_size (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1311 subclass->get_size_ref());
1312 if (!m_impl->si.null ()) m_impl->si->update_lookup_table_page_size(subclass->get_size_ref());
1315 case ISM_TRANS_CMD_CANDIDATE_SHOW: //FIXME:remove if useless
1317 MessageItemCandidateShow *subclass = static_cast<MessageItemCandidateShow*>(message);
1318 m_impl->signal_candidate_show (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1321 case ISM_TRANS_CMD_CANDIDATE_HIDE: //FIXME:remove if useless
1323 MessageItemCandidateHide *subclass = static_cast<MessageItemCandidateHide*>(message);
1324 m_impl->signal_candidate_hide (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1327 case ISM_TRANS_CMD_UPDATE_LOOKUP_TABLE: //FIXME:remove if useless
1329 MessageItemUpdateLookupTable *subclass = static_cast<MessageItemUpdateLookupTable*>(message);
1330 m_impl->signal_update_lookup_table (this, subclass->get_candidate_table_ref());
1333 case ISM_TRANS_CMD_UPDATE_CANDIDATE_ITEM_LAYOUT:
1335 MessageItemUpdateCandidateItemLayout *subclass = static_cast<MessageItemUpdateCandidateItemLayout*>(message);
1336 m_impl->signal_update_candidate_item_layout (this, subclass->get_row_items_ref());
1337 if (!m_impl->si.null ()) m_impl->si->update_candidate_item_layout(subclass->get_row_items_ref());
1340 case ISM_TRANS_CMD_SELECT_ASSOCIATE:
1342 MessageItemSelectAssociate *subclass = static_cast<MessageItemSelectAssociate*>(message);
1343 m_impl->signal_select_associate (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1344 subclass->get_item_ref());
1347 case ISM_TRANS_CMD_ASSOCIATE_TABLE_PAGE_UP:
1349 MessageItemAssociateTablePageUp *subclass = static_cast<MessageItemAssociateTablePageUp*>(message);
1350 m_impl->signal_associate_table_page_up (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1353 case ISM_TRANS_CMD_ASSOCIATE_TABLE_PAGE_DOWN:
1355 MessageItemAssociateTablePageDown *subclass = static_cast<MessageItemAssociateTablePageDown*>(message);
1356 m_impl->signal_associate_table_page_down (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1359 case ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE_PAGE_SIZE:
1361 MessageItemUpdateAssociateTablePageSize *subclass = static_cast<MessageItemUpdateAssociateTablePageSize*>(message);
1362 m_impl->signal_update_associate_table_page_size (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1363 subclass->get_size_ref());
1366 case ISM_TRANS_CMD_RESET_ISE_CONTEXT:
1368 MessageItemResetISEContext *subclass = static_cast<MessageItemResetISEContext*>(message);
1369 m_impl->signal_reset_ise_context (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1370 m_impl->signal_reset_input_context (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1371 if (!m_impl->si.null ()) m_impl->si->reset();
1374 case ISM_TRANS_CMD_TURN_ON_LOG:
1376 MessageItemTurnOnLog *subclass = static_cast<MessageItemTurnOnLog*>(message);
1377 m_impl->signal_turn_on_log (this, subclass->get_state_ref());
1380 case ISM_TRANS_CMD_UPDATE_DISPLAYED_CANDIDATE:
1382 MessageItemUpdateDisplayedCandidate *subclass = static_cast<MessageItemUpdateDisplayedCandidate*>(message);
1383 m_impl->signal_update_displayed_candidate_number (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1384 subclass->get_size_ref());
1385 if (!m_impl->si.null ()) m_impl->si->update_displayed_candidate_number(subclass->get_size_ref());
1388 case ISM_TRANS_CMD_LONGPRESS_CANDIDATE:
1390 MessageItemLongpressCandidate *subclass = static_cast<MessageItemLongpressCandidate*>(message);
1391 m_impl->signal_longpress_candidate (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1392 subclass->get_index_ref());
1393 if (!m_impl->si.null ()) m_impl->si->longpress_candidate(subclass->get_index_ref());
1396 case ISM_TRANS_CMD_SET_INPUT_HINT:
1398 MessageItemSetInputHint *subclass = static_cast<MessageItemSetInputHint*>(message);
1399 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1400 m_impl->signal_set_input_hint (this, subclass->get_input_hint_ref());
1402 if (!m_impl->si.null ()) m_impl->si->set_input_hint(subclass->get_input_hint_ref());
1405 case ISM_TRANS_CMD_UPDATE_BIDI_DIRECTION:
1407 MessageItemUpdateBidiDirection *subclass = static_cast<MessageItemUpdateBidiDirection*>(message);
1408 m_impl->signal_update_bidi_direction (this, subclass->get_bidi_direction());
1409 if (!m_impl->si.null ()) m_impl->si->update_bidi_direction(subclass->get_bidi_direction());
1412 case ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW:
1414 MessageItemShowISEOptionWindow *subclass = static_cast<MessageItemShowISEOptionWindow*>(message);
1415 m_impl->signal_show_option_window (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1418 case ISM_TRANS_CMD_RESUME_ISE_OPTION_WINDOW:
1420 MessageItemResumeISEOptionWindow *subclass = static_cast<MessageItemResumeISEOptionWindow*>(message);
1421 m_impl->signal_resume_option_window (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1424 case ISM_TRANS_CMD_CHECK_OPTION_WINDOW:
1427 m_impl->signal_check_option_window (this, avail);
1428 m_impl->send.clear ();
1429 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
1430 m_impl->send.put_data (avail);
1431 m_impl->send.write_to_socket (m_impl->socket);
1434 case ISM_TRANS_CMD_PROCESS_INPUT_DEVICE_EVENT:
1436 MessageItemProcessInputDeviceEvent *subclass = static_cast<MessageItemProcessInputDeviceEvent*>(message);
1438 unsigned int ecore_event_id = find_ecore_event_from_device_type((isf_device_type_e)(subclass->get_type_ref()));
1439 char *decoded = (char*)malloc(subclass->get_len_ref());
1440 size_t decoded_size = subclass->get_len_ref();
1442 if(device_buffer_decode((const char*)*(subclass->get_data_ptr()),
1443 subclass->get_len_ref(), (char*)(decoded), &decoded_size)) {
1444 m_impl->signal_process_input_device_event(this, ecore_event_id, decoded, decoded_size, ret);
1450 case SCIM_TRANS_CMD_SET_AUTOCAPITAL_TYPE:
1452 MessageItemSetAutocapitalType *subclass = static_cast<MessageItemSetAutocapitalType*>(message);
1453 if (!m_impl->si.null ()) m_impl->si->set_autocapital_type(subclass->get_auto_capital_type_ref());
1454 m_impl->signal_set_autocapital_type(this, subclass->get_auto_capital_type_ref());
1457 case ISM_TRANS_CMD_SET_PREDICTION_ALLOW:
1459 MessageItemSetPredictionAllow *subclass = static_cast<MessageItemSetPredictionAllow*>(message);
1460 if (!m_impl->si.null ()) m_impl->si->set_prediction_allow(subclass->get_prediction_allow_ref() == 0 ? false : true);
1461 m_impl->signal_set_prediction_allow(this, subclass->get_prediction_allow_ref());
1464 case ISM_TRANS_CMD_SET_KEYBOARD_MODE:
1466 MessageItemSetKeyboardMode *subclass = static_cast<MessageItemSetKeyboardMode*>(message);
1467 if (subclass->get_mode_ref())
1468 m_impl->need_update_entry_metadata = false;
1470 m_impl->need_update_entry_metadata = true;
1473 case ISM_TRANS_CMD_SET_PREDICTION_HINT:
1475 MessageItemSetPredictionHint *subclass = static_cast<MessageItemSetPredictionHint*>(message);
1476 m_impl->signal_set_prediction_hint (this, subclass->get_message_ref());
1479 case ISM_TRANS_CMD_SET_MIME_TYPE:
1481 MessageItemSetMimeType *subclass = static_cast<MessageItemSetMimeType*>(message);
1482 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1483 m_impl->signal_set_mime_type (this, subclass->get_mime_type_ref());
1487 case ISM_TRANS_CMD_FINALIZE_CONTENT:
1489 MessageItemFinalizeContent *subclass = static_cast<MessageItemFinalizeContent*>(message);
1491 if (m_impl->finalized_text != NULL)
1492 free(m_impl->finalized_text);
1493 m_impl->finalized_text = strdup(subclass->get_text_ref().c_str());
1494 m_impl->finalized_cursor_pos = subclass->get_cursor_pos_ref();
1498 case ISM_TRANS_CMD_SET_PREDICTION_HINT_DATA:
1500 MessageItemSetPredictionHintData *subclass = static_cast<MessageItemSetPredictionHintData*>(message);
1501 m_impl->signal_set_prediction_hint_data (this, 0, subclass->get_key_ref(), subclass->get_value_ref());
1504 case ISM_TRANS_CMD_SET_OPTIMIZATION_HINT:
1506 MessageItemSetOptimizationHint *subclass = static_cast<MessageItemSetOptimizationHint*>(message);
1507 m_impl->signal_set_optimization_hint(this, subclass->get_hint_ref());
1517 * @brief Request SCIM to reload all configuration.
1519 * This function should only by used by Setup Helper to request
1520 * scim's reloading the configuration.
1521 * Deprecated: reload config message only send by socketconfig client
1522 * using socketconfig::reload instead.
1525 HelperAgent::reload_config () const
1527 LOGD ("send reload config message to isf");
1528 if (!m_impl->m_config.null())
1529 m_impl->m_config->reload();
1533 * @brief Register some properties into Panel.
1535 * This function send the request to Panel to register a list
1538 * @param properties The list of Properties to be registered into Panel.
1540 * @sa scim::Property.
1543 HelperAgent::register_properties (const PropertyList &properties) const
1545 if (m_impl->socket_active.is_connected ()) {
1546 m_impl->send.clear ();
1547 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1548 m_impl->send.put_data (m_impl->magic_active);
1549 m_impl->send.put_command (SCIM_TRANS_CMD_REGISTER_PROPERTIES);
1550 m_impl->send.put_data (properties);
1551 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1556 * @brief Update a registered property.
1558 * @param property The property to be updated.
1561 HelperAgent::update_property (const Property &property) const
1563 if (m_impl->socket_active.is_connected ()) {
1564 m_impl->send.clear ();
1565 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1566 m_impl->send.put_data (m_impl->magic_active);
1567 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_PROPERTY);
1568 m_impl->send.put_data (property);
1569 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1574 * @brief Send a set of events to an IMEngineInstance.
1576 * All events should be put into a Transaction.
1577 * And the events can only be received by one IMEngineInstance object.
1579 * @param ic The handle of the Input Context to receive the events.
1580 * @param ic_uuid The UUID of the Input Context.
1581 * @param trans The Transaction object holds the events.
1584 HelperAgent::send_imengine_event (int ic,
1585 const String &ic_uuid,
1586 const Transaction &trans) const
1588 //remove if not necessary
1590 if (m_impl->socket_active.is_connected ()) {
1591 m_impl->send.clear ();
1592 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1593 m_impl->send.put_data (m_impl->magic_active);
1594 m_impl->send.put_command (SCIM_TRANS_CMD_PANEL_SEND_IMENGINE_EVENT);
1595 m_impl->send.put_data ((uint32)ic);
1596 m_impl->send.put_data (ic_uuid);
1597 m_impl->send.put_data (trans);
1598 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1601 if (!m_impl->si.null ()) m_impl->si->process_helper_event (ic_uuid, trans);
1605 * @brief Send a KeyEvent to an IMEngineInstance.
1607 * @param ic The handle of the IMEngineInstance to receive the event.
1608 * -1 means the currently focused IMEngineInstance.
1609 * @param ic_uuid The UUID of the IMEngineInstance. Empty means don't match.
1610 * @param key The KeyEvent to be sent.
1613 HelperAgent::send_key_event (int ic,
1614 const String &ic_uuid,
1615 const KeyEvent &key) const
1618 //FIXME: remove shift_mode_off, shift_mode_on, shift_mode_lock from ISE side
1619 if (key.code == SHIFT_MODE_OFF ||
1620 key.code == SHIFT_MODE_ON ||
1621 key.code == SHIFT_MODE_LOCK ||
1622 key.code == SHIFT_MODE_ENABLE ||
1623 key.code == SHIFT_MODE_DISABLE) {
1624 LOGW("FIXME ignore shift codes");
1628 if (m_impl->socket_active.is_connected ()) {
1629 m_impl->send.clear ();
1630 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1631 m_impl->send.put_data (m_impl->magic_active);
1632 m_impl->send.put_command (SCIM_TRANS_CMD_PANEL_SEND_KEY_EVENT);
1634 m_impl->send.put_data (m_impl->focused_ic);
1636 m_impl->send.put_data ((uint32)ic);
1638 m_impl->send.put_data (ic_uuid);
1639 m_impl->send.put_data (key);
1640 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1645 * @brief Forward a KeyEvent to client application directly.
1647 * @param ic The handle of the client Input Context to receive the event.
1648 * -1 means the currently focused Input Context.
1649 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1650 * Empty means don't match.
1651 * @param key The KeyEvent to be forwarded.
1654 HelperAgent::forward_key_event (int ic,
1655 const String &ic_uuid,
1656 const KeyEvent &key) const
1658 if (m_impl->socket_active.is_connected ()) {
1659 m_impl->send.clear ();
1660 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1661 m_impl->send.put_data (m_impl->magic_active);
1662 m_impl->send.put_command (SCIM_TRANS_CMD_FORWARD_KEY_EVENT);
1664 m_impl->send.put_data (m_impl->focused_ic);
1666 m_impl->send.put_data ((uint32)ic);
1668 m_impl->send.put_data (ic_uuid);
1669 m_impl->send.put_data (key);
1670 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1675 * @brief Commit a WideString to client application directly.
1677 * @param ic The handle of the client Input Context to receive the WideString.
1678 * -1 means the currently focused Input Context.
1679 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1680 * Empty means don't match.
1681 * @param wstr The WideString to be committed.
1684 HelperAgent::commit_string (int ic,
1685 const String &ic_uuid,
1686 const WideString &wstr) const
1688 if (m_impl->socket_active.is_connected ()) {
1689 m_impl->send.clear ();
1690 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1691 m_impl->send.put_data (m_impl->magic_active);
1692 m_impl->send.put_command (SCIM_TRANS_CMD_COMMIT_STRING);
1694 m_impl->send.put_data (m_impl->focused_ic);
1696 m_impl->send.put_data ((uint32)ic);
1698 m_impl->send.put_data (ic_uuid);
1699 m_impl->send.put_data (wstr);
1700 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1705 HelperAgent::commit_string (int ic,
1706 const String &ic_uuid,
1710 if (m_impl->socket_active.is_connected ()) {
1711 m_impl->send.clear ();
1712 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1713 m_impl->send.put_data (m_impl->magic_active);
1714 m_impl->send.put_command (SCIM_TRANS_CMD_COMMIT_STRING);
1716 m_impl->send.put_data (m_impl->focused_ic);
1718 m_impl->send.put_data ((uint32)ic);
1720 m_impl->send.put_data (ic_uuid);
1721 m_impl->send.put_dataw (buf, buflen);
1722 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1727 * @brief Request to show preedit string.
1729 * @param ic The handle of the client Input Context to receive the request.
1730 * -1 means the currently focused Input Context.
1731 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1732 * Empty means don't match.
1735 HelperAgent::show_preedit_string (int ic,
1736 const String &ic_uuid) const
1739 if (m_impl->socket_active.is_connected ()) {
1740 m_impl->send.clear ();
1741 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1742 m_impl->send.put_data (m_impl->magic_active);
1743 m_impl->send.put_command (SCIM_TRANS_CMD_SHOW_PREEDIT_STRING);
1744 m_impl->send.put_data ((uint32)ic);
1745 m_impl->send.put_data (ic_uuid);
1746 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1751 * @brief Request to show aux string.
1754 HelperAgent::show_aux_string (void) const
1757 if (m_impl->socket_active.is_connected ()) {
1758 m_impl->send.clear ();
1759 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1760 m_impl->send.put_data (m_impl->magic_active);
1761 m_impl->send.put_command (SCIM_TRANS_CMD_SHOW_AUX_STRING);
1762 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1767 * @brief Request to show candidate string.
1770 HelperAgent::show_candidate_string (void) const
1773 if (m_impl->socket_active.is_connected ()) {
1774 m_impl->send.clear ();
1775 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1776 m_impl->send.put_data (m_impl->magic_active);
1777 m_impl->send.put_command (SCIM_TRANS_CMD_SHOW_LOOKUP_TABLE);
1778 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1783 * @brief Request to show associate string.
1786 HelperAgent::show_associate_string (void) const
1788 if (m_impl->socket_active.is_connected ()) {
1789 m_impl->send.clear ();
1790 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1791 m_impl->send.put_data (m_impl->magic_active);
1792 m_impl->send.put_command (ISM_TRANS_CMD_SHOW_ASSOCIATE_TABLE);
1793 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1798 * @brief Request to hide preedit string.
1800 * @param ic The handle of the client Input Context to receive the request.
1801 * -1 means the currently focused Input Context.
1802 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1803 * Empty means don't match.
1806 HelperAgent::hide_preedit_string (int ic,
1807 const String &ic_uuid) const
1810 if (m_impl->socket_active.is_connected ()) {
1811 m_impl->send.clear ();
1812 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1813 m_impl->send.put_data (m_impl->magic_active);
1814 m_impl->send.put_command (SCIM_TRANS_CMD_HIDE_PREEDIT_STRING);
1815 m_impl->send.put_data ((uint32)ic);
1816 m_impl->send.put_data (ic_uuid);
1817 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1822 * @brief Request to hide aux string.
1825 HelperAgent::hide_aux_string (void) const
1827 if (m_impl->socket_active.is_connected ()) {
1828 m_impl->send.clear ();
1829 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1830 m_impl->send.put_data (m_impl->magic_active);
1831 m_impl->send.put_command (SCIM_TRANS_CMD_HIDE_AUX_STRING);
1832 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1837 * @brief Request to hide candidate string.
1840 HelperAgent::hide_candidate_string (void) const
1842 if (m_impl->socket_active.is_connected ()) {
1843 m_impl->send.clear ();
1844 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1845 m_impl->send.put_data (m_impl->magic_active);
1846 m_impl->send.put_command (SCIM_TRANS_CMD_HIDE_LOOKUP_TABLE);
1847 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1852 * @brief Request to hide associate string.
1855 HelperAgent::hide_associate_string (void) const
1857 if (m_impl->socket_active.is_connected ()) {
1858 m_impl->send.clear ();
1859 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1860 m_impl->send.put_data (m_impl->magic_active);
1861 m_impl->send.put_command (ISM_TRANS_CMD_HIDE_ASSOCIATE_TABLE);
1862 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1867 * @brief Update a new WideString for preedit.
1869 * @param ic The handle of the client Input Context to receive the WideString.
1870 * -1 means the currently focused Input Context.
1871 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1872 * Empty means don't match.
1873 * @param str The WideString to be updated.
1874 * @param attrs The attribute list for preedit string.
1877 HelperAgent::update_preedit_string (int ic,
1878 const String &ic_uuid,
1879 const WideString &str,
1880 const AttributeList &attrs) const
1882 update_preedit_string (ic, ic_uuid, str, str, attrs, -1);
1886 HelperAgent::update_preedit_string (int ic,
1887 const String &ic_uuid,
1890 const AttributeList &attrs) const
1892 update_preedit_string (ic, ic_uuid, buf, buflen, attrs, -1);
1896 * @brief Update a new WideString for preedit.
1898 * @param ic The handle of the client Input Context to receive the WideString.
1899 * -1 means the currently focused Input Context.
1900 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1901 * Empty means don't match.
1902 * @param str The WideString to be updated.
1903 * @param attrs The attribute list for preedit string.
1904 * @param caret The caret position in preedit string.
1907 HelperAgent::update_preedit_string (int ic,
1908 const String &ic_uuid,
1909 const WideString &wstr,
1910 const AttributeList &attrs,
1913 update_preedit_string (ic, ic_uuid, wstr, wstr, attrs, caret);
1917 HelperAgent::update_preedit_string (int ic,
1918 const String &ic_uuid,
1921 const AttributeList &attrs,
1925 if (m_impl->socket_active.is_connected ()) {
1926 m_impl->send.clear ();
1927 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1928 m_impl->send.put_data (m_impl->magic_active);
1929 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING);
1930 m_impl->send.put_data ((uint32)ic);
1931 m_impl->send.put_data (ic_uuid);
1932 m_impl->send.put_dataw (buf, buflen);
1933 m_impl->send.put_dataw (buf, buflen);
1934 m_impl->send.put_data (attrs);
1935 m_impl->send.put_data (caret);
1936 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1941 HelperAgent::update_preedit_string (int ic,
1942 const String &ic_uuid,
1943 const WideString &preedit,
1944 const WideString &commit,
1945 const AttributeList &attrs,
1948 if (m_impl->socket_active.is_connected ()) {
1949 m_impl->send.clear ();
1950 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1951 m_impl->send.put_data (m_impl->magic_active);
1952 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING);
1953 m_impl->send.put_data ((uint32)ic);
1954 m_impl->send.put_data (ic_uuid);
1955 m_impl->send.put_data (preedit);
1956 m_impl->send.put_data (commit);
1957 m_impl->send.put_data (attrs);
1958 m_impl->send.put_data (caret);
1959 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1964 * @brief Update the preedit caret position in the preedit string.
1966 * @param caret - the new position of the preedit caret.
1969 HelperAgent::update_preedit_caret (int caret) const
1972 if (m_impl->socket_active.is_connected ()) {
1973 m_impl->send.clear ();
1974 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1975 m_impl->send.put_data (m_impl->magic_active);
1976 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET);
1977 m_impl->send.put_data ((uint32)caret);
1978 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1983 * @brief Update a new string for aux.
1985 * @param str The string to be updated.
1986 * @param attrs The attribute list for aux string.
1989 HelperAgent::update_aux_string (const String &str,
1990 const AttributeList &attrs) const
1992 if (m_impl->socket_active.is_connected ()) {
1993 m_impl->send.clear ();
1994 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1995 m_impl->send.put_data (m_impl->magic_active);
1996 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_AUX_STRING);
1997 m_impl->send.put_data (str);
1998 m_impl->send.put_data (attrs);
1999 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2004 * @brief Request to update candidate.
2006 * @param table The lookup table for candidate.
2009 HelperAgent::update_candidate_string (const LookupTable &table) const
2011 if (m_impl->socket_active.is_connected ()) {
2012 m_impl->send.clear ();
2013 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2014 m_impl->send.put_data (m_impl->magic_active);
2015 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE);
2016 m_impl->send.put_data (table);
2017 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2022 * @brief Request to update associate.
2024 * @param table The lookup table for associate.
2027 HelperAgent::update_associate_string (const LookupTable &table) const
2029 if (m_impl->socket_active.is_connected ()) {
2030 m_impl->send.clear ();
2031 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2032 m_impl->send.put_data (m_impl->magic_active);
2033 m_impl->send.put_command (ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE);
2034 m_impl->send.put_data (table);
2035 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2040 * @brief When the input context of ISE is changed,
2041 * ISE can call this function to notify application
2043 * @param type type of event.
2044 * @param value value of event.
2047 HelperAgent::update_input_context (uint32 type, uint32 value) const
2049 if (type == ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT) {
2050 /* Update all state variables that could be queried by the client application */
2052 m_impl->signal_get_language_locale(this, -1, &buf);
2055 if (m_impl->socket_active.is_connected()) {
2056 m_impl->send.clear();
2057 m_impl->send.put_command(SCIM_TRANS_CMD_REQUEST);
2058 m_impl->send.put_data(m_impl->magic_active);
2059 m_impl->send.put_command(ISM_TRANS_CMD_UPDATE_ISE_LANGUAGE_LOCALE);
2060 m_impl->send.put_data(buf, strlen(buf));
2061 m_impl->send.write_to_socket(m_impl->socket_active, m_impl->magic_active);
2068 if (m_impl->socket_active.is_connected ()) {
2069 m_impl->send.clear ();
2070 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2071 m_impl->send.put_data (m_impl->magic_active);
2072 m_impl->send.put_command (ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT);
2073 m_impl->send.put_data (type);
2074 m_impl->send.put_data (value);
2075 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2080 * @brief Request to get surrounding text asynchronously.
2082 * @param uuid The helper ISE UUID.
2083 * @param maxlen_before The max length of before.
2084 * @param maxlen_after The max length of after.
2087 HelperAgent::get_surrounding_text (const String &uuid, int maxlen_before, int maxlen_after) const
2089 if (m_impl->socket_active.is_connected () && (m_impl->need_update_surrounding_text == 0)) {
2090 m_impl->send.clear ();
2091 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2092 m_impl->send.put_data (m_impl->magic_active);
2093 m_impl->send.put_command (SCIM_TRANS_CMD_GET_SURROUNDING_TEXT);
2094 m_impl->send.put_data (uuid);
2095 m_impl->send.put_data (maxlen_before);
2096 m_impl->send.put_data (maxlen_after);
2097 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2099 m_impl->need_update_surrounding_text++;
2103 * @brief Request to get surrounding text synchronously.
2105 * @param uuid The helper ISE UUID.
2106 * @param maxlen_before The max length of before.
2107 * @param maxlen_after The max length of after.
2108 * @param text The surrounding text.
2109 * @param cursor The cursor position.
2112 HelperAgent::get_surrounding_text (int maxlen_before, int maxlen_after, String &text, int &cursor)
2114 if (!m_impl->socket_active.is_connected ())
2117 if (!m_impl->ise_focus_flag) {
2118 if (m_impl->finalized_text) {
2119 String buffer = m_impl->finalized_text;
2120 cursor = m_impl->finalized_cursor_pos;
2121 int pos = cursor - maxlen_before;
2122 if (maxlen_before < 0) pos = 0;
2123 if (pos > (int)buffer.length()) pos = (int)buffer.length();
2124 if (pos < 0) pos = 0;
2125 size_t len = maxlen_after + (cursor - pos);
2126 if (maxlen_after < 0) len = String::npos;
2127 text = buffer.substr (pos, len);
2133 m_impl->send.clear();
2134 m_impl->send.put_command(SCIM_TRANS_CMD_REQUEST);
2135 m_impl->send.put_data(m_impl->magic_active);
2136 m_impl->send.put_command(SCIM_TRANS_CMD_GET_SURROUNDING_TEXT);
2137 m_impl->send.put_data("");
2138 m_impl->send.put_data(maxlen_before);
2139 m_impl->send.put_data(maxlen_after);
2140 m_impl->send.write_to_socket(m_impl->socket_active, m_impl->magic_active);
2141 if (m_impl->surrounding_text) {
2142 free(m_impl->surrounding_text);
2143 m_impl->surrounding_text = NULL;
2146 const int WAIT_FOR_SYNC_RESPONSE_TIMEOUT = 1000;
2147 /* Now we are waiting for the ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT message */
2148 if (wait_for_message(ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT, WAIT_FOR_SYNC_RESPONSE_TIMEOUT)) {
2149 MessageItem *message = message_queue.get_pending_message_by_cmd(ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT);
2150 handle_message(message);
2151 message_queue.remove_message(message);
2153 if (m_impl->surrounding_text) {
2154 text = m_impl->surrounding_text;
2155 cursor = m_impl->cursor_pos;
2159 if (m_impl->surrounding_text) {
2160 free(m_impl->surrounding_text);
2161 m_impl->surrounding_text = NULL;
2164 LOGD("message_queue size : %d", message_queue.get_message_size());
2166 m_impl->send.clear ();
2167 m_impl->send.put_command(SCIM_TRANS_CMD_REQUEST);
2168 m_impl->send.put_data(m_impl->magic_active);
2169 m_impl->send.put_command(SCIM_TRANS_CMD_PING);
2170 m_impl->send.write_to_socket(m_impl->socket_active, m_impl->magic_active);
2175 * @brief Request to delete surrounding text.
2177 * @param offset The offset for cursor position.
2178 * @param len The length for delete text.
2181 HelperAgent::delete_surrounding_text (int offset, int len) const
2183 LOGD ("offset = %d, len = %d", offset, len);
2185 if (m_impl->socket_active.is_connected ()) {
2186 m_impl->send.clear ();
2187 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2188 m_impl->send.put_data (m_impl->magic_active);
2189 m_impl->send.put_command (SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT);
2190 m_impl->send.put_data (offset);
2191 m_impl->send.put_data (len);
2192 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2197 * @brief Request to get selection text asynchronously.
2199 * @param uuid The helper ISE UUID.
2202 HelperAgent::get_selection (const String &uuid) const
2204 if (m_impl->socket_active.is_connected () && (m_impl->need_update_selection_text == 0)) {
2205 m_impl->send.clear ();
2206 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2207 m_impl->send.put_data (m_impl->magic_active);
2208 m_impl->send.put_command (SCIM_TRANS_CMD_GET_SELECTION);
2209 m_impl->send.put_data (uuid);
2210 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2212 m_impl->need_update_selection_text++;
2216 * @brief Request to get selection text synchronously.
2218 * @param text The selection text.
2221 HelperAgent::get_selection_text (String &text)
2224 if (!m_impl->socket_active.is_connected ())
2227 m_impl->send.clear ();
2228 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2229 m_impl->send.put_data (m_impl->magic_active);
2230 m_impl->send.put_command (SCIM_TRANS_CMD_GET_SELECTION);
2231 m_impl->send.put_data ("");
2232 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2233 if (m_impl->selection_text) {
2234 free (m_impl->selection_text);
2235 m_impl->selection_text = NULL;
2238 const int WAIT_FOR_SYNC_RESPONSE_TIMEOUT = 1000;
2239 /* Now we are waiting for the ISM_TRANS_CMD_UPDATE_SELECTION message */
2240 if (wait_for_message(ISM_TRANS_CMD_UPDATE_SELECTION, WAIT_FOR_SYNC_RESPONSE_TIMEOUT)) {
2241 MessageItem *message = message_queue.get_pending_message_by_cmd(ISM_TRANS_CMD_UPDATE_SELECTION);
2242 handle_message(message);
2243 message_queue.remove_message(message);
2244 if (m_impl->selection_text) {
2245 text = m_impl->selection_text;
2249 if (m_impl->selection_text) {
2250 free (m_impl->selection_text);
2251 m_impl->selection_text = NULL;
2254 LOGD("message_queue size : %d", message_queue.get_message_size());
2256 m_impl->send.clear ();
2257 m_impl->send.put_command(SCIM_TRANS_CMD_REQUEST);
2258 m_impl->send.put_data(m_impl->magic_active);
2259 m_impl->send.put_command(SCIM_TRANS_CMD_PING);
2260 m_impl->send.write_to_socket(m_impl->socket_active, m_impl->magic_active);
2264 * @brief Request to select text.
2266 * @param start The start position in text.
2267 * @param end The end position in text.
2270 HelperAgent::set_selection (int start, int end) const
2272 if (m_impl->socket_active.is_connected ()) {
2273 m_impl->send.clear ();
2274 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2275 m_impl->send.put_data (m_impl->magic_active);
2276 m_impl->send.put_command (SCIM_TRANS_CMD_SET_SELECTION);
2277 m_impl->send.put_data (start);
2278 m_impl->send.put_data (end);
2279 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2284 * @brief Send a private command to an application.
2286 * @param command The private command sent from IME.
2289 HelperAgent::send_private_command (const String &command) const
2291 if (m_impl->socket_active.is_connected ()) {
2292 m_impl->send.clear ();
2293 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2294 m_impl->send.put_data (m_impl->magic_active);
2295 m_impl->send.put_command (SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND);
2296 m_impl->send.put_data (command);
2297 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2302 * @brief Commit content to an application.
2304 * @param content The content sent from IME.
2307 HelperAgent::commit_content (const String &content, const String &description, const String &mime_types) const
2310 if (m_impl->socket_active.is_connected ()) {
2311 m_impl->send.clear ();
2312 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2313 m_impl->send.put_data (m_impl->magic_active);
2314 m_impl->send.put_command (SCIM_TRANS_CMD_COMMIT_CONTENT);
2315 m_impl->send.put_data (content);
2316 m_impl->send.put_data (description);
2317 m_impl->send.put_data (mime_types);
2318 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2323 * @brief Request to get uuid list of all keyboard ISEs.
2325 * @param uuid The helper ISE UUID.
2328 HelperAgent::get_keyboard_ise_list (const String &uuid) const
2330 if (m_impl->socket_active.is_connected ()) {
2331 m_impl->send.clear ();
2332 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2333 m_impl->send.put_data (m_impl->magic_active);
2334 m_impl->send.put_command (ISM_TRANS_CMD_GET_KEYBOARD_ISE_LIST);
2335 m_impl->send.put_data (uuid);
2336 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2341 * @brief Set candidate position in screen.
2343 * @param left The x position in screen.
2344 * @param top The y position in screen.
2347 HelperAgent::set_candidate_position (int left, int top) const
2349 if (m_impl->socket_active.is_connected ()) {
2350 m_impl->send.clear ();
2351 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2352 m_impl->send.put_data (m_impl->magic_active);
2353 m_impl->send.put_command (ISM_TRANS_CMD_SET_CANDIDATE_POSITION);
2354 m_impl->send.put_data (left);
2355 m_impl->send.put_data (top);
2356 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2361 * @brief Set candidate style.
2363 * @param portrait_line - the displayed line number for portrait mode.
2364 * @param mode - candidate window mode.
2367 HelperAgent::set_candidate_style (ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line,
2368 ISF_CANDIDATE_MODE_T mode) const
2370 if (m_impl->socket_active.is_connected ()) {
2371 m_impl->send.clear ();
2372 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2373 m_impl->send.put_data (m_impl->magic_active);
2374 m_impl->send.put_command (ISM_TRANS_CMD_SET_CANDIDATE_UI);
2375 m_impl->send.put_data (portrait_line);
2376 m_impl->send.put_data (mode);
2377 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2382 * @brief Request to hide candidate window.
2385 HelperAgent::candidate_hide (void) const
2387 if (m_impl->socket_active.is_connected ()) {
2388 m_impl->send.clear ();
2389 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2390 m_impl->send.put_data (m_impl->magic_active);
2391 m_impl->send.put_command (ISM_TRANS_CMD_HIDE_CANDIDATE);
2392 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2397 * @brief Request to get candidate window size and position.
2399 * @param uuid The helper ISE UUID.
2402 HelperAgent::get_candidate_window_geometry (const String &uuid) const
2404 if (m_impl->socket_active.is_connected ()) {
2405 m_impl->send.clear ();
2406 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2407 m_impl->send.put_data (m_impl->magic_active);
2408 m_impl->send.put_command (ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY);
2409 m_impl->send.put_data (uuid);
2410 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2415 * @brief Set current keyboard ISE.
2417 * @param uuid The keyboard ISE UUID.
2420 HelperAgent::set_keyboard_ise_by_uuid (const String &uuid) const
2423 IMEngineFactoryPointer factory;
2424 IMEngineModule *engine_module = NULL;
2425 static int instance_count = 1;
2427 if ((!m_impl->si.null ()) && m_impl->si->get_factory_uuid () == uuid) {
2428 ISF_SAVE_LOG ("Already in UUID: %s", uuid.c_str());
2432 if (!m_impl->si.null()) {
2433 m_impl->si->focus_out();
2437 if (m_impl->m_config.null ()) {
2438 ISF_SAVE_LOG ("config is not working");
2442 #ifdef HAVE_PKGMGR_INFO
2445 pkgmgrinfo_appinfo_h handle;
2446 ret = pkgmgrinfo_appinfo_get_appinfo(uuid.c_str(), &handle);
2447 if (ret != PMINFO_R_OK) {
2448 ISF_SAVE_LOG ("Retrieve app info failed : %s", uuid.c_str ());
2452 ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid);
2453 if (ret != PMINFO_R_OK) {
2454 ISF_SAVE_LOG ("Retrieve pkgid failed : %s, %p", uuid.c_str(), handle);
2455 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2459 imeInfo.module_name = pkgid;
2460 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2462 if (isf_db_select_ime_info_by_appid(uuid.c_str(), &imeInfo) < 1) {
2463 ISF_SAVE_LOG ("ime_info row is not available for %s", uuid.c_str());
2468 engine_module = &m_impl->engine_module;
2470 if (engine_module->valid() && imeInfo.module_name != engine_module->get_module_name()) {
2471 ISF_SAVE_LOG ("imengine module %s unloaded", engine_module->get_module_name().c_str());
2472 engine_module->unload();
2475 if (!engine_module->valid()) {
2476 if (engine_module->load (imeInfo.module_name, m_impl->m_config) == false) {
2477 ISF_SAVE_LOG ("load module %s failed", imeInfo.module_name.c_str());
2480 ISF_SAVE_LOG ("imengine module %s loaded", imeInfo.module_name.c_str());
2483 for (size_t j = 0; j < engine_module->number_of_factories (); ++j) {
2485 factory = engine_module->create_factory (j);
2486 if (factory.null () == false && factory->get_uuid () == uuid)
2494 if (factory.null()) {
2495 ISF_SAVE_LOG ("imengine uuid %s is not found", uuid.c_str());
2499 m_impl->si = factory->create_instance ("UTF-8", instance_count++);
2500 if (m_impl->si.null ()) {
2501 ISF_SAVE_LOG ("create_instance %s failed", uuid.c_str ());
2505 m_impl->attach_instance ();
2506 ISF_SAVE_LOG ("Require UUID: %s Current UUID: %s", uuid.c_str (), m_impl->si->get_factory_uuid ().c_str ());
2507 m_impl->si->set_layout (m_impl->layout);
2508 if (m_impl->focused_ic != (uint32)-1)
2509 m_impl->si->focus_in ();
2513 * @brief Request to get current keyboard ISE information.
2515 * @param uuid The helper ISE UUID.
2518 HelperAgent::get_keyboard_ise (const String &uuid) const
2520 //FIXME: maybe useless
2522 if (m_impl->socket_active.is_connected ()) {
2523 m_impl->send.clear ();
2524 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2525 m_impl->send.put_data (m_impl->magic_active);
2526 m_impl->send.put_command (ISM_TRANS_CMD_GET_KEYBOARD_ISE);
2527 m_impl->send.put_data (uuid);
2528 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2534 * @brief Update ISE window geometry.
2536 * @param x The x position in screen.
2537 * @param y The y position in screen.
2538 * @param width The ISE window width.
2539 * @param height The ISE window height.
2542 HelperAgent::update_geometry (int x, int y, int width, int height) const
2544 if (m_impl->socket_active.is_connected ()) {
2545 m_impl->send.clear ();
2546 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2547 m_impl->send.put_data (m_impl->magic_active);
2548 m_impl->send.put_command (ISM_TRANS_CMD_UPDATE_ISE_GEOMETRY);
2549 m_impl->send.put_data (x);
2550 m_impl->send.put_data (y);
2551 m_impl->send.put_data (width);
2552 m_impl->send.put_data (height);
2553 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2558 * @brief Request to expand candidate window.
2561 HelperAgent::expand_candidate (void) const
2563 if (m_impl->socket_active.is_connected ()) {
2564 m_impl->send.clear ();
2565 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2566 m_impl->send.put_data (m_impl->magic_active);
2567 m_impl->send.put_command (ISM_TRANS_CMD_EXPAND_CANDIDATE);
2568 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2573 * @brief Request to contract candidate window.
2576 HelperAgent::contract_candidate (void) const
2578 if (m_impl->socket_active.is_connected ()) {
2579 m_impl->send.clear ();
2580 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2581 m_impl->send.put_data (m_impl->magic_active);
2582 m_impl->send.put_command (ISM_TRANS_CMD_CONTRACT_CANDIDATE);
2583 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2588 * @brief Send selected candidate string index number.
2591 HelperAgent::select_candidate (int index) const
2593 if (!m_impl->si.null ())
2594 m_impl->si->select_candidate (index);
2595 //FIXME: maybe useless
2598 if (m_impl->socket_active.is_connected ()) {
2599 m_impl->send.clear ();
2600 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2601 m_impl->send.put_data (m_impl->magic_active);
2602 m_impl->send.put_command (ISM_TRANS_CMD_SELECT_CANDIDATE);
2603 m_impl->send.put_data (index);
2604 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2610 * @brief Update our ISE is exiting.
2612 * The IME must call this function before terminating IME itself in On-demand mode.
2613 * If this function isn't called, IME will automatically restart.
2614 * This function only works in On-demand mode.
2618 HelperAgent::update_ise_exit (void) const
2620 if (m_impl->socket_active.is_connected ()) {
2621 m_impl->send.clear ();
2622 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2623 m_impl->send.put_data (m_impl->magic_active);
2624 m_impl->send.put_command (ISM_TRANS_CMD_UPDATE_ISE_EXIT);
2625 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2627 // The update_ise_exit must be delivered before del_client of isf_info_manager was called.
2633 * @brief Request to reset keyboard ISE.
2636 HelperAgent::reset_keyboard_ise (void) const
2638 //FIXME: maybe useless
2640 if (m_impl->socket_active.is_connected ()) {
2641 m_impl->send.clear ();
2642 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2643 m_impl->send.put_data (m_impl->magic_active);
2644 m_impl->send.put_command (ISM_TRANS_CMD_PANEL_RESET_KEYBOARD_ISE);
2645 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2648 if (!m_impl->si.null ()) {
2649 m_impl->si->reset ();
2654 * @brief Request to flush keyboard ISE.
2657 HelperAgent::flush_keyboard_ise (void) const
2659 if (!m_impl->si.null ()) {
2660 m_impl->si->flush ();
2665 * @brief Request panel to hide ISE.
2668 HelperAgent::request_ise_hide (void) const
2670 if (m_impl->socket_active.is_connected ()) {
2671 m_impl->send.clear ();
2672 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2673 m_impl->send.put_data (m_impl->magic_active);
2674 m_impl->send.put_command (ISM_TRANS_CMD_REQUEST_ISE_HIDE);
2675 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2683 HelperAgent::recapture_string (int ic,
2684 const String &ic_uuid,
2687 const WideString &preedit_str,
2688 const WideString &commit_str,
2689 const AttributeList &attrs) const
2691 LOGD ("offset = %d, len = %d", offset, len);
2693 if (m_impl->socket_active.is_connected ()) {
2694 m_impl->send.clear ();
2695 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2696 m_impl->send.put_data (m_impl->magic_active);
2697 m_impl->send.put_command (ISM_TRANS_CMD_RECAPTURE_STRING);
2699 m_impl->send.put_data ((uint32)ic);
2700 m_impl->send.put_data (ic_uuid);
2702 // Deleting surrounding text
2703 m_impl->send.put_data (offset);
2704 m_impl->send.put_data (len);
2706 // Update preedit text
2707 m_impl->send.put_data (preedit_str);
2710 m_impl->send.put_data (commit_str);
2712 // preedit attributes
2713 m_impl->send.put_data (attrs);
2715 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2720 * @brief Connect a slot to Helper exit signal.
2722 * This signal is used to let the Helper exit.
2724 * The prototype of the slot is:
2726 * void exit (const HelperAgent *agent, int ic, const String &ic_uuid);
2729 * - agent The pointer to the HelperAgent object which emits this signal.
2730 * - ic An opaque handle of the currently focused input context.
2731 * - ic_uuid The UUID of the IMEngineInstance associated with the focused input context.
2734 HelperAgent::signal_connect_exit (HelperAgentSlotVoid *slot)
2736 return m_impl->signal_exit.connect (slot);
2740 * @brief Connect a slot to Helper attach input context signal.
2742 * This signal is used to attach an input context to this helper.
2744 * When an input context requst to start this helper, then this
2745 * signal will be emitted as soon as the helper is started.
2747 * When an input context want to start an already started helper,
2748 * this signal will also be emitted.
2750 * Helper can send some events back to the IMEngineInstance in this
2751 * signal-slot, to inform that it has been started sccessfully.
2753 * The prototype of the slot is:
2755 * void attach_input_context (const HelperAgent *agent, int ic, const String &ic_uuid);
2758 HelperAgent::signal_connect_attach_input_context (HelperAgentSlotVoid *slot)
2760 return m_impl->signal_attach_input_context.connect (slot);
2764 * @brief Connect a slot to Helper detach input context signal.
2766 * This signal is used to detach an input context from this helper.
2768 * When an input context requst to stop this helper, then this
2769 * signal will be emitted.
2771 * Helper shouldn't send any event back to the IMEngineInstance, because
2772 * the IMEngineInstance attached to the ic should have been destroyed.
2774 * The prototype of the slot is:
2776 * void detach_input_context (const HelperAgent *agent, int ic, const String &ic_uuid);
2779 HelperAgent::signal_connect_detach_input_context (HelperAgentSlotVoid *slot)
2781 return m_impl->signal_detach_input_context.connect (slot);
2785 * @brief Connect a slot to Helper reload config signal.
2787 * This signal is used to let the Helper reload configuration.
2789 * The prototype of the slot is:
2791 * void reload_config (const HelperAgent *agent, int ic, const String &ic_uuid);
2794 HelperAgent::signal_connect_reload_config (HelperAgentSlotVoid *slot)
2796 return m_impl->signal_reload_config.connect (slot);
2800 * @brief Connect a slot to Helper update screen signal.
2802 * This signal is used to let the Helper move its GUI to another screen.
2803 * It can only be emitted when SCIM_HELPER_NEED_SCREEN_INFO is set in HelperInfo.option.
2805 * The prototype of the slot is:
2807 * void update_screen (const HelperAgent *agent, int ic, const String &ic_uuid, int screen_number);
2810 HelperAgent::signal_connect_update_screen (HelperAgentSlotInt *slot)
2812 return m_impl->signal_update_screen.connect (slot);
2816 * @brief Connect a slot to Helper update spot location signal.
2818 * This signal is used to let the Helper move its GUI according to the current spot location.
2819 * It can only be emitted when SCIM_HELPER_NEED_SPOT_LOCATION_INFO is set in HelperInfo.option.
2821 * The prototype of the slot is:
2822 * void update_spot_location (const HelperAgent *agent, int ic, const String &ic_uuid, int x, int y);
2825 HelperAgent::signal_connect_update_spot_location (HelperAgentSlotIntInt *slot)
2827 return m_impl->signal_update_spot_location.connect (slot);
2831 * @brief Connect a slot to Helper update cursor position signal.
2833 * This signal is used to let the Helper get the cursor position information.
2835 * The prototype of the slot is:
2836 * void update_cursor_position (const HelperAgent *agent, int ic, const String &ic_uuid, int cursor_pos);
2839 HelperAgent::signal_connect_update_cursor_position (HelperAgentSlotInt *slot)
2841 return m_impl->signal_update_cursor_position.connect (slot);
2845 * @brief Connect a slot to Helper update surrounding text signal.
2847 * This signal is used to let the Helper get the surrounding text.
2849 * The prototype of the slot is:
2850 * void update_surrounding_text (const HelperAgent *agent, int ic, const String &text, int cursor);
2853 HelperAgent::signal_connect_update_surrounding_text (HelperAgentSlotInt *slot)
2855 return m_impl->signal_update_surrounding_text.connect (slot);
2859 * @brief Connect a slot to Helper update selection signal.
2861 * This signal is used to let the Helper get the selection.
2863 * The prototype of the slot is:
2864 * void update_selection (const HelperAgent *agent, int ic, const String &text);
2867 HelperAgent::signal_connect_update_selection (HelperAgentSlotVoid *slot)
2869 return m_impl->signal_update_selection.connect (slot);
2873 * @brief Connect a slot to Helper trigger property signal.
2875 * This signal is used to trigger a property registered by this Helper.
2876 * A property will be triggered when user clicks on it.
2878 * The prototype of the slot is:
2879 * void trigger_property (const HelperAgent *agent, int ic, const String &ic_uuid, const String &property);
2882 HelperAgent::signal_connect_trigger_property (HelperAgentSlotString *slot)
2884 return m_impl->signal_trigger_property.connect (slot);
2888 * @brief Connect a slot to Helper process imengine event signal.
2890 * This signal is used to deliver the events sent from IMEngine to Helper.
2892 * The prototype of the slot is:
2893 * void process_imengine_event (const HelperAgent *agent, int ic, const String &ic_uuid, const Transaction &transaction);
2896 HelperAgent::signal_connect_process_imengine_event (HelperAgentSlotTransaction *slot)
2898 return m_impl->signal_process_imengine_event.connect (slot);
2902 * @brief Connect a slot to Helper focus out signal.
2904 * This signal is used to do something when input context is focus out.
2906 * The prototype of the slot is:
2907 * void focus_out (const HelperAgent *agent, int ic, const String &ic_uuid);
2910 HelperAgent::signal_connect_focus_out (HelperAgentSlotVoid *slot)
2912 return m_impl->signal_focus_out.connect (slot);
2916 * @brief Connect a slot to Helper focus in signal.
2918 * This signal is used to do something when input context is focus in.
2920 * The prototype of the slot is:
2921 * void focus_in (const HelperAgent *agent, int ic, const String &ic_uuid);
2924 HelperAgent::signal_connect_focus_in (HelperAgentSlotVoid *slot)
2926 return m_impl->signal_focus_in.connect (slot);
2930 * @brief Connect a slot to Helper show signal.
2932 * This signal is used to show Helper ISE window.
2934 * The prototype of the slot is:
2935 * void ise_show (const HelperAgent *agent, int ic, char *buf, size_t &len);
2938 HelperAgent::signal_connect_ise_show (HelperAgentSlotIntRawVoid *slot)
2940 return m_impl->signal_ise_show.connect (slot);
2944 * @brief Connect a slot to Helper hide signal.
2946 * This signal is used to hide Helper ISE window.
2948 * The prototype of the slot is:
2949 * void ise_hide (const HelperAgent *agent, int ic, const String &ic_uuid);
2952 HelperAgent::signal_connect_ise_hide (HelperAgentSlotVoid *slot)
2954 return m_impl->signal_ise_hide.connect (slot);
2958 * @brief Connect a slot to Helper get ISE window geometry signal.
2960 * This signal is used to get Helper ISE window size and position.
2962 * The prototype of the slot is:
2963 * void get_geometry (const HelperAgent *agent, struct rectinfo &info);
2966 HelperAgent::signal_connect_get_geometry (HelperAgentSlotSize *slot)
2968 return m_impl->signal_get_geometry.connect (slot);
2972 * @brief Connect a slot to Helper set mode signal.
2974 * This signal is used to set Helper ISE mode.
2976 * The prototype of the slot is:
2977 * void set_mode (const HelperAgent *agent, uint32 &mode);
2980 HelperAgent::signal_connect_set_mode (HelperAgentSlotUintVoid *slot)
2982 return m_impl->signal_set_mode.connect (slot);
2986 * @brief Connect a slot to Helper set language signal.
2988 * This signal is used to set Helper ISE language.
2990 * The prototype of the slot is:
2991 * void set_language (const HelperAgent *agent, uint32 &language);
2994 HelperAgent::signal_connect_set_language (HelperAgentSlotUintVoid *slot)
2996 return m_impl->signal_set_language.connect (slot);
3000 * @brief Connect a slot to Helper set im data signal.
3002 * This signal is used to send im data to Helper ISE.
3004 * The prototype of the slot is:
3005 * void set_imdata (const HelperAgent *agent, char *buf, size_t &len);
3008 HelperAgent::signal_connect_set_imdata (HelperAgentSlotRawVoid *slot)
3010 return m_impl->signal_set_imdata.connect (slot);
3014 * @brief Connect a slot to Helper get im data signal.
3016 * This signal is used to get im data from Helper ISE.
3018 * The prototype of the slot is:
3019 * void get_imdata (const HelperAgent *, char **buf, size_t &len);
3022 HelperAgent::signal_connect_get_imdata (HelperAgentSlotGetRawVoid *slot)
3024 return m_impl->signal_get_imdata.connect (slot);
3028 * @brief Connect a slot to Helper get language locale signal.
3030 * This signal is used to get language locale from Helper ISE.
3032 * The prototype of the slot is:
3033 * void get_language_locale (const HelperAgent *, int ic, char **locale);
3036 HelperAgent::signal_connect_get_language_locale (HelperAgentSlotIntGetStringVoid *slot)
3038 return m_impl->signal_get_language_locale.connect (slot);
3042 * @brief Connect a slot to Helper set return key type signal.
3044 * This signal is used to send return key type to Helper ISE.
3046 * The prototype of the slot is:
3047 * void set_return_key_type (const HelperAgent *agent, uint32 &type);
3050 HelperAgent::signal_connect_set_return_key_type (HelperAgentSlotUintVoid *slot)
3052 return m_impl->signal_set_return_key_type.connect (slot);
3056 * @brief Connect a slot to Helper get return key type signal.
3058 * This signal is used to get return key type from Helper ISE.
3060 * The prototype of the slot is:
3061 * void get_return_key_type (const HelperAgent *agent, uint32 &type);
3064 HelperAgent::signal_connect_get_return_key_type (HelperAgentSlotUintVoid *slot)
3066 return m_impl->signal_get_return_key_type.connect (slot);
3070 * @brief Connect a slot to Helper set return key disable signal.
3072 * This signal is used to send return key disable to Helper ISE.
3074 * The prototype of the slot is:
3075 * void set_return_key_disable (const HelperAgent *agent, uint32 &disabled);
3078 HelperAgent::signal_connect_set_return_key_disable (HelperAgentSlotUintVoid *slot)
3080 return m_impl->signal_set_return_key_disable.connect (slot);
3084 * @brief Connect a slot to Helper process key event signal.
3086 * This signal is used to send keyboard key event to Helper ISE.
3088 * The prototype of the slot is:
3089 * void process_key_event (const HelperAgent *agent, KeyEvent &key, uint32 &ret);
3092 HelperAgent::signal_connect_process_key_event (HelperAgentSlotKeyEventUint *slot)
3094 return m_impl->signal_process_key_event.connect (slot);
3098 * @brief Connect a slot to Helper process key event with keycode signal.
3100 * This signal is used to send keyboard key event with keycode to Helper ISE.
3102 * The prototype of the slot is:
3103 * void process_key_event_with_keycode (const HelperAgent *agent, KeyEvent &key, uint32 &ret, uint32 keycode);
3106 HelperAgent::signal_connect_process_key_event_with_keycode (HelperAgentSlotKeyEventUintUint *slot)
3108 return m_impl->signal_process_key_event_with_keycode.connect (slot);
3112 * @brief Connect a slot to Helper get return key disable signal.
3114 * This signal is used to get return key disable from Helper ISE.
3116 * The prototype of the slot is:
3117 * void get_return_key_disable (const HelperAgent *agent, uint32 &disabled);
3120 HelperAgent::signal_connect_get_return_key_disable (HelperAgentSlotUintVoid *slot)
3122 return m_impl->signal_get_return_key_disable.connect (slot);
3126 * @brief Connect a slot to Helper set layout signal.
3128 * This signal is used to set Helper ISE layout.
3130 * The prototype of the slot is:
3131 * void set_layout (const HelperAgent *agent, uint32 &layout);
3134 HelperAgent::signal_connect_set_layout (HelperAgentSlotUintVoid *slot)
3136 return m_impl->signal_set_layout.connect (slot);
3140 * @brief Connect a slot to Helper get layout signal.
3142 * This signal is used to get Helper ISE layout.
3144 * The prototype of the slot is:
3145 * void get_layout (const HelperAgent *agent, uint32 &layout);
3148 HelperAgent::signal_connect_get_layout (HelperAgentSlotUintVoid *slot)
3150 return m_impl->signal_get_layout.connect (slot);
3154 * @brief Connect a slot to Helper set input mode signal.
3156 * This signal is used to set Helper ISE input mode.
3158 * The prototype of the slot is:
3159 * void set_input_mode (const HelperAgent *agent, uint32 &input_mode);
3162 HelperAgent::signal_connect_set_input_mode (HelperAgentSlotUintVoid *slot)
3164 return m_impl->signal_set_input_mode.connect (slot);
3168 * @brief Connect a slot to Helper set input hint signal.
3170 * This signal is used to set Helper ISE input hint.
3172 * The prototype of the slot is:
3173 * void set_input_hint (const HelperAgent *agent, uint32 &input_hint);
3176 HelperAgent::signal_connect_set_input_hint (HelperAgentSlotUintVoid *slot)
3178 return m_impl->signal_set_input_hint.connect (slot);
3182 * @brief Connect a slot to Helper set BiDi direction signal.
3184 * This signal is used to set Helper ISE BiDi direction.
3186 * The prototype of the slot is:
3187 * void update_bidi_direction (const HelperAgent *agent, uint32 &bidi_direction);
3190 HelperAgent::signal_connect_update_bidi_direction (HelperAgentSlotUintVoid *slot)
3192 return m_impl->signal_update_bidi_direction.connect (slot);
3196 * @brief Connect a slot to Helper set shift mode signal.
3198 * This signal is used to set Helper shift mode.
3200 * The prototype of the slot is:
3201 * void set_caps_mode (const HelperAgent *agent, uint32 &mode);
3204 HelperAgent::signal_connect_set_caps_mode (HelperAgentSlotUintVoid *slot)
3206 return m_impl->signal_set_caps_mode.connect (slot);
3210 * @brief Connect a slot to Helper reset input context signal.
3212 * This signal is used to reset Helper ISE input context.
3214 * The prototype of the slot is:
3215 * void reset_input_context (const HelperAgent *agent, int ic, const String &uuid);
3218 HelperAgent::signal_connect_reset_input_context (HelperAgentSlotVoid *slot)
3220 return m_impl->signal_reset_input_context.connect (slot);
3224 * @brief Connect a slot to Helper update candidate window geometry signal.
3226 * This signal is used to get candidate window size and position.
3228 * The prototype of the slot is:
3229 * void update_candidate_geometry (const HelperAgent *agent, int ic, const String &uuid, const rectinfo &info);
3232 HelperAgent::signal_connect_update_candidate_geometry (HelperAgentSlotRect *slot)
3234 return m_impl->signal_update_candidate_geometry.connect (slot);
3238 * @brief Connect a slot to Helper update keyboard ISE signal.
3240 * This signal is used to get current keyboard ISE name and uuid.
3242 * The prototype of the slot is:
3243 * void update_keyboard_ise (const HelperAgent *agent, int ic, const String &uuid,
3244 * const String &ise_name, const String &ise_uuid);
3247 HelperAgent::signal_connect_update_keyboard_ise (HelperAgentSlotString2 *slot)
3249 return m_impl->signal_update_keyboard_ise.connect (slot);
3253 * @brief Connect a slot to Helper update keyboard ISE list signal.
3255 * This signal is used to get uuid list of all keyboard ISEs.
3257 * The prototype of the slot is:
3258 * void update_keyboard_ise_list (const HelperAgent *agent, int ic, const String &uuid,
3259 * const std::vector<String> &ise_list);
3262 HelperAgent::signal_connect_update_keyboard_ise_list (HelperAgentSlotStringVector *slot)
3264 return m_impl->signal_update_keyboard_ise_list.connect (slot);
3268 * @brief Connect a slot to Helper candidate more window show signal.
3270 * This signal is used to do someting when candidate more window is showed.
3272 * The prototype of the slot is:
3273 * void candidate_more_window_show (const HelperAgent *agent, int ic, const String &uuid);
3276 HelperAgent::signal_connect_candidate_more_window_show (HelperAgentSlotVoid *slot)
3278 return m_impl->signal_candidate_more_window_show.connect (slot);
3282 * @brief Connect a slot to Helper candidate more window hide signal.
3284 * This signal is used to do someting when candidate more window is hidden.
3286 * The prototype of the slot is:
3287 * void candidate_more_window_hide (const HelperAgent *agent, int ic, const String &uuid);
3290 HelperAgent::signal_connect_candidate_more_window_hide (HelperAgentSlotVoid *slot)
3292 return m_impl->signal_candidate_more_window_hide.connect (slot);
3296 * @brief Connect a slot to Helper candidate show signal.
3298 * This signal is used to do candidate show.
3300 * The prototype of the slot is:
3301 * void candidate_show (const HelperAgent *agent, int ic, const String &uuid);
3304 HelperAgent::signal_connect_candidate_show (HelperAgentSlotVoid *slot)
3306 return m_impl->signal_candidate_show.connect (slot);
3310 * @brief Connect a slot to Helper candidate hide signal.
3312 * This signal is used to do candidate hide.
3314 * The prototype of the slot is:
3315 * void candidate_hide (const HelperAgent *agent, int ic, const String &uuid);
3318 HelperAgent::signal_connect_candidate_hide (HelperAgentSlotVoid *slot)
3320 return m_impl->signal_candidate_hide.connect (slot);
3324 * @brief Connect a slot to Helper update lookup table signal.
3326 * This signal is used to do someting when update lookup table.
3328 * The prototype of the slot is:
3329 * void update_lookup_table (const HelperAgent *agent, int ic, const String &uuid ,LookupTable &table);
3332 HelperAgent::signal_connect_update_lookup_table (HelperAgentSlotLookupTable *slot)
3334 return m_impl->signal_update_lookup_table.connect (slot);
3338 * @brief Connect a slot to Helper select aux signal.
3340 * This signal is used to do something when aux is selected.
3342 * The prototype of the slot is:
3343 * void select_aux (const HelperAgent *agent, int ic, const String &uuid, int index);
3346 HelperAgent::signal_connect_select_aux (HelperAgentSlotInt *slot)
3348 return m_impl->signal_select_aux.connect (slot);
3352 * @brief Connect a slot to Helper select candidate signal.
3354 * This signal is used to do something when candidate is selected.
3356 * The prototype of the slot is:
3357 * void select_candidate (const HelperAgent *agent, int ic, const String &uuid, int index);
3360 HelperAgent::signal_connect_select_candidate (HelperAgentSlotInt *slot)
3362 return m_impl->signal_select_candidate.connect (slot);
3366 * @brief Connect a slot to Helper candidate table page up signal.
3368 * This signal is used to do something when candidate table is paged up.
3370 * The prototype of the slot is:
3371 * void candidate_table_page_up (const HelperAgent *agent, int ic, const String &uuid);
3374 HelperAgent::signal_connect_candidate_table_page_up (HelperAgentSlotVoid *slot)
3376 return m_impl->signal_candidate_table_page_up.connect (slot);
3380 * @brief Connect a slot to Helper candidate table page down signal.
3382 * This signal is used to do something when candidate table is paged down.
3384 * The prototype of the slot is:
3385 * void candidate_table_page_down (const HelperAgent *agent, int ic, const String &uuid);
3388 HelperAgent::signal_connect_candidate_table_page_down (HelperAgentSlotVoid *slot)
3390 return m_impl->signal_candidate_table_page_down.connect (slot);
3394 * @brief Connect a slot to Helper update candidate table page size signal.
3396 * This signal is used to do something when candidate table page size is changed.
3398 * The prototype of the slot is:
3399 * void update_candidate_table_page_size (const HelperAgent *, int ic, const String &uuid, int page_size);
3402 HelperAgent::signal_connect_update_candidate_table_page_size (HelperAgentSlotInt *slot)
3404 return m_impl->signal_update_candidate_table_page_size.connect (slot);
3408 * @brief Connect a slot to Helper update candidate item layout signal.
3410 * The prototype of the slot is:
3411 * void update_candidate_item_layout (const HelperAgent *, const std::vector<uint32> &row_items);
3414 HelperAgent::signal_connect_update_candidate_item_layout (HelperAgentSlotUintVector *slot)
3416 return m_impl->signal_update_candidate_item_layout.connect (slot);
3420 * @brief Connect a slot to Helper select associate signal.
3422 * This signal is used to do something when associate is selected.
3424 * The prototype of the slot is:
3425 * void select_associate (const HelperAgent *agent, int ic, const String &uuid, int index);
3428 HelperAgent::signal_connect_select_associate (HelperAgentSlotInt *slot)
3430 return m_impl->signal_select_associate.connect (slot);
3434 * @brief Connect a slot to Helper associate table page up signal.
3436 * This signal is used to do something when associate table is paged up.
3438 * The prototype of the slot is:
3439 * void associate_table_page_up (const HelperAgent *agent, int ic, const String &uuid);
3442 HelperAgent::signal_connect_associate_table_page_up (HelperAgentSlotVoid *slot)
3444 return m_impl->signal_associate_table_page_up.connect (slot);
3448 * @brief Connect a slot to Helper associate table page down signal.
3450 * This signal is used to do something when associate table is paged down.
3452 * The prototype of the slot is:
3453 * void associate_table_page_down (const HelperAgent *agent, int ic, const String &uuid);
3456 HelperAgent::signal_connect_associate_table_page_down (HelperAgentSlotVoid *slot)
3458 return m_impl->signal_associate_table_page_down.connect (slot);
3462 * @brief Connect a slot to Helper update associate table page size signal.
3464 * This signal is used to do something when associate table page size is changed.
3466 * The prototype of the slot is:
3467 * void update_associate_table_page_size (const HelperAgent *, int ic, const String &uuid, int page_size);
3470 HelperAgent::signal_connect_update_associate_table_page_size (HelperAgentSlotInt *slot)
3472 return m_impl->signal_update_associate_table_page_size.connect (slot);
3476 * @brief Connect a slot to Helper turn on log signal.
3478 * This signal is used to turn on Helper ISE debug information.
3480 * The prototype of the slot is:
3481 * void turn_on_log (const HelperAgent *agent, uint32 &on);
3484 HelperAgent::signal_connect_turn_on_log (HelperAgentSlotUintVoid *slot)
3486 return m_impl->signal_turn_on_log.connect (slot);
3490 * @brief Connect a slot to Helper update displayed candidate number signal.
3492 * This signal is used to inform helper ISE displayed candidate number.
3494 * The prototype of the slot is:
3495 * void update_displayed_candidate_number (const HelperAgent *, int ic, const String &uuid, int number);
3498 HelperAgent::signal_connect_update_displayed_candidate_number (HelperAgentSlotInt *slot)
3500 return m_impl->signal_update_displayed_candidate_number.connect (slot);
3504 * @brief Connect a slot to Helper longpress candidate signal.
3506 * This signal is used to do something when candidate is longpress.
3508 * The prototype of the slot is:
3509 * void longpress_candidate (const HelperAgent *agent, int ic, const String &uuid, int index);
3512 HelperAgent::signal_connect_longpress_candidate (HelperAgentSlotInt *slot)
3514 return m_impl->signal_longpress_candidate.connect (slot);
3518 * @brief Connect a slot to Helper show option window.
3520 * This signal is used to do request the ISE to show option window.
3522 * The prototype of the slot is:
3523 * void show_option_window (const HelperAgent *agent, int ic, const String &uuid);
3526 HelperAgent::signal_connect_show_option_window (HelperAgentSlotVoid *slot)
3528 return m_impl->signal_show_option_window.connect (slot);
3532 * @brief Connect a slot to Helper resume option window.
3534 * This signal is used to do request the ISE to resume option window.
3536 * The prototype of the slot is:
3537 * void resume_option_window (const HelperAgent *agent, int ic, const String &uuid);
3540 HelperAgent::signal_connect_resume_option_window (HelperAgentSlotVoid *slot)
3542 return m_impl->signal_resume_option_window.connect (slot);
3546 * @brief Connect a slot to Helper check if the option is available.
3548 * This signal is used to check if the option (setting) is available from Helper ISE.
3550 * The prototype of the slot is:
3551 * void check_option_window (const HelperAgent *agent, uint32 &avail);
3554 HelperAgent::signal_connect_check_option_window (HelperAgentSlotUintVoid *slot)
3556 return m_impl->signal_check_option_window.connect (slot);
3560 * @brief Connect a slot to Helper process unconventional input device event signal.
3562 * This signal is used to send unconventional input device event to Helper ISE.
3564 * The prototype of the slot is:
3565 * void process_input_device_event (const HelperAgent *, uint32 &type, char *data, size_t &size, uint32 &ret);
3568 HelperAgent::signal_connect_process_input_device_event (HelperAgentSlotUintCharSizeUint *slot)
3570 return m_impl->signal_process_input_device_event.connect (slot);
3574 * @brief Connect a slot to Helper set prediction hint signal.
3576 * This signal is used to send prediction hint to Helper ISE.
3578 * The prototype of the slot is:
3579 * void set_prediction_hint (const HelperAgent *agent, char *prediction_hint);
3582 HelperAgent::signal_connect_set_prediction_hint (HelperAgentSlotStringVoid *slot)
3584 return m_impl->signal_set_prediction_hint.connect (slot);
3588 * @brief Connect a slot to Helper set mime type signal.
3590 * This signal is used to send mime type to Helper ISE.
3592 * The prototype of the slot is:
3593 * void set_mime_type (const HelperAgent *agent, char *mime_type);
3596 HelperAgent::signal_connect_set_mime_type (HelperAgentSlotStringVoid *slot)
3598 return m_impl->signal_set_mime_type.connect (slot);
3602 * @brief Connect a slot to Helper set prediction hint data signal.
3604 * This signal is used to send prediction hint data to Helper ISE.
3606 * The prototype of the slot is:
3607 * void set_prediction_hint_data (const HelperAgent *agent, char *key, char *value);
3610 HelperAgent::signal_connect_set_prediction_hint_data (HelperAgentSlotString *slot)
3612 return m_impl->signal_set_prediction_hint_data.connect (slot);
3616 * @brief Connect a slot to Helper set optimization hint signal.
3618 * This signal is used to send optimization hint to Helper ISE.
3620 * The prototype of the slot is:
3621 * void set_optimization_hint (const HelperAgent *agent, uint32 &hint);
3624 HelperAgent::signal_connect_set_optimization_hint (HelperAgentSlotUintVoid *slot)
3626 return m_impl->signal_set_optimization_hint.connect (slot);
3630 * @brief Connect a slot to Helper process key event with imengine signal.
3632 * This signal is used to deliver the key event to Helper ISE.
3634 * The prototype of the slot is:
3635 * void process_key_event_with_imengine (const HelperAgent *agent, KeyEvent &key, uint32 &ret);
3638 HelperAgent::signal_connect_process_key_event_with_imengine (HelperAgentSlotKeyEventUint *slot)
3640 return m_impl->signal_process_key_event_with_imengine.connect (slot);
3644 * @brief Connect a slot to Helper set autocapital type signal.
3646 * This signal is used to send autocapital type to imengine.
3648 * The prototype of the slot is:
3649 * void set_autocapital_type (const HelperAgent *agent, uint32 &type);
3652 HelperAgent::signal_connect_set_autocapital_type (HelperAgentSlotUintVoid *slot)
3654 return m_impl->signal_set_autocapital_type.connect (slot);
3658 * @brief Connect a slot to Helper set prediction allow signal.
3660 * This signal is used to send prediction allow to imengine.
3662 * The prototype of the slot is:
3663 * void set_prediction_allow (const HelperAgent *agent, uint32 &prediction_allow);
3666 HelperAgent::signal_connect_set_prediction_allow (HelperAgentSlotUintVoid *slot)
3668 return m_impl->signal_set_prediction_allow.connect (slot);
3671 } /* namespace scim */
3674 vi:ts=4:nowrap:ai:expandtab