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 };
878 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 etime = ((t1.tv_sec * 1000000 + t1.tv_usec) - (t0.tv_sec * 1000000 + t0.tv_usec)) / 1000;
892 } while (etime < 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 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 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 LOGD("imengine(%s) process key %d return %d", m_impl->si->get_factory_uuid().c_str(),
1175 subclass->get_key_ref().code, ret);
1179 m_impl->process_key_event_done (subclass->get_key_ref(), ret, subclass->get_serial_ref());
1182 case ISM_TRANS_CMD_SET_LAYOUT:
1184 MessageItemSetLayout *subclass = static_cast<MessageItemSetLayout*>(message);
1185 m_impl->layout = subclass->get_layout_ref();
1186 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1187 m_impl->signal_set_layout (this, subclass->get_layout_ref());
1189 if (!m_impl->si.null ()) m_impl->si->set_layout(subclass->get_layout_ref());
1192 case ISM_TRANS_CMD_GET_LAYOUT:
1196 m_impl->signal_get_layout (this, layout);
1197 m_impl->send.clear ();
1198 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
1199 m_impl->send.put_data (layout);
1200 m_impl->send.write_to_socket (m_impl->socket);
1203 case ISM_TRANS_CMD_SET_INPUT_MODE:
1205 MessageItemSetInputMode *subclass = static_cast<MessageItemSetInputMode*>(message);
1206 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1207 m_impl->signal_set_input_mode (this, subclass->get_input_mode_ref());
1211 case ISM_TRANS_CMD_SET_CAPS_MODE:
1213 MessageItemSetCapsMode *subclass = static_cast<MessageItemSetCapsMode*>(message);
1214 m_impl->signal_set_caps_mode (this, subclass->get_mode_ref());
1217 case SCIM_TRANS_CMD_PANEL_RESET_INPUT_CONTEXT:
1219 MessageItemPanelResetInputContext *subclass = static_cast<MessageItemPanelResetInputContext*>(message);
1220 m_impl->signal_reset_input_context (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1221 if (!m_impl->si.null ()) m_impl->si->reset();
1224 case ISM_TRANS_CMD_UPDATE_CANDIDATE_UI:
1226 MessageItemUpdateCandidateUI *subclass = static_cast<MessageItemUpdateCandidateUI*>(message);
1227 m_impl->signal_update_candidate_ui (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1228 subclass->get_style_ref(), subclass->get_mode_ref());
1231 case ISM_TRANS_CMD_UPDATE_CANDIDATE_GEOMETRY:
1233 MessageItemUpdateCandidateGeometry *subclass = static_cast<MessageItemUpdateCandidateGeometry*>(message);
1234 m_impl->signal_update_candidate_geometry (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1235 subclass->get_rectinfo_ref());
1238 case ISM_TRANS_CMD_UPDATE_KEYBOARD_ISE:
1240 MessageItemUpdateKeyboardISE *subclass = static_cast<MessageItemUpdateKeyboardISE*>(message);
1241 m_impl->signal_update_keyboard_ise (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1242 subclass->get_name_ref(), subclass->get_uuid_ref());
1245 case ISM_TRANS_CMD_UPDATE_KEYBOARD_ISE_LIST:
1247 MessageItemUpdateKeyboardISEList *subclass = static_cast<MessageItemUpdateKeyboardISEList*>(message);
1248 m_impl->signal_update_keyboard_ise_list (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1249 subclass->get_list_ref());
1252 case ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_SHOW:
1254 MessageItemCandidateMoreWindowShow *subclass = static_cast<MessageItemCandidateMoreWindowShow*>(message);
1255 m_impl->signal_candidate_more_window_show (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1256 if (!m_impl->si.null ()) m_impl->si->candidate_more_window_show();
1259 case ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_HIDE:
1261 MessageItemCandidateMoreWindowHide *subclass = static_cast<MessageItemCandidateMoreWindowHide*>(message);
1262 m_impl->signal_candidate_more_window_hide (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1263 if (!m_impl->si.null ()) m_impl->si->candidate_more_window_hide();
1266 case ISM_TRANS_CMD_SELECT_AUX:
1268 MessageItemSelectAux *subclass = static_cast<MessageItemSelectAux*>(message);
1269 m_impl->signal_select_aux (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1270 subclass->get_item_ref());
1271 if (!m_impl->si.null ()) m_impl->si->select_aux(subclass->get_item_ref());
1274 case SCIM_TRANS_CMD_SELECT_CANDIDATE: //FIXME:remove if useless
1276 MessageItemSelectCandidate *subclass = static_cast<MessageItemSelectCandidate*>(message);
1277 m_impl->signal_select_candidate (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1278 subclass->get_item_ref());
1279 if (!m_impl->si.null ()) m_impl->si->select_candidate(subclass->get_item_ref());
1282 case SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_UP: //FIXME:remove if useless
1284 MessageItemLookupTablePageUp *subclass = static_cast<MessageItemLookupTablePageUp*>(message);
1285 m_impl->signal_candidate_table_page_up (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1286 if (!m_impl->si.null ()) m_impl->si->lookup_table_page_up();
1289 case SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_DOWN: //FIXME:remove if useless
1291 MessageItemLookupTablePageDown *subclass = static_cast<MessageItemLookupTablePageDown*>(message);
1292 m_impl->signal_candidate_table_page_down (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1293 if (!m_impl->si.null ()) m_impl->si->lookup_table_page_down();
1296 case SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE_PAGE_SIZE:
1298 MessageItemUpdateLookupTablePageSize *subclass = static_cast<MessageItemUpdateLookupTablePageSize*>(message);
1299 m_impl->signal_update_candidate_table_page_size (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1300 subclass->get_size_ref());
1301 if (!m_impl->si.null ()) m_impl->si->update_lookup_table_page_size(subclass->get_size_ref());
1304 case ISM_TRANS_CMD_CANDIDATE_SHOW: //FIXME:remove if useless
1306 MessageItemCandidateShow *subclass = static_cast<MessageItemCandidateShow*>(message);
1307 m_impl->signal_candidate_show (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1310 case ISM_TRANS_CMD_CANDIDATE_HIDE: //FIXME:remove if useless
1312 MessageItemCandidateHide *subclass = static_cast<MessageItemCandidateHide*>(message);
1313 m_impl->signal_candidate_hide (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1316 case ISM_TRANS_CMD_UPDATE_LOOKUP_TABLE: //FIXME:remove if useless
1318 MessageItemUpdateLookupTable *subclass = static_cast<MessageItemUpdateLookupTable*>(message);
1319 m_impl->signal_update_lookup_table (this, subclass->get_candidate_table_ref());
1322 case ISM_TRANS_CMD_UPDATE_CANDIDATE_ITEM_LAYOUT:
1324 MessageItemUpdateCandidateItemLayout *subclass = static_cast<MessageItemUpdateCandidateItemLayout*>(message);
1325 m_impl->signal_update_candidate_item_layout (this, subclass->get_row_items_ref());
1326 if (!m_impl->si.null ()) m_impl->si->update_candidate_item_layout(subclass->get_row_items_ref());
1329 case ISM_TRANS_CMD_SELECT_ASSOCIATE:
1331 MessageItemSelectAssociate *subclass = static_cast<MessageItemSelectAssociate*>(message);
1332 m_impl->signal_select_associate (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1333 subclass->get_item_ref());
1336 case ISM_TRANS_CMD_ASSOCIATE_TABLE_PAGE_UP:
1338 MessageItemAssociateTablePageUp *subclass = static_cast<MessageItemAssociateTablePageUp*>(message);
1339 m_impl->signal_associate_table_page_up (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1342 case ISM_TRANS_CMD_ASSOCIATE_TABLE_PAGE_DOWN:
1344 MessageItemAssociateTablePageDown *subclass = static_cast<MessageItemAssociateTablePageDown*>(message);
1345 m_impl->signal_associate_table_page_down (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1348 case ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE_PAGE_SIZE:
1350 MessageItemUpdateAssociateTablePageSize *subclass = static_cast<MessageItemUpdateAssociateTablePageSize*>(message);
1351 m_impl->signal_update_associate_table_page_size (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1352 subclass->get_size_ref());
1355 case ISM_TRANS_CMD_RESET_ISE_CONTEXT:
1357 MessageItemResetISEContext *subclass = static_cast<MessageItemResetISEContext*>(message);
1358 m_impl->signal_reset_ise_context (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1359 m_impl->signal_reset_input_context (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1360 if (!m_impl->si.null ()) m_impl->si->reset();
1363 case ISM_TRANS_CMD_TURN_ON_LOG:
1365 MessageItemTurnOnLog *subclass = static_cast<MessageItemTurnOnLog*>(message);
1366 m_impl->signal_turn_on_log (this, subclass->get_state_ref());
1369 case ISM_TRANS_CMD_UPDATE_DISPLAYED_CANDIDATE:
1371 MessageItemUpdateDisplayedCandidate *subclass = static_cast<MessageItemUpdateDisplayedCandidate*>(message);
1372 m_impl->signal_update_displayed_candidate_number (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1373 subclass->get_size_ref());
1374 if (!m_impl->si.null ()) m_impl->si->update_displayed_candidate_number(subclass->get_size_ref());
1377 case ISM_TRANS_CMD_LONGPRESS_CANDIDATE:
1379 MessageItemLongpressCandidate *subclass = static_cast<MessageItemLongpressCandidate*>(message);
1380 m_impl->signal_longpress_candidate (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
1381 subclass->get_index_ref());
1382 if (!m_impl->si.null ()) m_impl->si->longpress_candidate(subclass->get_index_ref());
1385 case ISM_TRANS_CMD_SET_INPUT_HINT:
1387 MessageItemSetInputHint *subclass = static_cast<MessageItemSetInputHint*>(message);
1388 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1389 m_impl->signal_set_input_hint (this, subclass->get_input_hint_ref());
1391 if (!m_impl->si.null ()) m_impl->si->set_input_hint(subclass->get_input_hint_ref());
1394 case ISM_TRANS_CMD_UPDATE_BIDI_DIRECTION:
1396 MessageItemUpdateBidiDirection *subclass = static_cast<MessageItemUpdateBidiDirection*>(message);
1397 m_impl->signal_update_bidi_direction (this, subclass->get_bidi_direction());
1398 if (!m_impl->si.null ()) m_impl->si->update_bidi_direction(subclass->get_bidi_direction());
1401 case ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW:
1403 MessageItemShowISEOptionWindow *subclass = static_cast<MessageItemShowISEOptionWindow*>(message);
1404 m_impl->signal_show_option_window (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1407 case ISM_TRANS_CMD_RESUME_ISE_OPTION_WINDOW:
1409 MessageItemResumeISEOptionWindow *subclass = static_cast<MessageItemResumeISEOptionWindow*>(message);
1410 m_impl->signal_resume_option_window (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
1413 case ISM_TRANS_CMD_CHECK_OPTION_WINDOW:
1416 m_impl->signal_check_option_window (this, avail);
1417 m_impl->send.clear ();
1418 m_impl->send.put_command (SCIM_TRANS_CMD_REPLY);
1419 m_impl->send.put_data (avail);
1420 m_impl->send.write_to_socket (m_impl->socket);
1423 case ISM_TRANS_CMD_PROCESS_INPUT_DEVICE_EVENT:
1425 MessageItemProcessInputDeviceEvent *subclass = static_cast<MessageItemProcessInputDeviceEvent*>(message);
1427 unsigned int ecore_event_id = find_ecore_event_from_device_type((isf_device_type_e)(subclass->get_type_ref()));
1428 char *decoded = (char*)malloc(subclass->get_len_ref());
1429 size_t decoded_size = subclass->get_len_ref();
1431 if(device_buffer_decode((const char*)*(subclass->get_data_ptr()),
1432 subclass->get_len_ref(), (char*)(decoded), &decoded_size)) {
1433 m_impl->signal_process_input_device_event(this, ecore_event_id, decoded, decoded_size, ret);
1439 case SCIM_TRANS_CMD_SET_AUTOCAPITAL_TYPE:
1441 MessageItemSetAutocapitalType *subclass = static_cast<MessageItemSetAutocapitalType*>(message);
1442 if (!m_impl->si.null ()) m_impl->si->set_autocapital_type(subclass->get_auto_capital_type_ref());
1445 case ISM_TRANS_CMD_SET_PREDICTION_ALLOW:
1447 MessageItemSetPredictionAllow *subclass = static_cast<MessageItemSetPredictionAllow*>(message);
1448 if (!m_impl->si.null ()) m_impl->si->set_prediction_allow(subclass->get_prediction_allow_ref() == 0 ? false : true);
1451 case ISM_TRANS_CMD_SET_KEYBOARD_MODE:
1453 MessageItemSetKeyboardMode *subclass = static_cast<MessageItemSetKeyboardMode*>(message);
1454 if (subclass->get_mode_ref())
1455 m_impl->need_update_entry_metadata = false;
1457 m_impl->need_update_entry_metadata = true;
1460 case ISM_TRANS_CMD_SET_PREDICTION_HINT:
1462 MessageItemSetPredictionHint *subclass = static_cast<MessageItemSetPredictionHint*>(message);
1463 m_impl->signal_set_prediction_hint (this, subclass->get_message_ref());
1466 case ISM_TRANS_CMD_SET_MIME_TYPE:
1468 MessageItemSetMimeType *subclass = static_cast<MessageItemSetMimeType*>(message);
1469 if (m_impl->ise_show_flag || m_impl->need_update_entry_metadata) {
1470 m_impl->signal_set_mime_type (this, subclass->get_mime_type_ref());
1474 case ISM_TRANS_CMD_FINALIZE_CONTENT:
1476 MessageItemFinalizeContent *subclass = static_cast<MessageItemFinalizeContent*>(message);
1478 if (m_impl->finalized_text != NULL)
1479 free(m_impl->finalized_text);
1480 m_impl->finalized_text = strdup(subclass->get_text_ref().c_str());
1481 m_impl->finalized_cursor_pos = subclass->get_cursor_pos_ref();
1485 case ISM_TRANS_CMD_SET_PREDICTION_HINT_DATA:
1487 MessageItemSetPredictionHintData *subclass = static_cast<MessageItemSetPredictionHintData*>(message);
1488 m_impl->signal_set_prediction_hint_data (this, 0, subclass->get_key_ref(), subclass->get_value_ref());
1491 case ISM_TRANS_CMD_SET_OPTIMIZATION_HINT:
1493 MessageItemSetOptimizationHint *subclass = static_cast<MessageItemSetOptimizationHint*>(message);
1494 m_impl->signal_set_optimization_hint(this, subclass->get_hint_ref());
1504 * @brief Request SCIM to reload all configuration.
1506 * This function should only by used by Setup Helper to request
1507 * scim's reloading the configuration.
1508 * Deprecated: reload config message only send by socketconfig client
1509 * using socketconfig::reload instead.
1512 HelperAgent::reload_config () const
1514 LOGD ("send reload config message to isf");
1515 if (!m_impl->m_config.null())
1516 m_impl->m_config->reload();
1520 * @brief Register some properties into Panel.
1522 * This function send the request to Panel to register a list
1525 * @param properties The list of Properties to be registered into Panel.
1527 * @sa scim::Property.
1530 HelperAgent::register_properties (const PropertyList &properties) const
1532 if (m_impl->socket_active.is_connected ()) {
1533 m_impl->send.clear ();
1534 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1535 m_impl->send.put_data (m_impl->magic_active);
1536 m_impl->send.put_command (SCIM_TRANS_CMD_REGISTER_PROPERTIES);
1537 m_impl->send.put_data (properties);
1538 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1543 * @brief Update a registered property.
1545 * @param property The property to be updated.
1548 HelperAgent::update_property (const Property &property) const
1550 if (m_impl->socket_active.is_connected ()) {
1551 m_impl->send.clear ();
1552 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1553 m_impl->send.put_data (m_impl->magic_active);
1554 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_PROPERTY);
1555 m_impl->send.put_data (property);
1556 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1561 * @brief Send a set of events to an IMEngineInstance.
1563 * All events should be put into a Transaction.
1564 * And the events can only be received by one IMEngineInstance object.
1566 * @param ic The handle of the Input Context to receive the events.
1567 * @param ic_uuid The UUID of the Input Context.
1568 * @param trans The Transaction object holds the events.
1571 HelperAgent::send_imengine_event (int ic,
1572 const String &ic_uuid,
1573 const Transaction &trans) const
1575 //remove if not necessary
1577 if (m_impl->socket_active.is_connected ()) {
1578 m_impl->send.clear ();
1579 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1580 m_impl->send.put_data (m_impl->magic_active);
1581 m_impl->send.put_command (SCIM_TRANS_CMD_PANEL_SEND_IMENGINE_EVENT);
1582 m_impl->send.put_data ((uint32)ic);
1583 m_impl->send.put_data (ic_uuid);
1584 m_impl->send.put_data (trans);
1585 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1588 if (!m_impl->si.null ()) m_impl->si->process_helper_event (ic_uuid, trans);
1592 * @brief Send a KeyEvent to an IMEngineInstance.
1594 * @param ic The handle of the IMEngineInstance to receive the event.
1595 * -1 means the currently focused IMEngineInstance.
1596 * @param ic_uuid The UUID of the IMEngineInstance. Empty means don't match.
1597 * @param key The KeyEvent to be sent.
1600 HelperAgent::send_key_event (int ic,
1601 const String &ic_uuid,
1602 const KeyEvent &key) const
1605 //FIXME: remove shift_mode_off, shift_mode_on, shift_mode_lock from ISE side
1606 if (key.code == SHIFT_MODE_OFF ||
1607 key.code == SHIFT_MODE_ON ||
1608 key.code == SHIFT_MODE_LOCK ||
1609 key.code == SHIFT_MODE_ENABLE ||
1610 key.code == SHIFT_MODE_DISABLE) {
1611 LOGW("FIXME ignore shift codes");
1615 if (m_impl->socket_active.is_connected ()) {
1616 m_impl->send.clear ();
1617 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1618 m_impl->send.put_data (m_impl->magic_active);
1619 m_impl->send.put_command (SCIM_TRANS_CMD_PANEL_SEND_KEY_EVENT);
1621 m_impl->send.put_data (m_impl->focused_ic);
1623 m_impl->send.put_data ((uint32)ic);
1625 m_impl->send.put_data (ic_uuid);
1626 m_impl->send.put_data (key);
1627 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1632 * @brief Forward a KeyEvent to client application directly.
1634 * @param ic The handle of the client Input Context to receive the event.
1635 * -1 means the currently focused Input Context.
1636 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1637 * Empty means don't match.
1638 * @param key The KeyEvent to be forwarded.
1641 HelperAgent::forward_key_event (int ic,
1642 const String &ic_uuid,
1643 const KeyEvent &key) const
1645 if (m_impl->socket_active.is_connected ()) {
1646 m_impl->send.clear ();
1647 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1648 m_impl->send.put_data (m_impl->magic_active);
1649 m_impl->send.put_command (SCIM_TRANS_CMD_FORWARD_KEY_EVENT);
1651 m_impl->send.put_data (m_impl->focused_ic);
1653 m_impl->send.put_data ((uint32)ic);
1655 m_impl->send.put_data (ic_uuid);
1656 m_impl->send.put_data (key);
1657 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1662 * @brief Commit a WideString to client application directly.
1664 * @param ic The handle of the client Input Context to receive the WideString.
1665 * -1 means the currently focused Input Context.
1666 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1667 * Empty means don't match.
1668 * @param wstr The WideString to be committed.
1671 HelperAgent::commit_string (int ic,
1672 const String &ic_uuid,
1673 const WideString &wstr) const
1675 if (m_impl->socket_active.is_connected ()) {
1676 m_impl->send.clear ();
1677 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1678 m_impl->send.put_data (m_impl->magic_active);
1679 m_impl->send.put_command (SCIM_TRANS_CMD_COMMIT_STRING);
1681 m_impl->send.put_data (m_impl->focused_ic);
1683 m_impl->send.put_data ((uint32)ic);
1685 m_impl->send.put_data (ic_uuid);
1686 m_impl->send.put_data (wstr);
1687 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1692 HelperAgent::commit_string (int ic,
1693 const String &ic_uuid,
1697 if (m_impl->socket_active.is_connected ()) {
1698 m_impl->send.clear ();
1699 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1700 m_impl->send.put_data (m_impl->magic_active);
1701 m_impl->send.put_command (SCIM_TRANS_CMD_COMMIT_STRING);
1703 m_impl->send.put_data (m_impl->focused_ic);
1705 m_impl->send.put_data ((uint32)ic);
1707 m_impl->send.put_data (ic_uuid);
1708 m_impl->send.put_dataw (buf, buflen);
1709 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1714 * @brief Request to show preedit string.
1716 * @param ic The handle of the client Input Context to receive the request.
1717 * -1 means the currently focused Input Context.
1718 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1719 * Empty means don't match.
1722 HelperAgent::show_preedit_string (int ic,
1723 const String &ic_uuid) const
1726 if (m_impl->socket_active.is_connected ()) {
1727 m_impl->send.clear ();
1728 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1729 m_impl->send.put_data (m_impl->magic_active);
1730 m_impl->send.put_command (SCIM_TRANS_CMD_SHOW_PREEDIT_STRING);
1731 m_impl->send.put_data ((uint32)ic);
1732 m_impl->send.put_data (ic_uuid);
1733 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1738 * @brief Request to show aux string.
1741 HelperAgent::show_aux_string (void) const
1744 if (m_impl->socket_active.is_connected ()) {
1745 m_impl->send.clear ();
1746 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1747 m_impl->send.put_data (m_impl->magic_active);
1748 m_impl->send.put_command (SCIM_TRANS_CMD_SHOW_AUX_STRING);
1749 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1754 * @brief Request to show candidate string.
1757 HelperAgent::show_candidate_string (void) const
1760 if (m_impl->socket_active.is_connected ()) {
1761 m_impl->send.clear ();
1762 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1763 m_impl->send.put_data (m_impl->magic_active);
1764 m_impl->send.put_command (SCIM_TRANS_CMD_SHOW_LOOKUP_TABLE);
1765 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1770 * @brief Request to show associate string.
1773 HelperAgent::show_associate_string (void) const
1775 if (m_impl->socket_active.is_connected ()) {
1776 m_impl->send.clear ();
1777 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1778 m_impl->send.put_data (m_impl->magic_active);
1779 m_impl->send.put_command (ISM_TRANS_CMD_SHOW_ASSOCIATE_TABLE);
1780 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1785 * @brief Request to hide preedit string.
1787 * @param ic The handle of the client Input Context to receive the request.
1788 * -1 means the currently focused Input Context.
1789 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1790 * Empty means don't match.
1793 HelperAgent::hide_preedit_string (int ic,
1794 const String &ic_uuid) const
1797 if (m_impl->socket_active.is_connected ()) {
1798 m_impl->send.clear ();
1799 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1800 m_impl->send.put_data (m_impl->magic_active);
1801 m_impl->send.put_command (SCIM_TRANS_CMD_HIDE_PREEDIT_STRING);
1802 m_impl->send.put_data ((uint32)ic);
1803 m_impl->send.put_data (ic_uuid);
1804 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1809 * @brief Request to hide aux string.
1812 HelperAgent::hide_aux_string (void) const
1814 if (m_impl->socket_active.is_connected ()) {
1815 m_impl->send.clear ();
1816 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1817 m_impl->send.put_data (m_impl->magic_active);
1818 m_impl->send.put_command (SCIM_TRANS_CMD_HIDE_AUX_STRING);
1819 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1824 * @brief Request to hide candidate string.
1827 HelperAgent::hide_candidate_string (void) const
1829 if (m_impl->socket_active.is_connected ()) {
1830 m_impl->send.clear ();
1831 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1832 m_impl->send.put_data (m_impl->magic_active);
1833 m_impl->send.put_command (SCIM_TRANS_CMD_HIDE_LOOKUP_TABLE);
1834 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1839 * @brief Request to hide associate string.
1842 HelperAgent::hide_associate_string (void) const
1844 if (m_impl->socket_active.is_connected ()) {
1845 m_impl->send.clear ();
1846 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1847 m_impl->send.put_data (m_impl->magic_active);
1848 m_impl->send.put_command (ISM_TRANS_CMD_HIDE_ASSOCIATE_TABLE);
1849 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1854 * @brief Update a new WideString for preedit.
1856 * @param ic The handle of the client Input Context to receive the WideString.
1857 * -1 means the currently focused Input Context.
1858 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1859 * Empty means don't match.
1860 * @param str The WideString to be updated.
1861 * @param attrs The attribute list for preedit string.
1864 HelperAgent::update_preedit_string (int ic,
1865 const String &ic_uuid,
1866 const WideString &str,
1867 const AttributeList &attrs) const
1869 update_preedit_string (ic, ic_uuid, str, str, attrs, -1);
1873 HelperAgent::update_preedit_string (int ic,
1874 const String &ic_uuid,
1877 const AttributeList &attrs) const
1879 update_preedit_string (ic, ic_uuid, buf, buflen, attrs, -1);
1883 * @brief Update a new WideString for preedit.
1885 * @param ic The handle of the client Input Context to receive the WideString.
1886 * -1 means the currently focused Input Context.
1887 * @param ic_uuid The UUID of the IMEngine used by the Input Context.
1888 * Empty means don't match.
1889 * @param str The WideString to be updated.
1890 * @param attrs The attribute list for preedit string.
1891 * @param caret The caret position in preedit string.
1894 HelperAgent::update_preedit_string (int ic,
1895 const String &ic_uuid,
1896 const WideString &wstr,
1897 const AttributeList &attrs,
1900 update_preedit_string (ic, ic_uuid, wstr, wstr, attrs, caret);
1904 HelperAgent::update_preedit_string (int ic,
1905 const String &ic_uuid,
1908 const AttributeList &attrs,
1912 if (m_impl->socket_active.is_connected ()) {
1913 m_impl->send.clear ();
1914 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1915 m_impl->send.put_data (m_impl->magic_active);
1916 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING);
1917 m_impl->send.put_data ((uint32)ic);
1918 m_impl->send.put_data (ic_uuid);
1919 m_impl->send.put_dataw (buf, buflen);
1920 m_impl->send.put_dataw (buf, buflen);
1921 m_impl->send.put_data (attrs);
1922 m_impl->send.put_data (caret);
1923 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1928 HelperAgent::update_preedit_string (int ic,
1929 const String &ic_uuid,
1930 const WideString &preedit,
1931 const WideString &commit,
1932 const AttributeList &attrs,
1935 if (m_impl->socket_active.is_connected ()) {
1936 m_impl->send.clear ();
1937 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1938 m_impl->send.put_data (m_impl->magic_active);
1939 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING);
1940 m_impl->send.put_data ((uint32)ic);
1941 m_impl->send.put_data (ic_uuid);
1942 m_impl->send.put_data (preedit);
1943 m_impl->send.put_data (commit);
1944 m_impl->send.put_data (attrs);
1945 m_impl->send.put_data (caret);
1946 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1951 * @brief Update the preedit caret position in the preedit string.
1953 * @param caret - the new position of the preedit caret.
1956 HelperAgent::update_preedit_caret (int caret) const
1959 if (m_impl->socket_active.is_connected ()) {
1960 m_impl->send.clear ();
1961 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1962 m_impl->send.put_data (m_impl->magic_active);
1963 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET);
1964 m_impl->send.put_data ((uint32)caret);
1965 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1970 * @brief Update a new string for aux.
1972 * @param str The string to be updated.
1973 * @param attrs The attribute list for aux string.
1976 HelperAgent::update_aux_string (const String &str,
1977 const AttributeList &attrs) const
1979 if (m_impl->socket_active.is_connected ()) {
1980 m_impl->send.clear ();
1981 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
1982 m_impl->send.put_data (m_impl->magic_active);
1983 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_AUX_STRING);
1984 m_impl->send.put_data (str);
1985 m_impl->send.put_data (attrs);
1986 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
1991 * @brief Request to update candidate.
1993 * @param table The lookup table for candidate.
1996 HelperAgent::update_candidate_string (const LookupTable &table) const
1998 if (m_impl->socket_active.is_connected ()) {
1999 m_impl->send.clear ();
2000 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2001 m_impl->send.put_data (m_impl->magic_active);
2002 m_impl->send.put_command (SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE);
2003 m_impl->send.put_data (table);
2004 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2009 * @brief Request to update associate.
2011 * @param table The lookup table for associate.
2014 HelperAgent::update_associate_string (const LookupTable &table) const
2016 if (m_impl->socket_active.is_connected ()) {
2017 m_impl->send.clear ();
2018 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2019 m_impl->send.put_data (m_impl->magic_active);
2020 m_impl->send.put_command (ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE);
2021 m_impl->send.put_data (table);
2022 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2027 * @brief When the input context of ISE is changed,
2028 * ISE can call this function to notify application
2030 * @param type type of event.
2031 * @param value value of event.
2034 HelperAgent::update_input_context (uint32 type, uint32 value) const
2036 if (type == ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT) {
2037 /* Update all state variables that could be queried by the client application */
2039 m_impl->signal_get_language_locale(this, -1, &buf);
2042 if (m_impl->socket_active.is_connected()) {
2043 m_impl->send.clear();
2044 m_impl->send.put_command(SCIM_TRANS_CMD_REQUEST);
2045 m_impl->send.put_data(m_impl->magic_active);
2046 m_impl->send.put_command(ISM_TRANS_CMD_UPDATE_ISE_LANGUAGE_LOCALE);
2047 m_impl->send.put_data(buf, strlen(buf));
2048 m_impl->send.write_to_socket(m_impl->socket_active, m_impl->magic_active);
2055 if (m_impl->socket_active.is_connected ()) {
2056 m_impl->send.clear ();
2057 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2058 m_impl->send.put_data (m_impl->magic_active);
2059 m_impl->send.put_command (ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT);
2060 m_impl->send.put_data (type);
2061 m_impl->send.put_data (value);
2062 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2067 * @brief Request to get surrounding text asynchronously.
2069 * @param uuid The helper ISE UUID.
2070 * @param maxlen_before The max length of before.
2071 * @param maxlen_after The max length of after.
2074 HelperAgent::get_surrounding_text (const String &uuid, int maxlen_before, int maxlen_after) const
2076 if (m_impl->socket_active.is_connected () && (m_impl->need_update_surrounding_text == 0)) {
2077 m_impl->send.clear ();
2078 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2079 m_impl->send.put_data (m_impl->magic_active);
2080 m_impl->send.put_command (SCIM_TRANS_CMD_GET_SURROUNDING_TEXT);
2081 m_impl->send.put_data (uuid);
2082 m_impl->send.put_data (maxlen_before);
2083 m_impl->send.put_data (maxlen_after);
2084 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2086 m_impl->need_update_surrounding_text++;
2090 * @brief Request to get surrounding text synchronously.
2092 * @param uuid The helper ISE UUID.
2093 * @param maxlen_before The max length of before.
2094 * @param maxlen_after The max length of after.
2095 * @param text The surrounding text.
2096 * @param cursor The cursor position.
2099 HelperAgent::get_surrounding_text (int maxlen_before, int maxlen_after, String &text, int &cursor)
2101 if (!m_impl->socket_active.is_connected ())
2104 if (!m_impl->ise_focus_flag) {
2105 if (m_impl->finalized_text) {
2106 String buffer = m_impl->finalized_text;
2107 cursor = m_impl->finalized_cursor_pos;
2108 int pos = cursor - maxlen_before;
2109 if (maxlen_before < 0) pos = 0;
2110 if (pos > (int)buffer.length()) pos = (int)buffer.length();
2111 if (pos < 0) pos = 0;
2112 size_t len = maxlen_after + (cursor - pos);
2113 if (maxlen_after < 0) len = String::npos;
2114 text = buffer.substr (pos, len);
2120 m_impl->send.clear();
2121 m_impl->send.put_command(SCIM_TRANS_CMD_REQUEST);
2122 m_impl->send.put_data(m_impl->magic_active);
2123 m_impl->send.put_command(SCIM_TRANS_CMD_GET_SURROUNDING_TEXT);
2124 m_impl->send.put_data("");
2125 m_impl->send.put_data(maxlen_before);
2126 m_impl->send.put_data(maxlen_after);
2127 m_impl->send.write_to_socket(m_impl->socket_active, m_impl->magic_active);
2128 if (m_impl->surrounding_text) {
2129 free(m_impl->surrounding_text);
2130 m_impl->surrounding_text = NULL;
2133 const int WAIT_FOR_SYNC_RESPONSE_TIMEOUT = 1000;
2134 /* Now we are waiting for the ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT message */
2135 if (wait_for_message(ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT, WAIT_FOR_SYNC_RESPONSE_TIMEOUT)) {
2136 MessageItem *message = message_queue.get_pending_message_by_cmd(ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT);
2137 handle_message(message);
2138 message_queue.remove_message(message);
2140 if (m_impl->surrounding_text) {
2141 text = m_impl->surrounding_text;
2142 cursor = m_impl->cursor_pos;
2146 if (m_impl->surrounding_text) {
2147 free(m_impl->surrounding_text);
2148 m_impl->surrounding_text = NULL;
2154 * @brief Request to delete surrounding text.
2156 * @param offset The offset for cursor position.
2157 * @param len The length for delete text.
2160 HelperAgent::delete_surrounding_text (int offset, int len) const
2162 LOGD ("offset = %d, len = %d", offset, len);
2164 if (m_impl->socket_active.is_connected ()) {
2165 m_impl->send.clear ();
2166 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2167 m_impl->send.put_data (m_impl->magic_active);
2168 m_impl->send.put_command (SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT);
2169 m_impl->send.put_data (offset);
2170 m_impl->send.put_data (len);
2171 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2176 * @brief Request to get selection text asynchronously.
2178 * @param uuid The helper ISE UUID.
2181 HelperAgent::get_selection (const String &uuid) const
2183 if (m_impl->socket_active.is_connected () && (m_impl->need_update_selection_text == 0)) {
2184 m_impl->send.clear ();
2185 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2186 m_impl->send.put_data (m_impl->magic_active);
2187 m_impl->send.put_command (SCIM_TRANS_CMD_GET_SELECTION);
2188 m_impl->send.put_data (uuid);
2189 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2191 m_impl->need_update_selection_text++;
2195 * @brief Request to get selection text synchronously.
2197 * @param text The selection text.
2200 HelperAgent::get_selection_text (String &text)
2203 if (!m_impl->socket_active.is_connected ())
2206 m_impl->send.clear ();
2207 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2208 m_impl->send.put_data (m_impl->magic_active);
2209 m_impl->send.put_command (SCIM_TRANS_CMD_GET_SELECTION);
2210 m_impl->send.put_data ("");
2211 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2212 if (m_impl->selection_text) {
2213 free (m_impl->selection_text);
2214 m_impl->selection_text = NULL;
2217 const int WAIT_FOR_SYNC_RESPONSE_TIMEOUT = 1000;
2218 /* Now we are waiting for the ISM_TRANS_CMD_UPDATE_SELECTION message */
2219 if (wait_for_message(ISM_TRANS_CMD_UPDATE_SELECTION, WAIT_FOR_SYNC_RESPONSE_TIMEOUT)) {
2220 MessageItem *message = message_queue.get_pending_message_by_cmd(ISM_TRANS_CMD_UPDATE_SELECTION);
2221 handle_message(message);
2222 message_queue.remove_message(message);
2223 if (m_impl->selection_text) {
2224 text = m_impl->selection_text;
2228 if (m_impl->selection_text) {
2229 free (m_impl->selection_text);
2230 m_impl->selection_text = NULL;
2235 * @brief Request to select text.
2237 * @param start The start position in text.
2238 * @param end The end position in text.
2241 HelperAgent::set_selection (int start, int end) const
2243 if (m_impl->socket_active.is_connected ()) {
2244 m_impl->send.clear ();
2245 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2246 m_impl->send.put_data (m_impl->magic_active);
2247 m_impl->send.put_command (SCIM_TRANS_CMD_SET_SELECTION);
2248 m_impl->send.put_data (start);
2249 m_impl->send.put_data (end);
2250 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2255 * @brief Send a private command to an application.
2257 * @param command The private command sent from IME.
2260 HelperAgent::send_private_command (const String &command) const
2262 if (m_impl->socket_active.is_connected ()) {
2263 m_impl->send.clear ();
2264 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2265 m_impl->send.put_data (m_impl->magic_active);
2266 m_impl->send.put_command (SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND);
2267 m_impl->send.put_data (command);
2268 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2273 * @brief Commit content to an application.
2275 * @param content The content sent from IME.
2278 HelperAgent::commit_content (const String &content, const String &description, const String &mime_types) const
2281 if (m_impl->socket_active.is_connected ()) {
2282 m_impl->send.clear ();
2283 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2284 m_impl->send.put_data (m_impl->magic_active);
2285 m_impl->send.put_command (SCIM_TRANS_CMD_COMMIT_CONTENT);
2286 m_impl->send.put_data (content);
2287 m_impl->send.put_data (description);
2288 m_impl->send.put_data (mime_types);
2289 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2294 * @brief Request to get uuid list of all keyboard ISEs.
2296 * @param uuid The helper ISE UUID.
2299 HelperAgent::get_keyboard_ise_list (const String &uuid) const
2301 if (m_impl->socket_active.is_connected ()) {
2302 m_impl->send.clear ();
2303 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2304 m_impl->send.put_data (m_impl->magic_active);
2305 m_impl->send.put_command (ISM_TRANS_CMD_GET_KEYBOARD_ISE_LIST);
2306 m_impl->send.put_data (uuid);
2307 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2312 * @brief Set candidate position in screen.
2314 * @param left The x position in screen.
2315 * @param top The y position in screen.
2318 HelperAgent::set_candidate_position (int left, int top) const
2320 if (m_impl->socket_active.is_connected ()) {
2321 m_impl->send.clear ();
2322 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2323 m_impl->send.put_data (m_impl->magic_active);
2324 m_impl->send.put_command (ISM_TRANS_CMD_SET_CANDIDATE_POSITION);
2325 m_impl->send.put_data (left);
2326 m_impl->send.put_data (top);
2327 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2332 * @brief Set candidate style.
2334 * @param portrait_line - the displayed line number for portrait mode.
2335 * @param mode - candidate window mode.
2338 HelperAgent::set_candidate_style (ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line,
2339 ISF_CANDIDATE_MODE_T mode) const
2341 if (m_impl->socket_active.is_connected ()) {
2342 m_impl->send.clear ();
2343 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2344 m_impl->send.put_data (m_impl->magic_active);
2345 m_impl->send.put_command (ISM_TRANS_CMD_SET_CANDIDATE_UI);
2346 m_impl->send.put_data (portrait_line);
2347 m_impl->send.put_data (mode);
2348 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2353 * @brief Request to hide candidate window.
2356 HelperAgent::candidate_hide (void) const
2358 if (m_impl->socket_active.is_connected ()) {
2359 m_impl->send.clear ();
2360 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2361 m_impl->send.put_data (m_impl->magic_active);
2362 m_impl->send.put_command (ISM_TRANS_CMD_HIDE_CANDIDATE);
2363 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2368 * @brief Request to get candidate window size and position.
2370 * @param uuid The helper ISE UUID.
2373 HelperAgent::get_candidate_window_geometry (const String &uuid) const
2375 if (m_impl->socket_active.is_connected ()) {
2376 m_impl->send.clear ();
2377 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2378 m_impl->send.put_data (m_impl->magic_active);
2379 m_impl->send.put_command (ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY);
2380 m_impl->send.put_data (uuid);
2381 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2386 * @brief Set current keyboard ISE.
2388 * @param uuid The keyboard ISE UUID.
2391 HelperAgent::set_keyboard_ise_by_uuid (const String &uuid) const
2394 IMEngineFactoryPointer factory;
2395 IMEngineModule *engine_module = NULL;
2396 static int instance_count = 1;
2398 if ((!m_impl->si.null ()) && m_impl->si->get_factory_uuid () == uuid) {
2399 ISF_SAVE_LOG ("Already in UUID: %s", uuid.c_str());
2403 if (!m_impl->si.null()) {
2404 m_impl->si->focus_out();
2408 if (m_impl->m_config.null ()) {
2409 ISF_SAVE_LOG ("config is not working");
2413 #ifdef HAVE_PKGMGR_INFO
2416 pkgmgrinfo_appinfo_h handle;
2417 ret = pkgmgrinfo_appinfo_get_appinfo(uuid.c_str(), &handle);
2418 if (ret != PMINFO_R_OK) {
2419 ISF_SAVE_LOG ("Retrieve app info failed : %s", uuid.c_str ());
2423 ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid);
2424 if (ret != PMINFO_R_OK) {
2425 ISF_SAVE_LOG ("Retrieve pkgid failed : %s, %p", uuid.c_str(), handle);
2426 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2430 imeInfo.module_name = pkgid;
2431 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2433 if (isf_db_select_ime_info_by_appid(uuid.c_str(), &imeInfo) < 1) {
2434 ISF_SAVE_LOG ("ime_info row is not available for %s", uuid.c_str());
2439 engine_module = &m_impl->engine_module;
2441 if (engine_module->valid() && imeInfo.module_name != engine_module->get_module_name()) {
2442 ISF_SAVE_LOG ("imengine module %s unloaded", engine_module->get_module_name().c_str());
2443 engine_module->unload();
2446 if (!engine_module->valid()) {
2447 if (engine_module->load (imeInfo.module_name, m_impl->m_config) == false) {
2448 ISF_SAVE_LOG ("load module %s failed", imeInfo.module_name.c_str());
2451 ISF_SAVE_LOG ("imengine module %s loaded", imeInfo.module_name.c_str());
2454 for (size_t j = 0; j < engine_module->number_of_factories (); ++j) {
2456 factory = engine_module->create_factory (j);
2457 if (factory.null () == false && factory->get_uuid () == uuid)
2465 if (factory.null()) {
2466 ISF_SAVE_LOG ("imengine uuid %s is not found", uuid.c_str());
2470 m_impl->si = factory->create_instance ("UTF-8", instance_count++);
2471 if (m_impl->si.null ()) {
2472 ISF_SAVE_LOG ("create_instance %s failed", uuid.c_str ());
2476 m_impl->attach_instance ();
2477 ISF_SAVE_LOG ("Require UUID: %s Current UUID: %s", uuid.c_str (), m_impl->si->get_factory_uuid ().c_str ());
2478 m_impl->si->set_layout (m_impl->layout);
2479 if (m_impl->focused_ic != (uint32)-1)
2480 m_impl->si->focus_in ();
2484 * @brief Request to get current keyboard ISE information.
2486 * @param uuid The helper ISE UUID.
2489 HelperAgent::get_keyboard_ise (const String &uuid) const
2491 //FIXME: maybe useless
2493 if (m_impl->socket_active.is_connected ()) {
2494 m_impl->send.clear ();
2495 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2496 m_impl->send.put_data (m_impl->magic_active);
2497 m_impl->send.put_command (ISM_TRANS_CMD_GET_KEYBOARD_ISE);
2498 m_impl->send.put_data (uuid);
2499 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2505 * @brief Update ISE window geometry.
2507 * @param x The x position in screen.
2508 * @param y The y position in screen.
2509 * @param width The ISE window width.
2510 * @param height The ISE window height.
2513 HelperAgent::update_geometry (int x, int y, int width, int height) const
2515 if (m_impl->socket_active.is_connected ()) {
2516 m_impl->send.clear ();
2517 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2518 m_impl->send.put_data (m_impl->magic_active);
2519 m_impl->send.put_command (ISM_TRANS_CMD_UPDATE_ISE_GEOMETRY);
2520 m_impl->send.put_data (x);
2521 m_impl->send.put_data (y);
2522 m_impl->send.put_data (width);
2523 m_impl->send.put_data (height);
2524 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2529 * @brief Request to expand candidate window.
2532 HelperAgent::expand_candidate (void) const
2534 if (m_impl->socket_active.is_connected ()) {
2535 m_impl->send.clear ();
2536 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2537 m_impl->send.put_data (m_impl->magic_active);
2538 m_impl->send.put_command (ISM_TRANS_CMD_EXPAND_CANDIDATE);
2539 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2544 * @brief Request to contract candidate window.
2547 HelperAgent::contract_candidate (void) const
2549 if (m_impl->socket_active.is_connected ()) {
2550 m_impl->send.clear ();
2551 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2552 m_impl->send.put_data (m_impl->magic_active);
2553 m_impl->send.put_command (ISM_TRANS_CMD_CONTRACT_CANDIDATE);
2554 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2559 * @brief Send selected candidate string index number.
2562 HelperAgent::select_candidate (int index) const
2564 if (!m_impl->si.null ())
2565 m_impl->si->select_candidate (index);
2566 //FIXME: maybe useless
2569 if (m_impl->socket_active.is_connected ()) {
2570 m_impl->send.clear ();
2571 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2572 m_impl->send.put_data (m_impl->magic_active);
2573 m_impl->send.put_command (ISM_TRANS_CMD_SELECT_CANDIDATE);
2574 m_impl->send.put_data (index);
2575 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2581 * @brief Update our ISE is exiting.
2583 * The IME must call this function before terminating IME itself in On-demand mode.
2584 * If this function isn't called, IME will automatically restart.
2585 * This function only works in On-demand mode.
2589 HelperAgent::update_ise_exit (void) const
2591 if (m_impl->socket_active.is_connected ()) {
2592 m_impl->send.clear ();
2593 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2594 m_impl->send.put_data (m_impl->magic_active);
2595 m_impl->send.put_command (ISM_TRANS_CMD_UPDATE_ISE_EXIT);
2596 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2598 // The update_ise_exit must be delivered before del_client of isf_info_manager was called.
2604 * @brief Request to reset keyboard ISE.
2607 HelperAgent::reset_keyboard_ise (void) const
2609 //FIXME: maybe useless
2611 if (m_impl->socket_active.is_connected ()) {
2612 m_impl->send.clear ();
2613 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2614 m_impl->send.put_data (m_impl->magic_active);
2615 m_impl->send.put_command (ISM_TRANS_CMD_PANEL_RESET_KEYBOARD_ISE);
2616 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2619 if (!m_impl->si.null ()) {
2620 m_impl->si->reset ();
2625 * @brief Request to flush keyboard ISE.
2628 HelperAgent::flush_keyboard_ise (void) const
2630 if (!m_impl->si.null ()) {
2631 m_impl->si->flush ();
2636 * @brief Request panel to hide ISE.
2639 HelperAgent::request_ise_hide (void) const
2641 if (m_impl->socket_active.is_connected ()) {
2642 m_impl->send.clear ();
2643 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2644 m_impl->send.put_data (m_impl->magic_active);
2645 m_impl->send.put_command (ISM_TRANS_CMD_REQUEST_ISE_HIDE);
2646 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2654 HelperAgent::recapture_string (int ic,
2655 const String &ic_uuid,
2658 const WideString &preedit_str,
2659 const WideString &commit_str,
2660 const AttributeList &attrs) const
2662 LOGD ("offset = %d, len = %d", offset, len);
2664 if (m_impl->socket_active.is_connected ()) {
2665 m_impl->send.clear ();
2666 m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
2667 m_impl->send.put_data (m_impl->magic_active);
2668 m_impl->send.put_command (ISM_TRANS_CMD_RECAPTURE_STRING);
2670 m_impl->send.put_data ((uint32)ic);
2671 m_impl->send.put_data (ic_uuid);
2673 // Deleting surrounding text
2674 m_impl->send.put_data (offset);
2675 m_impl->send.put_data (len);
2677 // Update preedit text
2678 m_impl->send.put_data (preedit_str);
2681 m_impl->send.put_data (commit_str);
2683 // preedit attributes
2684 m_impl->send.put_data (attrs);
2686 m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
2691 * @brief Connect a slot to Helper exit signal.
2693 * This signal is used to let the Helper exit.
2695 * The prototype of the slot is:
2697 * void exit (const HelperAgent *agent, int ic, const String &ic_uuid);
2700 * - agent The pointer to the HelperAgent object which emits this signal.
2701 * - ic An opaque handle of the currently focused input context.
2702 * - ic_uuid The UUID of the IMEngineInstance associated with the focused input context.
2705 HelperAgent::signal_connect_exit (HelperAgentSlotVoid *slot)
2707 return m_impl->signal_exit.connect (slot);
2711 * @brief Connect a slot to Helper attach input context signal.
2713 * This signal is used to attach an input context to this helper.
2715 * When an input context requst to start this helper, then this
2716 * signal will be emitted as soon as the helper is started.
2718 * When an input context want to start an already started helper,
2719 * this signal will also be emitted.
2721 * Helper can send some events back to the IMEngineInstance in this
2722 * signal-slot, to inform that it has been started sccessfully.
2724 * The prototype of the slot is:
2726 * void attach_input_context (const HelperAgent *agent, int ic, const String &ic_uuid);
2729 HelperAgent::signal_connect_attach_input_context (HelperAgentSlotVoid *slot)
2731 return m_impl->signal_attach_input_context.connect (slot);
2735 * @brief Connect a slot to Helper detach input context signal.
2737 * This signal is used to detach an input context from this helper.
2739 * When an input context requst to stop this helper, then this
2740 * signal will be emitted.
2742 * Helper shouldn't send any event back to the IMEngineInstance, because
2743 * the IMEngineInstance attached to the ic should have been destroyed.
2745 * The prototype of the slot is:
2747 * void detach_input_context (const HelperAgent *agent, int ic, const String &ic_uuid);
2750 HelperAgent::signal_connect_detach_input_context (HelperAgentSlotVoid *slot)
2752 return m_impl->signal_detach_input_context.connect (slot);
2756 * @brief Connect a slot to Helper reload config signal.
2758 * This signal is used to let the Helper reload configuration.
2760 * The prototype of the slot is:
2762 * void reload_config (const HelperAgent *agent, int ic, const String &ic_uuid);
2765 HelperAgent::signal_connect_reload_config (HelperAgentSlotVoid *slot)
2767 return m_impl->signal_reload_config.connect (slot);
2771 * @brief Connect a slot to Helper update screen signal.
2773 * This signal is used to let the Helper move its GUI to another screen.
2774 * It can only be emitted when SCIM_HELPER_NEED_SCREEN_INFO is set in HelperInfo.option.
2776 * The prototype of the slot is:
2778 * void update_screen (const HelperAgent *agent, int ic, const String &ic_uuid, int screen_number);
2781 HelperAgent::signal_connect_update_screen (HelperAgentSlotInt *slot)
2783 return m_impl->signal_update_screen.connect (slot);
2787 * @brief Connect a slot to Helper update spot location signal.
2789 * This signal is used to let the Helper move its GUI according to the current spot location.
2790 * It can only be emitted when SCIM_HELPER_NEED_SPOT_LOCATION_INFO is set in HelperInfo.option.
2792 * The prototype of the slot is:
2793 * void update_spot_location (const HelperAgent *agent, int ic, const String &ic_uuid, int x, int y);
2796 HelperAgent::signal_connect_update_spot_location (HelperAgentSlotIntInt *slot)
2798 return m_impl->signal_update_spot_location.connect (slot);
2802 * @brief Connect a slot to Helper update cursor position signal.
2804 * This signal is used to let the Helper get the cursor position information.
2806 * The prototype of the slot is:
2807 * void update_cursor_position (const HelperAgent *agent, int ic, const String &ic_uuid, int cursor_pos);
2810 HelperAgent::signal_connect_update_cursor_position (HelperAgentSlotInt *slot)
2812 return m_impl->signal_update_cursor_position.connect (slot);
2816 * @brief Connect a slot to Helper update surrounding text signal.
2818 * This signal is used to let the Helper get the surrounding text.
2820 * The prototype of the slot is:
2821 * void update_surrounding_text (const HelperAgent *agent, int ic, const String &text, int cursor);
2824 HelperAgent::signal_connect_update_surrounding_text (HelperAgentSlotInt *slot)
2826 return m_impl->signal_update_surrounding_text.connect (slot);
2830 * @brief Connect a slot to Helper update selection signal.
2832 * This signal is used to let the Helper get the selection.
2834 * The prototype of the slot is:
2835 * void update_selection (const HelperAgent *agent, int ic, const String &text);
2838 HelperAgent::signal_connect_update_selection (HelperAgentSlotVoid *slot)
2840 return m_impl->signal_update_selection.connect (slot);
2844 * @brief Connect a slot to Helper trigger property signal.
2846 * This signal is used to trigger a property registered by this Helper.
2847 * A property will be triggered when user clicks on it.
2849 * The prototype of the slot is:
2850 * void trigger_property (const HelperAgent *agent, int ic, const String &ic_uuid, const String &property);
2853 HelperAgent::signal_connect_trigger_property (HelperAgentSlotString *slot)
2855 return m_impl->signal_trigger_property.connect (slot);
2859 * @brief Connect a slot to Helper process imengine event signal.
2861 * This signal is used to deliver the events sent from IMEngine to Helper.
2863 * The prototype of the slot is:
2864 * void process_imengine_event (const HelperAgent *agent, int ic, const String &ic_uuid, const Transaction &transaction);
2867 HelperAgent::signal_connect_process_imengine_event (HelperAgentSlotTransaction *slot)
2869 return m_impl->signal_process_imengine_event.connect (slot);
2873 * @brief Connect a slot to Helper focus out signal.
2875 * This signal is used to do something when input context is focus out.
2877 * The prototype of the slot is:
2878 * void focus_out (const HelperAgent *agent, int ic, const String &ic_uuid);
2881 HelperAgent::signal_connect_focus_out (HelperAgentSlotVoid *slot)
2883 return m_impl->signal_focus_out.connect (slot);
2887 * @brief Connect a slot to Helper focus in signal.
2889 * This signal is used to do something when input context is focus in.
2891 * The prototype of the slot is:
2892 * void focus_in (const HelperAgent *agent, int ic, const String &ic_uuid);
2895 HelperAgent::signal_connect_focus_in (HelperAgentSlotVoid *slot)
2897 return m_impl->signal_focus_in.connect (slot);
2901 * @brief Connect a slot to Helper show signal.
2903 * This signal is used to show Helper ISE window.
2905 * The prototype of the slot is:
2906 * void ise_show (const HelperAgent *agent, int ic, char *buf, size_t &len);
2909 HelperAgent::signal_connect_ise_show (HelperAgentSlotIntRawVoid *slot)
2911 return m_impl->signal_ise_show.connect (slot);
2915 * @brief Connect a slot to Helper hide signal.
2917 * This signal is used to hide Helper ISE window.
2919 * The prototype of the slot is:
2920 * void ise_hide (const HelperAgent *agent, int ic, const String &ic_uuid);
2923 HelperAgent::signal_connect_ise_hide (HelperAgentSlotVoid *slot)
2925 return m_impl->signal_ise_hide.connect (slot);
2929 * @brief Connect a slot to Helper get ISE window geometry signal.
2931 * This signal is used to get Helper ISE window size and position.
2933 * The prototype of the slot is:
2934 * void get_geometry (const HelperAgent *agent, struct rectinfo &info);
2937 HelperAgent::signal_connect_get_geometry (HelperAgentSlotSize *slot)
2939 return m_impl->signal_get_geometry.connect (slot);
2943 * @brief Connect a slot to Helper set mode signal.
2945 * This signal is used to set Helper ISE mode.
2947 * The prototype of the slot is:
2948 * void set_mode (const HelperAgent *agent, uint32 &mode);
2951 HelperAgent::signal_connect_set_mode (HelperAgentSlotUintVoid *slot)
2953 return m_impl->signal_set_mode.connect (slot);
2957 * @brief Connect a slot to Helper set language signal.
2959 * This signal is used to set Helper ISE language.
2961 * The prototype of the slot is:
2962 * void set_language (const HelperAgent *agent, uint32 &language);
2965 HelperAgent::signal_connect_set_language (HelperAgentSlotUintVoid *slot)
2967 return m_impl->signal_set_language.connect (slot);
2971 * @brief Connect a slot to Helper set im data signal.
2973 * This signal is used to send im data to Helper ISE.
2975 * The prototype of the slot is:
2976 * void set_imdata (const HelperAgent *agent, char *buf, size_t &len);
2979 HelperAgent::signal_connect_set_imdata (HelperAgentSlotRawVoid *slot)
2981 return m_impl->signal_set_imdata.connect (slot);
2985 * @brief Connect a slot to Helper get im data signal.
2987 * This signal is used to get im data from Helper ISE.
2989 * The prototype of the slot is:
2990 * void get_imdata (const HelperAgent *, char **buf, size_t &len);
2993 HelperAgent::signal_connect_get_imdata (HelperAgentSlotGetRawVoid *slot)
2995 return m_impl->signal_get_imdata.connect (slot);
2999 * @brief Connect a slot to Helper get language locale signal.
3001 * This signal is used to get language locale from Helper ISE.
3003 * The prototype of the slot is:
3004 * void get_language_locale (const HelperAgent *, int ic, char **locale);
3007 HelperAgent::signal_connect_get_language_locale (HelperAgentSlotIntGetStringVoid *slot)
3009 return m_impl->signal_get_language_locale.connect (slot);
3013 * @brief Connect a slot to Helper set return key type signal.
3015 * This signal is used to send return key type to Helper ISE.
3017 * The prototype of the slot is:
3018 * void set_return_key_type (const HelperAgent *agent, uint32 &type);
3021 HelperAgent::signal_connect_set_return_key_type (HelperAgentSlotUintVoid *slot)
3023 return m_impl->signal_set_return_key_type.connect (slot);
3027 * @brief Connect a slot to Helper get return key type signal.
3029 * This signal is used to get return key type from Helper ISE.
3031 * The prototype of the slot is:
3032 * void get_return_key_type (const HelperAgent *agent, uint32 &type);
3035 HelperAgent::signal_connect_get_return_key_type (HelperAgentSlotUintVoid *slot)
3037 return m_impl->signal_get_return_key_type.connect (slot);
3041 * @brief Connect a slot to Helper set return key disable signal.
3043 * This signal is used to send return key disable to Helper ISE.
3045 * The prototype of the slot is:
3046 * void set_return_key_disable (const HelperAgent *agent, uint32 &disabled);
3049 HelperAgent::signal_connect_set_return_key_disable (HelperAgentSlotUintVoid *slot)
3051 return m_impl->signal_set_return_key_disable.connect (slot);
3055 * @brief Connect a slot to Helper process key event signal.
3057 * This signal is used to send keyboard key event to Helper ISE.
3059 * The prototype of the slot is:
3060 * void process_key_event (const HelperAgent *agent, KeyEvent &key, uint32 &ret);
3063 HelperAgent::signal_connect_process_key_event (HelperAgentSlotKeyEventUint *slot)
3065 return m_impl->signal_process_key_event.connect (slot);
3069 * @brief Connect a slot to Helper process key event with keycode signal.
3071 * This signal is used to send keyboard key event with keycode to Helper ISE.
3073 * The prototype of the slot is:
3074 * void process_key_event_with_keycode (const HelperAgent *agent, KeyEvent &key, uint32 &ret, uint32 keycode);
3077 HelperAgent::signal_connect_process_key_event_with_keycode (HelperAgentSlotKeyEventUintUint *slot)
3079 return m_impl->signal_process_key_event_with_keycode.connect (slot);
3083 * @brief Connect a slot to Helper get return key disable signal.
3085 * This signal is used to get return key disable from Helper ISE.
3087 * The prototype of the slot is:
3088 * void get_return_key_disable (const HelperAgent *agent, uint32 &disabled);
3091 HelperAgent::signal_connect_get_return_key_disable (HelperAgentSlotUintVoid *slot)
3093 return m_impl->signal_get_return_key_disable.connect (slot);
3097 * @brief Connect a slot to Helper set layout signal.
3099 * This signal is used to set Helper ISE layout.
3101 * The prototype of the slot is:
3102 * void set_layout (const HelperAgent *agent, uint32 &layout);
3105 HelperAgent::signal_connect_set_layout (HelperAgentSlotUintVoid *slot)
3107 return m_impl->signal_set_layout.connect (slot);
3111 * @brief Connect a slot to Helper get layout signal.
3113 * This signal is used to get Helper ISE layout.
3115 * The prototype of the slot is:
3116 * void get_layout (const HelperAgent *agent, uint32 &layout);
3119 HelperAgent::signal_connect_get_layout (HelperAgentSlotUintVoid *slot)
3121 return m_impl->signal_get_layout.connect (slot);
3125 * @brief Connect a slot to Helper set input mode signal.
3127 * This signal is used to set Helper ISE input mode.
3129 * The prototype of the slot is:
3130 * void set_input_mode (const HelperAgent *agent, uint32 &input_mode);
3133 HelperAgent::signal_connect_set_input_mode (HelperAgentSlotUintVoid *slot)
3135 return m_impl->signal_set_input_mode.connect (slot);
3139 * @brief Connect a slot to Helper set input hint signal.
3141 * This signal is used to set Helper ISE input hint.
3143 * The prototype of the slot is:
3144 * void set_input_hint (const HelperAgent *agent, uint32 &input_hint);
3147 HelperAgent::signal_connect_set_input_hint (HelperAgentSlotUintVoid *slot)
3149 return m_impl->signal_set_input_hint.connect (slot);
3153 * @brief Connect a slot to Helper set BiDi direction signal.
3155 * This signal is used to set Helper ISE BiDi direction.
3157 * The prototype of the slot is:
3158 * void update_bidi_direction (const HelperAgent *agent, uint32 &bidi_direction);
3161 HelperAgent::signal_connect_update_bidi_direction (HelperAgentSlotUintVoid *slot)
3163 return m_impl->signal_update_bidi_direction.connect (slot);
3167 * @brief Connect a slot to Helper set shift mode signal.
3169 * This signal is used to set Helper shift mode.
3171 * The prototype of the slot is:
3172 * void set_caps_mode (const HelperAgent *agent, uint32 &mode);
3175 HelperAgent::signal_connect_set_caps_mode (HelperAgentSlotUintVoid *slot)
3177 return m_impl->signal_set_caps_mode.connect (slot);
3181 * @brief Connect a slot to Helper reset input context signal.
3183 * This signal is used to reset Helper ISE input context.
3185 * The prototype of the slot is:
3186 * void reset_input_context (const HelperAgent *agent, int ic, const String &uuid);
3189 HelperAgent::signal_connect_reset_input_context (HelperAgentSlotVoid *slot)
3191 return m_impl->signal_reset_input_context.connect (slot);
3195 * @brief Connect a slot to Helper update candidate window geometry signal.
3197 * This signal is used to get candidate window size and position.
3199 * The prototype of the slot is:
3200 * void update_candidate_geometry (const HelperAgent *agent, int ic, const String &uuid, const rectinfo &info);
3203 HelperAgent::signal_connect_update_candidate_geometry (HelperAgentSlotRect *slot)
3205 return m_impl->signal_update_candidate_geometry.connect (slot);
3209 * @brief Connect a slot to Helper update keyboard ISE signal.
3211 * This signal is used to get current keyboard ISE name and uuid.
3213 * The prototype of the slot is:
3214 * void update_keyboard_ise (const HelperAgent *agent, int ic, const String &uuid,
3215 * const String &ise_name, const String &ise_uuid);
3218 HelperAgent::signal_connect_update_keyboard_ise (HelperAgentSlotString2 *slot)
3220 return m_impl->signal_update_keyboard_ise.connect (slot);
3224 * @brief Connect a slot to Helper update keyboard ISE list signal.
3226 * This signal is used to get uuid list of all keyboard ISEs.
3228 * The prototype of the slot is:
3229 * void update_keyboard_ise_list (const HelperAgent *agent, int ic, const String &uuid,
3230 * const std::vector<String> &ise_list);
3233 HelperAgent::signal_connect_update_keyboard_ise_list (HelperAgentSlotStringVector *slot)
3235 return m_impl->signal_update_keyboard_ise_list.connect (slot);
3239 * @brief Connect a slot to Helper candidate more window show signal.
3241 * This signal is used to do someting when candidate more window is showed.
3243 * The prototype of the slot is:
3244 * void candidate_more_window_show (const HelperAgent *agent, int ic, const String &uuid);
3247 HelperAgent::signal_connect_candidate_more_window_show (HelperAgentSlotVoid *slot)
3249 return m_impl->signal_candidate_more_window_show.connect (slot);
3253 * @brief Connect a slot to Helper candidate more window hide signal.
3255 * This signal is used to do someting when candidate more window is hidden.
3257 * The prototype of the slot is:
3258 * void candidate_more_window_hide (const HelperAgent *agent, int ic, const String &uuid);
3261 HelperAgent::signal_connect_candidate_more_window_hide (HelperAgentSlotVoid *slot)
3263 return m_impl->signal_candidate_more_window_hide.connect (slot);
3267 * @brief Connect a slot to Helper candidate show signal.
3269 * This signal is used to do candidate show.
3271 * The prototype of the slot is:
3272 * void candidate_show (const HelperAgent *agent, int ic, const String &uuid);
3275 HelperAgent::signal_connect_candidate_show (HelperAgentSlotVoid *slot)
3277 return m_impl->signal_candidate_show.connect (slot);
3281 * @brief Connect a slot to Helper candidate hide signal.
3283 * This signal is used to do candidate hide.
3285 * The prototype of the slot is:
3286 * void candidate_hide (const HelperAgent *agent, int ic, const String &uuid);
3289 HelperAgent::signal_connect_candidate_hide (HelperAgentSlotVoid *slot)
3291 return m_impl->signal_candidate_hide.connect (slot);
3295 * @brief Connect a slot to Helper update lookup table signal.
3297 * This signal is used to do someting when update lookup table.
3299 * The prototype of the slot is:
3300 * void update_lookup_table (const HelperAgent *agent, int ic, const String &uuid ,LookupTable &table);
3303 HelperAgent::signal_connect_update_lookup_table (HelperAgentSlotLookupTable *slot)
3305 return m_impl->signal_update_lookup_table.connect (slot);
3309 * @brief Connect a slot to Helper select aux signal.
3311 * This signal is used to do something when aux is selected.
3313 * The prototype of the slot is:
3314 * void select_aux (const HelperAgent *agent, int ic, const String &uuid, int index);
3317 HelperAgent::signal_connect_select_aux (HelperAgentSlotInt *slot)
3319 return m_impl->signal_select_aux.connect (slot);
3323 * @brief Connect a slot to Helper select candidate signal.
3325 * This signal is used to do something when candidate is selected.
3327 * The prototype of the slot is:
3328 * void select_candidate (const HelperAgent *agent, int ic, const String &uuid, int index);
3331 HelperAgent::signal_connect_select_candidate (HelperAgentSlotInt *slot)
3333 return m_impl->signal_select_candidate.connect (slot);
3337 * @brief Connect a slot to Helper candidate table page up signal.
3339 * This signal is used to do something when candidate table is paged up.
3341 * The prototype of the slot is:
3342 * void candidate_table_page_up (const HelperAgent *agent, int ic, const String &uuid);
3345 HelperAgent::signal_connect_candidate_table_page_up (HelperAgentSlotVoid *slot)
3347 return m_impl->signal_candidate_table_page_up.connect (slot);
3351 * @brief Connect a slot to Helper candidate table page down signal.
3353 * This signal is used to do something when candidate table is paged down.
3355 * The prototype of the slot is:
3356 * void candidate_table_page_down (const HelperAgent *agent, int ic, const String &uuid);
3359 HelperAgent::signal_connect_candidate_table_page_down (HelperAgentSlotVoid *slot)
3361 return m_impl->signal_candidate_table_page_down.connect (slot);
3365 * @brief Connect a slot to Helper update candidate table page size signal.
3367 * This signal is used to do something when candidate table page size is changed.
3369 * The prototype of the slot is:
3370 * void update_candidate_table_page_size (const HelperAgent *, int ic, const String &uuid, int page_size);
3373 HelperAgent::signal_connect_update_candidate_table_page_size (HelperAgentSlotInt *slot)
3375 return m_impl->signal_update_candidate_table_page_size.connect (slot);
3379 * @brief Connect a slot to Helper update candidate item layout signal.
3381 * The prototype of the slot is:
3382 * void update_candidate_item_layout (const HelperAgent *, const std::vector<uint32> &row_items);
3385 HelperAgent::signal_connect_update_candidate_item_layout (HelperAgentSlotUintVector *slot)
3387 return m_impl->signal_update_candidate_item_layout.connect (slot);
3391 * @brief Connect a slot to Helper select associate signal.
3393 * This signal is used to do something when associate is selected.
3395 * The prototype of the slot is:
3396 * void select_associate (const HelperAgent *agent, int ic, const String &uuid, int index);
3399 HelperAgent::signal_connect_select_associate (HelperAgentSlotInt *slot)
3401 return m_impl->signal_select_associate.connect (slot);
3405 * @brief Connect a slot to Helper associate table page up signal.
3407 * This signal is used to do something when associate table is paged up.
3409 * The prototype of the slot is:
3410 * void associate_table_page_up (const HelperAgent *agent, int ic, const String &uuid);
3413 HelperAgent::signal_connect_associate_table_page_up (HelperAgentSlotVoid *slot)
3415 return m_impl->signal_associate_table_page_up.connect (slot);
3419 * @brief Connect a slot to Helper associate table page down signal.
3421 * This signal is used to do something when associate table is paged down.
3423 * The prototype of the slot is:
3424 * void associate_table_page_down (const HelperAgent *agent, int ic, const String &uuid);
3427 HelperAgent::signal_connect_associate_table_page_down (HelperAgentSlotVoid *slot)
3429 return m_impl->signal_associate_table_page_down.connect (slot);
3433 * @brief Connect a slot to Helper update associate table page size signal.
3435 * This signal is used to do something when associate table page size is changed.
3437 * The prototype of the slot is:
3438 * void update_associate_table_page_size (const HelperAgent *, int ic, const String &uuid, int page_size);
3441 HelperAgent::signal_connect_update_associate_table_page_size (HelperAgentSlotInt *slot)
3443 return m_impl->signal_update_associate_table_page_size.connect (slot);
3447 * @brief Connect a slot to Helper turn on log signal.
3449 * This signal is used to turn on Helper ISE debug information.
3451 * The prototype of the slot is:
3452 * void turn_on_log (const HelperAgent *agent, uint32 &on);
3455 HelperAgent::signal_connect_turn_on_log (HelperAgentSlotUintVoid *slot)
3457 return m_impl->signal_turn_on_log.connect (slot);
3461 * @brief Connect a slot to Helper update displayed candidate number signal.
3463 * This signal is used to inform helper ISE displayed candidate number.
3465 * The prototype of the slot is:
3466 * void update_displayed_candidate_number (const HelperAgent *, int ic, const String &uuid, int number);
3469 HelperAgent::signal_connect_update_displayed_candidate_number (HelperAgentSlotInt *slot)
3471 return m_impl->signal_update_displayed_candidate_number.connect (slot);
3475 * @brief Connect a slot to Helper longpress candidate signal.
3477 * This signal is used to do something when candidate is longpress.
3479 * The prototype of the slot is:
3480 * void longpress_candidate (const HelperAgent *agent, int ic, const String &uuid, int index);
3483 HelperAgent::signal_connect_longpress_candidate (HelperAgentSlotInt *slot)
3485 return m_impl->signal_longpress_candidate.connect (slot);
3489 * @brief Connect a slot to Helper show option window.
3491 * This signal is used to do request the ISE to show option window.
3493 * The prototype of the slot is:
3494 * void show_option_window (const HelperAgent *agent, int ic, const String &uuid);
3497 HelperAgent::signal_connect_show_option_window (HelperAgentSlotVoid *slot)
3499 return m_impl->signal_show_option_window.connect (slot);
3503 * @brief Connect a slot to Helper resume option window.
3505 * This signal is used to do request the ISE to resume option window.
3507 * The prototype of the slot is:
3508 * void resume_option_window (const HelperAgent *agent, int ic, const String &uuid);
3511 HelperAgent::signal_connect_resume_option_window (HelperAgentSlotVoid *slot)
3513 return m_impl->signal_resume_option_window.connect (slot);
3517 * @brief Connect a slot to Helper check if the option is available.
3519 * This signal is used to check if the option (setting) is available from Helper ISE.
3521 * The prototype of the slot is:
3522 * void check_option_window (const HelperAgent *agent, uint32 &avail);
3525 HelperAgent::signal_connect_check_option_window (HelperAgentSlotUintVoid *slot)
3527 return m_impl->signal_check_option_window.connect (slot);
3531 * @brief Connect a slot to Helper process unconventional input device event signal.
3533 * This signal is used to send unconventional input device event to Helper ISE.
3535 * The prototype of the slot is:
3536 * void process_input_device_event (const HelperAgent *, uint32 &type, char *data, size_t &size, uint32 &ret);
3539 HelperAgent::signal_connect_process_input_device_event (HelperAgentSlotUintCharSizeUint *slot)
3541 return m_impl->signal_process_input_device_event.connect (slot);
3545 * @brief Connect a slot to Helper set prediction hint signal.
3547 * This signal is used to send prediction hint to Helper ISE.
3549 * The prototype of the slot is:
3550 * void set_prediction_hint (const HelperAgent *agent, char *prediction_hint);
3553 HelperAgent::signal_connect_set_prediction_hint (HelperAgentSlotStringVoid *slot)
3555 return m_impl->signal_set_prediction_hint.connect (slot);
3559 * @brief Connect a slot to Helper set mime type signal.
3561 * This signal is used to send mime type to Helper ISE.
3563 * The prototype of the slot is:
3564 * void set_mime_type (const HelperAgent *agent, char *mime_type);
3567 HelperAgent::signal_connect_set_mime_type (HelperAgentSlotStringVoid *slot)
3569 return m_impl->signal_set_mime_type.connect (slot);
3573 * @brief Connect a slot to Helper set prediction hint data signal.
3575 * This signal is used to send prediction hint data to Helper ISE.
3577 * The prototype of the slot is:
3578 * void set_prediction_hint_data (const HelperAgent *agent, char *key, char *value);
3581 HelperAgent::signal_connect_set_prediction_hint_data (HelperAgentSlotString *slot)
3583 return m_impl->signal_set_prediction_hint_data.connect (slot);
3587 * @brief Connect a slot to Helper set optimization hint signal.
3589 * This signal is used to send optimization hint to Helper ISE.
3591 * The prototype of the slot is:
3592 * void set_optimization_hint (const HelperAgent *agent, uint32 &hint);
3595 HelperAgent::signal_connect_set_optimization_hint (HelperAgentSlotUintVoid *slot)
3597 return m_impl->signal_set_optimization_hint.connect (slot);
3600 } /* namespace scim */
3603 vi:ts=4:nowrap:ai:expandtab