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;
241 HelperAgentImpl (HelperAgent* thiz) : magic(0), magic_active(0), timeout(-1), focused_ic ((uint32) -1), thiz (thiz),
242 surrounding_text (NULL), selection_text (NULL), cursor_pos (0),
243 need_update_surrounding_text (0), need_update_selection_text (0),
244 layout (0), ise_show_flag (false), need_update_entry_metadata (false), ise_focus_flag (false),
245 finalized_text(NULL), finalized_cursor_pos(0) {
248 ~HelperAgentImpl () {
253 if (surrounding_text != NULL)
254 free (surrounding_text);
256 if (finalized_text != NULL)
257 free(finalized_text);
259 if (selection_text != NULL)
260 free (selection_text);
262 if (engine_module.valid ()) {
263 engine_module.unload ();
267 // Implementation of slot functions
269 slot_show_preedit_string (IMEngineInstanceBase *si)
271 thiz->show_preedit_string (focused_ic, "");
275 slot_show_aux_string (IMEngineInstanceBase *si)
277 thiz->show_aux_string ();
281 slot_show_lookup_table (IMEngineInstanceBase *si)
283 thiz->show_candidate_string ();
287 slot_hide_preedit_string (IMEngineInstanceBase *si)
289 thiz->hide_preedit_string (focused_ic, "");
293 slot_hide_aux_string (IMEngineInstanceBase *si)
295 thiz->hide_aux_string ();
299 slot_hide_lookup_table (IMEngineInstanceBase *si)
301 thiz->hide_candidate_string ();
305 slot_update_preedit_caret (IMEngineInstanceBase *si, int caret)
307 thiz->update_preedit_caret (caret);
311 slot_update_preedit_string (IMEngineInstanceBase *si,
312 const WideString & str,
313 const AttributeList & attrs,
316 thiz->update_preedit_string (-1, "", str, attrs, caret);
320 slot_update_preedit_string_with_commit (IMEngineInstanceBase *si,
321 const WideString & preedit,
322 const WideString & commit,
323 const AttributeList & attrs,
326 thiz->update_preedit_string (-1, "", preedit, commit, attrs, caret);
330 slot_update_aux_string (IMEngineInstanceBase *si,
331 const WideString & str,
332 const AttributeList & attrs)
334 thiz->update_aux_string (utf8_wcstombs(str), attrs);
338 slot_commit_string (IMEngineInstanceBase *si,
339 const WideString & str)
341 thiz->commit_string (-1, "", str);
345 slot_recapture_string (IMEngineInstanceBase *si,
348 const WideString & preedit,
349 const WideString & commit,
350 const AttributeList & attrs)
352 thiz->recapture_string (-1, "", offset, len, preedit, commit, attrs);
356 slot_forward_key_event (IMEngineInstanceBase *si,
357 const KeyEvent & key)
359 thiz->forward_key_event (-1, "", key);
363 slot_update_lookup_table (IMEngineInstanceBase *si,
364 const LookupTable & table)
366 thiz->update_candidate_string (table);
370 slot_register_properties (IMEngineInstanceBase *si,
371 const PropertyList & properties)
373 thiz->register_properties (properties);
377 slot_update_property (IMEngineInstanceBase *si,
378 const Property & property)
380 thiz->update_property (property);
384 slot_beep (IMEngineInstanceBase *si)
390 slot_start_helper (IMEngineInstanceBase *si,
391 const String &helper_uuid)
393 LOGW ("deprecated function");
397 slot_stop_helper (IMEngineInstanceBase *si,
398 const String &helper_uuid)
400 LOGW ("deprecated function");
404 slot_send_helper_event (IMEngineInstanceBase *si,
405 const String &helper_uuid,
406 const Transaction &trans)
408 signal_process_imengine_event (thiz, focused_ic, helper_uuid, trans);
412 slot_get_surrounding_text (IMEngineInstanceBase *si,
419 thiz->get_surrounding_text (maxlen_before, maxlen_after, _text, cursor);
420 text = utf8_mbstowcs(_text);
425 slot_delete_surrounding_text (IMEngineInstanceBase *si,
430 thiz->delete_surrounding_text (offset, len);
435 slot_get_selection (IMEngineInstanceBase *si,
439 thiz->get_selection_text (_text);
440 text = utf8_mbstowcs (_text);
445 slot_set_selection (IMEngineInstanceBase *si,
449 thiz->set_selection (start, end);
454 slot_expand_candidate (IMEngineInstanceBase *si)
456 thiz->expand_candidate ();
460 slot_contract_candidate (IMEngineInstanceBase *si)
462 thiz->contract_candidate ();
466 slot_set_candidate_style (IMEngineInstanceBase *si, ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line, ISF_CANDIDATE_MODE_T mode)
468 thiz->set_candidate_style (portrait_line, mode);
472 slot_send_private_command (IMEngineInstanceBase *si,
473 const String &command)
475 thiz->send_private_command (command);
479 slot_commit_content (IMEngineInstanceBase *si,
480 const String &content,
481 const String &description,
482 const String &mime_types)
485 thiz->commit_content (content, description, mime_types);
491 si->signal_connect_show_preedit_string (
492 slot (this, &HelperAgent::HelperAgentImpl::slot_show_preedit_string));
493 si->signal_connect_show_aux_string (
494 slot (this, &HelperAgent::HelperAgentImpl::slot_show_aux_string));
495 si->signal_connect_show_lookup_table (
496 slot (this, &HelperAgent::HelperAgentImpl::slot_show_lookup_table));
498 si->signal_connect_hide_preedit_string (
499 slot (this, &HelperAgent::HelperAgentImpl::slot_hide_preedit_string));
500 si->signal_connect_hide_aux_string (
501 slot (this, &HelperAgent::HelperAgentImpl::slot_hide_aux_string));
502 si->signal_connect_hide_lookup_table (
503 slot (this, &HelperAgent::HelperAgentImpl::slot_hide_lookup_table));
505 si->signal_connect_update_preedit_caret (
506 slot (this, &HelperAgent::HelperAgentImpl::slot_update_preedit_caret));
507 si->signal_connect_update_preedit_string (
508 slot (this, &HelperAgent::HelperAgentImpl::slot_update_preedit_string));
509 si->signal_connect_update_preedit_string_with_commit (
510 slot (this, &HelperAgent::HelperAgentImpl::slot_update_preedit_string_with_commit));
511 si->signal_connect_recapture_string (
512 slot (this, &HelperAgent::HelperAgentImpl::slot_recapture_string));
514 si->signal_connect_update_aux_string (
515 slot (this, &HelperAgent::HelperAgentImpl::slot_update_aux_string));
516 si->signal_connect_update_lookup_table (
517 slot (this, &HelperAgent::HelperAgentImpl::slot_update_lookup_table));
519 si->signal_connect_commit_string (
520 slot (this, &HelperAgent::HelperAgentImpl::slot_commit_string));
522 si->signal_connect_forward_key_event (
523 slot (this, &HelperAgent::HelperAgentImpl::slot_forward_key_event));
525 si->signal_connect_register_properties (
526 slot (this, &HelperAgent::HelperAgentImpl::slot_register_properties));
528 si->signal_connect_update_property (
529 slot (this, &HelperAgent::HelperAgentImpl::slot_update_property));
531 si->signal_connect_beep (
532 slot (this, &HelperAgent::HelperAgentImpl::slot_beep));
534 si->signal_connect_start_helper (
535 slot (this, &HelperAgent::HelperAgentImpl::slot_start_helper));
537 si->signal_connect_stop_helper (
538 slot (this, &HelperAgent::HelperAgentImpl::slot_stop_helper));
540 si->signal_connect_send_helper_event (
541 slot (this, &HelperAgent::HelperAgentImpl::slot_send_helper_event));
543 si->signal_connect_get_surrounding_text (
544 slot (this, &HelperAgent::HelperAgentImpl::slot_get_surrounding_text));
546 si->signal_connect_delete_surrounding_text (
547 slot (this, &HelperAgent::HelperAgentImpl::slot_delete_surrounding_text));
549 si->signal_connect_get_selection (
550 slot (this, &HelperAgent::HelperAgentImpl::slot_get_selection));
552 si->signal_connect_set_selection (
553 slot (this, &HelperAgent::HelperAgentImpl::slot_set_selection));
555 si->signal_connect_expand_candidate (
556 slot (this, &HelperAgent::HelperAgentImpl::slot_expand_candidate));
557 si->signal_connect_contract_candidate (
558 slot (this, &HelperAgent::HelperAgentImpl::slot_contract_candidate));
560 si->signal_connect_set_candidate_style (
561 slot (this, &HelperAgent::HelperAgentImpl::slot_set_candidate_style));
563 si->signal_connect_send_private_command (
564 slot (this, &HelperAgent::HelperAgentImpl::slot_send_private_command));
567 void process_key_event_done (KeyEvent &key, uint32 ret, uint32 serial) {
568 LOGD ("ret: %d, serial: %d", ret, serial);
569 if (socket_active.is_connected ()) {
571 send.put_command (SCIM_TRANS_CMD_REQUEST);
572 send.put_data (magic_active);
573 send.put_command (ISM_TRANS_CMD_PROCESS_KEY_EVENT_DONE);
576 send.put_data (serial);
577 send.write_to_socket (socket_active, magic_active);
581 void request_ise_hide () {
582 if (socket_active.is_connected ()) {
584 send.put_command (SCIM_TRANS_CMD_REQUEST);
585 send.put_data (magic_active);
586 send.put_command (ISM_TRANS_CMD_REQUEST_ISE_HIDE);
587 send.write_to_socket (socket_active, magic_active);
591 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 (false), ise_focus_flag (false), finalized_text (NULL), finalized_cursor_pos (0) { }
594 static MessageQueue message_queue;
596 HelperAgent::HelperAgent ()
597 : m_impl (new HelperAgentImpl (this))
599 message_queue.create();
602 HelperAgent::~HelperAgent ()
604 message_queue.destroy();
609 * @brief Open socket connection to the Panel.
611 * @param info The information of this Helper object.
612 * @param display The display which this Helper object should run on.
614 * @return The connection socket id. -1 means failed to create
618 HelperAgent::open_connection (const HelperInfo &info,
619 const String &display)
621 if (m_impl->socket.is_connected ())
624 SocketAddress address (scim_get_default_panel_socket_address (display));
625 int timeout = m_impl->timeout = scim_get_default_socket_timeout ();
628 if (!address.valid ())
632 std::cerr << " Connecting to PanelAgent server.";
633 ISF_LOG (" Connecting to PanelAgent server.\n");
634 while (!m_impl->socket.connect (address)) {
636 scim_usleep (100000);
638 std::cerr << "m_impl->socket.connect () is failed!!!\n";
639 ISF_LOG ("m_impl->socket.connect () is failed!!!\n");
643 std::cerr << " Connected :" << i << "\n";
644 ISF_LOG (" Connected :%d\n", i);
645 LOGD ("Connection to PanelAgent succeeded, %d", i);
647 /* Let's retry 10 times when failed */
648 int open_connection_retries = 0;
649 while (!scim_socket_open_connection (magic,
654 if (++open_connection_retries > 10) {
655 m_impl->socket.close ();
656 std::cerr << "scim_socket_open_connection () is failed!!!\n";
657 ISF_LOG ("scim_socket_open_connection () is failed!!!\n");
658 ISF_SAVE_LOG ("scim_socket_open_connection failed, %d", timeout);
663 /* Retry after re-connecting the socket */
664 if (m_impl->socket.is_connected ())
667 /* This time, just retry atmost 2 seconds */
669 while (!m_impl->socket.connect (address) && ++i < 10) {
670 scim_usleep (200000);
674 ISF_LOG ("scim_socket_open_connection () is successful.\n");
675 LOGD ("scim_socket_open_connection successful");
677 m_impl->send.clear ();
678 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
679 m_impl->send.put_data (magic);
680 m_impl->send.put_command (SCIM_TRANS_CMD_PANEL_REGISTER_HELPER);
681 m_impl->send.put_data (info.uuid);
682 m_impl->send.put_data (info.name);
683 m_impl->send.put_data (info.icon);
684 m_impl->send.put_data (info.description);
685 m_impl->send.put_data (info.option);
687 if (!m_impl->send.write_to_socket (m_impl->socket, magic)) {
688 m_impl->socket.close ();
693 if (m_impl->recv.read_from_socket (m_impl->socket, timeout) &&
694 m_impl->recv.get_command (cmd) && cmd == SCIM_TRANS_CMD_REPLY &&
695 m_impl->recv.get_command (cmd) && cmd == SCIM_TRANS_CMD_OK) {
696 m_impl->magic = magic;
698 while (m_impl->recv.get_command (cmd)) {
700 case SCIM_TRANS_CMD_HELPER_ATTACH_INPUT_CONTEXT:
704 while (m_impl->recv.get_data (ic) && m_impl->recv.get_data (ic_uuid))
705 m_impl->signal_attach_input_context (this, ic, ic_uuid);
708 case SCIM_TRANS_CMD_UPDATE_SCREEN:
711 if (m_impl->recv.get_data (screen))
712 m_impl->signal_update_screen (this, (uint32) -1, String (""), (int) screen);
720 //FIXME: Attaching input context is needed for desktop environment
721 LOGW ("Attach input context and update screen failed");
724 ISF_SAVE_LOG ("Trying connect() with Helper_Active");
726 /* connect to the panel agent as the active helper client */
727 if (!m_impl->socket_active.connect (address)) return -1;
728 open_connection_retries = 0;
729 while (!scim_socket_open_connection (magic,
730 String ("Helper_Active"),
732 m_impl->socket_active,
734 if (++open_connection_retries > 10) {
735 m_impl->socket_active.close ();
736 std::cerr << "Helper_Active scim_socket_open_connection () is failed!!!\n";
737 ISF_LOG ("Helper_Active scim_socket_open_connection () is failed!!!\n");
738 ISF_SAVE_LOG ("Helper_Active scim_socket_open_connection failed, %d", timeout);
743 /* Retry after re-connecting the socket */
744 if (m_impl->socket_active.is_connected ())
745 m_impl->socket_active.close ();
747 /* This time, just retry atmost 2 seconds */
749 while (!m_impl->socket_active.connect (address) && ++i < 10) {
750 scim_usleep (200000);
754 m_impl->magic_active = magic;
756 m_impl->send.clear ();
757 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
758 m_impl->send.put_data (magic);
759 m_impl->send.put_command (SCIM_TRANS_CMD_PANEL_REGISTER_ACTIVE_HELPER);
760 m_impl->send.put_data (info.uuid);
761 m_impl->send.put_data (info.name);
762 m_impl->send.put_data (info.icon);
763 m_impl->send.put_data (info.description);
764 m_impl->send.put_data (info.option);
766 if (!m_impl->send.write_to_socket (m_impl->socket_active, magic)) {
767 ISF_SAVE_LOG ("Helper_Active write_to_socket() failed");
768 m_impl->socket_active.close ();
771 m_impl->m_config = ConfigBase::get (false, "socket");
773 return m_impl->socket.get_id ();
777 * @brief Close the socket connection to Panel.
780 HelperAgent::close_connection ()
782 m_impl->socket.close ();
783 m_impl->socket_active.close ();
784 m_impl->send.clear ();
785 m_impl->recv.clear ();
787 m_impl->magic_active = 0;
792 * @brief Get the connection id previously returned by open_connection().
794 * @return the connection id
797 HelperAgent::get_connection_number () const
799 if (m_impl->socket.is_connected ())
800 return m_impl->socket.get_id ();
805 * @brief Check whether this HelperAgent has been connected to a Panel.
807 * Return true when it is connected to panel, otherwise return false.
810 HelperAgent::is_connected () const
812 return m_impl->socket.is_connected ();
816 * @brief Check if there are any events available to be processed.
818 * If it returns true then Helper object should call
819 * HelperAgent::filter_event() to process them.
821 * @return true if there are any events available.
824 HelperAgent::has_pending_event () const
826 if (m_impl->socket.is_connected () && m_impl->socket.wait_for_data (0) > 0)
829 if (message_queue.has_pending_message())
836 * @brief Process the pending events.
838 * This function will emit the corresponding signals according
841 * @return false if the connection is broken, otherwise return true.
844 HelperAgent::filter_event ()
846 if (!m_impl->socket.is_connected ()) {
847 LOGW("Connection lost, returning false");
851 if (m_impl->recv.read_from_socket (m_impl->socket, m_impl->timeout)) {
852 message_queue.read_from_transaction(m_impl->recv);
854 while (message_queue.has_pending_message()) {
855 MessageItem *message = message_queue.get_pending_message();
856 handle_message(message);
857 message_queue.remove_message(message);
860 LOGD("read_from_socket() failed but continuing");
868 * @brief Read messages from socket buffer, and see if there is a message with the given cmd.
870 * @return false if the connection is broken, or no message available with given cmd. Otherwise return true.
873 HelperAgent::wait_for_message(int cmd, int timeout)
875 struct timeval t0 = { 0, 0 };
876 struct timeval t1 = { 0, 0 };
877 struct timeval t2 = { 0, 0 };
879 gettimeofday(&t0, NULL);
882 if (!m_impl->socket.is_connected() || !m_impl->recv.read_from_socket(m_impl->socket, timeout))
885 message_queue.read_from_transaction(m_impl->recv);
886 if (message_queue.has_pending_message_by_cmd(cmd)) {
890 gettimeofday(&t1, NULL);
891 timersub(&t1, &t0, &t2);
892 } while (t2.tv_sec < timeout);
898 * @brief Process one message that is in our message queue.
900 * This function will emit the corresponding signals according
903 * @param message The message that needs to be handled.
905 * @return false if the connection is broken, otherwise return true.
908 HelperAgent::handle_message (MessageItem *message)
913 int cmd = message->get_command_ref();
914 LOGD ("HelperAgent::cmd = %d", cmd);
916 case SCIM_TRANS_CMD_EXIT:
918 MessageItemExit *subclass = static_cast<MessageItemExit*>(message);
919 ISF_SAVE_LOG ("Helper ISE received SCIM_TRANS_CMD_EXIT message");
920 m_impl->signal_exit(this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
923 case SCIM_TRANS_CMD_RELOAD_CONFIG:
925 MessageItemReloadConfig *subclass = static_cast<MessageItemReloadConfig*>(message);
926 m_impl->signal_reload_config (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
927 if (!m_impl->m_config.null())
928 m_impl->m_config->ConfigBase::reload();
931 case SCIM_TRANS_CMD_UPDATE_SCREEN:
933 MessageItemUpdateScreen *subclass = static_cast<MessageItemUpdateScreen*>(message);
934 m_impl->signal_update_screen (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
935 subclass->get_screen_ref());
938 case SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION:
940 MessageItemUpdateSpotLocation *subclass = static_cast<MessageItemUpdateSpotLocation*>(message);
941 m_impl->signal_update_spot_location (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
942 subclass->get_x_ref(), subclass->get_y_ref());
945 case ISM_TRANS_CMD_UPDATE_CURSOR_POSITION:
947 MessageItemUpdateCursorPosition *subclass = static_cast<MessageItemUpdateCursorPosition*>(message);
948 m_impl->cursor_pos = subclass->get_cursor_pos_ref();
949 LOGD ("update cursor position %d", subclass->get_cursor_pos_ref());
950 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
951 m_impl->signal_update_cursor_position (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
952 subclass->get_cursor_pos_ref());
954 if (!m_impl->si.null ()) m_impl->si->update_cursor_position(subclass->get_cursor_pos_ref());
957 case ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT:
959 MessageItemUpdateSurroundingText *subclass = static_cast<MessageItemUpdateSurroundingText*>(message);
960 if (m_impl->surrounding_text != NULL)
961 free (m_impl->surrounding_text);
962 m_impl->surrounding_text = strdup (subclass->get_text_ref().c_str ());
963 m_impl->cursor_pos = subclass->get_cursor_ref();
964 SECURE_LOGD ("surrounding text: %s, %d", m_impl->surrounding_text, subclass->get_cursor_ref());
965 while (m_impl->need_update_surrounding_text > 0) {
966 m_impl->need_update_surrounding_text--;
967 m_impl->signal_update_surrounding_text (this, subclass->get_ic_ref(),
968 subclass->get_text_ref(), subclass->get_cursor_ref());
972 case ISM_TRANS_CMD_UPDATE_SELECTION:
974 MessageItemUpdateSelection *subclass = static_cast<MessageItemUpdateSelection*>(message);
975 if (m_impl->selection_text != NULL)
976 free (m_impl->selection_text);
978 m_impl->selection_text = strdup (subclass->get_text_ref().c_str ());
979 SECURE_LOGD ("selection text: %s", m_impl->selection_text);
981 while (m_impl->need_update_selection_text > 0) {
982 m_impl->need_update_selection_text--;
983 m_impl->signal_update_selection (this, subclass->get_ic_ref(), subclass->get_text_ref());
987 case SCIM_TRANS_CMD_TRIGGER_PROPERTY:
989 MessageItemTriggerProperty *subclass = static_cast<MessageItemTriggerProperty*>(message);
990 m_impl->signal_trigger_property (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
991 subclass->get_property_ref());
992 if (!m_impl->si.null ()) m_impl->si->trigger_property(subclass->get_property_ref());
995 case SCIM_TRANS_CMD_HELPER_PROCESS_IMENGINE_EVENT:
997 MessageItemHelperProcessImengineEvent *subclass = static_cast<MessageItemHelperProcessImengineEvent*>(message);
998 m_impl->signal_process_imengine_event (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
999 subclass->get_transaction_ref());
1002 case SCIM_TRANS_CMD_HELPER_ATTACH_INPUT_CONTEXT:
1004 MessageItemHelperAttachInputContext *subclass = static_cast<MessageItemHelperAttachInputContext*>(message);
1005 m_impl->signal_attach_input_context (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1008 case SCIM_TRANS_CMD_HELPER_DETACH_INPUT_CONTEXT:
1010 MessageItemHelperDetachInputContext *subclass = static_cast<MessageItemHelperDetachInputContext*>(message);
1011 m_impl->signal_detach_input_context (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1014 case SCIM_TRANS_CMD_FOCUS_OUT:
1016 MessageItemFocusOut *subclass = static_cast<MessageItemFocusOut*>(message);
1017 m_impl->ise_focus_flag = false;
1018 m_impl->signal_focus_out (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1019 m_impl->focused_ic = (uint32) -1;
1020 if (!m_impl->si.null ()) m_impl->si->focus_out();
1022 m_impl->ise_show_flag = false;
1025 case SCIM_TRANS_CMD_FOCUS_IN:
1027 MessageItemFocusIn *subclass = static_cast<MessageItemFocusIn*>(message);
1028 m_impl->ise_focus_flag = true;
1030 m_impl->need_update_entry_metadata = true;
1031 m_impl->signal_focus_in (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1032 m_impl->focused_ic = subclass->get_ic_ref();
1033 if (m_impl->finalized_text != NULL)
1034 free(m_impl->finalized_text);
1035 m_impl->finalized_text = NULL;
1036 m_impl->finalized_cursor_pos = 0;
1037 if (!m_impl->si.null ()) m_impl->si->focus_in();
1040 case ISM_TRANS_CMD_SHOW_ISE_PANEL:
1042 MessageItemShowISEPanel *subclass = static_cast<MessageItemShowISEPanel*>(message);
1043 LOGD ("Helper ISE received ISM_TRANS_CMD_SHOW_ISE_PANEL message");
1045 m_impl->signal_ise_show (this, subclass->get_ic_ref(), *(subclass->get_data_ptr()),
1046 subclass->get_len_ref());
1047 m_impl->ise_show_flag = true;
1050 case ISM_TRANS_CMD_HIDE_ISE_PANEL:
1052 MessageItemHideISEPanel *subclass = static_cast<MessageItemHideISEPanel*>(message);
1053 LOGD ("Helper ISE received ISM_TRANS_CMD_HIDE_ISE_PANEL message");
1054 m_impl->signal_ise_hide (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1055 m_impl->ise_show_flag = false;
1058 case ISM_TRANS_CMD_GET_ACTIVE_ISE_GEOMETRY:
1060 struct rectinfo info = {0, 0, 0, 0};
1061 m_impl->signal_get_geometry (this, info);
1062 m_impl->send.clear ();
1063 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
1064 m_impl->send.put_data (info.pos_x);
1065 m_impl->send.put_data (info.pos_y);
1066 m_impl->send.put_data (info.width);
1067 m_impl->send.put_data (info.height);
1068 m_impl->send.write_to_socket (m_impl->socket);
1071 case ISM_TRANS_CMD_SET_ISE_MODE:
1073 MessageItemSetISEMode *subclass = static_cast<MessageItemSetISEMode*>(message);
1074 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1075 m_impl->signal_set_mode (this, subclass->get_mode_ref());
1079 case ISM_TRANS_CMD_SET_ISE_LANGUAGE:
1081 MessageItemSetISELanguage *subclass = static_cast<MessageItemSetISELanguage*>(message);
1082 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1083 m_impl->signal_set_language (this, subclass->get_language_ref());
1087 case ISM_TRANS_CMD_SET_ISE_IMDATA:
1089 MessageItemSetISEImData *subclass = static_cast<MessageItemSetISEImData*>(message);
1090 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1091 m_impl->signal_set_imdata (this, *(subclass->get_imdata_ptr()), subclass->get_len_ref());
1093 if (!m_impl->si.null ()) m_impl->si->set_imdata(*(subclass->get_imdata_ptr()),
1094 subclass->get_len_ref());
1097 case ISM_TRANS_CMD_GET_ISE_IMDATA:
1102 m_impl->signal_get_imdata (this, &buf, len);
1103 LOGD ("send ise imdata len = %zu", len);
1104 m_impl->send.clear ();
1105 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
1106 m_impl->send.put_data (buf, len);
1107 m_impl->send.write_to_socket (m_impl->socket);
1112 case ISM_TRANS_CMD_GET_ISE_LANGUAGE_LOCALE:
1114 MessageItemGetISELanguageLocale *subclass = static_cast<MessageItemGetISELanguageLocale*>(message);
1116 m_impl->signal_get_language_locale (this, subclass->get_ic_ref(), &buf);
1117 m_impl->send.clear ();
1118 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
1120 m_impl->send.put_data (buf, strlen (buf));
1121 m_impl->send.write_to_socket (m_impl->socket);
1126 case ISM_TRANS_CMD_SET_RETURN_KEY_TYPE:
1128 MessageItemSetReturnKeyType *subclass = static_cast<MessageItemSetReturnKeyType*>(message);
1129 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1130 m_impl->signal_set_return_key_type (this, subclass->get_type_ref());
1134 case ISM_TRANS_CMD_GET_RETURN_KEY_TYPE:
1137 m_impl->signal_get_return_key_type (this, type);
1138 m_impl->send.clear ();
1139 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
1140 m_impl->send.put_data (type);
1141 m_impl->send.write_to_socket (m_impl->socket);
1144 case ISM_TRANS_CMD_SET_RETURN_KEY_DISABLE:
1146 MessageItemSetReturnKeyDisable *subclass = static_cast<MessageItemSetReturnKeyDisable*>(message);
1147 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1148 m_impl->signal_set_return_key_disable (this, subclass->get_disabled_ref());
1152 case ISM_TRANS_CMD_GET_RETURN_KEY_DISABLE:
1154 uint32 disabled = 0;
1155 m_impl->signal_get_return_key_type (this, disabled);
1156 m_impl->send.clear ();
1157 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
1158 m_impl->send.put_data (disabled);
1159 m_impl->send.write_to_socket (m_impl->socket);
1162 case SCIM_TRANS_CMD_PROCESS_KEY_EVENT:
1164 MessageItemProcessKeyEvent *subclass = static_cast<MessageItemProcessKeyEvent*>(message);
1166 uint32 keycode_ret = 0;
1167 m_impl->signal_process_key_event(this, subclass->get_key_ref(), ret);
1168 m_impl->signal_process_key_event_with_keycode(this, subclass->get_key_ref(), keycode_ret, subclass->get_keycode_ref());
1169 if (ret == 0 && keycode_ret == 0) {
1170 if (!m_impl->si.null ()) {
1171 if (!(subclass->get_key_ref().get_key_string().compare("KeyRelease+XF86Back") == 0 ||
1172 subclass->get_key_ref().get_key_string().compare("XF86Back") == 0)) {
1173 ret = m_impl->si->process_key_event (subclass->get_key_ref());
1174 SECURE_LOGD ("imengine(%s) process key %d return %d", m_impl->si->get_factory_uuid().c_str(),
1175 subclass->get_key_ref().code, ret);
1179 if (ret != keycode_ret)
1181 m_impl->process_key_event_done (subclass->get_key_ref(), ret, subclass->get_serial_ref());
1184 case ISM_TRANS_CMD_SET_LAYOUT:
1186 MessageItemSetLayout *subclass = static_cast<MessageItemSetLayout*>(message);
1187 m_impl->layout = subclass->get_layout_ref();
1188 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1189 m_impl->signal_set_layout (this, subclass->get_layout_ref());
1191 if (!m_impl->si.null ()) m_impl->si->set_layout(subclass->get_layout_ref());
1194 case ISM_TRANS_CMD_GET_LAYOUT:
1198 m_impl->signal_get_layout (this, layout);
1199 m_impl->send.clear ();
1200 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
1201 m_impl->send.put_data (layout);
1202 m_impl->send.write_to_socket (m_impl->socket);
1205 case ISM_TRANS_CMD_SET_INPUT_MODE:
1207 MessageItemSetInputMode *subclass = static_cast<MessageItemSetInputMode*>(message);
1208 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1209 m_impl->signal_set_input_mode (this, subclass->get_input_mode_ref());
1213 case ISM_TRANS_CMD_SET_CAPS_MODE:
1215 MessageItemSetCapsMode *subclass = static_cast<MessageItemSetCapsMode*>(message);
1216 m_impl->signal_set_caps_mode (this, subclass->get_mode_ref());
1219 case SCIM_TRANS_CMD_PANEL_RESET_INPUT_CONTEXT:
1221 MessageItemPanelResetInputContext *subclass = static_cast<MessageItemPanelResetInputContext*>(message);
1222 m_impl->signal_reset_input_context (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1223 if (!m_impl->si.null ()) m_impl->si->reset();
1226 case ISM_TRANS_CMD_UPDATE_CANDIDATE_UI:
1228 MessageItemUpdateCandidateUI *subclass = static_cast<MessageItemUpdateCandidateUI*>(message);
1229 m_impl->signal_update_candidate_ui (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1230 subclass->get_style_ref(), subclass->get_mode_ref());
1233 case ISM_TRANS_CMD_UPDATE_CANDIDATE_GEOMETRY:
1235 MessageItemUpdateCandidateGeometry *subclass = static_cast<MessageItemUpdateCandidateGeometry*>(message);
1236 m_impl->signal_update_candidate_geometry (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1237 subclass->get_rectinfo_ref());
1240 case ISM_TRANS_CMD_UPDATE_KEYBOARD_ISE:
1242 MessageItemUpdateKeyboardISE *subclass = static_cast<MessageItemUpdateKeyboardISE*>(message);
1243 m_impl->signal_update_keyboard_ise (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1244 subclass->get_name_ref(), subclass->get_uuid_ref());
1247 case ISM_TRANS_CMD_UPDATE_KEYBOARD_ISE_LIST:
1249 MessageItemUpdateKeyboardISEList *subclass = static_cast<MessageItemUpdateKeyboardISEList*>(message);
1250 m_impl->signal_update_keyboard_ise_list (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1251 subclass->get_list_ref());
1254 case ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_SHOW:
1256 MessageItemCandidateMoreWindowShow *subclass = static_cast<MessageItemCandidateMoreWindowShow*>(message);
1257 m_impl->signal_candidate_more_window_show (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1258 if (!m_impl->si.null ()) m_impl->si->candidate_more_window_show();
1261 case ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_HIDE:
1263 MessageItemCandidateMoreWindowHide *subclass = static_cast<MessageItemCandidateMoreWindowHide*>(message);
1264 m_impl->signal_candidate_more_window_hide (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1265 if (!m_impl->si.null ()) m_impl->si->candidate_more_window_hide();
1268 case ISM_TRANS_CMD_SELECT_AUX:
1270 MessageItemSelectAux *subclass = static_cast<MessageItemSelectAux*>(message);
1271 m_impl->signal_select_aux (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1272 subclass->get_item_ref());
1273 if (!m_impl->si.null ()) m_impl->si->select_aux(subclass->get_item_ref());
1276 case SCIM_TRANS_CMD_SELECT_CANDIDATE: //FIXME:remove if useless
1278 MessageItemSelectCandidate *subclass = static_cast<MessageItemSelectCandidate*>(message);
1279 m_impl->signal_select_candidate (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1280 subclass->get_item_ref());
1281 if (!m_impl->si.null ()) m_impl->si->select_candidate(subclass->get_item_ref());
1284 case SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_UP: //FIXME:remove if useless
1286 MessageItemLookupTablePageUp *subclass = static_cast<MessageItemLookupTablePageUp*>(message);
1287 m_impl->signal_candidate_table_page_up (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1288 if (!m_impl->si.null ()) m_impl->si->lookup_table_page_up();
1291 case SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_DOWN: //FIXME:remove if useless
1293 MessageItemLookupTablePageDown *subclass = static_cast<MessageItemLookupTablePageDown*>(message);
1294 m_impl->signal_candidate_table_page_down (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1295 if (!m_impl->si.null ()) m_impl->si->lookup_table_page_down();
1298 case SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE_PAGE_SIZE:
1300 MessageItemUpdateLookupTablePageSize *subclass = static_cast<MessageItemUpdateLookupTablePageSize*>(message);
1301 m_impl->signal_update_candidate_table_page_size (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1302 subclass->get_size_ref());
1303 if (!m_impl->si.null ()) m_impl->si->update_lookup_table_page_size(subclass->get_size_ref());
1306 case ISM_TRANS_CMD_CANDIDATE_SHOW: //FIXME:remove if useless
1308 MessageItemCandidateShow *subclass = static_cast<MessageItemCandidateShow*>(message);
1309 m_impl->signal_candidate_show (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1312 case ISM_TRANS_CMD_CANDIDATE_HIDE: //FIXME:remove if useless
1314 MessageItemCandidateHide *subclass = static_cast<MessageItemCandidateHide*>(message);
1315 m_impl->signal_candidate_hide (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1318 case ISM_TRANS_CMD_UPDATE_LOOKUP_TABLE: //FIXME:remove if useless
1320 MessageItemUpdateLookupTable *subclass = static_cast<MessageItemUpdateLookupTable*>(message);
1321 m_impl->signal_update_lookup_table (this, subclass->get_candidate_table_ref());
1324 case ISM_TRANS_CMD_UPDATE_CANDIDATE_ITEM_LAYOUT:
1326 MessageItemUpdateCandidateItemLayout *subclass = static_cast<MessageItemUpdateCandidateItemLayout*>(message);
1327 m_impl->signal_update_candidate_item_layout (this, subclass->get_row_items_ref());
1328 if (!m_impl->si.null ()) m_impl->si->update_candidate_item_layout(subclass->get_row_items_ref());
1331 case ISM_TRANS_CMD_SELECT_ASSOCIATE:
1333 MessageItemSelectAssociate *subclass = static_cast<MessageItemSelectAssociate*>(message);
1334 m_impl->signal_select_associate (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1335 subclass->get_item_ref());
1338 case ISM_TRANS_CMD_ASSOCIATE_TABLE_PAGE_UP:
1340 MessageItemAssociateTablePageUp *subclass = static_cast<MessageItemAssociateTablePageUp*>(message);
1341 m_impl->signal_associate_table_page_up (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1344 case ISM_TRANS_CMD_ASSOCIATE_TABLE_PAGE_DOWN:
1346 MessageItemAssociateTablePageDown *subclass = static_cast<MessageItemAssociateTablePageDown*>(message);
1347 m_impl->signal_associate_table_page_down (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1350 case ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE_PAGE_SIZE:
1352 MessageItemUpdateAssociateTablePageSize *subclass = static_cast<MessageItemUpdateAssociateTablePageSize*>(message);
1353 m_impl->signal_update_associate_table_page_size (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1354 subclass->get_size_ref());
1357 case ISM_TRANS_CMD_RESET_ISE_CONTEXT:
1359 MessageItemResetISEContext *subclass = static_cast<MessageItemResetISEContext*>(message);
1360 m_impl->signal_reset_ise_context (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1361 m_impl->signal_reset_input_context (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1362 if (!m_impl->si.null ()) m_impl->si->reset();
1365 case ISM_TRANS_CMD_TURN_ON_LOG:
1367 MessageItemTurnOnLog *subclass = static_cast<MessageItemTurnOnLog*>(message);
1368 m_impl->signal_turn_on_log (this, subclass->get_state_ref());
1371 case ISM_TRANS_CMD_UPDATE_DISPLAYED_CANDIDATE:
1373 MessageItemUpdateDisplayedCandidate *subclass = static_cast<MessageItemUpdateDisplayedCandidate*>(message);
1374 m_impl->signal_update_displayed_candidate_number (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1375 subclass->get_size_ref());
1376 if (!m_impl->si.null ()) m_impl->si->update_displayed_candidate_number(subclass->get_size_ref());
1379 case ISM_TRANS_CMD_LONGPRESS_CANDIDATE:
1381 MessageItemLongpressCandidate *subclass = static_cast<MessageItemLongpressCandidate*>(message);
1382 m_impl->signal_longpress_candidate (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1383 subclass->get_index_ref());
1384 if (!m_impl->si.null ()) m_impl->si->longpress_candidate(subclass->get_index_ref());
1387 case ISM_TRANS_CMD_SET_INPUT_HINT:
1389 MessageItemSetInputHint *subclass = static_cast<MessageItemSetInputHint*>(message);
1390 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1391 m_impl->signal_set_input_hint (this, subclass->get_input_hint_ref());
1393 if (!m_impl->si.null ()) m_impl->si->set_input_hint(subclass->get_input_hint_ref());
1396 case ISM_TRANS_CMD_UPDATE_BIDI_DIRECTION:
1398 MessageItemUpdateBidiDirection *subclass = static_cast<MessageItemUpdateBidiDirection*>(message);
1399 m_impl->signal_update_bidi_direction (this, subclass->get_bidi_direction());
1400 if (!m_impl->si.null ()) m_impl->si->update_bidi_direction(subclass->get_bidi_direction());
1403 case ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW:
1405 MessageItemShowISEOptionWindow *subclass = static_cast<MessageItemShowISEOptionWindow*>(message);
1406 m_impl->signal_show_option_window (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1409 case ISM_TRANS_CMD_RESUME_ISE_OPTION_WINDOW:
1411 MessageItemResumeISEOptionWindow *subclass = static_cast<MessageItemResumeISEOptionWindow*>(message);
1412 m_impl->signal_resume_option_window (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1415 case ISM_TRANS_CMD_CHECK_OPTION_WINDOW:
1418 m_impl->signal_check_option_window (this, avail);
1419 m_impl->send.clear ();
1420 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
1421 m_impl->send.put_data (avail);
1422 m_impl->send.write_to_socket (m_impl->socket);
1425 case ISM_TRANS_CMD_PROCESS_INPUT_DEVICE_EVENT:
1427 MessageItemProcessInputDeviceEvent *subclass = static_cast<MessageItemProcessInputDeviceEvent*>(message);
1429 unsigned int ecore_event_id = find_ecore_event_from_device_type((isf_device_type_e)(subclass->get_type_ref()));
1430 char *decoded = (char*)malloc(subclass->get_len_ref());
1431 size_t decoded_size = subclass->get_len_ref();
1433 if(device_buffer_decode((const char*)*(subclass->get_data_ptr()),
1434 subclass->get_len_ref(), (char*)(decoded), &decoded_size)) {
1435 m_impl->signal_process_input_device_event(this, ecore_event_id, decoded, decoded_size, ret);
1441 case SCIM_TRANS_CMD_SET_AUTOCAPITAL_TYPE:
1443 MessageItemSetAutocapitalType *subclass = static_cast<MessageItemSetAutocapitalType*>(message);
1444 if (!m_impl->si.null ()) m_impl->si->set_autocapital_type(subclass->get_auto_capital_type_ref());
1447 case ISM_TRANS_CMD_SET_PREDICTION_ALLOW:
1449 MessageItemSetPredictionAllow *subclass = static_cast<MessageItemSetPredictionAllow*>(message);
1450 if (!m_impl->si.null ()) m_impl->si->set_prediction_allow(subclass->get_prediction_allow_ref() == 0 ? false : true);
1453 case ISM_TRANS_CMD_SET_KEYBOARD_MODE:
1455 MessageItemSetKeyboardMode *subclass = static_cast<MessageItemSetKeyboardMode*>(message);
1456 if (subclass->get_mode_ref())
1457 m_impl->need_update_entry_metadata = false;
1459 m_impl->need_update_entry_metadata = true;
1462 case ISM_TRANS_CMD_SET_PREDICTION_HINT:
1464 MessageItemSetPredictionHint *subclass = static_cast<MessageItemSetPredictionHint*>(message);
1465 m_impl->signal_set_prediction_hint (this, subclass->get_message_ref());
1468 case ISM_TRANS_CMD_SET_MIME_TYPE:
1470 MessageItemSetMimeType *subclass = static_cast<MessageItemSetMimeType*>(message);
1471 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1472 m_impl->signal_set_mime_type (this, subclass->get_mime_type_ref());
1476 case ISM_TRANS_CMD_FINALIZE_CONTENT:
1478 MessageItemFinalizeContent *subclass = static_cast<MessageItemFinalizeContent*>(message);
1480 if (m_impl->finalized_text != NULL)
1481 free(m_impl->finalized_text);
1482 m_impl->finalized_text = strdup(subclass->get_text_ref().c_str());
1483 m_impl->finalized_cursor_pos = subclass->get_cursor_pos_ref();
1487 case ISM_TRANS_CMD_SET_PREDICTION_HINT_DATA:
1489 MessageItemSetPredictionHintData *subclass = static_cast<MessageItemSetPredictionHintData*>(message);
1490 m_impl->signal_set_prediction_hint_data (this, 0, subclass->get_key_ref(), subclass->get_value_ref());
1493 case ISM_TRANS_CMD_SET_OPTIMIZATION_HINT:
1495 MessageItemSetOptimizationHint *subclass = static_cast<MessageItemSetOptimizationHint*>(message);
1496 m_impl->signal_set_optimization_hint(this, subclass->get_hint_ref());
1506 * @brief Request SCIM to reload all configuration.
1508 * This function should only by used by Setup Helper to request
1509 * scim's reloading the configuration.
1510 * Deprecated: reload config message only send by socketconfig client
1511 * using socketconfig::reload instead.
1514 HelperAgent::reload_config () const
1516 LOGD ("send reload config message to isf");
1517 if (!m_impl->m_config.null())
1518 m_impl->m_config->reload();
1522 * @brief Register some properties into Panel.
1524 * This function send the request to Panel to register a list
1527 * @param properties The list of Properties to be registered into Panel.
1529 * @sa scim::Property.
1532 HelperAgent::register_properties (const PropertyList &properties) const
1534 if (m_impl->socket_active.is_connected ()) {
1535 m_impl->send.clear ();
1536 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1537 m_impl->send.put_data (m_impl->magic_active);
1538 m_impl->send.put_command (SCIM_TRANS_CMD_REGISTER_PROPERTIES);
1539 m_impl->send.put_data (properties);
1540 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1545 * @brief Update a registered property.
1547 * @param property The property to be updated.
1550 HelperAgent::update_property (const Property &property) const
1552 if (m_impl->socket_active.is_connected ()) {
1553 m_impl->send.clear ();
1554 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1555 m_impl->send.put_data (m_impl->magic_active);
1556 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_PROPERTY);
1557 m_impl->send.put_data (property);
1558 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1563 * @brief Send a set of events to an IMEngineInstance.
1565 * All events should be put into a Transaction.
1566 * And the events can only be received by one IMEngineInstance object.
1568 * @param ic The handle of the Input Context to receive the events.
1569 * @param ic_uuid The UUID of the Input Context.
1570 * @param trans The Transaction object holds the events.
1573 HelperAgent::send_imengine_event (int ic,
1574 const String &ic_uuid,
1575 const Transaction &trans) const
1577 //remove if not necessary
1579 if (m_impl->socket_active.is_connected ()) {
1580 m_impl->send.clear ();
1581 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1582 m_impl->send.put_data (m_impl->magic_active);
1583 m_impl->send.put_command (SCIM_TRANS_CMD_PANEL_SEND_IMENGINE_EVENT);
1584 m_impl->send.put_data ((uint32)ic);
1585 m_impl->send.put_data (ic_uuid);
1586 m_impl->send.put_data (trans);
1587 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1590 if (!m_impl->si.null ()) m_impl->si->process_helper_event (ic_uuid, trans);
1594 * @brief Send a KeyEvent to an IMEngineInstance.
1596 * @param ic The handle of the IMEngineInstance to receive the event.
1597 * -1 means the currently focused IMEngineInstance.
1598 * @param ic_uuid The UUID of the IMEngineInstance. Empty means don't match.
1599 * @param key The KeyEvent to be sent.
1602 HelperAgent::send_key_event (int ic,
1603 const String &ic_uuid,
1604 const KeyEvent &key) const
1607 //FIXME: remove shift_mode_off, shift_mode_on, shift_mode_lock from ISE side
1608 /*if (key.code == SHIFT_MODE_OFF ||
1609 key.code == SHIFT_MODE_ON ||
1610 key.code == SHIFT_MODE_LOCK ||
1611 key.code == SHIFT_MODE_ENABLE ||
1612 key.code == SHIFT_MODE_DISABLE) {
1613 LOGW("FIXME ignore shift codes");
1617 if (m_impl->socket_active.is_connected ()) {
1618 m_impl->send.clear ();
1619 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1620 m_impl->send.put_data (m_impl->magic_active);
1621 m_impl->send.put_command (SCIM_TRANS_CMD_PANEL_SEND_KEY_EVENT);
1623 m_impl->send.put_data (m_impl->focused_ic);
1625 m_impl->send.put_data ((uint32)ic);
1627 m_impl->send.put_data (ic_uuid);
1628 m_impl->send.put_data (key);
1629 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1634 * @brief Forward a KeyEvent to client application directly.
1636 * @param ic The handle of the client Input Context to receive the event.
1637 * -1 means the currently focused Input Context.
1638 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1639 * Empty means don't match.
1640 * @param key The KeyEvent to be forwarded.
1643 HelperAgent::forward_key_event (int ic,
1644 const String &ic_uuid,
1645 const KeyEvent &key) const
1647 if (m_impl->socket_active.is_connected ()) {
1648 m_impl->send.clear ();
1649 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1650 m_impl->send.put_data (m_impl->magic_active);
1651 m_impl->send.put_command (SCIM_TRANS_CMD_FORWARD_KEY_EVENT);
1653 m_impl->send.put_data (m_impl->focused_ic);
1655 m_impl->send.put_data ((uint32)ic);
1657 m_impl->send.put_data (ic_uuid);
1658 m_impl->send.put_data (key);
1659 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1664 * @brief Commit a WideString to client application directly.
1666 * @param ic The handle of the client Input Context to receive the WideString.
1667 * -1 means the currently focused Input Context.
1668 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1669 * Empty means don't match.
1670 * @param wstr The WideString to be committed.
1673 HelperAgent::commit_string (int ic,
1674 const String &ic_uuid,
1675 const WideString &wstr) const
1677 if (m_impl->socket_active.is_connected ()) {
1678 m_impl->send.clear ();
1679 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1680 m_impl->send.put_data (m_impl->magic_active);
1681 m_impl->send.put_command (SCIM_TRANS_CMD_COMMIT_STRING);
1683 m_impl->send.put_data (m_impl->focused_ic);
1685 m_impl->send.put_data ((uint32)ic);
1687 m_impl->send.put_data (ic_uuid);
1688 m_impl->send.put_data (wstr);
1689 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1694 HelperAgent::commit_string (int ic,
1695 const String &ic_uuid,
1699 if (m_impl->socket_active.is_connected ()) {
1700 m_impl->send.clear ();
1701 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1702 m_impl->send.put_data (m_impl->magic_active);
1703 m_impl->send.put_command (SCIM_TRANS_CMD_COMMIT_STRING);
1705 m_impl->send.put_data (m_impl->focused_ic);
1707 m_impl->send.put_data ((uint32)ic);
1709 m_impl->send.put_data (ic_uuid);
1710 m_impl->send.put_dataw (buf, buflen);
1711 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1716 * @brief Request to show preedit string.
1718 * @param ic The handle of the client Input Context to receive the request.
1719 * -1 means the currently focused Input Context.
1720 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1721 * Empty means don't match.
1724 HelperAgent::show_preedit_string (int ic,
1725 const String &ic_uuid) const
1728 if (m_impl->socket_active.is_connected ()) {
1729 m_impl->send.clear ();
1730 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1731 m_impl->send.put_data (m_impl->magic_active);
1732 m_impl->send.put_command (SCIM_TRANS_CMD_SHOW_PREEDIT_STRING);
1733 m_impl->send.put_data ((uint32)ic);
1734 m_impl->send.put_data (ic_uuid);
1735 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1740 * @brief Request to show aux string.
1743 HelperAgent::show_aux_string (void) const
1746 if (m_impl->socket_active.is_connected ()) {
1747 m_impl->send.clear ();
1748 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1749 m_impl->send.put_data (m_impl->magic_active);
1750 m_impl->send.put_command (SCIM_TRANS_CMD_SHOW_AUX_STRING);
1751 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1756 * @brief Request to show candidate string.
1759 HelperAgent::show_candidate_string (void) const
1762 if (m_impl->socket_active.is_connected ()) {
1763 m_impl->send.clear ();
1764 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1765 m_impl->send.put_data (m_impl->magic_active);
1766 m_impl->send.put_command (SCIM_TRANS_CMD_SHOW_LOOKUP_TABLE);
1767 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1772 * @brief Request to show associate string.
1775 HelperAgent::show_associate_string (void) const
1777 if (m_impl->socket_active.is_connected ()) {
1778 m_impl->send.clear ();
1779 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1780 m_impl->send.put_data (m_impl->magic_active);
1781 m_impl->send.put_command (ISM_TRANS_CMD_SHOW_ASSOCIATE_TABLE);
1782 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1787 * @brief Request to hide preedit string.
1789 * @param ic The handle of the client Input Context to receive the request.
1790 * -1 means the currently focused Input Context.
1791 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1792 * Empty means don't match.
1795 HelperAgent::hide_preedit_string (int ic,
1796 const String &ic_uuid) const
1799 if (m_impl->socket_active.is_connected ()) {
1800 m_impl->send.clear ();
1801 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1802 m_impl->send.put_data (m_impl->magic_active);
1803 m_impl->send.put_command (SCIM_TRANS_CMD_HIDE_PREEDIT_STRING);
1804 m_impl->send.put_data ((uint32)ic);
1805 m_impl->send.put_data (ic_uuid);
1806 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1811 * @brief Request to hide aux string.
1814 HelperAgent::hide_aux_string (void) const
1816 if (m_impl->socket_active.is_connected ()) {
1817 m_impl->send.clear ();
1818 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1819 m_impl->send.put_data (m_impl->magic_active);
1820 m_impl->send.put_command (SCIM_TRANS_CMD_HIDE_AUX_STRING);
1821 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1826 * @brief Request to hide candidate string.
1829 HelperAgent::hide_candidate_string (void) const
1831 if (m_impl->socket_active.is_connected ()) {
1832 m_impl->send.clear ();
1833 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1834 m_impl->send.put_data (m_impl->magic_active);
1835 m_impl->send.put_command (SCIM_TRANS_CMD_HIDE_LOOKUP_TABLE);
1836 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1841 * @brief Request to hide associate string.
1844 HelperAgent::hide_associate_string (void) const
1846 if (m_impl->socket_active.is_connected ()) {
1847 m_impl->send.clear ();
1848 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1849 m_impl->send.put_data (m_impl->magic_active);
1850 m_impl->send.put_command (ISM_TRANS_CMD_HIDE_ASSOCIATE_TABLE);
1851 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1856 * @brief Update a new WideString for preedit.
1858 * @param ic The handle of the client Input Context to receive the WideString.
1859 * -1 means the currently focused Input Context.
1860 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1861 * Empty means don't match.
1862 * @param str The WideString to be updated.
1863 * @param attrs The attribute list for preedit string.
1866 HelperAgent::update_preedit_string (int ic,
1867 const String &ic_uuid,
1868 const WideString &str,
1869 const AttributeList &attrs) const
1871 update_preedit_string (ic, ic_uuid, str, str, attrs, -1);
1875 HelperAgent::update_preedit_string (int ic,
1876 const String &ic_uuid,
1879 const AttributeList &attrs) const
1881 update_preedit_string (ic, ic_uuid, buf, buflen, attrs, -1);
1885 * @brief Update a new WideString for preedit.
1887 * @param ic The handle of the client Input Context to receive the WideString.
1888 * -1 means the currently focused Input Context.
1889 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1890 * Empty means don't match.
1891 * @param str The WideString to be updated.
1892 * @param attrs The attribute list for preedit string.
1893 * @param caret The caret position in preedit string.
1896 HelperAgent::update_preedit_string (int ic,
1897 const String &ic_uuid,
1898 const WideString &wstr,
1899 const AttributeList &attrs,
1902 update_preedit_string (ic, ic_uuid, wstr, wstr, attrs, caret);
1906 HelperAgent::update_preedit_string (int ic,
1907 const String &ic_uuid,
1910 const AttributeList &attrs,
1914 if (m_impl->socket_active.is_connected ()) {
1915 m_impl->send.clear ();
1916 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1917 m_impl->send.put_data (m_impl->magic_active);
1918 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING);
1919 m_impl->send.put_data ((uint32)ic);
1920 m_impl->send.put_data (ic_uuid);
1921 m_impl->send.put_dataw (buf, buflen);
1922 m_impl->send.put_dataw (buf, buflen);
1923 m_impl->send.put_data (attrs);
1924 m_impl->send.put_data (caret);
1925 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1930 HelperAgent::update_preedit_string (int ic,
1931 const String &ic_uuid,
1932 const WideString &preedit,
1933 const WideString &commit,
1934 const AttributeList &attrs,
1937 if (m_impl->socket_active.is_connected ()) {
1938 m_impl->send.clear ();
1939 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1940 m_impl->send.put_data (m_impl->magic_active);
1941 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING);
1942 m_impl->send.put_data ((uint32)ic);
1943 m_impl->send.put_data (ic_uuid);
1944 m_impl->send.put_data (preedit);
1945 m_impl->send.put_data (commit);
1946 m_impl->send.put_data (attrs);
1947 m_impl->send.put_data (caret);
1948 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1953 * @brief Update the preedit caret position in the preedit string.
1955 * @param caret - the new position of the preedit caret.
1958 HelperAgent::update_preedit_caret (int caret) const
1961 if (m_impl->socket_active.is_connected ()) {
1962 m_impl->send.clear ();
1963 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1964 m_impl->send.put_data (m_impl->magic_active);
1965 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET);
1966 m_impl->send.put_data ((uint32)caret);
1967 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1972 * @brief Update a new string for aux.
1974 * @param str The string to be updated.
1975 * @param attrs The attribute list for aux string.
1978 HelperAgent::update_aux_string (const String &str,
1979 const AttributeList &attrs) const
1981 if (m_impl->socket_active.is_connected ()) {
1982 m_impl->send.clear ();
1983 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1984 m_impl->send.put_data (m_impl->magic_active);
1985 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_AUX_STRING);
1986 m_impl->send.put_data (str);
1987 m_impl->send.put_data (attrs);
1988 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1993 * @brief Request to update candidate.
1995 * @param table The lookup table for candidate.
1998 HelperAgent::update_candidate_string (const LookupTable &table) const
2000 if (m_impl->socket_active.is_connected ()) {
2001 m_impl->send.clear ();
2002 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2003 m_impl->send.put_data (m_impl->magic_active);
2004 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE);
2005 m_impl->send.put_data (table);
2006 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2011 * @brief Request to update associate.
2013 * @param table The lookup table for associate.
2016 HelperAgent::update_associate_string (const LookupTable &table) const
2018 if (m_impl->socket_active.is_connected ()) {
2019 m_impl->send.clear ();
2020 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2021 m_impl->send.put_data (m_impl->magic_active);
2022 m_impl->send.put_command (ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE);
2023 m_impl->send.put_data (table);
2024 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2029 * @brief When the input context of ISE is changed,
2030 * ISE can call this function to notify application
2032 * @param type type of event.
2033 * @param value value of event.
2036 HelperAgent::update_input_context (uint32 type, uint32 value) const
2038 if (type == ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT) {
2039 /* Update all state variables that could be queried by the client application */
2041 m_impl->signal_get_language_locale(this, -1, &buf);
2044 if (m_impl->socket_active.is_connected()) {
2045 m_impl->send.clear();
2046 m_impl->send.put_command(SCIM_TRANS_CMD_REQUEST);
2047 m_impl->send.put_data(m_impl->magic_active);
2048 m_impl->send.put_command(ISM_TRANS_CMD_UPDATE_ISE_LANGUAGE_LOCALE);
2049 m_impl->send.put_data(buf, strlen(buf));
2050 m_impl->send.write_to_socket(m_impl->socket_active, m_impl->magic_active);
2057 if (m_impl->socket_active.is_connected ()) {
2058 m_impl->send.clear ();
2059 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2060 m_impl->send.put_data (m_impl->magic_active);
2061 m_impl->send.put_command (ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT);
2062 m_impl->send.put_data (type);
2063 m_impl->send.put_data (value);
2064 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2069 * @brief Request to get surrounding text asynchronously.
2071 * @param uuid The helper ISE UUID.
2072 * @param maxlen_before The max length of before.
2073 * @param maxlen_after The max length of after.
2076 HelperAgent::get_surrounding_text (const String &uuid, int maxlen_before, int maxlen_after) const
2078 if (m_impl->socket_active.is_connected () && (m_impl->need_update_surrounding_text == 0)) {
2079 m_impl->send.clear ();
2080 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2081 m_impl->send.put_data (m_impl->magic_active);
2082 m_impl->send.put_command (SCIM_TRANS_CMD_GET_SURROUNDING_TEXT);
2083 m_impl->send.put_data (uuid);
2084 m_impl->send.put_data (maxlen_before);
2085 m_impl->send.put_data (maxlen_after);
2086 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2088 m_impl->need_update_surrounding_text++;
2092 * @brief Request to get surrounding text synchronously.
2094 * @param uuid The helper ISE UUID.
2095 * @param maxlen_before The max length of before.
2096 * @param maxlen_after The max length of after.
2097 * @param text The surrounding text.
2098 * @param cursor The cursor position.
2101 HelperAgent::get_surrounding_text (int maxlen_before, int maxlen_after, String &text, int &cursor)
2103 if (!m_impl->socket_active.is_connected ())
2106 if (!m_impl->ise_focus_flag) {
2107 if (m_impl->finalized_text) {
2108 String buffer = m_impl->finalized_text;
2109 cursor = m_impl->finalized_cursor_pos;
2110 int pos = cursor - maxlen_before;
2111 if (maxlen_before < 0) pos = 0;
2112 if (pos > (int)buffer.length()) pos = (int)buffer.length();
2113 if (pos < 0) pos = 0;
2114 size_t len = maxlen_after + (cursor - pos);
2115 if (maxlen_after < 0) len = String::npos;
2116 text = buffer.substr (pos, len);
2122 m_impl->send.clear();
2123 m_impl->send.put_command(SCIM_TRANS_CMD_REQUEST);
2124 m_impl->send.put_data(m_impl->magic_active);
2125 m_impl->send.put_command(SCIM_TRANS_CMD_GET_SURROUNDING_TEXT);
2126 m_impl->send.put_data("");
2127 m_impl->send.put_data(maxlen_before);
2128 m_impl->send.put_data(maxlen_after);
2129 m_impl->send.write_to_socket(m_impl->socket_active, m_impl->magic_active);
2130 if (m_impl->surrounding_text) {
2131 free(m_impl->surrounding_text);
2132 m_impl->surrounding_text = NULL;
2135 const int WAIT_FOR_SYNC_RESPONSE_TIMEOUT = 1000;
2136 /* Now we are waiting for the ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT message */
2137 if (wait_for_message(ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT, WAIT_FOR_SYNC_RESPONSE_TIMEOUT)) {
2138 MessageItem *message = message_queue.get_pending_message_by_cmd(ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT);
2139 handle_message(message);
2140 message_queue.remove_message(message);
2142 if (m_impl->surrounding_text) {
2143 text = m_impl->surrounding_text;
2144 cursor = m_impl->cursor_pos;
2148 if (m_impl->surrounding_text) {
2149 free(m_impl->surrounding_text);
2150 m_impl->surrounding_text = NULL;
2153 LOGD("message_queue size : %d", message_queue.get_message_size());
2155 m_impl->send.clear ();
2156 m_impl->send.put_command(SCIM_TRANS_CMD_REQUEST);
2157 m_impl->send.put_data(m_impl->magic_active);
2158 m_impl->send.put_command(SCIM_TRANS_CMD_PING);
2159 m_impl->send.write_to_socket(m_impl->socket_active, m_impl->magic_active);
2164 * @brief Request to delete surrounding text.
2166 * @param offset The offset for cursor position.
2167 * @param len The length for delete text.
2170 HelperAgent::delete_surrounding_text (int offset, int len) const
2172 LOGD ("offset = %d, len = %d", offset, len);
2174 if (m_impl->socket_active.is_connected ()) {
2175 m_impl->send.clear ();
2176 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2177 m_impl->send.put_data (m_impl->magic_active);
2178 m_impl->send.put_command (SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT);
2179 m_impl->send.put_data (offset);
2180 m_impl->send.put_data (len);
2181 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2186 * @brief Request to get selection text asynchronously.
2188 * @param uuid The helper ISE UUID.
2191 HelperAgent::get_selection (const String &uuid) const
2193 if (m_impl->socket_active.is_connected () && (m_impl->need_update_selection_text == 0)) {
2194 m_impl->send.clear ();
2195 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2196 m_impl->send.put_data (m_impl->magic_active);
2197 m_impl->send.put_command (SCIM_TRANS_CMD_GET_SELECTION);
2198 m_impl->send.put_data (uuid);
2199 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2201 m_impl->need_update_selection_text++;
2205 * @brief Request to get selection text synchronously.
2207 * @param text The selection text.
2210 HelperAgent::get_selection_text (String &text)
2213 if (!m_impl->socket_active.is_connected ())
2216 m_impl->send.clear ();
2217 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2218 m_impl->send.put_data (m_impl->magic_active);
2219 m_impl->send.put_command (SCIM_TRANS_CMD_GET_SELECTION);
2220 m_impl->send.put_data ("");
2221 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2222 if (m_impl->selection_text) {
2223 free (m_impl->selection_text);
2224 m_impl->selection_text = NULL;
2227 const int WAIT_FOR_SYNC_RESPONSE_TIMEOUT = 1000;
2228 /* Now we are waiting for the ISM_TRANS_CMD_UPDATE_SELECTION message */
2229 if (wait_for_message(ISM_TRANS_CMD_UPDATE_SELECTION, WAIT_FOR_SYNC_RESPONSE_TIMEOUT)) {
2230 MessageItem *message = message_queue.get_pending_message_by_cmd(ISM_TRANS_CMD_UPDATE_SELECTION);
2231 handle_message(message);
2232 message_queue.remove_message(message);
2233 if (m_impl->selection_text) {
2234 text = m_impl->selection_text;
2238 if (m_impl->selection_text) {
2239 free (m_impl->selection_text);
2240 m_impl->selection_text = NULL;
2243 LOGD("message_queue size : %d", message_queue.get_message_size());
2245 m_impl->send.clear ();
2246 m_impl->send.put_command(SCIM_TRANS_CMD_REQUEST);
2247 m_impl->send.put_data(m_impl->magic_active);
2248 m_impl->send.put_command(SCIM_TRANS_CMD_PING);
2249 m_impl->send.write_to_socket(m_impl->socket_active, m_impl->magic_active);
2253 * @brief Request to select text.
2255 * @param start The start position in text.
2256 * @param end The end position in text.
2259 HelperAgent::set_selection (int start, int end) const
2261 if (m_impl->socket_active.is_connected ()) {
2262 m_impl->send.clear ();
2263 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2264 m_impl->send.put_data (m_impl->magic_active);
2265 m_impl->send.put_command (SCIM_TRANS_CMD_SET_SELECTION);
2266 m_impl->send.put_data (start);
2267 m_impl->send.put_data (end);
2268 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2273 * @brief Send a private command to an application.
2275 * @param command The private command sent from IME.
2278 HelperAgent::send_private_command (const String &command) const
2280 if (m_impl->socket_active.is_connected ()) {
2281 m_impl->send.clear ();
2282 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2283 m_impl->send.put_data (m_impl->magic_active);
2284 m_impl->send.put_command (SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND);
2285 m_impl->send.put_data (command);
2286 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2291 * @brief Commit content to an application.
2293 * @param content The content sent from IME.
2296 HelperAgent::commit_content (const String &content, const String &description, const String &mime_types) const
2299 if (m_impl->socket_active.is_connected ()) {
2300 m_impl->send.clear ();
2301 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2302 m_impl->send.put_data (m_impl->magic_active);
2303 m_impl->send.put_command (SCIM_TRANS_CMD_COMMIT_CONTENT);
2304 m_impl->send.put_data (content);
2305 m_impl->send.put_data (description);
2306 m_impl->send.put_data (mime_types);
2307 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2312 * @brief Request to get uuid list of all keyboard ISEs.
2314 * @param uuid The helper ISE UUID.
2317 HelperAgent::get_keyboard_ise_list (const String &uuid) const
2319 if (m_impl->socket_active.is_connected ()) {
2320 m_impl->send.clear ();
2321 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2322 m_impl->send.put_data (m_impl->magic_active);
2323 m_impl->send.put_command (ISM_TRANS_CMD_GET_KEYBOARD_ISE_LIST);
2324 m_impl->send.put_data (uuid);
2325 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2330 * @brief Set candidate position in screen.
2332 * @param left The x position in screen.
2333 * @param top The y position in screen.
2336 HelperAgent::set_candidate_position (int left, int top) const
2338 if (m_impl->socket_active.is_connected ()) {
2339 m_impl->send.clear ();
2340 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2341 m_impl->send.put_data (m_impl->magic_active);
2342 m_impl->send.put_command (ISM_TRANS_CMD_SET_CANDIDATE_POSITION);
2343 m_impl->send.put_data (left);
2344 m_impl->send.put_data (top);
2345 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2350 * @brief Set candidate style.
2352 * @param portrait_line - the displayed line number for portrait mode.
2353 * @param mode - candidate window mode.
2356 HelperAgent::set_candidate_style (ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line,
2357 ISF_CANDIDATE_MODE_T mode) const
2359 if (m_impl->socket_active.is_connected ()) {
2360 m_impl->send.clear ();
2361 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2362 m_impl->send.put_data (m_impl->magic_active);
2363 m_impl->send.put_command (ISM_TRANS_CMD_SET_CANDIDATE_UI);
2364 m_impl->send.put_data (portrait_line);
2365 m_impl->send.put_data (mode);
2366 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2371 * @brief Request to hide candidate window.
2374 HelperAgent::candidate_hide (void) const
2376 if (m_impl->socket_active.is_connected ()) {
2377 m_impl->send.clear ();
2378 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2379 m_impl->send.put_data (m_impl->magic_active);
2380 m_impl->send.put_command (ISM_TRANS_CMD_HIDE_CANDIDATE);
2381 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2386 * @brief Request to get candidate window size and position.
2388 * @param uuid The helper ISE UUID.
2391 HelperAgent::get_candidate_window_geometry (const String &uuid) const
2393 if (m_impl->socket_active.is_connected ()) {
2394 m_impl->send.clear ();
2395 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2396 m_impl->send.put_data (m_impl->magic_active);
2397 m_impl->send.put_command (ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY);
2398 m_impl->send.put_data (uuid);
2399 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2404 * @brief Set current keyboard ISE.
2406 * @param uuid The keyboard ISE UUID.
2409 HelperAgent::set_keyboard_ise_by_uuid (const String &uuid) const
2412 IMEngineFactoryPointer factory;
2413 IMEngineModule *engine_module = NULL;
2414 static int instance_count = 1;
2416 if ((!m_impl->si.null ()) && m_impl->si->get_factory_uuid () == uuid) {
2417 ISF_SAVE_LOG ("Already in UUID: %s", uuid.c_str());
2421 if (!m_impl->si.null()) {
2422 m_impl->si->focus_out();
2426 if (m_impl->m_config.null ()) {
2427 ISF_SAVE_LOG ("config is not working");
2431 #ifdef HAVE_PKGMGR_INFO
2434 pkgmgrinfo_appinfo_h handle;
2435 ret = pkgmgrinfo_appinfo_get_appinfo(uuid.c_str(), &handle);
2436 if (ret != PMINFO_R_OK) {
2437 ISF_SAVE_LOG ("Retrieve app info failed : %s", uuid.c_str ());
2441 ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid);
2442 if (ret != PMINFO_R_OK) {
2443 ISF_SAVE_LOG ("Retrieve pkgid failed : %s, %p", uuid.c_str(), handle);
2444 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2448 imeInfo.module_name = pkgid;
2449 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2451 if (isf_db_select_ime_info_by_appid(uuid.c_str(), &imeInfo) < 1) {
2452 ISF_SAVE_LOG ("ime_info row is not available for %s", uuid.c_str());
2457 engine_module = &m_impl->engine_module;
2459 if (engine_module->valid() && imeInfo.module_name != engine_module->get_module_name()) {
2460 ISF_SAVE_LOG ("imengine module %s unloaded", engine_module->get_module_name().c_str());
2461 engine_module->unload();
2464 if (!engine_module->valid()) {
2465 if (engine_module->load (imeInfo.module_name, m_impl->m_config) == false) {
2466 ISF_SAVE_LOG ("load module %s failed", imeInfo.module_name.c_str());
2469 ISF_SAVE_LOG ("imengine module %s loaded", imeInfo.module_name.c_str());
2472 for (size_t j = 0; j < engine_module->number_of_factories (); ++j) {
2474 factory = engine_module->create_factory (j);
2475 if (factory.null () == false && factory->get_uuid () == uuid)
2483 if (factory.null()) {
2484 ISF_SAVE_LOG ("imengine uuid %s is not found", uuid.c_str());
2488 m_impl->si = factory->create_instance ("UTF-8", instance_count++);
2489 if (m_impl->si.null ()) {
2490 ISF_SAVE_LOG ("create_instance %s failed", uuid.c_str ());
2494 m_impl->attach_instance ();
2495 ISF_SAVE_LOG ("Require UUID: %s Current UUID: %s", uuid.c_str (), m_impl->si->get_factory_uuid ().c_str ());
2496 m_impl->si->set_layout (m_impl->layout);
2497 if (m_impl->focused_ic != (uint32)-1)
2498 m_impl->si->focus_in ();
2502 * @brief Request to get current keyboard ISE information.
2504 * @param uuid The helper ISE UUID.
2507 HelperAgent::get_keyboard_ise (const String &uuid) const
2509 //FIXME: maybe useless
2511 if (m_impl->socket_active.is_connected ()) {
2512 m_impl->send.clear ();
2513 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2514 m_impl->send.put_data (m_impl->magic_active);
2515 m_impl->send.put_command (ISM_TRANS_CMD_GET_KEYBOARD_ISE);
2516 m_impl->send.put_data (uuid);
2517 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2523 * @brief Update ISE window geometry.
2525 * @param x The x position in screen.
2526 * @param y The y position in screen.
2527 * @param width The ISE window width.
2528 * @param height The ISE window height.
2531 HelperAgent::update_geometry (int x, int y, int width, int height) const
2533 if (m_impl->socket_active.is_connected ()) {
2534 m_impl->send.clear ();
2535 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2536 m_impl->send.put_data (m_impl->magic_active);
2537 m_impl->send.put_command (ISM_TRANS_CMD_UPDATE_ISE_GEOMETRY);
2538 m_impl->send.put_data (x);
2539 m_impl->send.put_data (y);
2540 m_impl->send.put_data (width);
2541 m_impl->send.put_data (height);
2542 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2547 * @brief Request to expand candidate window.
2550 HelperAgent::expand_candidate (void) const
2552 if (m_impl->socket_active.is_connected ()) {
2553 m_impl->send.clear ();
2554 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2555 m_impl->send.put_data (m_impl->magic_active);
2556 m_impl->send.put_command (ISM_TRANS_CMD_EXPAND_CANDIDATE);
2557 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2562 * @brief Request to contract candidate window.
2565 HelperAgent::contract_candidate (void) const
2567 if (m_impl->socket_active.is_connected ()) {
2568 m_impl->send.clear ();
2569 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2570 m_impl->send.put_data (m_impl->magic_active);
2571 m_impl->send.put_command (ISM_TRANS_CMD_CONTRACT_CANDIDATE);
2572 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2577 * @brief Send selected candidate string index number.
2580 HelperAgent::select_candidate (int index) const
2582 if (!m_impl->si.null ())
2583 m_impl->si->select_candidate (index);
2584 //FIXME: maybe useless
2587 if (m_impl->socket_active.is_connected ()) {
2588 m_impl->send.clear ();
2589 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2590 m_impl->send.put_data (m_impl->magic_active);
2591 m_impl->send.put_command (ISM_TRANS_CMD_SELECT_CANDIDATE);
2592 m_impl->send.put_data (index);
2593 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2599 * @brief Update our ISE is exiting.
2601 * The IME must call this function before terminating IME itself in On-demand mode.
2602 * If this function isn't called, IME will automatically restart.
2603 * This function only works in On-demand mode.
2607 HelperAgent::update_ise_exit (void) const
2609 if (m_impl->socket_active.is_connected ()) {
2610 m_impl->send.clear ();
2611 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2612 m_impl->send.put_data (m_impl->magic_active);
2613 m_impl->send.put_command (ISM_TRANS_CMD_UPDATE_ISE_EXIT);
2614 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2616 // The update_ise_exit must be delivered before del_client of isf_info_manager was called.
2622 * @brief Request to reset keyboard ISE.
2625 HelperAgent::reset_keyboard_ise (void) const
2627 //FIXME: maybe useless
2629 if (m_impl->socket_active.is_connected ()) {
2630 m_impl->send.clear ();
2631 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2632 m_impl->send.put_data (m_impl->magic_active);
2633 m_impl->send.put_command (ISM_TRANS_CMD_PANEL_RESET_KEYBOARD_ISE);
2634 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2637 if (!m_impl->si.null ()) {
2638 m_impl->si->reset ();
2643 * @brief Request to flush keyboard ISE.
2646 HelperAgent::flush_keyboard_ise (void) const
2648 if (!m_impl->si.null ()) {
2649 m_impl->si->flush ();
2654 * @brief Request panel to hide ISE.
2657 HelperAgent::request_ise_hide (void) const
2659 if (m_impl->socket_active.is_connected ()) {
2660 m_impl->send.clear ();
2661 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2662 m_impl->send.put_data (m_impl->magic_active);
2663 m_impl->send.put_command (ISM_TRANS_CMD_REQUEST_ISE_HIDE);
2664 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2672 HelperAgent::recapture_string (int ic,
2673 const String &ic_uuid,
2676 const WideString &preedit_str,
2677 const WideString &commit_str,
2678 const AttributeList &attrs) const
2680 LOGD ("offset = %d, len = %d", offset, len);
2682 if (m_impl->socket_active.is_connected ()) {
2683 m_impl->send.clear ();
2684 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2685 m_impl->send.put_data (m_impl->magic_active);
2686 m_impl->send.put_command (ISM_TRANS_CMD_RECAPTURE_STRING);
2688 m_impl->send.put_data ((uint32)ic);
2689 m_impl->send.put_data (ic_uuid);
2691 // Deleting surrounding text
2692 m_impl->send.put_data (offset);
2693 m_impl->send.put_data (len);
2695 // Update preedit text
2696 m_impl->send.put_data (preedit_str);
2699 m_impl->send.put_data (commit_str);
2701 // preedit attributes
2702 m_impl->send.put_data (attrs);
2704 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2709 * @brief Connect a slot to Helper exit signal.
2711 * This signal is used to let the Helper exit.
2713 * The prototype of the slot is:
2715 * void exit (const HelperAgent *agent, int ic, const String &ic_uuid);
2718 * - agent The pointer to the HelperAgent object which emits this signal.
2719 * - ic An opaque handle of the currently focused input context.
2720 * - ic_uuid The UUID of the IMEngineInstance associated with the focused input context.
2723 HelperAgent::signal_connect_exit (HelperAgentSlotVoid *slot)
2725 return m_impl->signal_exit.connect (slot);
2729 * @brief Connect a slot to Helper attach input context signal.
2731 * This signal is used to attach an input context to this helper.
2733 * When an input context requst to start this helper, then this
2734 * signal will be emitted as soon as the helper is started.
2736 * When an input context want to start an already started helper,
2737 * this signal will also be emitted.
2739 * Helper can send some events back to the IMEngineInstance in this
2740 * signal-slot, to inform that it has been started sccessfully.
2742 * The prototype of the slot is:
2744 * void attach_input_context (const HelperAgent *agent, int ic, const String &ic_uuid);
2747 HelperAgent::signal_connect_attach_input_context (HelperAgentSlotVoid *slot)
2749 return m_impl->signal_attach_input_context.connect (slot);
2753 * @brief Connect a slot to Helper detach input context signal.
2755 * This signal is used to detach an input context from this helper.
2757 * When an input context requst to stop this helper, then this
2758 * signal will be emitted.
2760 * Helper shouldn't send any event back to the IMEngineInstance, because
2761 * the IMEngineInstance attached to the ic should have been destroyed.
2763 * The prototype of the slot is:
2765 * void detach_input_context (const HelperAgent *agent, int ic, const String &ic_uuid);
2768 HelperAgent::signal_connect_detach_input_context (HelperAgentSlotVoid *slot)
2770 return m_impl->signal_detach_input_context.connect (slot);
2774 * @brief Connect a slot to Helper reload config signal.
2776 * This signal is used to let the Helper reload configuration.
2778 * The prototype of the slot is:
2780 * void reload_config (const HelperAgent *agent, int ic, const String &ic_uuid);
2783 HelperAgent::signal_connect_reload_config (HelperAgentSlotVoid *slot)
2785 return m_impl->signal_reload_config.connect (slot);
2789 * @brief Connect a slot to Helper update screen signal.
2791 * This signal is used to let the Helper move its GUI to another screen.
2792 * It can only be emitted when SCIM_HELPER_NEED_SCREEN_INFO is set in HelperInfo.option.
2794 * The prototype of the slot is:
2796 * void update_screen (const HelperAgent *agent, int ic, const String &ic_uuid, int screen_number);
2799 HelperAgent::signal_connect_update_screen (HelperAgentSlotInt *slot)
2801 return m_impl->signal_update_screen.connect (slot);
2805 * @brief Connect a slot to Helper update spot location signal.
2807 * This signal is used to let the Helper move its GUI according to the current spot location.
2808 * It can only be emitted when SCIM_HELPER_NEED_SPOT_LOCATION_INFO is set in HelperInfo.option.
2810 * The prototype of the slot is:
2811 * void update_spot_location (const HelperAgent *agent, int ic, const String &ic_uuid, int x, int y);
2814 HelperAgent::signal_connect_update_spot_location (HelperAgentSlotIntInt *slot)
2816 return m_impl->signal_update_spot_location.connect (slot);
2820 * @brief Connect a slot to Helper update cursor position signal.
2822 * This signal is used to let the Helper get the cursor position information.
2824 * The prototype of the slot is:
2825 * void update_cursor_position (const HelperAgent *agent, int ic, const String &ic_uuid, int cursor_pos);
2828 HelperAgent::signal_connect_update_cursor_position (HelperAgentSlotInt *slot)
2830 return m_impl->signal_update_cursor_position.connect (slot);
2834 * @brief Connect a slot to Helper update surrounding text signal.
2836 * This signal is used to let the Helper get the surrounding text.
2838 * The prototype of the slot is:
2839 * void update_surrounding_text (const HelperAgent *agent, int ic, const String &text, int cursor);
2842 HelperAgent::signal_connect_update_surrounding_text (HelperAgentSlotInt *slot)
2844 return m_impl->signal_update_surrounding_text.connect (slot);
2848 * @brief Connect a slot to Helper update selection signal.
2850 * This signal is used to let the Helper get the selection.
2852 * The prototype of the slot is:
2853 * void update_selection (const HelperAgent *agent, int ic, const String &text);
2856 HelperAgent::signal_connect_update_selection (HelperAgentSlotVoid *slot)
2858 return m_impl->signal_update_selection.connect (slot);
2862 * @brief Connect a slot to Helper trigger property signal.
2864 * This signal is used to trigger a property registered by this Helper.
2865 * A property will be triggered when user clicks on it.
2867 * The prototype of the slot is:
2868 * void trigger_property (const HelperAgent *agent, int ic, const String &ic_uuid, const String &property);
2871 HelperAgent::signal_connect_trigger_property (HelperAgentSlotString *slot)
2873 return m_impl->signal_trigger_property.connect (slot);
2877 * @brief Connect a slot to Helper process imengine event signal.
2879 * This signal is used to deliver the events sent from IMEngine to Helper.
2881 * The prototype of the slot is:
2882 * void process_imengine_event (const HelperAgent *agent, int ic, const String &ic_uuid, const Transaction &transaction);
2885 HelperAgent::signal_connect_process_imengine_event (HelperAgentSlotTransaction *slot)
2887 return m_impl->signal_process_imengine_event.connect (slot);
2891 * @brief Connect a slot to Helper focus out signal.
2893 * This signal is used to do something when input context is focus out.
2895 * The prototype of the slot is:
2896 * void focus_out (const HelperAgent *agent, int ic, const String &ic_uuid);
2899 HelperAgent::signal_connect_focus_out (HelperAgentSlotVoid *slot)
2901 return m_impl->signal_focus_out.connect (slot);
2905 * @brief Connect a slot to Helper focus in signal.
2907 * This signal is used to do something when input context is focus in.
2909 * The prototype of the slot is:
2910 * void focus_in (const HelperAgent *agent, int ic, const String &ic_uuid);
2913 HelperAgent::signal_connect_focus_in (HelperAgentSlotVoid *slot)
2915 return m_impl->signal_focus_in.connect (slot);
2919 * @brief Connect a slot to Helper show signal.
2921 * This signal is used to show Helper ISE window.
2923 * The prototype of the slot is:
2924 * void ise_show (const HelperAgent *agent, int ic, char *buf, size_t &len);
2927 HelperAgent::signal_connect_ise_show (HelperAgentSlotIntRawVoid *slot)
2929 return m_impl->signal_ise_show.connect (slot);
2933 * @brief Connect a slot to Helper hide signal.
2935 * This signal is used to hide Helper ISE window.
2937 * The prototype of the slot is:
2938 * void ise_hide (const HelperAgent *agent, int ic, const String &ic_uuid);
2941 HelperAgent::signal_connect_ise_hide (HelperAgentSlotVoid *slot)
2943 return m_impl->signal_ise_hide.connect (slot);
2947 * @brief Connect a slot to Helper get ISE window geometry signal.
2949 * This signal is used to get Helper ISE window size and position.
2951 * The prototype of the slot is:
2952 * void get_geometry (const HelperAgent *agent, struct rectinfo &info);
2955 HelperAgent::signal_connect_get_geometry (HelperAgentSlotSize *slot)
2957 return m_impl->signal_get_geometry.connect (slot);
2961 * @brief Connect a slot to Helper set mode signal.
2963 * This signal is used to set Helper ISE mode.
2965 * The prototype of the slot is:
2966 * void set_mode (const HelperAgent *agent, uint32 &mode);
2969 HelperAgent::signal_connect_set_mode (HelperAgentSlotUintVoid *slot)
2971 return m_impl->signal_set_mode.connect (slot);
2975 * @brief Connect a slot to Helper set language signal.
2977 * This signal is used to set Helper ISE language.
2979 * The prototype of the slot is:
2980 * void set_language (const HelperAgent *agent, uint32 &language);
2983 HelperAgent::signal_connect_set_language (HelperAgentSlotUintVoid *slot)
2985 return m_impl->signal_set_language.connect (slot);
2989 * @brief Connect a slot to Helper set im data signal.
2991 * This signal is used to send im data to Helper ISE.
2993 * The prototype of the slot is:
2994 * void set_imdata (const HelperAgent *agent, char *buf, size_t &len);
2997 HelperAgent::signal_connect_set_imdata (HelperAgentSlotRawVoid *slot)
2999 return m_impl->signal_set_imdata.connect (slot);
3003 * @brief Connect a slot to Helper get im data signal.
3005 * This signal is used to get im data from Helper ISE.
3007 * The prototype of the slot is:
3008 * void get_imdata (const HelperAgent *, char **buf, size_t &len);
3011 HelperAgent::signal_connect_get_imdata (HelperAgentSlotGetRawVoid *slot)
3013 return m_impl->signal_get_imdata.connect (slot);
3017 * @brief Connect a slot to Helper get language locale signal.
3019 * This signal is used to get language locale from Helper ISE.
3021 * The prototype of the slot is:
3022 * void get_language_locale (const HelperAgent *, int ic, char **locale);
3025 HelperAgent::signal_connect_get_language_locale (HelperAgentSlotIntGetStringVoid *slot)
3027 return m_impl->signal_get_language_locale.connect (slot);
3031 * @brief Connect a slot to Helper set return key type signal.
3033 * This signal is used to send return key type to Helper ISE.
3035 * The prototype of the slot is:
3036 * void set_return_key_type (const HelperAgent *agent, uint32 &type);
3039 HelperAgent::signal_connect_set_return_key_type (HelperAgentSlotUintVoid *slot)
3041 return m_impl->signal_set_return_key_type.connect (slot);
3045 * @brief Connect a slot to Helper get return key type signal.
3047 * This signal is used to get return key type from Helper ISE.
3049 * The prototype of the slot is:
3050 * void get_return_key_type (const HelperAgent *agent, uint32 &type);
3053 HelperAgent::signal_connect_get_return_key_type (HelperAgentSlotUintVoid *slot)
3055 return m_impl->signal_get_return_key_type.connect (slot);
3059 * @brief Connect a slot to Helper set return key disable signal.
3061 * This signal is used to send return key disable to Helper ISE.
3063 * The prototype of the slot is:
3064 * void set_return_key_disable (const HelperAgent *agent, uint32 &disabled);
3067 HelperAgent::signal_connect_set_return_key_disable (HelperAgentSlotUintVoid *slot)
3069 return m_impl->signal_set_return_key_disable.connect (slot);
3073 * @brief Connect a slot to Helper process key event signal.
3075 * This signal is used to send keyboard key event to Helper ISE.
3077 * The prototype of the slot is:
3078 * void process_key_event (const HelperAgent *agent, KeyEvent &key, uint32 &ret);
3081 HelperAgent::signal_connect_process_key_event (HelperAgentSlotKeyEventUint *slot)
3083 return m_impl->signal_process_key_event.connect (slot);
3087 * @brief Connect a slot to Helper process key event with keycode signal.
3089 * This signal is used to send keyboard key event with keycode to Helper ISE.
3091 * The prototype of the slot is:
3092 * void process_key_event_with_keycode (const HelperAgent *agent, KeyEvent &key, uint32 &ret, uint32 keycode);
3095 HelperAgent::signal_connect_process_key_event_with_keycode (HelperAgentSlotKeyEventUintUint *slot)
3097 return m_impl->signal_process_key_event_with_keycode.connect (slot);
3101 * @brief Connect a slot to Helper get return key disable signal.
3103 * This signal is used to get return key disable from Helper ISE.
3105 * The prototype of the slot is:
3106 * void get_return_key_disable (const HelperAgent *agent, uint32 &disabled);
3109 HelperAgent::signal_connect_get_return_key_disable (HelperAgentSlotUintVoid *slot)
3111 return m_impl->signal_get_return_key_disable.connect (slot);
3115 * @brief Connect a slot to Helper set layout signal.
3117 * This signal is used to set Helper ISE layout.
3119 * The prototype of the slot is:
3120 * void set_layout (const HelperAgent *agent, uint32 &layout);
3123 HelperAgent::signal_connect_set_layout (HelperAgentSlotUintVoid *slot)
3125 return m_impl->signal_set_layout.connect (slot);
3129 * @brief Connect a slot to Helper get layout signal.
3131 * This signal is used to get Helper ISE layout.
3133 * The prototype of the slot is:
3134 * void get_layout (const HelperAgent *agent, uint32 &layout);
3137 HelperAgent::signal_connect_get_layout (HelperAgentSlotUintVoid *slot)
3139 return m_impl->signal_get_layout.connect (slot);
3143 * @brief Connect a slot to Helper set input mode signal.
3145 * This signal is used to set Helper ISE input mode.
3147 * The prototype of the slot is:
3148 * void set_input_mode (const HelperAgent *agent, uint32 &input_mode);
3151 HelperAgent::signal_connect_set_input_mode (HelperAgentSlotUintVoid *slot)
3153 return m_impl->signal_set_input_mode.connect (slot);
3157 * @brief Connect a slot to Helper set input hint signal.
3159 * This signal is used to set Helper ISE input hint.
3161 * The prototype of the slot is:
3162 * void set_input_hint (const HelperAgent *agent, uint32 &input_hint);
3165 HelperAgent::signal_connect_set_input_hint (HelperAgentSlotUintVoid *slot)
3167 return m_impl->signal_set_input_hint.connect (slot);
3171 * @brief Connect a slot to Helper set BiDi direction signal.
3173 * This signal is used to set Helper ISE BiDi direction.
3175 * The prototype of the slot is:
3176 * void update_bidi_direction (const HelperAgent *agent, uint32 &bidi_direction);
3179 HelperAgent::signal_connect_update_bidi_direction (HelperAgentSlotUintVoid *slot)
3181 return m_impl->signal_update_bidi_direction.connect (slot);
3185 * @brief Connect a slot to Helper set shift mode signal.
3187 * This signal is used to set Helper shift mode.
3189 * The prototype of the slot is:
3190 * void set_caps_mode (const HelperAgent *agent, uint32 &mode);
3193 HelperAgent::signal_connect_set_caps_mode (HelperAgentSlotUintVoid *slot)
3195 return m_impl->signal_set_caps_mode.connect (slot);
3199 * @brief Connect a slot to Helper reset input context signal.
3201 * This signal is used to reset Helper ISE input context.
3203 * The prototype of the slot is:
3204 * void reset_input_context (const HelperAgent *agent, int ic, const String &uuid);
3207 HelperAgent::signal_connect_reset_input_context (HelperAgentSlotVoid *slot)
3209 return m_impl->signal_reset_input_context.connect (slot);
3213 * @brief Connect a slot to Helper update candidate window geometry signal.
3215 * This signal is used to get candidate window size and position.
3217 * The prototype of the slot is:
3218 * void update_candidate_geometry (const HelperAgent *agent, int ic, const String &uuid, const rectinfo &info);
3221 HelperAgent::signal_connect_update_candidate_geometry (HelperAgentSlotRect *slot)
3223 return m_impl->signal_update_candidate_geometry.connect (slot);
3227 * @brief Connect a slot to Helper update keyboard ISE signal.
3229 * This signal is used to get current keyboard ISE name and uuid.
3231 * The prototype of the slot is:
3232 * void update_keyboard_ise (const HelperAgent *agent, int ic, const String &uuid,
3233 * const String &ise_name, const String &ise_uuid);
3236 HelperAgent::signal_connect_update_keyboard_ise (HelperAgentSlotString2 *slot)
3238 return m_impl->signal_update_keyboard_ise.connect (slot);
3242 * @brief Connect a slot to Helper update keyboard ISE list signal.
3244 * This signal is used to get uuid list of all keyboard ISEs.
3246 * The prototype of the slot is:
3247 * void update_keyboard_ise_list (const HelperAgent *agent, int ic, const String &uuid,
3248 * const std::vector<String> &ise_list);
3251 HelperAgent::signal_connect_update_keyboard_ise_list (HelperAgentSlotStringVector *slot)
3253 return m_impl->signal_update_keyboard_ise_list.connect (slot);
3257 * @brief Connect a slot to Helper candidate more window show signal.
3259 * This signal is used to do someting when candidate more window is showed.
3261 * The prototype of the slot is:
3262 * void candidate_more_window_show (const HelperAgent *agent, int ic, const String &uuid);
3265 HelperAgent::signal_connect_candidate_more_window_show (HelperAgentSlotVoid *slot)
3267 return m_impl->signal_candidate_more_window_show.connect (slot);
3271 * @brief Connect a slot to Helper candidate more window hide signal.
3273 * This signal is used to do someting when candidate more window is hidden.
3275 * The prototype of the slot is:
3276 * void candidate_more_window_hide (const HelperAgent *agent, int ic, const String &uuid);
3279 HelperAgent::signal_connect_candidate_more_window_hide (HelperAgentSlotVoid *slot)
3281 return m_impl->signal_candidate_more_window_hide.connect (slot);
3285 * @brief Connect a slot to Helper candidate show signal.
3287 * This signal is used to do candidate show.
3289 * The prototype of the slot is:
3290 * void candidate_show (const HelperAgent *agent, int ic, const String &uuid);
3293 HelperAgent::signal_connect_candidate_show (HelperAgentSlotVoid *slot)
3295 return m_impl->signal_candidate_show.connect (slot);
3299 * @brief Connect a slot to Helper candidate hide signal.
3301 * This signal is used to do candidate hide.
3303 * The prototype of the slot is:
3304 * void candidate_hide (const HelperAgent *agent, int ic, const String &uuid);
3307 HelperAgent::signal_connect_candidate_hide (HelperAgentSlotVoid *slot)
3309 return m_impl->signal_candidate_hide.connect (slot);
3313 * @brief Connect a slot to Helper update lookup table signal.
3315 * This signal is used to do someting when update lookup table.
3317 * The prototype of the slot is:
3318 * void update_lookup_table (const HelperAgent *agent, int ic, const String &uuid ,LookupTable &table);
3321 HelperAgent::signal_connect_update_lookup_table (HelperAgentSlotLookupTable *slot)
3323 return m_impl->signal_update_lookup_table.connect (slot);
3327 * @brief Connect a slot to Helper select aux signal.
3329 * This signal is used to do something when aux is selected.
3331 * The prototype of the slot is:
3332 * void select_aux (const HelperAgent *agent, int ic, const String &uuid, int index);
3335 HelperAgent::signal_connect_select_aux (HelperAgentSlotInt *slot)
3337 return m_impl->signal_select_aux.connect (slot);
3341 * @brief Connect a slot to Helper select candidate signal.
3343 * This signal is used to do something when candidate is selected.
3345 * The prototype of the slot is:
3346 * void select_candidate (const HelperAgent *agent, int ic, const String &uuid, int index);
3349 HelperAgent::signal_connect_select_candidate (HelperAgentSlotInt *slot)
3351 return m_impl->signal_select_candidate.connect (slot);
3355 * @brief Connect a slot to Helper candidate table page up signal.
3357 * This signal is used to do something when candidate table is paged up.
3359 * The prototype of the slot is:
3360 * void candidate_table_page_up (const HelperAgent *agent, int ic, const String &uuid);
3363 HelperAgent::signal_connect_candidate_table_page_up (HelperAgentSlotVoid *slot)
3365 return m_impl->signal_candidate_table_page_up.connect (slot);
3369 * @brief Connect a slot to Helper candidate table page down signal.
3371 * This signal is used to do something when candidate table is paged down.
3373 * The prototype of the slot is:
3374 * void candidate_table_page_down (const HelperAgent *agent, int ic, const String &uuid);
3377 HelperAgent::signal_connect_candidate_table_page_down (HelperAgentSlotVoid *slot)
3379 return m_impl->signal_candidate_table_page_down.connect (slot);
3383 * @brief Connect a slot to Helper update candidate table page size signal.
3385 * This signal is used to do something when candidate table page size is changed.
3387 * The prototype of the slot is:
3388 * void update_candidate_table_page_size (const HelperAgent *, int ic, const String &uuid, int page_size);
3391 HelperAgent::signal_connect_update_candidate_table_page_size (HelperAgentSlotInt *slot)
3393 return m_impl->signal_update_candidate_table_page_size.connect (slot);
3397 * @brief Connect a slot to Helper update candidate item layout signal.
3399 * The prototype of the slot is:
3400 * void update_candidate_item_layout (const HelperAgent *, const std::vector<uint32> &row_items);
3403 HelperAgent::signal_connect_update_candidate_item_layout (HelperAgentSlotUintVector *slot)
3405 return m_impl->signal_update_candidate_item_layout.connect (slot);
3409 * @brief Connect a slot to Helper select associate signal.
3411 * This signal is used to do something when associate is selected.
3413 * The prototype of the slot is:
3414 * void select_associate (const HelperAgent *agent, int ic, const String &uuid, int index);
3417 HelperAgent::signal_connect_select_associate (HelperAgentSlotInt *slot)
3419 return m_impl->signal_select_associate.connect (slot);
3423 * @brief Connect a slot to Helper associate table page up signal.
3425 * This signal is used to do something when associate table is paged up.
3427 * The prototype of the slot is:
3428 * void associate_table_page_up (const HelperAgent *agent, int ic, const String &uuid);
3431 HelperAgent::signal_connect_associate_table_page_up (HelperAgentSlotVoid *slot)
3433 return m_impl->signal_associate_table_page_up.connect (slot);
3437 * @brief Connect a slot to Helper associate table page down signal.
3439 * This signal is used to do something when associate table is paged down.
3441 * The prototype of the slot is:
3442 * void associate_table_page_down (const HelperAgent *agent, int ic, const String &uuid);
3445 HelperAgent::signal_connect_associate_table_page_down (HelperAgentSlotVoid *slot)
3447 return m_impl->signal_associate_table_page_down.connect (slot);
3451 * @brief Connect a slot to Helper update associate table page size signal.
3453 * This signal is used to do something when associate table page size is changed.
3455 * The prototype of the slot is:
3456 * void update_associate_table_page_size (const HelperAgent *, int ic, const String &uuid, int page_size);
3459 HelperAgent::signal_connect_update_associate_table_page_size (HelperAgentSlotInt *slot)
3461 return m_impl->signal_update_associate_table_page_size.connect (slot);
3465 * @brief Connect a slot to Helper turn on log signal.
3467 * This signal is used to turn on Helper ISE debug information.
3469 * The prototype of the slot is:
3470 * void turn_on_log (const HelperAgent *agent, uint32 &on);
3473 HelperAgent::signal_connect_turn_on_log (HelperAgentSlotUintVoid *slot)
3475 return m_impl->signal_turn_on_log.connect (slot);
3479 * @brief Connect a slot to Helper update displayed candidate number signal.
3481 * This signal is used to inform helper ISE displayed candidate number.
3483 * The prototype of the slot is:
3484 * void update_displayed_candidate_number (const HelperAgent *, int ic, const String &uuid, int number);
3487 HelperAgent::signal_connect_update_displayed_candidate_number (HelperAgentSlotInt *slot)
3489 return m_impl->signal_update_displayed_candidate_number.connect (slot);
3493 * @brief Connect a slot to Helper longpress candidate signal.
3495 * This signal is used to do something when candidate is longpress.
3497 * The prototype of the slot is:
3498 * void longpress_candidate (const HelperAgent *agent, int ic, const String &uuid, int index);
3501 HelperAgent::signal_connect_longpress_candidate (HelperAgentSlotInt *slot)
3503 return m_impl->signal_longpress_candidate.connect (slot);
3507 * @brief Connect a slot to Helper show option window.
3509 * This signal is used to do request the ISE to show option window.
3511 * The prototype of the slot is:
3512 * void show_option_window (const HelperAgent *agent, int ic, const String &uuid);
3515 HelperAgent::signal_connect_show_option_window (HelperAgentSlotVoid *slot)
3517 return m_impl->signal_show_option_window.connect (slot);
3521 * @brief Connect a slot to Helper resume option window.
3523 * This signal is used to do request the ISE to resume option window.
3525 * The prototype of the slot is:
3526 * void resume_option_window (const HelperAgent *agent, int ic, const String &uuid);
3529 HelperAgent::signal_connect_resume_option_window (HelperAgentSlotVoid *slot)
3531 return m_impl->signal_resume_option_window.connect (slot);
3535 * @brief Connect a slot to Helper check if the option is available.
3537 * This signal is used to check if the option (setting) is available from Helper ISE.
3539 * The prototype of the slot is:
3540 * void check_option_window (const HelperAgent *agent, uint32 &avail);
3543 HelperAgent::signal_connect_check_option_window (HelperAgentSlotUintVoid *slot)
3545 return m_impl->signal_check_option_window.connect (slot);
3549 * @brief Connect a slot to Helper process unconventional input device event signal.
3551 * This signal is used to send unconventional input device event to Helper ISE.
3553 * The prototype of the slot is:
3554 * void process_input_device_event (const HelperAgent *, uint32 &type, char *data, size_t &size, uint32 &ret);
3557 HelperAgent::signal_connect_process_input_device_event (HelperAgentSlotUintCharSizeUint *slot)
3559 return m_impl->signal_process_input_device_event.connect (slot);
3563 * @brief Connect a slot to Helper set prediction hint signal.
3565 * This signal is used to send prediction hint to Helper ISE.
3567 * The prototype of the slot is:
3568 * void set_prediction_hint (const HelperAgent *agent, char *prediction_hint);
3571 HelperAgent::signal_connect_set_prediction_hint (HelperAgentSlotStringVoid *slot)
3573 return m_impl->signal_set_prediction_hint.connect (slot);
3577 * @brief Connect a slot to Helper set mime type signal.
3579 * This signal is used to send mime type to Helper ISE.
3581 * The prototype of the slot is:
3582 * void set_mime_type (const HelperAgent *agent, char *mime_type);
3585 HelperAgent::signal_connect_set_mime_type (HelperAgentSlotStringVoid *slot)
3587 return m_impl->signal_set_mime_type.connect (slot);
3591 * @brief Connect a slot to Helper set prediction hint data signal.
3593 * This signal is used to send prediction hint data to Helper ISE.
3595 * The prototype of the slot is:
3596 * void set_prediction_hint_data (const HelperAgent *agent, char *key, char *value);
3599 HelperAgent::signal_connect_set_prediction_hint_data (HelperAgentSlotString *slot)
3601 return m_impl->signal_set_prediction_hint_data.connect (slot);
3605 * @brief Connect a slot to Helper set optimization hint signal.
3607 * This signal is used to send optimization hint to Helper ISE.
3609 * The prototype of the slot is:
3610 * void set_optimization_hint (const HelperAgent *agent, uint32 &hint);
3613 HelperAgent::signal_connect_set_optimization_hint (HelperAgentSlotUintVoid *slot)
3615 return m_impl->signal_set_optimization_hint.connect (slot);
3618 } /* namespace scim */
3621 vi:ts=4:nowrap:ai:expandtab