Support to apply boosting mode when launching IME in TV
[platform/core/uifw/isf.git] / ism / src / isf_info_manager.cpp
1 /** @file isf_info_manager.cpp
2  *  @brief Implementation of class InfoManager.
3  */
4
5 /* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
6
7 /*
8  * Smart Common Input Method
9  *
10  * Copyright (c) 2005 James Su <suzhe@tsinghua.org.cn>
11  * Copyright (c) 2012-2016 Samsung Electronics Co., Ltd.
12  *
13  *
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.
18  *
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.
23  *
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
28  *
29  * Modifications by Samsung Electronics Co., Ltd.
30  * 1. Add new signals
31  *    a. m_signal_set_keyboard_ise and m_signal_get_keyboard_ise
32  *    b. m_signal_focus_in and m_signal_focus_out
33  *    c. m_signal_expand_candidate, m_signal_contract_candidate and m_signal_set_candidate_ui
34  *    d. m_signal_get_ise_list, m_signal_get_keyboard_ise_list, m_signal_update_ise_geometry and m_signal_get_ise_information
35  *    e. m_signal_set_active_ise_by_uuid and m_signal_get_ise_info_by_uuid
36  *    f. m_signal_accept_connection, m_signal_close_connection and m_signal_exit
37  * 2. Add new interface APIs in PanelClient class
38  *    a. get_helper_manager_id (), has_helper_manager_pending_event () and filter_helper_manager_event ()
39  *    b. update_candidate_panel_event (), update_input_panel_event () and select_aux ()
40  *    c. candidate_more_window_show () and candidate_more_window_hide ()
41  *    d. update_displayed_candidate_number () and update_candidate_item_layout ()
42  *    e. stop_helper (), send_longpress_event () and update_ise_list ()
43  *    f. filter_event (), filter_exception_event () and get_server_id ()
44  * 3. Donot use thread to receive message
45  * 4. Monitor socket frontend for self-recovery function
46  *
47  * $Id: scim_panel_agent.cpp,v 1.8.2.1 2006/01/09 14:32:18 suzhe Exp $
48  *
49  */
50
51
52 #define Uses_SCIM_PANEL_AGENT
53 #define Uses_SCIM_HELPER
54 #define Uses_SCIM_EVENT
55 #define Uses_SCIM_CONFIG
56 #define Uses_SCIM_CONFIG_MODULE
57 #define Uses_SCIM_CONFIG_PATH
58 #define Uses_SCIM_UTILITY
59
60 #include <string.h>
61 #include <sys/types.h>
62 #include <sys/times.h>
63 #include <dlog.h>
64 #include <unistd.h>
65 #include <sys/socket.h>
66 #include <vconf.h>
67 #include <vconf-keys.h>
68 #include "scim_private.h"
69 #include "scim.h"
70 #include "scim_stl_map.h"
71 #include "isf_panel_agent_manager.h"
72 #include "isf_debug.h"
73 #include "isf_pkg.h"
74 #include "ise_context.h"
75
76 #ifdef LOG_TAG
77 # undef LOG_TAG
78 #endif
79 #define LOG_TAG             "ISF_PANEL_EFL"
80
81 static const clock_t MIN_REPEAT_TIME=2;
82
83 namespace scim
84 {
85
86 typedef Signal0<void>
87 InfoManagerSignalVoid;
88
89 typedef Signal1<void, int>
90 InfoManagerSignalInt;
91
92 typedef Signal1<void, int&>
93 InfoManagerSignalInt2;
94
95 typedef Signal1<void, const String&>
96 InfoManagerSignalString;
97
98 typedef Signal2<void, const String&, bool>
99 InfoManagerSignalStringBool;
100
101 typedef Signal2<void, String&, String&>
102 InfoManagerSignalString2;
103
104 typedef Signal2<void, int, const String&>
105 InfoManagerSignalIntString;
106
107 typedef Signal1<void, const PanelFactoryInfo&>
108 InfoManagerSignalFactoryInfo;
109
110 typedef Signal1<void, const std::vector <PanelFactoryInfo> &>
111 InfoManagerSignalFactoryInfoVector;
112
113 typedef Signal1<void, const LookupTable&>
114 InfoManagerSignalLookupTable;
115
116 typedef Signal1<void, const Property&>
117 InfoManagerSignalProperty;
118
119 typedef Signal1<void, const PropertyList&>
120 InfoManagerSignalPropertyList;
121
122 typedef Signal2<void, int, int>
123 InfoManagerSignalIntInt;
124
125 typedef Signal2<void, int&, int&>
126 InfoManagerSignalIntInt2;
127
128 typedef Signal3<void, int, int, int>
129 InfoManagerSignalIntIntInt;
130
131 typedef Signal3<void, const String &, const String &, const String &>
132 InfoManagerSignalString3;
133
134 typedef Signal4<void, int, int, int, int>
135 InfoManagerSignalIntIntIntInt;
136
137 typedef Signal2<void, int, const Property&>
138 InfoManagerSignalIntProperty;
139
140 typedef Signal2<void, int, const PropertyList&>
141 InfoManagerSignalIntPropertyList;
142
143 typedef Signal2<void, int, const HelperInfo&>
144 InfoManagerSignalIntHelperInfo;
145
146 typedef Signal3<void, const String&, const AttributeList&, int>
147 InfoManagerSignalAttributeStringInt;
148
149 typedef Signal5<void, int, int, const String&, const String&, const AttributeList&>
150 InfoManagerSignalAttributeInt2String2;
151
152 typedef Signal2<void, const String&, const AttributeList&>
153 InfoManagerSignalAttributeString;
154
155 typedef Signal1<void, std::vector <String> &>
156 InfoManagerSignalStringVector;
157
158 typedef Signal1<bool, HELPER_ISE_INFO&>
159 InfoManagerSignalBoolHelperInfo;
160
161 typedef Signal1<bool, std::vector <String> &>
162 InfoManagerSignalBoolStringVector;
163
164 typedef Signal2<void, char*, std::vector <String> &>
165 InfoManagerSignalStrStringVector;
166
167 typedef Signal2<bool, const String&, ISE_INFO&>
168 InfoManagerSignalStringISEINFO;
169
170 typedef Signal2<bool, String, int&>
171 InfoManagerSignalStringInt;
172
173 typedef Signal1<void, const KeyEvent&>
174 InfoManagerSignalKeyEvent;
175
176 typedef Signal1<void, struct rectinfo&>
177 InfoManagerSignalRect;
178
179 typedef Signal6<bool, String, String&, String&, int&, int&, String&>
180 InfoManagerSignalBoolString4int2;
181
182 typedef Signal2<void, int, struct rectinfo&>
183 InfoManagerSignalIntRect;
184
185 typedef Signal2<bool, int, String>
186 InfoManagerSignalIntString2;
187
188 typedef Signal1<bool, String>
189 InfoManagerSignalBoolString;
190
191 typedef Signal2<bool, String, String&>
192 InfoManagerSignalBoolString2;
193
194 typedef Signal1<void, bool>
195 InfoManagerSignalBool;
196
197 struct HelperClientStub {
198     int id;
199     int ref;
200
201     HelperClientStub (int i = 0, int r = 0) : id (i), ref (r) { }
202 };
203
204 struct IMControlStub {
205     std::vector<ISE_INFO> info;
206     std::vector<int> count;
207 };
208
209 #define DEFAULT_CONTEXT_VALUE 0xfff
210
211 #if SCIM_USE_STL_EXT_HASH_MAP
212 typedef __gnu_cxx::hash_map <int, ClientInfo, __gnu_cxx::hash <int> >       ClientRepository;
213 typedef __gnu_cxx::hash_map <int, HelperInfo, __gnu_cxx::hash <int> >       HelperInfoRepository;
214 typedef __gnu_cxx::hash_map <uint32, String, __gnu_cxx::hash <unsigned int> > ClientContextUUIDRepository;
215 typedef __gnu_cxx::hash_map <String, HelperClientStub, scim_hash_string>    HelperClientIndex;
216 typedef __gnu_cxx::hash_map <String, std::vector < std::pair <uint32, String> >, scim_hash_string>    StartHelperICIndex;
217 #elif SCIM_USE_STL_HASH_MAP
218 typedef std::hash_map <int, ClientInfo, std::hash <int> >                   ClientRepository;
219 typedef std::hash_map <int, HelperInfo, std::hash <int> >                   HelperInfoRepository;
220 typedef std::hash_map <uint32, String, std::hash <unsigned int> >           ClientContextUUIDRepository;
221 typedef std::hash_map <String, HelperClientStub, scim_hash_string>          HelperClientIndex;
222 typedef std::hash_map <String, std::vector < std::pair <uint32, String> >, scim_hash_string>          StartHelperICIndex;
223 #else
224 typedef std::map <int, ClientInfo>                                          ClientRepository;
225 typedef std::map <int, HelperInfo>                                          HelperInfoRepository;
226 typedef std::map <uint32, String>                                           ClientContextUUIDRepository;
227 typedef std::map <String, HelperClientStub>                                 HelperClientIndex;
228 typedef std::map <String, std::vector < std::pair <uint32, String> > >                                StartHelperICIndex;
229 #endif
230
231 typedef std::map <String, uint32>              UUIDCountRepository;
232 typedef std::map <String, enum HelperState>    UUIDStateRepository;
233 typedef std::map <String, int>                 StringIntRepository;
234 typedef std::map <int, struct IMControlStub>   IMControlRepository;
235 typedef std::map <int, int>                    IntIntRepository;
236
237 static uint32
238 get_helper_ic (int client, uint32 context)
239 {
240     return (uint32) (client & 0xFFFF) | ((context & 0x7FFF) << 16);
241 }
242
243 static void
244 get_imengine_client_context (uint32 helper_ic, int& client, uint32& context)
245 {
246     client   = (int) (helper_ic & 0xFFFF);
247     context  = ((helper_ic >> 16) & 0x7FFF);
248 }
249
250 static bool
251 clients_equal (int first, int second)
252 {
253     return ((first & 0xFFFF) == (second & 0xFFFF));
254 }
255
256 static bool
257 contexts_equal (uint32 first, uint32 second)
258 {
259     return ((first & 0x7FFF) == (second & 0x7FFF));
260 }
261
262 static void
263 initialize_remote_input_vconf_key ()
264 {
265     if (vconf_set_bool (VCONFKEY_ISF_REMOTE_INPUT_DETECTED, 0) != 0)
266         LOGW ("Failed to set vconf key");
267 }
268
269 //==================================== InfoManager ===========================
270 class InfoManager::InfoManagerImpl
271 {
272     int                                 m_current_screen;
273
274     String                              m_config_name;
275     String                              m_display_name;
276
277     int                                 m_current_socket_client;
278     uint32                              m_current_client_context;
279     String                              m_current_context_uuid;
280     TOOLBAR_MODE_T                      m_current_toolbar_mode;
281     uint32                              m_current_helper_option;
282     String                              m_current_helper_uuid;
283     String                              m_last_helper_uuid;
284     String                              m_current_ise_name;
285     int                                 m_pending_active_imcontrol_id;
286     int                                 m_show_request_client_id;
287     int                                 m_active_client_id;
288     IntIntRepository                    m_panel_client_map;
289     IntIntRepository                    m_imcontrol_map;
290     bool                                m_should_shared_ise;
291     bool                                m_ise_exiting;
292     bool                                m_is_imengine_aux;
293     bool                                m_is_imengine_candidate;
294     bool                                m_refocus_needed;
295     bool                                m_reshow_needed;
296     bool                                m_restart_needed;
297     bool                                m_is_ise_alive;
298
299     std::vector<int>                    m_current_send_remoteinput_id;
300     std::vector<int>                    m_current_recv_remoteinput_id;
301
302     int                                 m_last_socket_client;
303     uint32                              m_last_client_context;
304     String                              m_last_context_uuid;
305
306     char*                               m_ise_context_buffer;
307     size_t                              m_ise_context_length;
308     char*                               m_imdata_buffer;
309     size_t                              m_imdata_length;
310
311     ClientRepository                    m_client_repository;
312     /*
313     * Each Helper ISE has two socket connect between InfoManager and HelperAgent.
314     * m_helper_info_repository records the active connection.
315     * m_helper_active_info_repository records the passive connection.
316     */
317     HelperInfoRepository                m_helper_info_repository;
318     HelperInfoRepository                m_helper_active_info_repository;
319     HelperClientIndex                   m_helper_client_index;
320
321     /* when helper register, notify imcontrol client */
322     StringIntRepository                 m_ise_pending_repository;
323     IMControlRepository                 m_imcontrol_repository;
324
325     StartHelperICIndex                  m_start_helper_ic_index;
326
327     /* Keyboard ISE */
328     ClientContextUUIDRepository         m_client_context_uuids;
329
330     /* Helper ISE */
331     ClientContextUUIDRepository         m_client_context_helper;
332     UUIDCountRepository                 m_helper_uuid_count;
333
334     InfoManagerSignalVoid                m_signal_turn_on;
335     InfoManagerSignalVoid                m_signal_turn_off;
336     InfoManagerSignalVoid                m_signal_show_panel;
337     InfoManagerSignalVoid                m_signal_hide_panel;
338     InfoManagerSignalInt                 m_signal_update_screen;
339     InfoManagerSignalIntIntInt           m_signal_update_spot_location;
340     InfoManagerSignalFactoryInfo         m_signal_update_factory_info;
341     InfoManagerSignalVoid                m_signal_start_default_ise;
342     InfoManagerSignalBool                m_signal_stop_default_ise;
343     InfoManagerSignalIntInt              m_signal_update_input_context;
344     InfoManagerSignalString              m_signal_update_language_locale;
345     InfoManagerSignalIntInt              m_signal_set_candidate_ui;
346     InfoManagerSignalIntInt2             m_signal_get_candidate_ui;
347     InfoManagerSignalIntInt              m_signal_set_candidate_position;
348     InfoManagerSignalRect                m_signal_get_candidate_geometry;
349     InfoManagerSignalRect                m_signal_get_input_panel_geometry;
350     InfoManagerSignalString              m_signal_set_keyboard_ise;
351     InfoManagerSignalString2             m_signal_get_keyboard_ise;
352     InfoManagerSignalString              m_signal_show_help;
353     InfoManagerSignalFactoryInfoVector   m_signal_show_factory_menu;
354     InfoManagerSignalVoid                m_signal_show_preedit_string;
355     InfoManagerSignalVoid                m_signal_show_aux_string;
356     InfoManagerSignalVoid                m_signal_show_lookup_table;
357     InfoManagerSignalVoid                m_signal_show_associate_table;
358     InfoManagerSignalVoid                m_signal_hide_preedit_string;
359     InfoManagerSignalVoid                m_signal_hide_aux_string;
360     InfoManagerSignalVoid                m_signal_hide_lookup_table;
361     InfoManagerSignalVoid                m_signal_hide_associate_table;
362     InfoManagerSignalAttributeStringInt  m_signal_update_preedit_string;
363     InfoManagerSignalAttributeInt2String2 m_signal_recapture_string;
364     InfoManagerSignalInt                 m_signal_update_preedit_caret;
365     InfoManagerSignalAttributeString     m_signal_update_aux_string;
366     InfoManagerSignalLookupTable         m_signal_update_lookup_table;
367     InfoManagerSignalLookupTable         m_signal_update_associate_table;
368     InfoManagerSignalPropertyList        m_signal_register_properties;
369     InfoManagerSignalProperty            m_signal_update_property;
370     InfoManagerSignalIntPropertyList     m_signal_register_helper_properties;
371     InfoManagerSignalIntProperty         m_signal_update_helper_property;
372     InfoManagerSignalIntHelperInfo       m_signal_register_helper;
373     InfoManagerSignalInt                 m_signal_remove_helper;
374     InfoManagerSignalStringBool          m_signal_set_active_ise_by_uuid;
375     InfoManagerSignalVoid                m_signal_focus_in;
376     InfoManagerSignalVoid                m_signal_focus_out;
377     InfoManagerSignalVoid                m_signal_expand_candidate;
378     InfoManagerSignalVoid                m_signal_contract_candidate;
379     InfoManagerSignalInt                 m_signal_select_candidate;
380     InfoManagerSignalBoolStringVector    m_signal_get_ise_list;
381     InfoManagerSignalBoolHelperInfo      m_signal_get_all_helper_ise_info;
382     InfoManagerSignalStringBool          m_signal_set_has_option_helper_ise_info;
383     InfoManagerSignalStringBool          m_signal_set_enable_helper_ise_info;
384     InfoManagerSignalVoid                m_signal_show_helper_ise_list;
385     InfoManagerSignalVoid                m_signal_show_helper_ise_selector;
386     InfoManagerSignalStringInt           m_signal_is_helper_ise_enabled;
387     InfoManagerSignalBoolString4int2     m_signal_get_ise_information;
388     InfoManagerSignalBoolStringVector    m_signal_get_keyboard_ise_list;
389     InfoManagerSignalIntIntIntInt        m_signal_update_ise_geometry;
390     InfoManagerSignalStringVector        m_signal_get_language_list;
391     InfoManagerSignalStringVector        m_signal_get_all_language;
392     InfoManagerSignalStrStringVector     m_signal_get_ise_language;
393     InfoManagerSignalStringISEINFO       m_signal_get_ise_info_by_uuid;
394     InfoManagerSignalKeyEvent            m_signal_send_key_event;
395
396     InfoManagerSignalInt                 m_signal_accept_connection;
397     InfoManagerSignalInt                 m_signal_close_connection;
398     InfoManagerSignalVoid                m_signal_exit;
399
400     InfoManagerSignalVoid                m_signal_transaction_start;
401     InfoManagerSignalVoid                m_signal_transaction_end;
402
403     InfoManagerSignalVoid                m_signal_lock;
404     InfoManagerSignalVoid                m_signal_unlock;
405
406     InfoManagerSignalVoid                m_signal_show_ise;
407     InfoManagerSignalVoid                m_signal_hide_ise;
408
409     InfoManagerSignalVoid                m_signal_will_show_ack;
410     InfoManagerSignalVoid                m_signal_will_hide_ack;
411
412     InfoManagerSignalInt                 m_signal_set_keyboard_mode;
413
414     InfoManagerSignalVoid                m_signal_candidate_will_hide_ack;
415     InfoManagerSignalInt2                m_signal_get_ise_state;
416     InfoManagerSignalString3             m_signal_run_helper;
417
418     InfoManagerSignalIntRect             m_signal_get_recent_ise_geometry;
419
420     InfoManagerSignalStringBool          m_signal_remoteinput_send_input_message;
421     InfoManagerSignalIntString           m_signal_remoteinput_send_surrounding_text;
422
423     InfoManagerSignalIntString2          m_signal_check_privilege_by_sockfd;
424
425     InfoManagerSignalBoolString          m_signal_launch_option_application;
426     InfoManagerSignalBoolString2         m_signal_get_ise_setting_appid;
427
428     PanelAgentManager                    m_panel_agent_manager;
429
430     void delete_ise_context_buffer (void) {
431         if (m_ise_context_buffer != NULL) {
432             delete[] m_ise_context_buffer;
433             m_ise_context_buffer = NULL;
434             m_ise_context_length = 0;
435         }
436     }
437
438     void delete_imdata_buffer (void) {
439         if (m_imdata_buffer != NULL) {
440             delete[] m_imdata_buffer;
441             m_imdata_buffer = NULL;
442             m_imdata_length = 0;
443         }
444     }
445
446 public:
447     InfoManagerImpl ()
448         : m_current_screen (0),
449           m_current_socket_client (-1), m_current_client_context (0),
450           m_current_toolbar_mode (TOOLBAR_KEYBOARD_MODE),
451           m_current_helper_option (0),
452           m_pending_active_imcontrol_id (-1),
453           m_show_request_client_id (-1),
454           m_active_client_id (-1),
455           m_should_shared_ise (false),
456           m_ise_exiting (false), m_is_imengine_aux (false), m_is_imengine_candidate (false),
457           m_refocus_needed (false),
458           m_reshow_needed (false),
459           m_restart_needed (false),
460           m_is_ise_alive (false),
461           m_last_socket_client (-1), m_last_client_context (0),
462           m_ise_context_buffer (NULL), m_ise_context_length (0),
463           m_imdata_buffer (NULL), m_imdata_length (0) {
464         m_current_ise_name = String (_ ("English Keyboard"));
465         m_imcontrol_repository.clear ();
466         m_imcontrol_map.clear ();
467         m_current_send_remoteinput_id.clear ();
468         m_current_recv_remoteinput_id.clear ();
469         m_panel_client_map.clear ();
470     }
471
472     ~InfoManagerImpl () {
473         delete_ise_context_buffer ();
474         delete_imdata_buffer ();
475     }
476
477     bool initialize (InfoManager* info_manager, const ConfigPointer& config, const String& display, bool resident) {
478
479         m_config_name = "socket";
480         m_display_name = display;
481
482         return m_panel_agent_manager.initialize (info_manager, config, display, resident);
483     }
484
485     bool valid (void) const {
486         return m_panel_agent_manager.valid ();
487     }
488
489 public:
490
491     void stop (void) {
492         SCIM_DEBUG_MAIN (1) << "InfoManager::stop ()\n";
493
494         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
495             String helper_uuid = get_current_helper_uuid ();
496             hide_helper (helper_uuid);
497             stop_helper (helper_uuid, -2, 0);
498         }
499
500         m_panel_agent_manager.stop ();
501     }
502
503     TOOLBAR_MODE_T get_current_toolbar_mode () const {
504         return m_current_toolbar_mode;
505     }
506
507     String get_current_ise_name () const {
508         return m_current_ise_name;
509     }
510
511     String get_current_helper_uuid () const {
512         return m_current_helper_uuid;
513     }
514
515     uint32 get_current_helper_option () const {
516         return m_current_helper_option;
517     }
518
519     void set_current_ise_name (String& name) {
520         m_current_ise_name = name;
521     }
522
523     void set_current_toolbar_mode (TOOLBAR_MODE_T mode) {
524         m_current_toolbar_mode = mode;
525     }
526
527     void set_current_helper_option (uint32 option) {
528         m_current_helper_option = option;
529     }
530
531     void update_panel_event (int cmd, uint32 nType, uint32 nValue) {
532         int    focused_client;
533         uint32 focused_context;
534         get_focused_context (focused_client, focused_context);
535
536         if (focused_client == -1 && m_active_client_id != -1) {
537             focused_client  = m_panel_client_map[m_active_client_id];
538             focused_context = 0;
539         }
540
541         SCIM_DEBUG_MAIN (1) << __func__ << " (" << nType << ", " << nValue << "), client=" << focused_client << "\n";
542         ClientInfo client_info = socket_get_client_info (focused_client);
543
544         if (client_info.type == FRONTEND_CLIENT) {
545             m_panel_agent_manager.update_panel_event (focused_client, focused_context, cmd, nType, nValue);
546         } else {
547             std::cerr << __func__ << " focused client is not existed!!!" << "\n";
548         }
549
550         if (m_panel_client_map[m_show_request_client_id] != focused_client) {
551             client_info = socket_get_client_info (m_panel_client_map[m_show_request_client_id]);
552
553             if (client_info.type == FRONTEND_CLIENT) {
554                 m_panel_agent_manager.update_panel_event (m_panel_client_map[m_show_request_client_id], 0, cmd, nType, nValue);
555                 std::cerr << __func__ << " show request client=" << m_panel_client_map[m_show_request_client_id] << "\n";
556             } else {
557                 std::cerr << __func__ << " show request client is not existed!!!" << "\n";
558             }
559         }
560     }
561
562     bool move_preedit_caret (uint32 position) {
563         SCIM_DEBUG_MAIN (1) << "InfoManager::move_preedit_caret (" << position << ")\n";
564         int client;
565         uint32 context;
566         lock ();
567         get_focused_context (client, context);
568
569         if (client >= 0) {
570             m_panel_agent_manager.update_preedit_caret (client, context, position);
571         }
572
573         unlock ();
574         return client >= 0;
575     }
576 //useless
577 #if 0
578     bool request_help (void) {
579         SCIM_DEBUG_MAIN (1) << "InfoManager::request_help ()\n";
580         int client;
581         uint32 context;
582         lock ();
583         get_focused_context (client, context);
584
585         if (client >= 0) {
586             m_panel_agent_manager.request_help (client, context);
587         }
588
589         unlock ();
590         return client >= 0;
591     }
592
593     bool request_factory_menu (void) {
594         SCIM_DEBUG_MAIN (1) << "InfoManager::request_factory_menu ()\n";
595         int client;
596         uint32 context;
597         lock ();
598         get_focused_context (client, context);
599
600         if (client >= 0) {
601             m_panel_agent_manager.request_factory_menu (client, context);
602         }
603
604         unlock ();
605         return client >= 0;
606     }
607 #endif
608
609     //ISM_TRANS_CMD_PANEL_RESET_KEYBOARD_ISE
610     bool reset_keyboard_ise (void) {
611         SCIM_DEBUG_MAIN (1) << "InfoManager::reset_keyboard_ise ()\n";
612         int    client = -1;
613         uint32 context = 0;
614         lock ();
615         get_focused_context (client, context);
616
617         if (client >= 0) {
618             m_panel_agent_manager.reset_keyboard_ise (client, context);
619         }
620
621         unlock ();
622         return client >= 0;
623     }
624
625     bool update_keyboard_ise_list (void) {
626         SCIM_DEBUG_MAIN (1) << "InfoManager::update_keyboard_ise_list ()\n";
627         int    client = -1;
628         uint32 context = 0;
629         lock ();
630         get_focused_context (client, context);
631
632         if (client >= 0) {
633             m_panel_agent_manager.update_keyboard_ise_list (client, context);
634         }
635
636         unlock ();
637         return client >= 0;
638     }
639
640     bool change_factory (const String&  uuid) {
641         SCIM_DEBUG_MAIN (1) << "InfoManager::change_factory (" << uuid << ")\n";
642         int client;
643         uint32 context;
644 #if 0
645         if (scim_global_config_read (SCIM_GLOBAL_CONFIG_PRELOAD_KEYBOARD_ISE, false))
646             m_helper_manager.preload_keyboard_ise (uuid);
647 #endif
648         lock ();
649         get_focused_context (client, context);
650
651         if (client >= 0) {
652             m_panel_agent_manager.change_factory (client, context, uuid);
653         }
654
655         unlock ();
656         return client >= 0;
657     }
658
659     bool helper_candidate_show (void) {
660         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
661         bool ret = false;
662
663         int    client;
664         uint32 context;
665         get_focused_context (client, context);
666
667         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
668             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
669
670             if (it != m_helper_client_index.end ()) {
671                 uint32 ctx = get_helper_ic (client, context);
672                 m_panel_agent_manager.helper_candidate_show (it->second.id, ctx, m_current_helper_uuid);
673                 ret = true;
674             }
675         }
676
677         /* Inform wayland module that we are showing candidate window */
678         int     focused_client;
679         uint32  focused_context;
680         String  focused_uuid = get_focused_context(focused_client, focused_context);
681         m_panel_agent_manager.helper_candidate_show(focused_client, focused_context, focused_uuid);
682
683         return ret;
684     }
685
686     bool helper_candidate_hide (void) {
687         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
688         bool ret = false;
689
690         int    client;
691         uint32 context;
692         get_focused_context (client, context);
693
694         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
695             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
696
697             if (it != m_helper_client_index.end ()) {
698                 uint32 ctx = get_helper_ic (client, context);
699                 m_panel_agent_manager.helper_candidate_hide (it->second.id, ctx, m_current_helper_uuid);
700                 ret = true;
701             }
702         }
703
704         /* Inform wayland module that we are hiding candidate window */
705         int     focused_client;
706         uint32  focused_context;
707         String  focused_uuid = get_focused_context(focused_client, focused_context);
708         m_panel_agent_manager.helper_candidate_hide(focused_client, focused_context, focused_uuid);
709
710         return ret;
711     }
712
713     bool candidate_more_window_show (void) {
714         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
715         int    client;
716         uint32 context;
717         get_focused_context (client, context);
718
719         if (m_is_imengine_candidate) {
720             if (client >= 0) {
721                 m_panel_agent_manager.candidate_more_window_show (client, context);
722                 return true;
723             }
724         } else {
725             if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
726                 HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
727
728                 if (it != m_helper_client_index.end ()) {
729                     uint32 ctx = get_helper_ic (client, context);
730                     m_panel_agent_manager.candidate_more_window_show (it->second.id, ctx);
731                     return true;
732                 }
733             }
734         }
735
736         return false;
737     }
738
739     bool candidate_more_window_hide (void) {
740         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
741         int    client;
742         uint32 context;
743         get_focused_context (client, context);
744
745         if (m_is_imengine_candidate) {
746             if (client >= 0) {
747                 m_panel_agent_manager.candidate_more_window_hide (client, context);
748                 return true;
749             }
750         } else {
751             if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
752                 HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
753
754                 if (it != m_helper_client_index.end ()) {
755                     uint32 ctx = get_helper_ic (client, context);
756                     m_panel_agent_manager.candidate_more_window_hide (it->second.id, ctx);
757                     return true;
758                 }
759             }
760         }
761
762         return false;
763     }
764
765     bool update_helper_lookup_table (const LookupTable& table) {
766         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
767         int    client;
768         uint32 context;
769
770         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
771             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
772
773             if (it != m_helper_client_index.end ()) {
774                 uint32 ctx;
775                 get_focused_context (client, context);
776                 ctx = get_helper_ic (client, context);
777                 m_panel_agent_manager.update_helper_lookup_table (it->second.id, ctx, m_current_helper_uuid, table);
778                 return true;
779             }
780         }
781
782         return false;
783     }
784
785     bool select_aux (uint32 item) {
786         SCIM_DEBUG_MAIN (1) << "InfoManager::select_aux (" << item << ")\n";
787         int client;
788         uint32 context;
789         lock ();
790         get_focused_context (client, context);
791
792         if (m_is_imengine_aux) {
793             if (client >= 0) {
794                 m_panel_agent_manager.select_aux (client, context, item);
795             }
796         } else {
797             helper_select_aux (item);
798         }
799
800         unlock ();
801         return client >= 0;
802     }
803
804     bool select_candidate (uint32 item) {
805         SCIM_DEBUG_MAIN (1) << "InfoManager::select_candidate (" << item << ")\n";
806         int client;
807         uint32 context;
808         lock ();
809         get_focused_context (client, context);
810
811         if (m_is_imengine_candidate) {
812             if (client >= 0) {
813                 m_panel_agent_manager.select_candidate (client, context, item);
814             }
815         } else {
816             helper_select_candidate (item);
817         }
818
819         unlock ();
820         return client >= 0;
821     }
822
823     bool lookup_table_page_up (void) {
824         SCIM_DEBUG_MAIN (1) << "InfoManager::lookup_table_page_up ()\n";
825         int client;
826         uint32 context;
827         lock ();
828         get_focused_context (client, context);
829
830         if (m_is_imengine_candidate) {
831             if (client >= 0) {
832                 m_panel_agent_manager.lookup_table_page_up (client, context);
833             }
834         } else {
835             helper_lookup_table_page_up ();
836         }
837
838         unlock ();
839         return client >= 0;
840     }
841
842     bool lookup_table_page_down (void) {
843         SCIM_DEBUG_MAIN (1) << "InfoManager::lookup_table_page_down ()\n";
844         int client;
845         uint32 context;
846         lock ();
847         get_focused_context (client, context);
848
849         if (m_is_imengine_candidate) {
850             if (client >= 0) {
851                 m_panel_agent_manager.lookup_table_page_down (client, context);
852             }
853         } else {
854             helper_lookup_table_page_down ();
855         }
856
857         unlock ();
858         return client >= 0;
859     }
860
861     bool update_lookup_table_page_size (uint32 size) {
862         SCIM_DEBUG_MAIN (1) << "InfoManager::update_lookup_table_page_size (" << size << ")\n";
863         int client;
864         uint32 context;
865         lock ();
866         get_focused_context (client, context);
867
868         if (m_is_imengine_candidate) {
869             if (client >= 0) {
870                 m_panel_agent_manager.update_lookup_table_page_size (client, context, size);
871             }
872         } else {
873             helper_update_lookup_table_page_size (size);
874         }
875
876         unlock ();
877         return client >= 0;
878     }
879
880     bool update_candidate_item_layout (const std::vector<uint32>& row_items) {
881         SCIM_DEBUG_MAIN (1) << __func__ << " (" << row_items.size () << ")\n";
882         int client;
883         uint32 context;
884         lock ();
885         get_focused_context (client, context);
886
887         if (m_is_imengine_candidate) {
888             if (client >= 0) {
889                 m_panel_agent_manager.update_candidate_item_layout (client, context, row_items);
890             }
891         } else {
892             helper_update_candidate_item_layout (row_items);
893         }
894
895         unlock ();
896         return client >= 0;
897     }
898
899     bool select_associate (uint32 item) {
900         SCIM_DEBUG_MAIN (1) << "InfoManager::select_associate (" << item << ")\n";
901         int client;
902         uint32 context;
903         lock ();
904         get_focused_context (client, context);
905
906         if (client >= 0) {
907             m_panel_agent_manager.select_associate (client, context, item);
908         }
909
910         unlock ();
911         helper_select_associate (item);
912         return client >= 0;
913     }
914
915     bool associate_table_page_up (void) {
916         SCIM_DEBUG_MAIN (1) << "InfoManager::associate_table_page_up ()\n";
917         int client;
918         uint32 context;
919         lock ();
920         get_focused_context (client, context);
921
922         if (client >= 0) {
923             m_panel_agent_manager.associate_table_page_up (client, context);
924         }
925
926         unlock ();
927         helper_associate_table_page_up ();
928         return client >= 0;
929     }
930
931     bool associate_table_page_down (void) {
932         SCIM_DEBUG_MAIN (1) << "InfoManager::associate_table_page_down ()\n";
933         int client;
934         uint32 context;
935         lock ();
936         get_focused_context (client, context);
937
938         if (client >= 0) {
939             m_panel_agent_manager.associate_table_page_down (client, context);
940         }
941
942         unlock ();
943         helper_associate_table_page_down ();
944         return client >= 0;
945     }
946
947     bool update_associate_table_page_size (uint32 size) {
948         SCIM_DEBUG_MAIN (1) << "InfoManager::update_associate_table_page_size (" << size << ")\n";
949         int client;
950         uint32 context;
951         lock ();
952         get_focused_context (client, context);
953
954         if (client >= 0) {
955             m_panel_agent_manager.update_associate_table_page_size (client, context, size);
956         }
957
958         unlock ();
959         helper_update_associate_table_page_size (size);
960         return client >= 0;
961     }
962
963     bool update_displayed_candidate_number (uint32 size) {
964         SCIM_DEBUG_MAIN (1) << __func__ << " (" << size << ")\n";
965         int client;
966         uint32 context;
967         lock ();
968         get_focused_context (client, context);
969
970         if (m_is_imengine_candidate) {
971             if (client >= 0) {
972                 m_panel_agent_manager.update_displayed_candidate_number (client, context, size);
973             }
974         } else {
975             helper_update_displayed_candidate_number (size);
976         }
977
978         unlock ();
979         return client >= 0;
980     }
981
982     void send_longpress_event (int type, int index) {
983         SCIM_DEBUG_MAIN (1) << __func__ << " (" << type << ", " << index << ")\n";
984         int    client;
985         uint32 context;
986         get_focused_context (client, context);
987
988         if (m_is_imengine_candidate) {
989             if (client >= 0) {
990                 m_panel_agent_manager.send_longpress_event (client, context, index);
991             }
992         } else {
993             helper_longpress_candidate (index);
994         }
995     }
996
997     bool trigger_property (const String&  property) {
998         SCIM_DEBUG_MAIN (1) << "InfoManager::trigger_property (" << property << ")\n";
999         int client;
1000         uint32 context;
1001         lock ();
1002         get_focused_context (client, context);
1003
1004         if (client >= 0) {
1005             m_panel_agent_manager.trigger_property (client, context, property);
1006         }
1007
1008         unlock ();
1009         return client >= 0;
1010     }
1011
1012     bool start_helper (const String&  uuid, int client, uint32 context) {
1013         SCIM_DEBUG_MAIN (1) << "InfoManager::start_helper (" << uuid << ")\n";
1014         LOGD ("start ISE(%s)", uuid.c_str ());
1015
1016         if (uuid.length () <= 0)
1017             return false;
1018
1019         lock ();
1020         /*if (m_current_toolbar_mode != TOOLBAR_HELPER_MODE || m_current_helper_uuid.compare (uuid) != 0)*/ {
1021             SCIM_DEBUG_MAIN (1) << "Run_helper\n";
1022
1023             uint32 ic = get_helper_ic (m_panel_client_map[client], context);
1024             String ic_uuid;
1025             /* Get the context uuid from the client context registration table. */
1026             {
1027                 ClientContextUUIDRepository::iterator it =
1028                     m_client_context_uuids.find (get_helper_ic (m_panel_client_map[client], context));
1029
1030                 if (it != m_client_context_uuids.end ())
1031                     ic_uuid = it->second;
1032             }
1033             m_start_helper_ic_index [uuid].push_back (std::make_pair (ic, ic_uuid));
1034             m_signal_run_helper (uuid, m_config_name, m_display_name);
1035         }
1036         m_current_helper_uuid = uuid;
1037         unlock ();
1038         return true;
1039     }
1040
1041     bool stop_helper (const String& uuid, int client, uint32 context) {
1042         char buf[256] = {0};
1043         snprintf (buf, sizeof (buf), "time:%ld  pid:%d  %s  %s  prepare to stop ISE(%s)\n",
1044                   time (0), getpid (), __FILE__, __func__, uuid.c_str ());
1045         LOGD ("prepare to stop ISE(%s)", uuid.c_str ());
1046         SCIM_DEBUG_MAIN (1) << "InfoManager::stop_helper (" << uuid << ")\n";
1047
1048         if (uuid.length () <= 0)
1049             return false;
1050
1051         lock ();
1052         uint32 ctx = get_helper_ic (client, context);
1053         HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
1054
1055         if (it != m_helper_client_index.end ()) {
1056             m_ise_exiting = true;
1057             m_current_helper_uuid = String ("");
1058             m_panel_agent_manager.exit (it->second.id, ctx);
1059             SCIM_DEBUG_MAIN (1) << "Stop helper\n";
1060             ISF_SAVE_LOG ("send SCIM_TRANS_CMD_EXIT message to %s", uuid.c_str ());
1061         }
1062
1063         /* Since we are stopping this helper, erase information from start_helper_ic_index too */
1064         m_start_helper_ic_index.erase (uuid);
1065
1066         unlock ();
1067         return true;
1068     }
1069
1070     void focus_out_helper (const String& uuid, int client, uint32 context) {
1071         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1072
1073         if (it != m_helper_client_index.end ()) {
1074             uint32 ctx = get_helper_ic (client, context);
1075             m_panel_agent_manager.focus_out_helper (it->second.id, ctx, uuid);
1076         }
1077     }
1078
1079     void focus_in_helper (const String& uuid, int client, uint32 context) {
1080         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1081
1082         if (it != m_helper_client_index.end ()) {
1083             uint32 ctx = get_helper_ic (client, context);
1084             m_panel_agent_manager.focus_in_helper (it->second.id, ctx, uuid);
1085         }
1086     }
1087
1088     bool show_helper (const String& uuid, char* data, size_t& len, uint32 ctx) {
1089         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1090
1091         if (it != m_helper_client_index.end ()) {
1092             Socket client_socket (it->second.id);
1093             m_panel_agent_manager.show_helper (it->second.id, ctx, uuid, data, len);
1094             return true;
1095         }
1096
1097         LOGW ("Can't find %s", m_current_helper_uuid.c_str ());
1098
1099         return false;
1100     }
1101
1102     void hide_helper (const String& uuid, uint32 ctx = 0) {
1103         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1104
1105         if (it != m_helper_client_index.end ()) {
1106             int client;
1107             uint32 context;
1108
1109             if (ctx == 0) {
1110                 get_focused_context (client, context);
1111                 ctx = get_helper_ic (client, context);
1112             }
1113
1114             m_panel_agent_manager.hide_helper (it->second.id, ctx, uuid);
1115         }
1116     }
1117
1118     bool set_helper_mode (const String& uuid, uint32& mode) {
1119         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1120
1121         if (it != m_helper_client_index.end ()) {
1122             int client;
1123             uint32 context;
1124             uint32 ctx;
1125             get_focused_context (client, context);
1126             ctx = get_helper_ic (client, context);
1127             m_panel_agent_manager.set_helper_mode (it->second.id, ctx, uuid, mode);
1128             return true;
1129         }
1130
1131         return false;
1132     }
1133
1134     bool set_helper_language (const String& uuid, uint32& language) {
1135         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1136
1137         if (it != m_helper_client_index.end ()) {
1138             int client     = -1;
1139             uint32 context = 0;
1140             uint32 ctx;
1141             get_focused_context (client, context);
1142             ctx = get_helper_ic (client, context);
1143             m_panel_agent_manager.set_helper_language (it->second.id, ctx, uuid, language);
1144             return true;
1145         }
1146
1147         return false;
1148     }
1149
1150     bool set_helper_imdata (const String& uuid, const char* imdata, size_t& len) {
1151         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1152
1153         if (it != m_helper_client_index.end ()) {
1154             int client     = -1;
1155             uint32 context = 0;
1156             uint32 ctx;
1157             get_focused_context (client, context);
1158             ctx = get_helper_ic (client, context);
1159             m_panel_agent_manager.set_helper_imdata (it->second.id, ctx, uuid, imdata, len);
1160             return true;
1161         }
1162
1163         return false;
1164     }
1165
1166     bool set_helper_return_key_type (const String& uuid, int type) {
1167         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1168
1169         if (it != m_helper_client_index.end ()) {
1170             int client     = -1;
1171             uint32 context = 0;
1172             uint32 ctx;
1173             get_focused_context (client, context);
1174             ctx = get_helper_ic (client, context);
1175             m_panel_agent_manager.set_helper_return_key_type (it->second.id, ctx, uuid, type);
1176             return true;
1177         }
1178
1179         return false;
1180     }
1181
1182     bool get_helper_return_key_type (const String& uuid, uint32& type) {
1183         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1184
1185         if (it != m_helper_client_index.end ()) {
1186             int    client;
1187             uint32 context;
1188             uint32 ctx;
1189             get_focused_context (client, context);
1190             ctx = get_helper_ic (client, context);
1191             m_panel_agent_manager.get_helper_return_key_type (it->second.id, ctx, uuid, type);
1192             return true;
1193         }
1194
1195         return false;
1196     }
1197
1198     bool set_helper_return_key_disable (const String& uuid, bool disabled) {
1199         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1200
1201         if (it != m_helper_client_index.end ()) {
1202             int client     = -1;
1203             uint32 context = 0;
1204             uint32 ctx;
1205             get_focused_context (client, context);
1206             ctx = get_helper_ic (client, context);
1207             m_panel_agent_manager.set_helper_return_key_disable (it->second.id, ctx, uuid, disabled);
1208             return true;
1209         }
1210
1211         return false;
1212     }
1213
1214     bool get_helper_return_key_disable (const String& uuid, uint32& disabled) {
1215         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1216
1217         if (it != m_helper_client_index.end ()) {
1218             int    client;
1219             uint32 context;
1220             uint32 ctx;
1221             get_focused_context (client, context);
1222             ctx = get_helper_ic (client, context);
1223             m_panel_agent_manager.get_helper_return_key_disable (it->second.id, ctx, uuid, disabled);
1224             return true;
1225         }
1226
1227         return false;
1228     }
1229
1230     bool set_helper_layout (const String& uuid, uint32& layout) {
1231         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1232
1233         if (it != m_helper_client_index.end ()) {
1234             int client;
1235             uint32 context;
1236             uint32 ctx;
1237             get_focused_context (client, context);
1238             ctx = get_helper_ic (client, context);
1239             m_panel_agent_manager.set_helper_layout (it->second.id, ctx, uuid, layout);
1240             return true;
1241         }
1242
1243         return false;
1244     }
1245
1246     bool set_helper_input_mode (const String& uuid, uint32& mode) {
1247         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1248
1249         if (it != m_helper_client_index.end ()) {
1250             int client;
1251             uint32 context;
1252             uint32 ctx;
1253             get_focused_context (client, context);
1254             ctx = get_helper_ic (client, context);
1255             m_panel_agent_manager.set_helper_input_mode (it->second.id, ctx, uuid, mode);
1256             return true;
1257         }
1258
1259         return false;
1260     }
1261
1262     bool set_helper_input_hint (const String& uuid, uint32& hint) {
1263         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1264
1265         if (it != m_helper_client_index.end ()) {
1266             int client;
1267             uint32 context;
1268             uint32 ctx;
1269             get_focused_context (client, context);
1270             ctx = get_helper_ic (client, context);
1271             m_panel_agent_manager.set_helper_input_hint (it->second.id, ctx, uuid, hint);
1272             return true;
1273         }
1274
1275         return false;
1276     }
1277
1278     bool set_helper_bidi_direction (const String& uuid, uint32& direction) {
1279         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1280
1281         if (it != m_helper_client_index.end ()) {
1282             int client;
1283             uint32 context;
1284             uint32 ctx;
1285             get_focused_context (client, context);
1286             ctx = get_helper_ic (client, context);
1287             m_panel_agent_manager.set_helper_bidi_direction (it->second.id, ctx, uuid, direction);
1288             return true;
1289         }
1290
1291         return false;
1292     }
1293
1294     bool set_helper_caps_mode (const String& uuid, uint32& mode) {
1295         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1296
1297         if (it != m_helper_client_index.end ()) {
1298             int client;
1299             uint32 context;
1300             uint32 ctx;
1301             get_focused_context (client, context);
1302             ctx = get_helper_ic (client, context);
1303             m_panel_agent_manager.set_helper_caps_mode (it->second.id, ctx, uuid, mode);
1304             return true;
1305         }
1306
1307         return false;
1308     }
1309
1310     int get_client_pid(int client_id)
1311     {
1312         Socket client_socket(client_id);
1313
1314         int sockfd = client_socket.get_id();
1315         struct ucred ucred;
1316         socklen_t len = sizeof(struct ucred);
1317         if (getsockopt(sockfd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) == 0) {
1318             LOGI("client pid : %u", ucred.pid);
1319         }
1320         else {
1321             LOGW("Failed to get socket infomation");
1322             return 0;
1323         }
1324
1325         return ucred.pid;
1326     }
1327
1328     bool show_helper_option_window (const String& uuid, int caller_pid) {
1329         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1330
1331         if (it != m_helper_client_index.end ()) {
1332             int client;
1333             uint32 context;
1334             uint32 ctx;
1335             get_focused_context (client, context);
1336             ctx = get_helper_ic (client, context);
1337
1338             if (!m_signal_launch_option_application (uuid)) {
1339                 LOGD ("call show helper option");
1340                 int ime_pid = get_client_pid(it->second.id);
1341                 LOGD ("parent : %d, client : %d", caller_pid, ime_pid);
1342                 m_panel_agent_manager.show_helper_option_window (it->second.id, ctx, uuid, caller_pid, ime_pid);
1343                 m_panel_agent_manager.set_transient_for (caller_pid, ime_pid);
1344             }
1345
1346             return true;
1347         }
1348
1349         return false;
1350     }
1351
1352     bool resume_helper_option_window (const String& uuid) {
1353         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1354
1355         if (it != m_helper_client_index.end ()) {
1356             int client;
1357             uint32 context;
1358             uint32 ctx;
1359             get_focused_context (client, context);
1360             ctx = get_helper_ic (client, context);
1361             m_panel_agent_manager.resume_helper_option_window (it->second.id, ctx, uuid);
1362             return true;
1363         }
1364
1365         return false;
1366     }
1367
1368     bool set_helper_keyboard_mode (const String& uuid, uint32& mode) {
1369         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1370
1371         if (it != m_helper_client_index.end ()) {
1372             int client;
1373             uint32 context;
1374             uint32 ctx;
1375             get_focused_context (client, context);
1376             ctx = get_helper_ic (client, context);
1377             m_panel_agent_manager.set_helper_keyboard_mode (it->second.id, ctx, uuid, mode);
1378             return true;
1379         }
1380
1381         return false;
1382     }
1383
1384     bool set_helper_prediction_hint (const String& uuid, String prediction_hint) {
1385         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1386
1387         if (it != m_helper_client_index.end ()) {
1388             int client;
1389             uint32 context;
1390             uint32 ctx;
1391             get_focused_context (client, context);
1392             ctx = get_helper_ic (client, context);
1393             m_panel_agent_manager.set_helper_prediction_hint (it->second.id, ctx, uuid, prediction_hint);
1394             return true;
1395         }
1396
1397         return false;
1398     }
1399
1400     bool set_helper_mime_type (const String& uuid, String mime_type) {
1401         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1402
1403         if (it != m_helper_client_index.end ()) {
1404             int client;
1405             uint32 context;
1406             uint32 ctx;
1407             get_focused_context (client, context);
1408             ctx = get_helper_ic (client, context);
1409             m_panel_agent_manager.set_helper_mime_type (it->second.id, ctx, uuid, mime_type);
1410             return true;
1411         }
1412
1413         return false;
1414     }
1415
1416     bool finalize_content_helper (const String& uuid, String text, uint32 cursor_pos) {
1417         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1418
1419         if (it != m_helper_client_index.end ()) {
1420             int client;
1421             uint32 context;
1422             uint32 ctx;
1423             get_focused_context (client, context);
1424             ctx = get_helper_ic (client, context);
1425             m_panel_agent_manager.finalize_content_helper (it->second.id, ctx, uuid, text, cursor_pos);
1426             return true;
1427         }
1428
1429         return false;
1430     }
1431
1432     bool set_helper_prediction_hint_data (const String& uuid, String key, String value) {
1433         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1434
1435         if (it != m_helper_client_index.end ()) {
1436             int client;
1437             uint32 context;
1438             uint32 ctx;
1439             get_focused_context (client, context);
1440             ctx = get_helper_ic (client, context);
1441             m_panel_agent_manager.set_helper_prediction_hint_data (it->second.id, ctx, uuid, key, value);
1442             return true;
1443         }
1444
1445         return false;
1446     }
1447
1448     bool set_helper_optimization_hint(const String& uuid, uint32& hint) {
1449         HelperClientIndex::iterator it = m_helper_client_index.find(m_current_helper_uuid);
1450
1451         if (it != m_helper_client_index.end()) {
1452             int client;
1453             uint32 context;
1454             uint32 ctx;
1455             get_focused_context(client, context);
1456             ctx = get_helper_ic(client, context);
1457             m_panel_agent_manager.set_helper_optimization_hint(it->second.id, ctx, uuid, hint);
1458             return true;
1459         }
1460
1461         return false;
1462     }
1463
1464     bool set_helper_enable (const String& uuid, uint32 enabled) {
1465         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1466
1467         if (it != m_helper_client_index.end ()) {
1468             int client;
1469             uint32 context;
1470             uint32 ctx;
1471             get_focused_context (client, context);
1472             ctx = get_helper_ic (client, context);
1473             m_panel_agent_manager.set_helper_enable (it->second.id, ctx, uuid, enabled);
1474             return true;
1475         }
1476
1477         return false;
1478     }
1479
1480     //ISM_TRANS_CMD_SHOW_ISF_CONTROL
1481     void show_isf_panel (int client_id) {
1482         SCIM_DEBUG_MAIN (4) << "InfoManager::show_isf_panel ()\n";
1483         m_signal_show_panel ();
1484     }
1485
1486     //ISM_TRANS_CMD_SEND_REMOTE_INPUT_MESSAGE
1487     bool send_remote_input_message (int client_id, char* buf, size_t len) {
1488         SCIM_DEBUG_MAIN(4) << "InfoManager::send_remote_input_message ()\n";
1489
1490         if (buf && len > 0) {
1491             String msg (buf);
1492             m_signal_remoteinput_send_input_message (msg, true);
1493             return true;
1494         }
1495
1496         return false;
1497     }
1498
1499     void send_remote_surrounding_text (const char* text, uint32 cursor) {
1500         SCIM_DEBUG_MAIN(4) << "InfoManager::send_remote_surrounding_text ()\n";
1501
1502         m_signal_remoteinput_send_surrounding_text (cursor, text);
1503     }
1504
1505     //ISM_TRANS_CMD_HIDE_ISF_CONTROL
1506     void hide_isf_panel (int client_id) {
1507         SCIM_DEBUG_MAIN (4) << "InfoManager::hide_isf_panel ()\n";
1508         m_signal_hide_panel ();
1509     }
1510
1511     //ISM_TRANS_CMD_SHOW_ISE_PANEL
1512     void show_ise_panel (int client_id, uint32 client, uint32 context, char*   data, size_t  len) {
1513         SCIM_DEBUG_MAIN (4) << "InfoManager::show_ise_panel ()\n";
1514         m_reshow_needed = true;
1515         String initial_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String (""));
1516         String default_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
1517         LOGD ("prepare to show ISE %d [%s] [%s]", client_id, initial_uuid.c_str (), default_uuid.c_str ());
1518         bool ret = false;
1519         m_show_request_client_id = client_id;
1520         m_active_client_id = client_id;
1521         SCIM_DEBUG_MAIN (4) << __func__ << " (client:" << client << " context:" << context << ")\n";
1522
1523         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode) {
1524             uint32 ctx = get_helper_ic (client, context);
1525             ret = show_helper (m_current_helper_uuid, data, len, ctx);
1526         }
1527
1528         /* Save ISE context for ISE panel re-showing */
1529         /* The size of data can be bigger than Ise_Context size if there is IMDATA. */
1530         if (data && len > 0) {
1531             delete_imdata_buffer ();
1532             delete_ise_context_buffer ();
1533             m_ise_context_buffer = new char [len];
1534             if (m_ise_context_buffer) {
1535                 m_ise_context_length = len;
1536                 memcpy (m_ise_context_buffer, data, m_ise_context_length);
1537             }
1538         }
1539
1540         if (ret) {
1541             m_signal_show_ise ();
1542         } else {
1543             bool launch_ise_on_request = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_LAUNCH_ISE_ON_REQUEST), false);
1544             bool enable_auto_restart = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_ENABLE_AUTO_RESTART_ISE), true);
1545             if (launch_ise_on_request || !enable_auto_restart)
1546                 m_signal_start_default_ise ();
1547         }
1548     }
1549
1550     //ISM_TRANS_CMD_HIDE_ISE_PANEL
1551     void hide_ise_panel (int client_id, uint32 client, uint32 context) {
1552         SCIM_DEBUG_MAIN (4) << "InfoManager::hide_ise_panel ()\n";
1553         LOGD ("prepare to hide ISE, %d %d", client_id, m_show_request_client_id);
1554         SCIM_DEBUG_MAIN (4) << __func__ << " (client:" << client << " context:" << context << ")\n";
1555
1556         m_reshow_needed = false;
1557         if (m_panel_client_map[client_id] == m_current_socket_client || client_id == m_show_request_client_id) {
1558 //            && (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)) {
1559             int    focused_client;
1560             uint32 focused_context;
1561             get_focused_context (focused_client, focused_context);
1562
1563             if (focused_client == -1 && m_active_client_id != -1) {
1564                 focused_client  = m_panel_client_map[m_active_client_id];
1565                 focused_context = 0;
1566             }
1567
1568             m_signal_hide_ise ();
1569         }
1570     }
1571
1572     void hide_helper_ise (void) {
1573 #ifdef WAYLAND
1574         int    focused_client;
1575         uint32 focused_context;
1576         get_focused_context (focused_client, focused_context);
1577         m_panel_agent_manager.hide_helper_ise (focused_client, focused_context);
1578 #else
1579         m_signal_hide_ise ();
1580 #endif
1581     }
1582
1583     void prelaunch_helper_ise (void) {
1584         SCIM_DEBUG_MAIN (4) << "InfoManager::prelaunch_helper_ise ()\n";
1585
1586         /* NOTE :
1587          * Currently the SHOW_PREPARE hint is delivered only to the already-running ISEs.
1588          * If the newly launched ise also has to be notified of given optimization hint,
1589          * we'll need to mark the hint somewhere and send the message when a newly launched
1590          * ise connects to the panel.
1591          */
1592         HelperClientIndex::iterator it = m_helper_client_index.find(m_current_helper_uuid);
1593         if (it != m_helper_client_index.end()) {
1594             int    client;
1595             uint32 context;
1596             uint32 ctx;
1597             get_focused_context(client, context);
1598             ctx = get_helper_ic(client, context);
1599             m_panel_agent_manager.set_helper_optimization_hint(it->second.id, ctx, m_current_helper_uuid, ISE_OPTIMIZATION_HINT_SHOW_PREPARE);
1600         }
1601
1602         m_signal_start_default_ise();
1603     }
1604
1605     void set_default_ise (const DEFAULT_ISE_T& ise) {
1606         LOGD ("set default ise : %s", ise.uuid.c_str());
1607         scim_global_config_write (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), ise.uuid);
1608         scim_global_config_flush ();
1609     }
1610
1611     void set_should_shared_ise (const bool should_shared_ise) {
1612         m_should_shared_ise = should_shared_ise;
1613     }
1614     //SCIM_TRANS_CMD_PROCESS_KEY_EVENT
1615     bool process_key_event (KeyEvent& key, uint32 serial, uint32 keycode) {
1616         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1617
1618         if (m_is_ise_alive == false)
1619             return false;
1620
1621         if (it != m_helper_client_index.end ()) {
1622             int    client;
1623             uint32 context;
1624             uint32 ctx;
1625             get_focused_context (client, context);
1626             ctx = get_helper_ic (client, context);
1627             return m_panel_agent_manager.process_key_event (it->second.id, ctx, m_current_helper_uuid, key, serial, keycode);
1628         }
1629
1630         return false;
1631     }
1632
1633     //ISM_TRANS_CMD_PROCESS_INPUT_DEVICE_EVENT
1634     bool process_input_device_event(int client_id, uint32 type, const char *data, size_t len, _OUT_ uint32& result) {
1635         SCIM_DEBUG_MAIN(4) << "InfoManager::process_input_device_event ()\n";
1636         HelperClientIndex::iterator it = m_helper_client_index.find(m_current_helper_uuid);
1637
1638         if (it != m_helper_client_index.end()) {
1639             int    client;
1640             uint32 context;
1641             uint32 ctx;
1642             get_focused_context(client, context);
1643             ctx = get_helper_ic(client, context);
1644             return m_panel_agent_manager.process_input_device_event(it->second.id, ctx, m_current_helper_uuid, type, data, len, result);
1645         }
1646
1647         return false;
1648     }
1649
1650     bool get_helper_geometry (String& uuid, struct rectinfo& info) {
1651         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1652
1653         if (it != m_helper_client_index.end ()) {
1654             int    client;
1655             uint32 context;
1656             uint32 ctx;
1657             get_focused_context (client, context);
1658             ctx = get_helper_ic (client, context);
1659             return m_panel_agent_manager.get_helper_geometry (it->second.id, ctx, uuid, info);
1660         }
1661
1662         return false;
1663     }
1664
1665     bool get_helper_imdata (String& uuid, char** imdata, size_t& len) {
1666         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1667
1668         if (it != m_helper_client_index.end ()) {
1669             int    client;
1670             uint32 context;
1671             uint32 ctx;
1672             get_focused_context (client, context);
1673             ctx = get_helper_ic (client, context);
1674             m_panel_agent_manager.get_helper_imdata (it->second.id, ctx, uuid, imdata, len);
1675             return true;
1676         }
1677
1678         return false;
1679     }
1680
1681     bool get_helper_layout (String& uuid, uint32& layout) {
1682         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1683
1684         if (it != m_helper_client_index.end ()) {
1685             int    client;
1686             uint32 context;
1687             uint32 ctx;
1688             get_focused_context (client, context);
1689             ctx = get_helper_ic (client, context);
1690             m_panel_agent_manager.get_helper_layout (it->second.id, ctx, uuid, layout);
1691             return true;
1692         }
1693
1694         return false;
1695     }
1696     //ISM_TRANS_CMD_GET_ACTIVE_ISE_GEOMETRY
1697     void get_input_panel_geometry (int client_id, _OUT_ struct rectinfo& info) {
1698         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
1699         m_signal_get_input_panel_geometry (info);
1700     }
1701     //ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY
1702     void get_candidate_window_geometry (int client_id, _OUT_ struct rectinfo& info) {
1703         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
1704         m_signal_get_candidate_geometry (info);
1705     }
1706     //ISM_TRANS_CMD_GET_ISE_LANGUAGE_LOCALE
1707     void get_ise_language_locale (int client_id, _OUT_ char** data, _OUT_ size_t& len) {
1708         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
1709         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
1710             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1711
1712             if (it != m_helper_client_index.end ()) {
1713                 int    client;
1714                 uint32 context;
1715                 get_focused_context (client, context);
1716                 uint32 ctx = get_helper_ic (client, context);
1717                 m_panel_agent_manager.get_ise_language_locale (it->second.id, ctx, m_current_helper_uuid, data, len);
1718             }
1719         }
1720     }
1721
1722     void get_current_ise_geometry (rectinfo& rect) {
1723         SCIM_DEBUG_MAIN (4) << __func__ << " \n";
1724         bool           ret  = false;
1725
1726         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
1727             ret = get_helper_geometry (m_current_helper_uuid, rect);
1728
1729         if (!ret) {
1730             rect.pos_x  = 0;
1731             rect.pos_y  = 0;
1732             rect.width  = 0;
1733             rect.height = 0;
1734         }
1735     }
1736
1737     void set_ise_mode (int client_id, uint32 mode) {
1738         SCIM_DEBUG_MAIN (4) << "InfoManager::set_ise_mode ()\n";
1739
1740         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
1741             set_helper_mode (m_current_helper_uuid, mode);
1742     }
1743     //ISM_TRANS_CMD_SET_LAYOUT
1744     void set_ise_layout (int client_id, uint32 layout) {
1745         SCIM_DEBUG_MAIN (4) << "InfoManager::set_ise_layout ()\n";
1746         if (m_ise_context_buffer != NULL && m_ise_context_length > 0) {
1747             Ise_Context *iseContext = reinterpret_cast<Ise_Context *>(m_ise_context_buffer);
1748             iseContext->layout = static_cast<Ecore_IMF_Input_Panel_Layout>(layout);
1749         }
1750         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
1751             set_helper_layout (m_current_helper_uuid, layout);
1752     }
1753     //ISM_TRANS_CMD_SET_INPUT_MODE
1754     void set_ise_input_mode (int client_id, uint32 input_mode) {
1755         SCIM_DEBUG_MAIN (4) << "InfoManager::set_ise_input_mode ()\n";
1756
1757         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
1758             set_helper_input_mode (m_current_helper_uuid, input_mode);
1759     }
1760     //ISM_TRANS_CMD_SET_INPUT_HINT
1761     void set_ise_input_hint (int client_id, uint32 input_hint) {
1762         SCIM_DEBUG_MAIN (4) << "InfoManager::set_ise_input_hint ()\n";
1763         if (m_ise_context_buffer != NULL && m_ise_context_length > 0) {
1764             Ise_Context *iseContext = reinterpret_cast<Ise_Context *>(m_ise_context_buffer);
1765             iseContext->input_hint = static_cast<Ecore_IMF_Input_Hints>(input_hint);
1766         }
1767         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
1768             set_helper_input_hint (m_current_helper_uuid, input_hint);
1769     }
1770     //ISM_TRANS_CMD_UPDATE_BIDI_DIRECTION
1771     void update_ise_bidi_direction (int client_id, uint32 bidi_direction) {
1772         SCIM_DEBUG_MAIN (4) << "InfoManager::update_ise_bidi_direction ()\n";
1773         if (m_ise_context_buffer != NULL && m_ise_context_length > 0) {
1774             Ise_Context *iseContext = reinterpret_cast<Ise_Context *>(m_ise_context_buffer);
1775             iseContext->bidi_direction = static_cast<Ecore_IMF_BiDi_Direction>(bidi_direction);
1776         }
1777         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
1778             set_helper_bidi_direction (m_current_helper_uuid, bidi_direction);
1779     }
1780     //ISM_TRANS_CMD_SET_ISE_LANGUAGE
1781     void set_ise_language (int client_id, uint32 language) {
1782         SCIM_DEBUG_MAIN (4) << "InfoManager::set_ise_language ()\n";
1783         if (m_ise_context_buffer != NULL && m_ise_context_length > 0) {
1784             Ise_Context *iseContext = reinterpret_cast<Ise_Context *>(m_ise_context_buffer);
1785             iseContext->language = static_cast<Ecore_IMF_Input_Panel_Lang>(language);
1786         }
1787         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
1788             set_helper_language (m_current_helper_uuid, language);
1789     }
1790     //ISM_TRANS_CMD_SET_ISE_IMDATA
1791     void set_ise_imdata (int client_id, const char*   imdata, size_t  len) {
1792         SCIM_DEBUG_MAIN (4) << "InfoManager::set_ise_imdata ()\n";
1793
1794         delete_imdata_buffer ();
1795         m_imdata_buffer = new char [len];
1796         if (m_imdata_buffer) {
1797             m_imdata_length = len;
1798             memcpy (m_imdata_buffer, imdata, m_imdata_length);
1799         }
1800         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
1801             set_helper_imdata (m_current_helper_uuid, imdata, len);
1802     }
1803     //ISM_TRANS_CMD_GET_ISE_IMDATA
1804     bool get_ise_imdata (int client_id, _OUT_ char** imdata, _OUT_ size_t& len) {
1805         SCIM_DEBUG_MAIN (4) << "InfoManager::get_ise_imdata ()\n";
1806         bool    ret    = false;
1807
1808         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
1809             ret = get_helper_imdata (m_current_helper_uuid, imdata, len);
1810
1811         return ret;
1812     }
1813     //ISM_TRANS_CMD_GET_LAYOUT
1814     bool get_ise_layout (int client_id, _OUT_ uint32& layout) {
1815         SCIM_DEBUG_MAIN (4) << "InfoManager::get_ise_layout ()\n";
1816         bool   ret = false;
1817
1818         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
1819             ret = get_helper_layout (m_current_helper_uuid, layout);
1820
1821         return ret;
1822     }
1823     //ISM_TRANS_CMD_GET_ISE_STATE
1824     void get_ise_state (int client_id, _OUT_ int& state) {
1825         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
1826         m_signal_get_ise_state (state);
1827     }
1828     //ISM_TRANS_CMD_GET_ACTIVE_ISE
1829     void get_active_ise (int client_id, _OUT_ String& default_uuid) {
1830         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
1831         default_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
1832     }
1833     //ISM_TRANS_CMD_GET_ISE_LIST
1834     void get_ise_list (int client_id, _OUT_ std::vector<String>& strlist) {
1835         SCIM_DEBUG_MAIN (4) << "InfoManager::get_ise_list ()\n";
1836         m_signal_get_ise_list (strlist);
1837     }
1838     //ISM_TRANS_CMD_GET_ALL_HELPER_ISE_INFO
1839     void get_all_helper_ise_info (int client_id, _OUT_ HELPER_ISE_INFO& info) {
1840         SCIM_DEBUG_MAIN (4) << "InfoManager::get_all_helper_ise_info ()\n";
1841         m_signal_get_all_helper_ise_info (info);
1842
1843         //1 Check if the current IME's option (setting) is available or not.
1844         for (uint32 i = 0; i < info.appid.size (); i++) {
1845             if (m_current_helper_uuid.compare (info.appid [i]) == 0) {  // Find the current IME
1846                 // If the current IME's "has_option" is unknown (-1), get it through ISM_TRANS_CMD_CHECK_OPTION_WINDOW command.
1847                 // And it's saved to ime_info DB. Then next time this will be skipped.
1848                 if (info.has_option [i] >= 2) {
1849                     HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
1850
1851                     if (it != m_helper_client_index.end ()) {
1852                         int    client;
1853                         uint32 context;
1854                         get_focused_context (client, context);
1855                         uint32 ctx = get_helper_ic (client, context);
1856                         uint32 avail = static_cast<uint32> (-1);
1857                         m_panel_agent_manager.check_option_window (it->second.id, ctx, m_current_helper_uuid, avail);
1858
1859                         if (!avail) {
1860                             String setting_app = isf_pkg_get_setting_app (m_current_helper_uuid);
1861                             if (setting_app.length () > 0)
1862                                 avail = 1;
1863                         }
1864
1865                         if (avail < 2) {
1866                             info.has_option [i] = avail;
1867                             // Update "has_option" column of ime_info DB and global variable.
1868                             m_signal_set_has_option_helper_ise_info (info.appid [i], static_cast<bool> (avail));
1869                         }
1870                     }
1871                 }
1872             }
1873         }
1874     }
1875     //ISM_TRANS_CMD_SET_ENABLE_HELPER_ISE_INFO
1876     //reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
1877     void set_enable_helper_ise_info (int client_id, String appid, uint32 is_enabled) {
1878         SCIM_DEBUG_MAIN (4) << "InfoManager::set_enable_helper_ise_info ()\n";
1879         m_signal_set_enable_helper_ise_info (appid, static_cast<bool> (is_enabled));
1880     }
1881     //ISM_TRANS_CMD_SHOW_HELPER_ISE_LIST
1882     //reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
1883     void show_helper_ise_list (int client_id) {
1884         SCIM_DEBUG_MAIN (4) << "InfoManager::show_helper_ise_list ()\n";
1885         m_signal_show_helper_ise_list ();
1886     }
1887     //ISM_TRANS_CMD_SHOW_HELPER_ISE_SELECTOR
1888     //reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
1889     void show_helper_ise_selector (int client_id) {
1890         SCIM_DEBUG_MAIN (4) << "InfoManager::show_helper_ise_selector ()\n";
1891         m_signal_show_helper_ise_selector ();
1892     }
1893     //ISM_TRANS_CMD_IS_HELPER_ISE_ENABLED
1894     //reply
1895     void is_helper_ise_enabled (int client_id, String strAppid, _OUT_ uint32& nEnabled) {
1896         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
1897         int _nEnabled = 0;
1898         m_signal_is_helper_ise_enabled (strAppid, _nEnabled);
1899         nEnabled = (uint32)_nEnabled;
1900     }
1901     //ISM_TRANS_CMD_GET_ISE_INFORMATION
1902     void get_ise_information (int client_id, String strUuid, _OUT_ String& strName, _OUT_ String& strLanguage,
1903                               _OUT_ int& nType, _OUT_ int& nOption, _OUT_ String& strModuleName) {
1904         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
1905         m_signal_get_ise_information (strUuid, strName, strLanguage, nType, nOption, strModuleName);
1906     }
1907     /*
1908      * useless
1909      */
1910     void get_language_list (int client_id, _OUT_ std::vector<String>& strlist) {
1911         SCIM_DEBUG_MAIN (4) << "InfoManager::get_language_list ()\n";
1912         m_signal_get_language_list (strlist);
1913     }
1914
1915     void get_all_language (int client_id, _OUT_ std::vector<String>& strlist) {
1916         SCIM_DEBUG_MAIN (4) << "InfoManager::get_all_language ()\n";
1917         m_signal_get_all_language (strlist);
1918     }
1919     /*
1920      * useless
1921      */
1922     void get_ise_language (int client_id, char* buf, size_t len, _OUT_ std::vector<String>& strlist) {
1923         SCIM_DEBUG_MAIN (4) << "InfoManager::get_ise_language ()\n";
1924         m_signal_get_ise_language (buf, strlist);
1925     }
1926     //ISM_TRANS_CMD_RESET_ISE_OPTION
1927     //reply SCIM_TRANS_CMD_OK
1928     bool reset_ise_option (int client_id) {
1929         SCIM_DEBUG_MAIN (1) << "InfoManager::reset_ise_option ()\n";
1930         int    client = -1;
1931         uint32 context;
1932         lock ();
1933         ClientContextUUIDRepository::iterator it = m_client_context_uuids.begin ();
1934
1935         if (it != m_client_context_uuids.end ()) {
1936             get_imengine_client_context (it->first, client, context);
1937         }
1938
1939         if (client >= 0) {
1940             m_panel_agent_manager.reset_ise_option (client, context);
1941         }
1942
1943         unlock ();
1944         return client >= 0;
1945     }
1946
1947     bool find_active_ise_by_uuid (String uuid) {
1948         HelperInfoRepository::iterator iter = m_helper_info_repository.begin ();
1949
1950         for (; iter != m_helper_info_repository.end (); iter++) {
1951             if (!uuid.compare (iter->second.uuid))
1952                 return true;
1953         }
1954
1955         return false;
1956     }
1957     //ISM_TRANS_CMD_SET_ACTIVE_ISE_BY_UUID
1958     //reply
1959     bool set_active_ise_by_uuid (int client_id, char*  buf, size_t  len) {
1960         SCIM_DEBUG_MAIN (4) << "InfoManager::set_active_ise_by_uuid ()\n";
1961
1962         if (buf == NULL) {
1963             return false;
1964         }
1965
1966         String uuid (buf);
1967         ISE_INFO info;
1968
1969         if (!m_signal_get_ise_info_by_uuid (uuid, info)) {
1970             return false;
1971         }
1972
1973         if (info.type == TOOLBAR_KEYBOARD_MODE) {
1974             m_signal_set_active_ise_by_uuid (uuid, 1);
1975             return true;
1976         } else {
1977             m_signal_set_active_ise_by_uuid (uuid, 1);
1978         }
1979
1980         sync ();
1981
1982         if (find_active_ise_by_uuid (uuid)) {
1983             return true;
1984         } else {
1985             m_ise_pending_repository[uuid] = client_id;
1986             return false;
1987         }
1988     }
1989     //ISM_TRANS_CMD_SET_INITIAL_ISE_BY_UUID
1990     //reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
1991     void set_initial_ise_by_uuid (int client_id, char*  buf, size_t  len) {
1992         SCIM_DEBUG_MAIN (4) << "InfoManager::set_initial_ise_by_uuid ()\n";
1993
1994         if (buf == NULL) {
1995             return;
1996         }
1997
1998         String uuid (buf);
1999         scim_global_config_write (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String (uuid));
2000         scim_global_config_flush ();
2001     }
2002     //ISM_TRANS_CMD_SET_RETURN_KEY_TYPE
2003     void set_ise_return_key_type (int client_id, uint32 type) {
2004         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
2005         if (m_ise_context_buffer != NULL && m_ise_context_length > 0) {
2006             Ise_Context *iseContext = reinterpret_cast<Ise_Context *>(m_ise_context_buffer);
2007             iseContext->return_key_type = static_cast<Ecore_IMF_Input_Panel_Return_Key_Type>(type);
2008         }
2009         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
2010             set_helper_return_key_type (m_current_helper_uuid, type);
2011     }
2012     //ISM_TRANS_CMD_GET_RETURN_KEY_TYPE
2013     //reply
2014     bool get_ise_return_key_type (int client_id, _OUT_ uint32& type) {
2015         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
2016         bool   ret  = false;
2017
2018         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
2019             ret = get_helper_return_key_type (m_current_helper_uuid, type);
2020
2021         return ret;
2022     }
2023     //ISM_TRANS_CMD_SET_RETURN_KEY_DISABLE
2024     void set_ise_return_key_disable (int client_id, uint32 disabled) {
2025         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
2026         if (m_ise_context_buffer != NULL && m_ise_context_length > 0) {
2027             Ise_Context *iseContext = reinterpret_cast<Ise_Context *>(m_ise_context_buffer);
2028             iseContext->return_key_disabled = static_cast<Eina_Bool>(disabled);
2029         }
2030         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
2031             set_helper_return_key_disable (m_current_helper_uuid, disabled);
2032     }
2033     //ISM_TRANS_CMD_GET_RETURN_KEY_DISABLE
2034     bool get_ise_return_key_disable (int client_id, _OUT_ uint32& disabled) {
2035         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
2036         bool   ret  = false;
2037
2038         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
2039             ret = get_helper_return_key_disable (m_current_helper_uuid, disabled);
2040
2041         return ret;
2042     }
2043
2044     void reset_helper_context (const String& uuid) {
2045         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
2046
2047         if (it != m_helper_client_index.end ()) {
2048             int client;
2049             uint32 context;
2050             uint32 ctx;
2051             get_focused_context (client, context);
2052             ctx = get_helper_ic (client, context);
2053             m_panel_agent_manager.reset_helper_context (it->second.id, ctx, uuid);
2054         }
2055     }
2056     /*
2057      * useless
2058      */
2059     void reset_ise_context (int client_id) {
2060         SCIM_DEBUG_MAIN (4) << "InfoManager::reset_ise_context ()\n";
2061
2062         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
2063             reset_helper_context (m_current_helper_uuid);
2064     }
2065     //ISM_TRANS_CMD_SET_CAPS_MODE
2066     void set_ise_caps_mode (int client_id, uint32 mode) {
2067         SCIM_DEBUG_MAIN (4) << "InfoManager::set_ise_caps_mode ()\n";
2068         if (m_ise_context_buffer != NULL && m_ise_context_length > 0) {
2069             Ise_Context *iseContext = reinterpret_cast<Ise_Context *>(m_ise_context_buffer);
2070             iseContext->caps_mode = static_cast<Eina_Bool>(mode);
2071         }
2072         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
2073             set_helper_caps_mode (m_current_helper_uuid, mode);
2074     }
2075
2076     //SCIM_TRANS_CMD_RELOAD_CONFIG
2077     void reload_config (void) {
2078         SCIM_DEBUG_MAIN (1) << "InfoManager::reload_config ()\n";
2079         lock ();
2080
2081         for (ClientRepository::iterator it = m_client_repository.begin (); it != m_client_repository.end (); ++it) {
2082             if (it->second.type == FRONTEND_CLIENT || it->second.type == HELPER_CLIENT) {
2083                 m_panel_agent_manager.reload_config (it->first);
2084             }
2085         }
2086
2087         unlock ();
2088     }
2089
2090     bool exit (void) {
2091         SCIM_DEBUG_MAIN (1) << "InfoManager::exit ()\n";
2092         lock ();
2093
2094         for (ClientRepository::iterator it = m_client_repository.begin (); it != m_client_repository.end (); ++it) {
2095             m_panel_agent_manager.exit (it->first, 0);
2096         }
2097
2098         unlock ();
2099         stop ();
2100         return true;
2101     }
2102
2103     void update_ise_list (std::vector<String>& strList) {
2104         /* request PanelClient to update keyboard ise list */
2105         update_keyboard_ise_list ();
2106     }
2107     //ISM_TRANS_CMD_SEND_WILL_SHOW_ACK
2108     void will_show_ack (int client_id) {
2109         SCIM_DEBUG_MAIN (4) << "InfoManager::will_show_ack ()\n";
2110         m_signal_will_show_ack ();
2111     }
2112     //ISM_TRANS_CMD_SEND_WILL_HIDE_ACK
2113     void will_hide_ack (int client_id) {
2114         SCIM_DEBUG_MAIN (4) << "InfoManager::will_hide_ack ()\n";
2115         m_signal_will_hide_ack ();
2116     }
2117     //ISM_TRANS_CMD_RESET_DEFAULT_ISE
2118     void reset_default_ise (int client_id) {
2119         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
2120         String initial_ise = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String (""));
2121
2122         if (initial_ise.length () > 0)
2123             m_signal_set_active_ise_by_uuid (initial_ise, 1);
2124         else
2125             std::cerr << "Read SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID is failed!!!\n";
2126     }
2127     //ISM_TRANS_CMD_SET_HARDWARE_KEYBOARD_MODE
2128     void set_keyboard_mode (int client_id, uint32 mode) {
2129         SCIM_DEBUG_MAIN (4) << "InfoManager::set_keyboard_mode ()\n";
2130         m_signal_set_keyboard_mode (mode);
2131         set_ise_keyboard_mode (client_id, mode);
2132     }
2133     //ISM_TRANS_CMD_SEND_CANDIDATE_WILL_HIDE_ACK
2134     void candidate_will_hide_ack (int client_id) {
2135         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "\n";
2136         m_signal_candidate_will_hide_ack ();
2137     }
2138
2139     //ISM_TRANS_CMD_GET_ACTIVE_HELPER_OPTION
2140     void get_active_helper_option (int client_id, _OUT_ uint32& option) {
2141         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
2142         option = get_current_helper_option ();
2143     }
2144     //ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW
2145     void show_ise_option_window (int client_id, int caller_pid) {
2146         SCIM_DEBUG_MAIN (4) << "InfoManager::show_ise_option_window ()\n";
2147         String initial_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String (""));
2148         String default_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
2149         LOGD ("prepare to show ISE option window %d [%s] [%s]", client_id, initial_uuid.c_str (), default_uuid.c_str ());
2150
2151         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode) {
2152             show_helper_option_window (m_current_helper_uuid, caller_pid);
2153         }
2154     }
2155
2156     //ISM_TRANS_CMD_GET_ISE_SETTING_APPID
2157     void get_ise_setting_appid (int client_id, _OUT_ String &ime_setting_appid) {
2158         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
2159         m_signal_get_ise_setting_appid (m_current_helper_uuid, ime_setting_appid);
2160     }
2161
2162     //ISM_TRANS_CMD_RESUME_ISE_OPTION_WINDOW
2163     void resume_ise_option_window (int client_id) {
2164         SCIM_DEBUG_MAIN (4) << "InfoManager::resume_ise_option_window ()\n";
2165         String initial_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String (""));
2166         String default_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
2167         LOGD ("prepare to resume ISE option window %d [%s] [%s]", client_id, initial_uuid.c_str (), default_uuid.c_str ());
2168
2169         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode) {
2170             resume_helper_option_window (m_current_helper_uuid);
2171         }
2172     }
2173
2174     //ISM_TRANS_CMD_SET_KEYBOARD_MODE
2175     void set_ise_keyboard_mode (int client_id, uint32 mode) {
2176         SCIM_DEBUG_MAIN (4) << "InfoManager::set_ise_keyboard_mode ()\n";
2177         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
2178             set_helper_keyboard_mode (m_current_helper_uuid, mode);
2179     }
2180
2181     //ISM_TRANS_CMD_SET_PREDICTION_HINT
2182     void set_prediction_hint (int client_id, String prediction_hint) {
2183         SCIM_DEBUG_MAIN (4) << "InfoManager::set_prediction_hint ()\n";
2184         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
2185             set_helper_prediction_hint (m_current_helper_uuid, prediction_hint);
2186     }
2187
2188     //ISM_TRANS_CMD_SET_MIME_TYPE
2189     void set_ise_mime_type (int client_id, String mime_type) {
2190         SCIM_DEBUG_MAIN (4) << "InfoManager::set_mime_type ()\n";
2191         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
2192             set_helper_mime_type (m_current_helper_uuid, mime_type);
2193     }
2194
2195     //ISM_TRANS_CMD_FINALIZE_CONTENT
2196     void finalize_content (int client_id, String text, uint32 cursor_pos) {
2197         SCIM_DEBUG_MAIN (4) << "InfoManager::finalize_content ()\n";
2198         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
2199             finalize_content_helper (m_current_helper_uuid, text, cursor_pos);
2200     }
2201
2202     //ISM_TRANS_CMD_SET_PREDICTION_HINT_DATA
2203     void set_prediction_hint_data (int client_id, String key, String value) {
2204         SCIM_DEBUG_MAIN (4) << "InfoManager::set_prediction_hint_data ()\n";
2205         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
2206             set_helper_prediction_hint_data (m_current_helper_uuid, key, value);
2207     }
2208
2209     //ISM_TRANS_CMD_SET_OPTIMIZATION_HINT
2210     void set_optimization_hint(int client_id, uint32 hint) {
2211         SCIM_DEBUG_MAIN(4) << "InfoManager::set_optimization_hint ()\n";
2212         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
2213             set_helper_optimization_hint(m_current_helper_uuid, hint);
2214     }
2215
2216     //ISM_TRANS_CMD_SET_ISE_ENABLE
2217     void set_ise_enable (int client_id, uint32 enabled) {
2218         SCIM_DEBUG_MAIN (4) << "InfoManager::set_ise_enable ()\n";
2219         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
2220             set_helper_enable (m_current_helper_uuid, enabled);
2221     }
2222
2223     //ISM_TRANS_CMD_EXPAND_CANDIDATE
2224     void expand_candidate () {
2225         LOGD ("");
2226         m_signal_expand_candidate ();
2227     }
2228
2229     //ISM_TRANS_CMD_CONTRACT_CANDIDATE
2230     void contract_candidate () {
2231         LOGD ("");
2232         m_signal_contract_candidate ();
2233     }
2234     //ISM_TRANS_CMD_GET_RECENT_ISE_GEOMETRY
2235     void get_recent_ise_geometry (int client_id, uint32 angle, _OUT_ struct rectinfo& info) {
2236         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
2237         LOGD ("");
2238         m_signal_get_recent_ise_geometry (angle, info);
2239     }
2240
2241     bool check_privilege_by_sockfd (int client_id, const String& privilege) {
2242         return m_signal_check_privilege_by_sockfd (client_id, privilege);
2243     }
2244
2245     bool remoteinput_update_preedit_string (WideString str, AttributeList &attrs, uint32 caret)
2246     {
2247         SCIM_DEBUG_MAIN(1) << "PanelAgent::update_preedit_string ()\n";
2248         int    client = -1;
2249         uint32 context = 0;
2250
2251         lock ();
2252
2253         get_focused_context (client, context);
2254         if (client >= 0) {
2255             m_panel_agent_manager.remote_update_preedit_string (client, context, str, str, attrs, caret);
2256         }
2257
2258         unlock ();
2259
2260         return client >= 0;
2261     }
2262
2263     bool remoteinput_commit_string (const WideString &str)
2264     {
2265         SCIM_DEBUG_MAIN(1) << "PanelAgent::remote_commit_string ()\n";
2266         int    client = -1;
2267         uint32 context = 0;
2268
2269         lock ();
2270
2271         get_focused_context (client, context);
2272         if (client >= 0) {
2273             m_panel_agent_manager.remote_commit_string (client, context, str);
2274         }
2275
2276         unlock ();
2277
2278         return client >= 0;
2279     }
2280
2281     bool remoteinput_send_key_event (const KeyEvent &key)
2282     {
2283         SCIM_DEBUG_MAIN(1) << "PanelAgent::remote_send_key_event ()\n";
2284         int    client = -1;
2285         uint32 context = 0;
2286
2287         get_focused_context (client, context);
2288         if (client >= 0) {
2289             m_panel_agent_manager.remote_send_key_event (client, context, key);
2290         }
2291
2292         return client >= 0;
2293     }
2294
2295     bool remoteinput_forward_key_event (const KeyEvent &key)
2296     {
2297         SCIM_DEBUG_MAIN(1) << "PanelAgent::remote_forward_key_event ()\n";
2298         int    client = -1;
2299         uint32 context = 0;
2300
2301         get_focused_context (client, context);
2302         if (client >= 0) {
2303             m_panel_agent_manager.remote_forward_key_event (client, context, key);
2304         }
2305
2306         return client >= 0;
2307     }
2308
2309     bool remoteinput_delete_surrounding_text (uint32 offset, uint32 len)
2310     {
2311         SCIM_DEBUG_MAIN(1) << "PanelAgent::remote_delete_surrounding_text ()\n";
2312         int    client = -1;
2313         uint32 context = 0;
2314
2315         get_focused_context (client, context);
2316         if (client >= 0) {
2317             m_panel_agent_manager.remote_delete_surrounding_text (client, context, offset, len);
2318         }
2319
2320         return client >= 0;
2321     }
2322
2323     bool remoteinput_set_cursor_position (uint32 cursor)
2324     {
2325         SCIM_DEBUG_MAIN(1) << "PanelAgent::remote_set_cursor_position ()\n";
2326         int    client = -1;
2327         uint32 context = 0;
2328
2329         get_focused_context (client, context);
2330         if (client >= 0) {
2331             m_panel_agent_manager.socket_helper_set_selection (client, context, cursor, cursor);
2332         }
2333
2334         return client >= 0;
2335     }
2336
2337     void reshow_input_panel () {
2338         /* Check whether application is already focus_in */
2339         if (m_refocus_needed) {
2340             LOGD ("Re-focus in");
2341             SCIM_DEBUG_MAIN (2) << "Application is already focus_in!\n";
2342
2343             focus_in_helper (m_current_helper_uuid, m_current_socket_client, m_current_client_context);
2344             reset_keyboard_ise ();
2345         }
2346
2347         /* Check whether ISE panel is already shown */
2348         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode && m_ise_context_length > 0 && m_reshow_needed) {
2349             LOGD ("Re-show input_panel");
2350             SCIM_DEBUG_MAIN (2) << "Re-show ISE panel!\n";
2351
2352             int    focused_client;
2353             uint32 focused_context;
2354
2355             get_focused_context (focused_client, focused_context);
2356             if (focused_client == -1 && m_active_client_id != -1) {
2357                 focused_client  = m_panel_client_map[m_active_client_id];
2358                 focused_context = 0;
2359             }
2360
2361             m_panel_agent_manager.request_ise_reshow (focused_client, focused_context);
2362             m_panel_agent_manager.update_entry_metadata (focused_client, focused_context);
2363             uint32 ctx = get_helper_ic (focused_client, focused_context);
2364             bool ret = show_helper (m_current_helper_uuid, m_ise_context_buffer, m_ise_context_length, ctx);
2365             if (ret) {
2366                 m_signal_show_ise ();
2367
2368                 if (m_imdata_buffer && m_imdata_length > 0 && m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
2369                     set_helper_imdata (m_current_helper_uuid, m_imdata_buffer, m_imdata_length);
2370             }
2371         }
2372     }
2373
2374     void request_ise_terminate () {
2375         if (m_client_context_uuids.size () == 0) {
2376             LOGD("Request to terminate IME");
2377             m_signal_stop_default_ise (true);
2378         }
2379     }
2380
2381     void set_floating_mode (uint32 floating_mode) {
2382         int     focused_client;
2383         uint32  focused_context;
2384         get_focused_context (focused_client, focused_context);
2385         ClientInfo client_info = socket_get_client_info (focused_client);
2386
2387         if (client_info.type == FRONTEND_CLIENT) {
2388             m_panel_agent_manager.set_floating_mode (focused_client, focused_context, floating_mode);
2389         }
2390     }
2391
2392     void set_floating_drag_enabled (uint32 enabled) {
2393         int     focused_client;
2394         uint32  focused_context;
2395         get_focused_context (focused_client, focused_context);
2396         ClientInfo client_info = socket_get_client_info (focused_client);
2397
2398         if (client_info.type == FRONTEND_CLIENT) {
2399             m_panel_agent_manager.set_floating_drag_enabled (focused_client, focused_context, enabled);
2400         }
2401     }
2402
2403     Connection signal_connect_turn_on (InfoManagerSlotVoid*                slot) {
2404         return m_signal_turn_on.connect (slot);
2405     }
2406
2407     Connection signal_connect_turn_off (InfoManagerSlotVoid*                slot) {
2408         return m_signal_turn_off.connect (slot);
2409     }
2410
2411     Connection signal_connect_show_panel (InfoManagerSlotVoid*                slot) {
2412         return m_signal_show_panel.connect (slot);
2413     }
2414
2415     Connection signal_connect_hide_panel (InfoManagerSlotVoid*                slot) {
2416         return m_signal_hide_panel.connect (slot);
2417     }
2418
2419     Connection signal_connect_update_screen (InfoManagerSlotInt*                 slot) {
2420         return m_signal_update_screen.connect (slot);
2421     }
2422
2423     Connection signal_connect_update_spot_location (InfoManagerSlotIntIntInt*           slot) {
2424         return m_signal_update_spot_location.connect (slot);
2425     }
2426
2427     Connection signal_connect_update_factory_info (InfoManagerSlotFactoryInfo*         slot) {
2428         return m_signal_update_factory_info.connect (slot);
2429     }
2430
2431     Connection signal_connect_start_default_ise (InfoManagerSlotVoid*                slot) {
2432         return m_signal_start_default_ise.connect (slot);
2433     }
2434
2435     Connection signal_connect_stop_default_ise (InfoManagerSlotBool*                slot) {
2436         return m_signal_stop_default_ise.connect (slot);
2437     }
2438
2439     Connection signal_connect_set_candidate_ui (InfoManagerSlotIntInt*              slot) {
2440         return m_signal_set_candidate_ui.connect (slot);
2441     }
2442
2443     Connection signal_connect_get_candidate_ui (InfoManagerSlotIntInt2*             slot) {
2444         return m_signal_get_candidate_ui.connect (slot);
2445     }
2446
2447     Connection signal_connect_set_candidate_position (InfoManagerSlotIntInt*              slot) {
2448         return m_signal_set_candidate_position.connect (slot);
2449     }
2450
2451     Connection signal_connect_get_candidate_geometry (InfoManagerSlotRect*                slot) {
2452         return m_signal_get_candidate_geometry.connect (slot);
2453     }
2454
2455     Connection signal_connect_get_input_panel_geometry (InfoManagerSlotRect*                slot) {
2456         return m_signal_get_input_panel_geometry.connect (slot);
2457     }
2458
2459     Connection signal_connect_set_keyboard_ise (InfoManagerSlotString*              slot) {
2460         return m_signal_set_keyboard_ise.connect (slot);
2461     }
2462
2463     Connection signal_connect_get_keyboard_ise (InfoManagerSlotString2*             slot) {
2464         return m_signal_get_keyboard_ise.connect (slot);
2465     }
2466
2467     Connection signal_connect_show_help (InfoManagerSlotString*              slot) {
2468         return m_signal_show_help.connect (slot);
2469     }
2470
2471     Connection signal_connect_show_factory_menu (InfoManagerSlotFactoryInfoVector*   slot) {
2472         return m_signal_show_factory_menu.connect (slot);
2473     }
2474
2475     Connection signal_connect_show_preedit_string (InfoManagerSlotVoid*                slot) {
2476         return m_signal_show_preedit_string.connect (slot);
2477     }
2478
2479     Connection signal_connect_show_aux_string (InfoManagerSlotVoid*                slot) {
2480         return m_signal_show_aux_string.connect (slot);
2481     }
2482
2483     Connection signal_connect_show_lookup_table (InfoManagerSlotVoid*                slot) {
2484         return m_signal_show_lookup_table.connect (slot);
2485     }
2486
2487     Connection signal_connect_show_associate_table (InfoManagerSlotVoid*                slot) {
2488         return m_signal_show_associate_table.connect (slot);
2489     }
2490
2491     Connection signal_connect_hide_preedit_string (InfoManagerSlotVoid*                slot) {
2492         return m_signal_hide_preedit_string.connect (slot);
2493     }
2494
2495     Connection signal_connect_hide_aux_string (InfoManagerSlotVoid*                slot) {
2496         return m_signal_hide_aux_string.connect (slot);
2497     }
2498
2499     Connection signal_connect_hide_lookup_table (InfoManagerSlotVoid*                slot) {
2500         return m_signal_hide_lookup_table.connect (slot);
2501     }
2502
2503     Connection signal_connect_hide_associate_table (InfoManagerSlotVoid*                slot) {
2504         return m_signal_hide_associate_table.connect (slot);
2505     }
2506
2507     Connection signal_connect_update_preedit_string (InfoManagerSlotAttributeStringInt*  slot) {
2508         return m_signal_update_preedit_string.connect (slot);
2509     }
2510
2511     Connection signal_connect_update_preedit_caret (InfoManagerSlotInt*                 slot) {
2512         return m_signal_update_preedit_caret.connect (slot);
2513     }
2514
2515     Connection signal_connect_recapture_string (InfoManagerSlotAttributeInt2String2*    slot) {
2516         return m_signal_recapture_string.connect (slot);
2517     }
2518
2519     Connection signal_connect_update_aux_string (InfoManagerSlotAttributeString*     slot) {
2520         return m_signal_update_aux_string.connect (slot);
2521     }
2522
2523     Connection signal_connect_update_lookup_table (InfoManagerSlotLookupTable*         slot) {
2524         return m_signal_update_lookup_table.connect (slot);
2525     }
2526
2527     Connection signal_connect_update_associate_table (InfoManagerSlotLookupTable*         slot) {
2528         return m_signal_update_associate_table.connect (slot);
2529     }
2530
2531     Connection signal_connect_register_properties (InfoManagerSlotPropertyList*        slot) {
2532         return m_signal_register_properties.connect (slot);
2533     }
2534
2535     Connection signal_connect_update_property (InfoManagerSlotProperty*            slot) {
2536         return m_signal_update_property.connect (slot);
2537     }
2538
2539     Connection signal_connect_register_helper_properties (InfoManagerSlotIntPropertyList*     slot) {
2540         return m_signal_register_helper_properties.connect (slot);
2541     }
2542
2543     Connection signal_connect_update_helper_property (InfoManagerSlotIntProperty*         slot) {
2544         return m_signal_update_helper_property.connect (slot);
2545     }
2546
2547     Connection signal_connect_register_helper (InfoManagerSlotIntHelperInfo*       slot) {
2548         return m_signal_register_helper.connect (slot);
2549     }
2550
2551     Connection signal_connect_remove_helper (InfoManagerSlotInt*                 slot) {
2552         return m_signal_remove_helper.connect (slot);
2553     }
2554
2555     Connection signal_connect_set_active_ise_by_uuid (InfoManagerSlotStringBool*          slot) {
2556         return m_signal_set_active_ise_by_uuid.connect (slot);
2557     }
2558
2559     Connection signal_connect_focus_in (InfoManagerSlotVoid*                   slot) {
2560         return m_signal_focus_in.connect (slot);
2561     }
2562
2563     Connection signal_connect_focus_out (InfoManagerSlotVoid*                   slot) {
2564         return m_signal_focus_out.connect (slot);
2565     }
2566
2567     Connection signal_connect_expand_candidate (InfoManagerSlotVoid*                   slot) {
2568         return m_signal_expand_candidate.connect (slot);
2569     }
2570
2571     Connection signal_connect_contract_candidate (InfoManagerSlotVoid*                   slot) {
2572         return m_signal_contract_candidate.connect (slot);
2573     }
2574
2575     Connection signal_connect_select_candidate (InfoManagerSlotInt*                    slot) {
2576         return m_signal_select_candidate.connect (slot);
2577     }
2578
2579     Connection signal_connect_get_ise_list (InfoManagerSlotBoolStringVector*       slot) {
2580         return m_signal_get_ise_list.connect (slot);
2581     }
2582
2583     Connection signal_connect_get_all_helper_ise_info (InfoManagerSlotBoolHelperInfo*       slot) {
2584         return m_signal_get_all_helper_ise_info.connect (slot);
2585     }
2586
2587     Connection signal_connect_set_has_option_helper_ise_info (InfoManagerSlotStringBool*          slot) {
2588         return m_signal_set_has_option_helper_ise_info.connect (slot);
2589     }
2590
2591     Connection signal_connect_set_enable_helper_ise_info (InfoManagerSlotStringBool*          slot) {
2592         return m_signal_set_enable_helper_ise_info.connect (slot);
2593     }
2594
2595     Connection signal_connect_show_helper_ise_list (InfoManagerSlotVoid*                slot) {
2596         return m_signal_show_helper_ise_list.connect (slot);
2597     }
2598
2599     Connection signal_connect_show_helper_ise_selector (InfoManagerSlotVoid*                slot) {
2600         return m_signal_show_helper_ise_selector.connect (slot);
2601     }
2602
2603     Connection signal_connect_is_helper_ise_enabled (InfoManagerSlotStringInt*                slot) {
2604         return m_signal_is_helper_ise_enabled.connect (slot);
2605     }
2606
2607     Connection signal_connect_get_ise_information (InfoManagerSlotBoolString4int2*        slot) {
2608         return m_signal_get_ise_information.connect (slot);
2609     }
2610
2611     Connection signal_connect_get_keyboard_ise_list (InfoManagerSlotBoolStringVector*       slot) {
2612         return m_signal_get_keyboard_ise_list.connect (slot);
2613     }
2614
2615     Connection signal_connect_update_ise_geometry (InfoManagerSlotIntIntIntInt*           slot) {
2616         return m_signal_update_ise_geometry.connect (slot);
2617     }
2618
2619     Connection signal_connect_get_language_list (InfoManagerSlotStringVector*           slot) {
2620         return m_signal_get_language_list.connect (slot);
2621     }
2622
2623     Connection signal_connect_get_all_language (InfoManagerSlotStringVector*           slot) {
2624         return m_signal_get_all_language.connect (slot);
2625     }
2626
2627     Connection signal_connect_get_ise_language (InfoManagerSlotStrStringVector*        slot) {
2628         return m_signal_get_ise_language.connect (slot);
2629     }
2630
2631     Connection signal_connect_get_ise_info_by_uuid (InfoManagerSlotStringISEINFO*          slot) {
2632         return m_signal_get_ise_info_by_uuid.connect (slot);
2633     }
2634
2635     Connection signal_connect_send_key_event (InfoManagerSlotKeyEvent*               slot) {
2636         return m_signal_send_key_event.connect (slot);
2637     }
2638
2639     Connection signal_connect_accept_connection (InfoManagerSlotInt*                    slot) {
2640         return m_signal_accept_connection.connect (slot);
2641     }
2642
2643     Connection signal_connect_close_connection (InfoManagerSlotInt*                    slot) {
2644         return m_signal_close_connection.connect (slot);
2645     }
2646
2647     Connection signal_connect_exit (InfoManagerSlotVoid*                   slot) {
2648         return m_signal_exit.connect (slot);
2649     }
2650
2651     Connection signal_connect_transaction_start (InfoManagerSlotVoid*                   slot) {
2652         return m_signal_transaction_start.connect (slot);
2653     }
2654
2655     Connection signal_connect_transaction_end (InfoManagerSlotVoid*                   slot) {
2656         return m_signal_transaction_end.connect (slot);
2657     }
2658
2659     Connection signal_connect_lock (InfoManagerSlotVoid*                   slot) {
2660         return m_signal_lock.connect (slot);
2661     }
2662
2663     Connection signal_connect_unlock (InfoManagerSlotVoid*                   slot) {
2664         return m_signal_unlock.connect (slot);
2665     }
2666
2667     Connection signal_connect_update_input_context (InfoManagerSlotIntInt*                 slot) {
2668         return m_signal_update_input_context.connect (slot);
2669     }
2670
2671     Connection signal_connect_update_language_locale(InfoManagerSlotString*                 slot) {
2672         return m_signal_update_language_locale.connect(slot);
2673     }
2674
2675     Connection signal_connect_show_ise (InfoManagerSlotVoid*                slot) {
2676         return m_signal_show_ise.connect (slot);
2677     }
2678
2679     Connection signal_connect_hide_ise (InfoManagerSlotVoid*                slot) {
2680         return m_signal_hide_ise.connect (slot);
2681     }
2682
2683     Connection signal_connect_will_show_ack (InfoManagerSlotVoid*                slot) {
2684         return m_signal_will_show_ack.connect (slot);
2685     }
2686
2687     Connection signal_connect_will_hide_ack (InfoManagerSlotVoid*                slot) {
2688         return m_signal_will_hide_ack.connect (slot);
2689     }
2690
2691     Connection signal_connect_set_keyboard_mode (InfoManagerSlotInt*                slot) {
2692         return m_signal_set_keyboard_mode.connect (slot);
2693     }
2694
2695     Connection signal_connect_candidate_will_hide_ack (InfoManagerSlotVoid*                slot) {
2696         return m_signal_candidate_will_hide_ack.connect (slot);
2697     }
2698
2699     Connection signal_connect_get_ise_state (InfoManagerSlotInt2*                slot) {
2700         return m_signal_get_ise_state.connect (slot);
2701     }
2702
2703     Connection signal_connect_run_helper (InfoManagerSlotString3*                slot)
2704     {
2705         return m_signal_run_helper.connect (slot);
2706     }
2707
2708     Connection signal_connect_launch_option_application (InfoManagerSlotBoolString*                slot)
2709     {
2710         return m_signal_launch_option_application.connect (slot);
2711     }
2712
2713     Connection signal_connect_get_ise_setting_appid (InfoManagerSlotBoolString2*                slot)
2714     {
2715         return m_signal_get_ise_setting_appid.connect (slot);
2716     }
2717
2718     Connection signal_connect_get_recent_ise_geometry (InfoManagerSlotIntRect*                slot) {
2719         return m_signal_get_recent_ise_geometry.connect (slot);
2720     }
2721
2722     Connection signal_connect_check_privilege_by_sockfd  (InfoManagerSlotIntString2* slot)
2723     {
2724         return m_signal_check_privilege_by_sockfd.connect (slot);
2725     }
2726
2727     Connection signal_connect_remoteinput_send_input_message   (InfoManagerSlotStringBool*                slot)
2728     {
2729         return m_signal_remoteinput_send_input_message.connect (slot);
2730     }
2731
2732     Connection signal_connect_remoteinput_send_surrounding_text (InfoManagerSlotIntString*                slot)
2733     {
2734         return m_signal_remoteinput_send_surrounding_text.connect (slot);
2735     }
2736
2737     //ISM_TRANS_CMD_REGISTER_PANEL_CLIENT
2738     void register_panel_client (uint32 client_id, uint32 id) {
2739         m_panel_client_map [client_id] = (int)id;
2740     }
2741     //SCIM_TRANS_CMD_PANEL_REGISTER_INPUT_CONTEXT
2742     void register_input_context (uint32 client_id, uint32 context, String  uuid) {
2743         uint32 ctx = get_helper_ic (m_panel_client_map[client_id], context);
2744         m_client_context_uuids [ctx] = uuid;
2745     }
2746     //SCIM_TRANS_CMD_PANEL_REMOVE_INPUT_CONTEXT
2747     void remove_input_context (uint32 client_id, uint32 context) {
2748         uint32 ctx = get_helper_ic (m_panel_client_map[client_id], context);
2749         m_client_context_uuids.erase (ctx);
2750
2751         if (ctx == get_helper_ic (m_current_socket_client, m_current_client_context)) {
2752             lock ();
2753             m_current_socket_client  = m_last_socket_client;
2754             m_current_client_context = m_last_client_context;
2755             m_current_context_uuid   = m_last_context_uuid;
2756             m_last_socket_client     = -1;
2757             m_last_client_context    = 0;
2758             m_last_context_uuid      = String ("");
2759
2760             if (m_current_socket_client == -1) {
2761                 unlock ();
2762                 socket_update_control_panel ();
2763             } else {
2764                 unlock ();
2765             }
2766         } else if (ctx == get_helper_ic (m_last_socket_client, m_last_client_context)) {
2767             lock ();
2768             m_last_socket_client  = -1;
2769             m_last_client_context = 0;
2770             m_last_context_uuid   = String ("");
2771             unlock ();
2772         }
2773     }
2774
2775     //SCIM_TRANS_CMD_PANEL_RESET_INPUT_CONTEXT
2776     void socket_reset_input_context (int client_id, uint32 context) {
2777         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_reset_input_context \n";
2778
2779         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
2780             socket_reset_helper_input_context (m_current_helper_uuid, m_panel_client_map[client_id], context);
2781     }
2782
2783     //SCIM_TRANS_CMD_FOCUS_IN
2784     void focus_in (int client_id, uint32 context,  String  uuid) {
2785         m_refocus_needed = true;
2786         bool launch_ise_on_request = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_LAUNCH_ISE_ON_REQUEST), false);
2787         if (launch_ise_on_request)
2788             m_signal_start_default_ise ();
2789
2790         m_signal_focus_in ();
2791         focus_in_helper (m_current_helper_uuid, m_panel_client_map[client_id], context);
2792         SCIM_DEBUG_MAIN (2) << "PanelAgent::focus_in (" << client_id << "," << context << "," << uuid << ")\n";
2793         m_active_client_id = client_id;
2794         lock ();
2795
2796         if (m_current_socket_client >= 0) {
2797             m_last_socket_client  = m_current_socket_client;
2798             m_last_client_context = m_current_client_context;
2799             m_last_context_uuid   = m_current_context_uuid;
2800         }
2801
2802         m_current_socket_client  = m_panel_client_map[client_id];
2803         m_current_client_context = context;
2804         m_current_context_uuid   = uuid;
2805         unlock ();
2806     }
2807
2808     //SCIM_TRANS_CMD_FOCUS_OUT
2809     void focus_out (int client_id, uint32 context) {
2810         m_refocus_needed = false;
2811         m_signal_focus_out ();
2812         lock ();
2813         focus_out_helper (m_current_helper_uuid, m_panel_client_map[client_id], context);
2814
2815         if (m_current_socket_client >= 0) {
2816             m_last_socket_client  = m_current_socket_client;
2817             m_last_client_context = m_current_client_context;
2818             m_last_context_uuid   = m_current_context_uuid;
2819         }
2820
2821         m_current_socket_client  = -1;
2822         m_current_client_context = 0;
2823         m_current_context_uuid   = String ("");
2824         unlock ();
2825
2826         /* Release ISE context & IMDATA buffer */
2827         delete_imdata_buffer ();
2828         delete_ise_context_buffer ();
2829     }
2830
2831     //ISM_TRANS_CMD_TURN_ON_LOG
2832     void socket_turn_on_log (uint32 isOn) {
2833         if (isOn) {
2834             DebugOutput::enable_debug (SCIM_DEBUG_AllMask);
2835             DebugOutput::set_verbose_level (7);
2836             SCIM_DEBUG_MAIN (4) << __func__ << " on\n";
2837         } else {
2838             SCIM_DEBUG_MAIN (4) << __func__ << " off\n";
2839             DebugOutput::disable_debug (SCIM_DEBUG_AllMask);
2840             DebugOutput::set_verbose_level (0);
2841         }
2842
2843         int     focused_client;
2844         uint32  focused_context;
2845         get_focused_context (focused_client, focused_context);
2846
2847         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
2848             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
2849
2850             if (it != m_helper_client_index.end ()) {
2851                 //uint32 ctx = get_helper_ic (focused_client, focused_context);
2852                 //FIXME
2853                 //m_panel_agent_manager.socket_turn_on_log (it->second.id, ctx, m_current_helper_uuid, isOn);
2854             }
2855         }
2856
2857         if (focused_client == -1) {
2858             std::cerr << __func__ << " get_focused_context is failed!!!\n";
2859             return;
2860         }
2861
2862         ClientInfo client_info = socket_get_client_info (focused_client);
2863
2864         if (client_info.type == FRONTEND_CLIENT) {
2865             //FIXME
2866             //m_panel_agent_manager.socket_turn_on_log (focused_client, focused_context, isOn);
2867         }
2868     }
2869
2870
2871     void add_client (int client_id, uint32 key, ClientType type) {
2872         LOGD ("id:%d, key:%d, type:%d", client_id, key, type);
2873         ClientInfo info;
2874         info.key = key;
2875         info.type = type;
2876         SCIM_DEBUG_MAIN (4) << "Add client to repository. Type=" << type << " key=" << key << "\n";
2877         lock ();
2878         m_client_repository [client_id] = info;
2879
2880         if (info.type == HELPER_CLIENT || info.type == HELPER_ACT_CLIENT)
2881             m_is_ise_alive = true;
2882
2883         if (info.type == IMCONTROL_ACT_CLIENT) {
2884             m_pending_active_imcontrol_id = client_id;
2885         } else if (info.type == IMCONTROL_CLIENT) {
2886             m_imcontrol_map [m_pending_active_imcontrol_id] = client_id;
2887             m_pending_active_imcontrol_id = -1;
2888         } else if (info.type == REMOTEINPUT_ACT_CLIENT) {
2889             m_current_send_remoteinput_id.push_back (client_id);
2890         } else if (info.type == REMOTEINPUT_CLIENT) {
2891             m_current_recv_remoteinput_id.push_back (client_id);
2892         }
2893
2894         LOGD ("%zu clients connecting", m_client_repository.size());
2895
2896         unlock ();
2897     }
2898
2899     void del_client (int client_id) {
2900         ClientRepository::iterator iter = m_client_repository.find(client_id);
2901         if (iter == m_client_repository.end()) {
2902             LOGW("The client with id %d does not exist in our client repository, returning", client_id);
2903             return;
2904         }
2905         lock ();
2906         m_signal_close_connection (client_id);
2907         ClientInfo client_info = socket_get_client_info (client_id);
2908         m_client_repository.erase (client_id);
2909         LOGD ("id:%d, type:%d", client_id, client_info.type);
2910 #ifdef PANEL_SERVER_AUTO_EXIT
2911         /* Exit panel if there is no connected client anymore. */
2912         if (client_info.type != UNKNOWN_CLIENT && m_client_repository.size () == 0 && !m_should_resident) {
2913             SCIM_DEBUG_MAIN (4) << "Exit Socket Server Thread.\n";
2914             server->shutdown ();
2915             m_signal_exit.emit ();
2916         }
2917 #endif
2918         unlock ();
2919
2920         if (client_info.type == FRONTEND_CLIENT) {
2921             SCIM_DEBUG_MAIN (4) << "It's a FrontEnd client.\n";
2922
2923             /* The focused client is closed. */
2924             if (m_current_socket_client == client_id) {
2925                 if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
2926                     hide_helper (m_current_helper_uuid);
2927
2928                 lock ();
2929                 m_current_socket_client = -1;
2930                 m_current_client_context = 0;
2931                 m_current_context_uuid = String ("");
2932                 unlock ();
2933                 socket_transaction_start ();
2934                 socket_turn_off ();
2935                 socket_transaction_end ();
2936             }
2937
2938             if (m_last_socket_client == client_id) {
2939                 lock ();
2940                 m_last_socket_client = -1;
2941                 m_last_client_context = 0;
2942                 m_last_context_uuid = String ("");
2943                 unlock ();
2944             }
2945
2946             /* Erase all associated Client Context UUIDs. */
2947             std::vector <uint32> ctx_list;
2948             ClientContextUUIDRepository::iterator it = m_client_context_uuids.begin ();
2949
2950             for (; it != m_client_context_uuids.end (); ++it) {
2951                 if ((it->first & 0xFFFF) == (client_id & 0xFFFF))
2952                     ctx_list.push_back (it->first);
2953             }
2954
2955             for (size_t i = 0; i < ctx_list.size (); ++i)
2956                 m_client_context_uuids.erase (ctx_list [i]);
2957
2958             /* Erase all helperise info associated with the client */
2959             ctx_list.clear ();
2960             it = m_client_context_helper.begin ();
2961
2962             for (; it != m_client_context_helper.end (); ++it) {
2963                 if ((it->first & 0xFFFF) == (client_id & 0xFFFF)) {
2964                     ctx_list.push_back (it->first);
2965                     /* similar to stop_helper except that it will not call get_focused_context() */
2966                     String uuid = it->second;
2967
2968                     if (m_helper_uuid_count.find (uuid) != m_helper_uuid_count.end ()) {
2969                         uint32 count = m_helper_uuid_count[uuid];
2970
2971                         if (1 == count) {
2972                             m_helper_uuid_count.erase (uuid);
2973                             HelperClientIndex::iterator pise = m_helper_client_index.find (uuid);
2974
2975                             if (pise != m_helper_client_index.end ()) {
2976                                 stop_helper (uuid, pise->second.id, it->first);
2977                             }
2978
2979                             SCIM_DEBUG_MAIN (1) << "Stop HelperISE " << uuid << " ...\n";
2980                         } else {
2981                             m_helper_uuid_count[uuid] = count - 1;
2982                             focus_out_helper (uuid, (it->first & 0xFFFF), ((it->first >> 16) & 0x7FFF));
2983                             SCIM_DEBUG_MAIN (1) << "Decrement usage count of HelperISE " << uuid
2984                                                 << " to " << m_helper_uuid_count[uuid] << "\n";
2985                         }
2986                     }
2987                 }
2988             }
2989
2990             for (size_t i = 0; i < ctx_list.size (); ++i)
2991                 m_client_context_helper.erase (ctx_list [i]);
2992
2993             HelperInfoRepository::iterator iter = m_helper_info_repository.begin ();
2994
2995             for (; iter != m_helper_info_repository.end (); iter++) {
2996                 if (!m_current_helper_uuid.compare (iter->second.uuid))
2997                     if (! (iter->second.option & ISM_ISE_HIDE_IN_CONTROL_PANEL))
2998                         socket_update_control_panel ();
2999             }
3000         } else if (client_info.type == FRONTEND_ACT_CLIENT) {
3001             SCIM_DEBUG_MAIN (4) << "It's a FRONTEND_ACT_CLIENT client.\n";
3002             IntIntRepository::iterator iter2 = m_panel_client_map.find (client_id);
3003
3004             if (iter2 != m_panel_client_map.end ())
3005                 m_panel_client_map.erase (iter2);
3006         } else if (client_info.type == HELPER_CLIENT) {
3007             SCIM_DEBUG_MAIN (4) << "It's a Helper client.\n";
3008             lock ();
3009             HelperInfoRepository::iterator hiit = m_helper_info_repository.find (client_id);
3010
3011             bool launch_ise_on_request = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_LAUNCH_ISE_ON_REQUEST), false);
3012             bool enable_auto_restart = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_ENABLE_AUTO_RESTART_ISE), true);
3013             if (hiit != m_helper_info_repository.end ()) {
3014                 bool restart = false;
3015                 String uuid = hiit->second.uuid;
3016                 HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
3017
3018                 String default_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
3019                 if ((hiit->second.option & SCIM_HELPER_AUTO_RESTART) &&
3020                     (default_uuid.compare (uuid) == 0 || default_uuid.compare ("") == 0) &&
3021                     (it != m_helper_client_index.end () && it->second.ref > 0)) {
3022                     restart = true;
3023                 }
3024
3025                 m_helper_client_index.erase (uuid);
3026                 m_helper_info_repository.erase (hiit);
3027
3028                 m_signal_stop_default_ise (false);
3029
3030                 if ((m_refocus_needed || m_reshow_needed || !launch_ise_on_request) && enable_auto_restart)
3031                     m_restart_needed = true;
3032
3033                 if (restart && !m_ise_exiting && m_restart_needed) {
3034                     struct tms     tiks_buf;
3035                     static clock_t start_tiks = times (&tiks_buf);
3036                     static clock_t  clock_tiks = sysconf (_SC_CLK_TCK);
3037                     clock_t curr_tiks = times (&tiks_buf);
3038                     clock_t  secs = (curr_tiks - start_tiks) / clock_tiks;
3039                     //LOGE ("time second:%f", secs);
3040                     static String  restart_uuid;
3041
3042                     if (restart_uuid != uuid || secs > MIN_REPEAT_TIME) {
3043                         scim_usleep (100000);
3044
3045                         int    client;
3046                         uint32 context;
3047                         get_focused_context(client, context);
3048
3049                         uint32 ic = get_helper_ic (client, context);
3050                         String ic_uuid;
3051                         /* Get the context uuid from the client context registration table. */
3052                         {
3053                             ClientContextUUIDRepository::iterator it =
3054                                 m_client_context_uuids.find (get_helper_ic (m_panel_client_map[client], context));
3055
3056                             if (it != m_client_context_uuids.end ())
3057                                 ic_uuid = it->second;
3058                         }
3059
3060                         m_start_helper_ic_index[uuid].push_back(std::make_pair(ic, ic_uuid));
3061                         m_signal_run_helper (uuid, m_config_name, m_display_name);
3062                         restart_uuid = uuid;
3063                         LOGE ("Auto restart soft ISE:%s", uuid.c_str ());
3064                     } else {
3065                         reset_default_ise (0);
3066                         ISF_SAVE_LOG ("Auto restart is abnormal, reset default ISE");
3067                     }
3068
3069                     start_tiks = curr_tiks;
3070                 }
3071             }
3072
3073             m_ise_exiting = false;
3074             m_restart_needed = launch_ise_on_request ? false : true;
3075             unlock ();
3076             socket_transaction_start ();
3077             m_signal_remove_helper (client_id);
3078             socket_transaction_end ();
3079         } else if (client_info.type == HELPER_ACT_CLIENT) {
3080             SCIM_DEBUG_MAIN (4) << "It's a Helper passive client.\n";
3081             lock ();
3082             HelperInfoRepository::iterator hiit = m_helper_active_info_repository.find (client_id);
3083
3084             if (hiit != m_helper_active_info_repository.end ()) {
3085                 if (hiit->second.uuid == m_current_helper_uuid)
3086                     m_is_ise_alive = false;
3087
3088                 m_helper_active_info_repository.erase (hiit);
3089             }
3090
3091             unlock ();
3092         } else if (client_info.type == IMCONTROL_ACT_CLIENT) {
3093             SCIM_DEBUG_MAIN (4) << "It's a IMCONTROL_ACT_CLIENT client.\n";
3094             IMControlRepository::iterator iter = m_imcontrol_repository.find (client_id);
3095
3096             if (iter != m_imcontrol_repository.end ()) {
3097                 int size = iter->second.info.size ();
3098                 int i = 0;
3099
3100                 while (i < size) {
3101                     stop_helper ((iter->second.info)[i].uuid, (iter->second.count)[i], DEFAULT_CONTEXT_VALUE);
3102
3103                     if ((iter->second.info)[i].option & ISM_ISE_HIDE_IN_CONTROL_PANEL)
3104                         m_current_helper_uuid = m_last_helper_uuid;
3105
3106                     i++;
3107                 }
3108
3109                 m_imcontrol_repository.erase (iter);
3110             }
3111
3112             IntIntRepository::iterator iter2 = m_imcontrol_map.find (client_id);
3113
3114             if (iter2 != m_imcontrol_map.end ())
3115                 m_imcontrol_map.erase (iter2);
3116         } else if (client_info.type == REMOTEINPUT_ACT_CLIENT) {
3117             SCIM_DEBUG_MAIN (4) << "It's a REMOTEINPUT_ACT_CLIENT client.\n";
3118
3119             for (unsigned int i = 0; i < m_current_send_remoteinput_id.size (); i++) {
3120                 if (m_current_send_remoteinput_id.at (i) == client_id) {
3121                     m_current_send_remoteinput_id.erase (m_current_send_remoteinput_id.begin () + i);
3122                     break;
3123                 }
3124             }
3125         } else if (client_info.type == REMOTEINPUT_CLIENT) {
3126             SCIM_DEBUG_MAIN (4) << "It's a REMOTEINPUT_CLIENT client.\n";
3127
3128             for (unsigned int i = 0; i < m_current_recv_remoteinput_id.size (); i++) {
3129                 if (m_current_recv_remoteinput_id.at (i) == client_id) {
3130                     m_current_recv_remoteinput_id.erase (m_current_recv_remoteinput_id.begin () + i);
3131                     break;
3132                 }
3133             }
3134         } else if (client_info.type == CONFIG_CLIENT) {
3135             SCIM_DEBUG_MAIN(4) << "It's a CONFIG_CLIENT client.\n";
3136         }
3137         LOGI ("clients: %zu, panel clients: %zu, imcontrols size: %zu, helper infos: %zu, \
3138 helper active infos: %zu, helper client indexes: %zu, ises pending: %zu, \
3139 imcontrols: %zu, start helper ic indexes: %zu, client context uuids: %zu, \
3140 client context helpers: %zu, helpers uuid count: %zu",
3141                m_client_repository.size(),
3142                m_panel_client_map.size(),
3143                m_imcontrol_map.size(),
3144                m_helper_info_repository.size(),
3145                m_helper_active_info_repository.size(),
3146                m_helper_client_index.size(),
3147                m_ise_pending_repository.size(),
3148                m_imcontrol_repository.size(),
3149                m_start_helper_ic_index.size(),
3150                m_client_context_uuids.size(),
3151                m_client_context_helper.size(),
3152                m_helper_uuid_count.size());
3153     }
3154
3155     const ClientInfo& socket_get_client_info (int client) {
3156         static ClientInfo null_client = { 0, UNKNOWN_CLIENT };
3157         ClientRepository::iterator it = m_client_repository.find (client);
3158
3159         if (it != m_client_repository.end ())
3160             return it->second;
3161
3162         return null_client;
3163     }
3164
3165     //SCIM_TRANS_CMD_PANEL_TURN_ON
3166     void socket_turn_on (void) {
3167         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_turn_on ()\n";
3168         m_signal_turn_on ();
3169     }
3170     //SCIM_TRANS_CMD_PANEL_TURN_OFF
3171     void socket_turn_off (void) {
3172         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_turn_off ()\n";
3173         m_signal_turn_off ();
3174     }
3175     //SCIM_TRANS_CMD_UPDATE_SCREEN
3176     void socket_update_screen (int client_id, uint32 num) {
3177         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_screen ()\n";
3178
3179         if (((int) num) != m_current_screen) {
3180             SCIM_DEBUG_MAIN (4) << "New Screen number = " << num << "\n";
3181             m_signal_update_screen ((int) num);
3182             helper_all_update_screen ((int) num);
3183             m_current_screen = (num);
3184         }
3185     }
3186     //SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION
3187     void socket_update_spot_location (uint32 x, uint32 y, uint32 top_y) {
3188         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_spot_location ()\n";
3189         SCIM_DEBUG_MAIN (4) << "New Spot location x=" << x << " y=" << y << "\n";
3190         m_signal_update_spot_location ((int)x, (int)y, (int)top_y);
3191         helper_all_update_spot_location ((int)x, (int)y);
3192     }
3193     //ISM_TRANS_CMD_UPDATE_CURSOR_POSITION
3194     void socket_update_cursor_position (uint32 cursor_pos) {
3195         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_cursor_position ()\n";
3196         SCIM_DEBUG_MAIN (4) << "New cursor position pos=" << cursor_pos << "\n";
3197         if (m_ise_context_buffer != NULL && m_ise_context_length > 0) {
3198             Ise_Context *iseContext = reinterpret_cast<Ise_Context *>(m_ise_context_buffer);
3199             iseContext->cursor_pos = static_cast<int>(cursor_pos);
3200         }
3201         helper_all_update_cursor_position ((int)cursor_pos);
3202     }
3203     //ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT
3204     void socket_update_surrounding_text (String text, uint32 cursor) {
3205         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
3206         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
3207
3208         if (it != m_helper_client_index.end ()) {
3209             int    client;
3210             uint32 context;
3211             uint32 ctx;
3212             lock ();
3213             get_focused_context (client, context);
3214             ctx = get_helper_ic (client, context);
3215             m_panel_agent_manager.socket_update_surrounding_text (it->second.id, ctx, m_current_helper_uuid, text, cursor);
3216             unlock ();
3217         }
3218     }
3219
3220     void remoteinput_callback_focus_in () {
3221         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
3222
3223         for (unsigned int i = 0; i < m_current_recv_remoteinput_id.size (); i++) {
3224             lock();
3225             m_panel_agent_manager.socket_remoteinput_focus_in (m_current_recv_remoteinput_id.at (i));
3226             unlock ();
3227         }
3228     }
3229
3230     void remoteinput_callback_focus_out () {
3231         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
3232
3233         for (unsigned int i = 0; i < m_current_recv_remoteinput_id.size (); i++) {
3234             lock();
3235             m_panel_agent_manager.socket_remoteinput_focus_out (m_current_recv_remoteinput_id.at (i));
3236             unlock ();
3237         }
3238     }
3239
3240     void remoteinput_callback_entry_metadata (uint32 hint, uint32 layout, int variation, uint32 autocapital_type, int return_key_disabled, uint32 return_key_type) {
3241         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
3242         if (m_ise_context_buffer != NULL && m_ise_context_length > 0) {
3243             Ise_Context *iseContext = reinterpret_cast<Ise_Context *>(m_ise_context_buffer);
3244             iseContext->layout = static_cast<Ecore_IMF_Input_Panel_Layout>(layout);
3245             iseContext->return_key_type = static_cast<Ecore_IMF_Input_Panel_Return_Key_Type>(return_key_type);
3246             iseContext->return_key_disabled = static_cast<Eina_Bool>(return_key_disabled);
3247             iseContext->layout_variation = static_cast<int>(variation);
3248             iseContext->autocapital_type = static_cast<Ecore_IMF_Autocapital_Type>(autocapital_type);
3249             iseContext->input_hint = static_cast<Ecore_IMF_Input_Hints>(hint);
3250         }
3251         for (unsigned int i = 0; i < m_current_recv_remoteinput_id.size (); i++) {
3252             lock();
3253             m_panel_agent_manager.socket_remoteinput_entry_metadata (m_current_recv_remoteinput_id.at (i), hint, layout, variation, autocapital_type, return_key_disabled, return_key_type);
3254             unlock ();
3255         }
3256     }
3257
3258     void remoteinput_callback_surrounding_text (String text, uint32 cursor) {
3259         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
3260
3261         for (unsigned int i = 0; i < m_current_recv_remoteinput_id.size (); i++) {
3262             lock();
3263             m_panel_agent_manager.socket_remoteinput_surrounding_text (m_current_recv_remoteinput_id.at (i), text, cursor);
3264             unlock ();
3265         }
3266     }
3267
3268     void remoteinput_callback_input_resource (uint32 input_resource) {
3269         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
3270
3271         for (unsigned int i = 0; i < m_current_recv_remoteinput_id.size (); i++) {
3272             lock();
3273             m_panel_agent_manager.socket_remoteinput_input_resource (m_current_recv_remoteinput_id.at (i), input_resource);
3274             unlock ();
3275         }
3276     }
3277
3278     void remoteinput_callback_key_symbol (String key_symbol, int press, uint32 timestamp) {
3279         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
3280
3281         for (unsigned int i = 0; i < m_current_recv_remoteinput_id.size (); i++) {
3282             lock();
3283             m_panel_agent_manager.socket_remoteinput_key_symbol (m_current_recv_remoteinput_id.at (i), key_symbol, press, timestamp);
3284             unlock ();
3285         }
3286     }
3287
3288     void remoteinput_callback_cursor_position (uint32 cursor) {
3289         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
3290
3291         for (unsigned int i = 0; i < m_current_recv_remoteinput_id.size (); i++) {
3292             lock();
3293             m_panel_agent_manager.socket_remoteinput_cursor_position (m_current_recv_remoteinput_id.at (i), cursor);
3294             unlock ();
3295         }
3296     }
3297
3298     //ISM_TRANS_CMD_UPDATE_SELECTION
3299     void socket_update_selection (String text) {
3300         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
3301         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
3302
3303         if (it != m_helper_client_index.end ()) {
3304             int    client;
3305             uint32 context;
3306             uint32 ctx;
3307             lock ();
3308             get_focused_context (client, context);
3309             ctx = get_helper_ic (client, context);
3310             m_panel_agent_manager.socket_update_selection (it->second.id, ctx, m_current_helper_uuid, text);
3311             unlock ();
3312         }
3313     }
3314     //SCIM_TRANS_CMD_PANEL_UPDATE_FACTORY_INFO
3315     void socket_update_factory_info (PanelFactoryInfo& info) {
3316         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_factory_info ()\n";
3317         SCIM_DEBUG_MAIN (4) << "New Factory info uuid=" << info.uuid << " name=" << info.name << "\n";
3318         info.lang = scim_get_normalized_language (info.lang);
3319         m_signal_update_factory_info (info);
3320     }
3321     //SCIM_TRANS_CMD_PANEL_SHOW_HELP
3322     void socket_show_help (String help) {
3323         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_show_help ()\n";
3324         m_signal_show_help (help);
3325     }
3326     //SCIM_TRANS_CMD_PANEL_SHOW_FACTORY_MENU
3327     void socket_show_factory_menu (std::vector <PanelFactoryInfo>& vec) {
3328         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_show_factory_menu ()\n";
3329
3330         if (vec.size ())
3331             m_signal_show_factory_menu (vec);
3332     }
3333
3334     //SCIM_TRANS_CMD_SHOW_PREEDIT_STRING
3335     void socket_show_preedit_string (void) {
3336         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_show_preedit_string ()\n";
3337         m_signal_show_preedit_string ();
3338     }
3339     //SCIM_TRANS_CMD_SHOW_AUX_STRING
3340     void socket_show_aux_string (void) {
3341         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_show_aux_string ()\n";
3342         m_signal_show_aux_string ();
3343     }
3344     //SCIM_TRANS_CMD_SHOW_LOOKUP_TABLE
3345     void socket_show_lookup_table (void) {
3346         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_show_lookup_table ()\n";
3347
3348         if (m_ise_context_buffer != NULL && m_ise_context_length > 0) {
3349             Ise_Context *iseContext = reinterpret_cast<Ise_Context *>(m_ise_context_buffer);
3350             if (iseContext->layout == ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD || iseContext->input_hint & ECORE_IMF_INPUT_HINT_SENSITIVE_DATA)
3351                 return;
3352         }
3353
3354         m_signal_show_lookup_table ();
3355     }
3356     //ISM_TRANS_CMD_SHOW_ASSOCIATE_TABLE
3357     void socket_show_associate_table (void) {
3358         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_show_associate_table ()\n";
3359         m_signal_show_associate_table ();
3360     }
3361     //SCIM_TRANS_CMD_HIDE_PREEDIT_STRING
3362     void socket_hide_preedit_string (void) {
3363         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_hide_preedit_string ()\n";
3364         m_signal_hide_preedit_string ();
3365     }
3366     //SCIM_TRANS_CMD_HIDE_AUX_STRING
3367     void socket_hide_aux_string (void) {
3368         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_hide_aux_string ()\n";
3369         m_signal_hide_aux_string ();
3370     }
3371     //SCIM_TRANS_CMD_HIDE_LOOKUP_TABLE
3372     void socket_hide_lookup_table (void) {
3373         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_hide_lookup_table ()\n";
3374         m_signal_hide_lookup_table ();
3375     }
3376     //ISM_TRANS_CMD_HIDE_ASSOCIATE_TABLE
3377     void socket_hide_associate_table (void) {
3378         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_hide_associate_table ()\n";
3379         m_signal_hide_associate_table ();
3380     }
3381     //SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING
3382     void socket_update_preedit_string (String& str, const AttributeList& attrs, uint32 caret) {
3383         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_preedit_string ()\n";
3384         m_signal_update_preedit_string (str, attrs, (int) caret);
3385     }
3386     //SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET
3387     void socket_update_preedit_caret (uint32 caret) {
3388         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_preedit_caret ()\n";
3389         m_signal_update_preedit_caret ((int) caret);
3390     }
3391     //ISM_TRANS_CMD_RECAPTURE_STRING
3392     void socket_recapture_string (int offset, int len, String& preedit, String& commit, const AttributeList& attrs) {
3393         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_preedit_caret ()\n";
3394         m_signal_recapture_string (offset, len, preedit, commit, attrs);
3395     }
3396     //SCIM_TRANS_CMD_UPDATE_AUX_STRING
3397     void socket_update_aux_string (String& str, const AttributeList& attrs) {
3398         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_aux_string ()\n";
3399         m_signal_update_aux_string (str, attrs);
3400         m_is_imengine_aux = true;
3401     }
3402     //SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE
3403     void socket_update_lookup_table (const LookupTable& table) {
3404         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_lookup_table ()\n";
3405         //FIXME:
3406         //g_isf_candidate_table = _isf_candidate_table;
3407         m_signal_update_lookup_table (table);
3408         m_is_imengine_candidate = true;
3409     }
3410     //ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE
3411     void socket_update_associate_table (const LookupTable& table) {
3412         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_associate_table ()\n";
3413         m_signal_update_associate_table (table);
3414     }
3415
3416     void socket_update_control_panel (void) {
3417         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_control_panel ()\n";
3418         String name, uuid;
3419         m_signal_get_keyboard_ise (name, uuid);
3420         PanelFactoryInfo info;
3421
3422         if (name.length () > 0)
3423             info = PanelFactoryInfo (uuid, name, String (""), String (""));
3424         else
3425             info = PanelFactoryInfo (String (""), String (_ ("English Keyboard")), String ("C"), String (SCIM_KEYBOARD_ICON_FILE));
3426
3427         m_signal_update_factory_info (info);
3428     }
3429     //SCIM_TRANS_CMD_REGISTER_PROPERTIES
3430     void socket_register_properties (const PropertyList& properties) {
3431         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_register_properties ()\n";
3432         m_signal_register_properties (properties);
3433     }
3434     //SCIM_TRANS_CMD_UPDATE_PROPERTY
3435     void socket_update_property (const Property& property) {
3436         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_property ()\n";
3437         m_signal_update_property (property);
3438     }
3439     //ISM_TRANS_CMD_GET_KEYBOARD_ISE_LIST
3440     void socket_get_keyboard_ise_list (String& uuid) {
3441         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_get_keyboard_ise_list ()\n";
3442         std::vector<String> list;
3443         list.clear ();
3444         m_signal_get_keyboard_ise_list (list);
3445         HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
3446
3447         if (it != m_helper_client_index.end ()) {
3448             int    client;
3449             uint32 context;
3450             get_focused_context (client, context);
3451             uint32 ctx = get_helper_ic (client, context);
3452             m_panel_agent_manager.socket_get_keyboard_ise_list (it->second.id, ctx, uuid, list);
3453         }
3454     }
3455     //ISM_TRANS_CMD_SET_CANDIDATE_UI
3456     void socket_set_candidate_ui (uint32 portrait_line, uint32 mode) {
3457         SCIM_DEBUG_MAIN (4) << __func__ << " \n";
3458         m_signal_set_candidate_ui (portrait_line, mode);
3459     }
3460     //ISM_TRANS_CMD_GET_CANDIDATE_UI
3461     void socket_get_candidate_ui (String uuid) {
3462         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_get_candidate_ui ()\n";
3463         int style = 0, mode = 0;
3464         m_signal_get_candidate_ui (style, mode);
3465         HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
3466
3467         if (it != m_helper_client_index.end ()) {
3468             int    client;
3469             uint32 context;
3470             get_focused_context (client, context);
3471             uint32 ctx = get_helper_ic (client, context);
3472             m_panel_agent_manager.socket_get_candidate_ui (it->second.id, ctx, uuid, style, mode);
3473         }
3474     }
3475     //ISM_TRANS_CMD_SET_CANDIDATE_POSITION
3476     void socket_set_candidate_position (uint32 left, uint32 top) {
3477         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_set_candidate_position ()\n";
3478         m_signal_set_candidate_position (left, top);
3479     }
3480     //ISM_TRANS_CMD_HIDE_CANDIDATE
3481     void socket_hide_candidate (void) {
3482         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_hide_candidate ()\n";
3483         m_signal_hide_preedit_string ();
3484         m_signal_hide_aux_string ();
3485         m_signal_hide_lookup_table ();
3486         m_signal_hide_associate_table ();
3487     }
3488     //ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY
3489     void socket_get_candidate_geometry (String& uuid) {
3490         SCIM_DEBUG_MAIN (4) << __func__ << " \n";
3491         HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
3492
3493         if (it != m_helper_client_index.end ()) {
3494             struct rectinfo info = {0, 0, 0, 0};
3495             m_signal_get_candidate_geometry (info);
3496             int    client;
3497             uint32 context;
3498             get_focused_context (client, context);
3499             uint32 ctx = get_helper_ic (client, context);
3500             m_panel_agent_manager.socket_get_candidate_geometry (it->second.id, ctx, uuid, info);
3501         }
3502     }
3503     //ISM_TRANS_CMD_SET_KEYBOARD_ISE_BY_UUID
3504     void socket_set_keyboard_ise (String uuid) {
3505         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_set_keyboard_ise ()\n";
3506         LOGD ("");
3507         m_signal_set_keyboard_ise (uuid);
3508     }
3509     //ISM_TRANS_CMD_SELECT_CANDIDATE
3510     void socket_helper_select_candidate (uint32 index) {
3511         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_set_keyboard_ise ()\n";
3512         LOGD ("");
3513         m_signal_select_candidate (index);
3514     }
3515     //ISM_TRANS_CMD_UPDATE_ISE_GEOMETRY
3516     void socket_helper_update_ise_geometry (int client, uint32 x, uint32 y, uint32 width, uint32 height) {
3517         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
3518         LOGD ("");
3519         int    focused_client;
3520         uint32 focused_context;
3521         HelperInfoRepository::iterator it = m_helper_active_info_repository.find (client);
3522
3523         if (it != m_helper_active_info_repository.end ()) {
3524             if (it->second.uuid == m_current_helper_uuid) {
3525                 m_signal_update_ise_geometry (x, y, width, height);
3526
3527                 get_focused_context (focused_client, focused_context);
3528                 ClientInfo client_info = socket_get_client_info (focused_client);
3529                 if (client_info.type == FRONTEND_CLIENT) {
3530                     m_panel_agent_manager.update_ise_geometry (focused_client, focused_context, x, y, width, height);
3531                 }
3532             }
3533         }
3534     }
3535     //ISM_TRANS_CMD_GET_KEYBOARD_ISE
3536     void socket_get_keyboard_ise (String uuid) {
3537         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_get_keyboard_ise ()\n";
3538         String ise_name, ise_uuid;
3539         int    client  = -1;
3540         uint32 context = 0;
3541         uint32 ctx     = 0;
3542         get_focused_context (client, context);
3543         ctx = get_helper_ic (client, context);
3544
3545         if (m_client_context_uuids.find (ctx) != m_client_context_uuids.end ())
3546             ise_uuid = m_client_context_uuids[ctx];
3547
3548         m_signal_get_keyboard_ise (ise_name, ise_uuid);
3549         HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
3550
3551         if (it != m_helper_client_index.end ()) {
3552             get_focused_context (client, context);
3553             ctx = get_helper_ic (client, context);
3554             m_panel_agent_manager.socket_get_keyboard_ise (it->second.id, ctx, uuid, ise_name, ise_uuid);
3555         }
3556     }
3557
3558     //SCIM_TRANS_CMD_START_HELPER
3559     void socket_start_helper (int client_id, uint32 context, String uuid) {
3560         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_start_helper ()\n";
3561         HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
3562         lock ();
3563         uint32 ic = get_helper_ic (m_panel_client_map[client_id], context);
3564         String ic_uuid;
3565         /* Get the context uuid from the client context registration table. */
3566         {
3567             ClientContextUUIDRepository::iterator it = m_client_context_uuids.find (get_helper_ic (m_panel_client_map[client_id], context));
3568
3569             if (it != m_client_context_uuids.end ())
3570                 ic_uuid = it->second;
3571         }
3572
3573         if (m_current_socket_client == m_panel_client_map[client_id] && m_current_client_context == context) {
3574             if (!ic_uuid.length ()) ic_uuid = m_current_context_uuid;
3575         } else if (m_last_socket_client == m_panel_client_map[client_id] && m_last_client_context == context) {
3576             if (!ic_uuid.length ()) ic_uuid = m_last_context_uuid;
3577         }
3578
3579         if (it == m_helper_client_index.end ()) {
3580             SCIM_DEBUG_MAIN (5) << "Run this Helper.\n";
3581             m_start_helper_ic_index [uuid].push_back (std::make_pair (ic, ic_uuid));
3582             m_signal_run_helper (uuid, m_config_name, m_display_name);
3583         } else {
3584             SCIM_DEBUG_MAIN (5) << "Increase the Reference count.\n";
3585             m_panel_agent_manager.socket_start_helper (it->second.id, ic, ic_uuid);
3586             ++ it->second.ref;
3587         }
3588
3589         unlock ();
3590     }
3591     //SCIM_TRANS_CMD_STOP_HELPER
3592     void socket_stop_helper (int client_id, uint32 context, String uuid) {
3593         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_stop_helper ()\n";
3594         HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
3595         lock ();
3596         uint32 ic = get_helper_ic (m_panel_client_map[client_id], context);
3597
3598         if (it != m_helper_client_index.end ()) {
3599             SCIM_DEBUG_MAIN (5) << "Decrease the Reference count.\n";
3600             -- it->second.ref;
3601             String ic_uuid;
3602             /* Get the context uuid from the client context registration table. */
3603             {
3604                 ClientContextUUIDRepository::iterator it = m_client_context_uuids.find (get_helper_ic (m_panel_client_map[client_id], context));
3605
3606                 if (it != m_client_context_uuids.end ())
3607                     ic_uuid = it->second;
3608             }
3609
3610             if (m_current_socket_client == m_panel_client_map[client_id] && m_current_client_context == context) {
3611                 if (!ic_uuid.length ()) ic_uuid = m_current_context_uuid;
3612             } else if (m_last_socket_client == m_panel_client_map[client_id] && m_last_client_context == context) {
3613                 if (!ic_uuid.length ()) ic_uuid = m_last_context_uuid;
3614             }
3615
3616             m_panel_agent_manager.helper_detach_input_context (it->second.id, ic, ic_uuid);
3617
3618             if (it->second.ref <= 0)
3619                 m_panel_agent_manager.exit (it->second.id, ic);
3620         }
3621
3622         unlock ();
3623     }
3624     //SCIM_TRANS_CMD_SEND_HELPER_EVENT
3625     void socket_send_helper_event (int client_id, uint32 context, String uuid, const Transaction& _nest_trans) {
3626         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_send_helper_event ()\n";
3627         HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
3628
3629         if (it != m_helper_client_index.end ()) {
3630             String ic_uuid;
3631             /* Get the context uuid from the client context registration table. */
3632             {
3633                 ClientContextUUIDRepository::iterator it = m_client_context_uuids.find (get_helper_ic (m_panel_client_map[client_id], context));
3634
3635                 if (it != m_client_context_uuids.end ())
3636                     ic_uuid = it->second;
3637             }
3638
3639             if (m_current_socket_client == m_panel_client_map[client_id] && m_current_client_context == context) {
3640                 if (!ic_uuid.length ()) ic_uuid = m_current_context_uuid;
3641             } else if (m_last_socket_client == m_panel_client_map[client_id] && m_last_client_context == context) {
3642                 if (!ic_uuid.length ()) ic_uuid = m_last_context_uuid;
3643             }
3644
3645             m_panel_agent_manager.helper_process_imengine_event (it->second.id, get_helper_ic (m_panel_client_map[client_id], context), ic_uuid, _nest_trans);
3646         }
3647     }
3648
3649     //SCIM_TRANS_CMD_REGISTER_PROPERTIES
3650     void socket_helper_register_properties (int client, PropertyList& properties) {
3651         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_register_properties (" << client << ")\n";
3652         m_signal_register_helper_properties (client, properties);
3653
3654 #if 0 //why? remove if useless, infinite loop
3655         /* Check whether application is already focus_in */
3656         if (m_current_socket_client != -1) {
3657             SCIM_DEBUG_MAIN (2) << "Application is already focus_in!\n";
3658             focus_in_helper (m_current_helper_uuid, m_current_socket_client, m_current_client_context);
3659             reset_keyboard_ise ();
3660         }
3661
3662         /* Check whether ISE panel is already shown */
3663         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode && m_ise_context_length > 0) {
3664             SCIM_DEBUG_MAIN (2) << "Re-show ISE panel!\n";
3665             int    focused_client;
3666             uint32 focused_context;
3667             get_focused_context (focused_client, focused_context);
3668
3669             if (focused_client == -1 && m_active_client_id != -1) {
3670                 focused_client  = m_panel_client_map[m_active_client_id];
3671                 focused_context = 0;
3672             }
3673
3674             uint32 ctx = get_helper_ic (focused_client, focused_context);
3675             bool ret = show_helper (m_current_helper_uuid, m_ise_context_buffer, m_ise_context_length, ctx);
3676
3677             if (ret)
3678                 m_signal_show_ise ();
3679         }
3680 #endif
3681     }
3682     //SCIM_TRANS_CMD_UPDATE_PROPERTY
3683     void socket_helper_update_property (int client, Property& property) {
3684         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_update_property (" << client << ")\n";
3685         m_signal_update_helper_property (client, property);
3686     }
3687     //SCIM_TRANS_CMD_PANEL_SEND_IMENGINE_EVENT
3688     void socket_helper_send_imengine_event (int client, uint32 target_ic, String target_uuid , Transaction& nest_trans) {
3689         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_send_imengine_event (" << client << ")\n";
3690         HelperInfoRepository::iterator hiit = m_helper_active_info_repository.find (client);
3691
3692         if (hiit != m_helper_active_info_repository.end ()) {
3693             int     target_client;
3694             uint32  target_context;
3695             get_imengine_client_context (target_ic, target_client, target_context);
3696             int     focused_client;
3697             uint32  focused_context;
3698             String  focused_uuid;
3699             focused_uuid = get_focused_context (focused_client, focused_context);
3700
3701             if (target_ic == (uint32) (-1)) {
3702                 target_client  = focused_client;
3703                 target_context = focused_context;
3704             }
3705
3706             if (target_uuid.length () == 0)
3707                 target_uuid = focused_uuid;
3708
3709             ClientInfo  client_info = socket_get_client_info (target_client);
3710             SCIM_DEBUG_MAIN (5) << "Target UUID = " << target_uuid << "  Focused UUId = " << focused_uuid << "\nTarget Client = " << target_client << "\n";
3711
3712             if (client_info.type == FRONTEND_CLIENT) {
3713                 /* If the original context value is greater than 0x7FFF, the line below would not work properly
3714                    since the target_context acquired by get_imengine_client_context() is always smaller than 0x7FFF.
3715                    But since the send_imengine_event() of scim_helper module will call IMEngine's
3716                    process_helper_event() function directly, instead of sending SEND_IMENGINE_EVENT message.
3717                    So we are not going to handle this kind of exceptional case for now. */
3718                 m_panel_agent_manager.process_helper_event (target_client, target_context, target_uuid, hiit->second.uuid, nest_trans);
3719             }
3720         }
3721     }
3722
3723     void socket_helper_key_event_op (int client, int cmd, uint32 target_ic, String& target_uuid, KeyEvent& key) {
3724         if (!key.empty ()) {
3725             int     target_client;
3726             uint32  target_context;
3727             get_imengine_client_context (target_ic, target_client, target_context);
3728             int     focused_client;
3729             uint32  focused_context;
3730             String  focused_uuid;
3731             focused_uuid = get_focused_context (focused_client, focused_context);
3732
3733             if (target_ic == (uint32) (-1)) {
3734                 target_client  = focused_client;
3735                 target_context = focused_context;
3736             }
3737
3738             if (target_uuid.length () == 0)
3739                 target_uuid = focused_uuid;
3740
3741             if (target_client == -1) {
3742                 /* FIXUP: monitor 'Invalid Window' error */
3743                 LOGW ("focused target client is NULL");
3744             } else if (target_uuid == focused_uuid &&
3745                 clients_equal (target_client, focused_client) &&
3746                 contexts_equal (target_context, focused_context)) {
3747                 ClientInfo client_info = socket_get_client_info (focused_client);
3748
3749                 if (client_info.type == FRONTEND_CLIENT) {
3750                     m_panel_agent_manager.socket_helper_key_event (focused_client, focused_context, cmd, key);
3751                 }
3752             } else {
3753                 LOGD ("[target_client : %d, focused_client : %d] => %d, [target_context : %u, focused_context : %u] => %d",
3754                     target_client, focused_client, clients_equal (target_client, focused_client),
3755                     target_context, focused_context, contexts_equal (target_context, focused_context));
3756             }
3757         }
3758     }
3759     //SCIM_TRANS_CMD_PROCESS_KEY_EVENT
3760     //SCIM_TRANS_CMD_PANEL_SEND_KEY_EVENT
3761     void socket_helper_send_key_event (int client, uint32 target_ic, String target_uuid, KeyEvent key) {
3762         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_send_key_event (" << client << ")\n";
3763         ISF_PROF_DEBUG ("first message")
3764         socket_helper_key_event_op (client, SCIM_TRANS_CMD_PROCESS_KEY_EVENT, target_ic, target_uuid, key);
3765         if (_TV)
3766             initialize_remote_input_vconf_key ();
3767     }
3768     //SCIM_TRANS_CMD_FORWARD_KEY_EVENT
3769     void socket_helper_forward_key_event (int client, uint32 target_ic, String target_uuid, KeyEvent key) {
3770         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_forward_key_event (" << client << ")\n";
3771         socket_helper_key_event_op (client, SCIM_TRANS_CMD_FORWARD_KEY_EVENT, target_ic, target_uuid, key);
3772         if (_TV)
3773             initialize_remote_input_vconf_key ();
3774     }
3775
3776     //SCIM_TRANS_CMD_COMMIT_STRING
3777     void socket_helper_commit_string (int client, uint32 target_ic, String target_uuid, WideString wstr) {
3778         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_commit_string (" << client << ")\n";
3779
3780         if (wstr.length ()) {
3781             int     target_client;
3782             uint32  target_context;
3783             get_imengine_client_context (target_ic, target_client, target_context);
3784             int     focused_client;
3785             uint32  focused_context;
3786             String  focused_uuid;
3787             focused_uuid = get_focused_context (focused_client, focused_context);
3788
3789             if (target_ic == (uint32) (-1)) {
3790                 target_client  = focused_client;
3791                 target_context = focused_context;
3792             }
3793
3794             if (target_uuid.length () == 0)
3795                 target_uuid = focused_uuid;
3796
3797             if (target_uuid == focused_uuid &&
3798                 clients_equal (target_client, focused_client) &&
3799                 contexts_equal (target_context, focused_context)) {
3800                 ClientInfo client_info = socket_get_client_info (focused_client);
3801
3802                 if (client_info.type == FRONTEND_CLIENT) {
3803                     m_panel_agent_manager.commit_string (focused_client, focused_context, wstr);
3804                     if (_TV)
3805                         initialize_remote_input_vconf_key ();
3806                 } else {
3807                     std::cerr << "target client is not existed!!!" << "\n";
3808                 }
3809             }
3810         }
3811     }
3812     //SCIM_TRANS_CMD_GET_SURROUNDING_TEXT
3813     void socket_helper_get_surrounding_text (int client, String uuid, uint32 maxlen_before, uint32 maxlen_after) {
3814         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << " (" << client << ")\n";
3815         int     focused_client;
3816         uint32  focused_context;
3817         get_focused_context (focused_client, focused_context);
3818         ClientInfo client_info = socket_get_client_info (focused_client);
3819
3820         /* If the get_surrounding_text was received when there is no client available,
3821          * return empty surrounding text since the sender would be waiting for reply */
3822         if (focused_client == -1) {
3823             socket_update_surrounding_text("", 0);
3824         } else {
3825             if (client_info.type == FRONTEND_CLIENT) {
3826                 m_panel_agent_manager.socket_helper_get_surrounding_text (focused_client, focused_context, maxlen_before, maxlen_after);
3827             }
3828         }
3829     }
3830     //SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT
3831     void socket_helper_delete_surrounding_text (int client, uint32 offset, uint32 len) {
3832         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << " (" << client << ")\n";
3833         int     focused_client;
3834         uint32  focused_context;
3835         get_focused_context (focused_client, focused_context);
3836         ClientInfo client_info = socket_get_client_info (focused_client);
3837
3838         if (client_info.type == FRONTEND_CLIENT) {
3839             m_panel_agent_manager.socket_helper_delete_surrounding_text (focused_client, focused_context, offset, len);
3840             if (_TV)
3841                 initialize_remote_input_vconf_key ();
3842         }
3843     }
3844     //SCIM_TRANS_CMD_GET_SELECTION
3845     void socket_helper_get_selection (int client, String uuid) {
3846         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << " (" << client << ")\n";
3847         int     focused_client;
3848         uint32  focused_context;
3849         get_focused_context (focused_client, focused_context);
3850         ClientInfo client_info = socket_get_client_info (focused_client);
3851
3852         if (client_info.type == FRONTEND_CLIENT) {
3853             m_panel_agent_manager.socket_helper_get_selection (focused_client, focused_context);
3854         }
3855     }
3856     //SCIM_TRANS_CMD_SET_SELECTION
3857     void socket_helper_set_selection (int client, uint32 start, uint32 end) {
3858         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << " (" << client << ")\n";
3859         int     focused_client;
3860         uint32  focused_context;
3861         get_focused_context (focused_client, focused_context);
3862         ClientInfo client_info = socket_get_client_info (focused_client);
3863
3864         if (client_info.type == FRONTEND_CLIENT) {
3865             m_panel_agent_manager.socket_helper_set_selection (focused_client, focused_context, start, end);
3866         }
3867     }
3868
3869     //SCIM_TRANS_CMD_SHOW_PREEDIT_STRING
3870     void socket_helper_show_preedit_string (int client, uint32 target_ic, String target_uuid) {
3871         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_show_preedit_string (" << client << ")\n";
3872         int     target_client;
3873         uint32  target_context;
3874         get_imengine_client_context (target_ic, target_client, target_context);
3875         int     focused_client;
3876         uint32  focused_context;
3877         String  focused_uuid = get_focused_context (focused_client, focused_context);
3878
3879         if (target_ic == (uint32) (-1)) {
3880             target_client  = focused_client;
3881             target_context = focused_context;
3882         }
3883
3884         if (target_uuid.length () == 0)
3885             target_uuid = focused_uuid;
3886
3887         if (target_uuid == focused_uuid &&
3888             clients_equal (target_client, focused_client) &&
3889             contexts_equal (target_context, focused_context)) {
3890             ClientInfo client_info = socket_get_client_info (focused_client);
3891
3892             if (client_info.type == FRONTEND_CLIENT) {
3893                 m_panel_agent_manager.show_preedit_string (focused_client, focused_context);
3894             }
3895         }
3896     }
3897     //SCIM_TRANS_CMD_HIDE_PREEDIT_STRING
3898     void socket_helper_hide_preedit_string (int client, uint32 target_ic, String target_uuid) {
3899         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_hide_preedit_string (" << client << ")\n";
3900         int     target_client;
3901         uint32  target_context;
3902         get_imengine_client_context (target_ic, target_client, target_context);
3903         int     focused_client;
3904         uint32  focused_context;
3905         String  focused_uuid = get_focused_context (focused_client, focused_context);
3906
3907         if (target_ic == (uint32) (-1)) {
3908             target_client  = focused_client;
3909             target_context = focused_context;
3910         }
3911
3912         if (target_uuid.length () == 0)
3913             target_uuid = focused_uuid;
3914
3915         if (target_uuid == focused_uuid &&
3916             clients_equal (target_client, focused_client) &&
3917             contexts_equal (target_context, focused_context)) {
3918             ClientInfo client_info = socket_get_client_info (focused_client);
3919
3920             if (client_info.type == FRONTEND_CLIENT) {
3921                 m_panel_agent_manager.hide_preedit_string (focused_client, focused_context);
3922             }
3923         }
3924     }
3925     //SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING
3926     void socket_helper_update_preedit_string (int client, uint32 target_ic, String target_uuid, WideString preedit, WideString commit, AttributeList& attrs, uint32 caret) {
3927         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_update_preedit_string (" << client << ")\n";
3928         int     target_client;
3929         uint32  target_context;
3930         get_imengine_client_context (target_ic, target_client, target_context);
3931         int     focused_client;
3932         uint32  focused_context;
3933         String  focused_uuid;
3934         focused_uuid = get_focused_context (focused_client, focused_context);
3935
3936         if (target_ic == (uint32) (-1)) {
3937             target_client  = focused_client;
3938             target_context = focused_context;
3939         }
3940
3941         if (target_uuid.length () == 0)
3942             target_uuid = focused_uuid;
3943
3944         if (target_uuid == focused_uuid &&
3945             clients_equal (target_client, focused_client) &&
3946             contexts_equal (target_context, focused_context)) {
3947             ClientInfo client_info = socket_get_client_info (focused_client);
3948
3949             if (client_info.type == FRONTEND_CLIENT) {
3950                 m_panel_agent_manager.update_preedit_string (focused_client, focused_context, preedit, commit, attrs, caret);
3951                 if (_TV)
3952                     initialize_remote_input_vconf_key ();
3953             }
3954         }
3955     }
3956     //SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET
3957     void socket_helper_update_preedit_caret (int client, uint32 caret) {
3958         SCIM_DEBUG_MAIN (4) << __func__ << " (" << client << ")\n";
3959         int     focused_client;
3960         uint32  focused_context;
3961         String  focused_uuid;
3962         focused_uuid = get_focused_context (focused_client, focused_context);
3963         ClientInfo client_info = socket_get_client_info (focused_client);
3964
3965         if (client_info.type == FRONTEND_CLIENT) {
3966             m_panel_agent_manager.update_preedit_caret (focused_client, focused_context, caret);
3967         }
3968     }
3969
3970     //ISM_TRANS_CMD_RECAPTURE_STRING
3971     void socket_helper_recapture_string (int client, uint32 target_ic, String target_uuid, int offset, int len, WideString preedit,
3972             WideString commit, AttributeList& attrs) {
3973         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_recapture_string (" << client << ")\n";
3974         int     target_client;
3975         uint32  target_context;
3976         get_imengine_client_context (target_ic, target_client, target_context);
3977         int     focused_client;
3978         uint32  focused_context;
3979         String  focused_uuid;
3980         focused_uuid = get_focused_context (focused_client, focused_context);
3981
3982         if (target_ic == (uint32) (-1)) {
3983             target_client  = focused_client;
3984             target_context = focused_context;
3985         }
3986
3987         if (target_uuid.length () == 0)
3988             target_uuid = focused_uuid;
3989
3990         if (target_uuid == focused_uuid &&
3991             clients_equal (target_client, focused_client) &&
3992             contexts_equal (target_context, focused_context)) {
3993             ClientInfo client_info = socket_get_client_info (focused_client);
3994
3995             if (client_info.type == FRONTEND_CLIENT) {
3996                 m_panel_agent_manager.recapture_string (focused_client, focused_context, offset, len, preedit, commit, attrs);
3997                 if (_TV)
3998                     initialize_remote_input_vconf_key ();
3999             }
4000         }
4001     }
4002
4003     //SCIM_TRANS_CMD_PANEL_REGISTER_HELPER
4004     void socket_helper_register_helper (int client, HelperInfo& info) {
4005         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_register_helper (" << client << ")\n";
4006         bool result = false;
4007         lock ();
4008         String language;
4009         int type;
4010         int option;
4011         String module_name;
4012
4013         if (!m_signal_get_ise_information (info.uuid, info.name, language, type, option, module_name)) {
4014             LOGW ("This helper (%s) is not IME", info.uuid.c_str ());
4015             unlock ();
4016             return;
4017         }
4018         info.option = option;
4019
4020         if (info.uuid.length ()) {
4021             SCIM_DEBUG_MAIN (4) << "New Helper uuid=" << info.uuid << " name=" << info.name << "\n";
4022             HelperClientIndex::iterator it = m_helper_client_index.find (info.uuid);
4023
4024             if (it == m_helper_client_index.end ()) {
4025                 m_helper_info_repository [client] = info;
4026                 m_helper_client_index [info.uuid] = HelperClientStub (client, 1);
4027                 StartHelperICIndex::iterator icit = m_start_helper_ic_index.find (info.uuid);
4028
4029                 if (icit != m_start_helper_ic_index.end ()) {
4030                     m_panel_agent_manager.helper_attach_input_context_and_update_screen (client, icit->second, m_current_screen);
4031                     m_start_helper_ic_index.erase (icit);
4032                     result = true;
4033                 } else {
4034                     LOGW ("Failed to register IME : %s", info.uuid.c_str ());
4035                     m_panel_agent_manager.send_fail_reply(client);
4036                 }
4037             } else {
4038                 LOGW ("Failed to register IME : %s", info.uuid.c_str ());
4039                 m_panel_agent_manager.send_fail_reply(client);
4040             }
4041         }
4042
4043         unlock ();
4044
4045         if (result) {
4046             LOGD ("Succeed to register IME : %s", info.uuid.c_str ());
4047             m_signal_register_helper (client, info);
4048         }
4049     }
4050
4051     //SCIM_TRANS_CMD_PANEL_REGISTER_ACTIVE_HELPER
4052     void socket_helper_register_helper_passive (int client, HelperInfo& info) {
4053         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_register_helper_passive (" << client << ")\n";
4054         lock ();
4055         String language;
4056         int type;
4057         int option;
4058         String module_name;
4059
4060         if (!m_signal_get_ise_information (info.uuid, info.name, language, type, option, module_name)) {
4061             LOGW ("This helper (%s) is not IME", info.uuid.c_str ());
4062             unlock ();
4063             return;
4064         }
4065         info.option = option;
4066
4067         if (info.uuid.length ()) {
4068             SCIM_DEBUG_MAIN (4) << "New Helper Passive uuid=" << info.uuid << " name=" << info.name << "\n";
4069             HelperInfoRepository::iterator it = m_helper_active_info_repository.find (client);
4070
4071             if (it == m_helper_active_info_repository.end ()) {
4072                 m_helper_active_info_repository[client] =  info;
4073             }
4074
4075             StringIntRepository::iterator iter = m_ise_pending_repository.find (info.uuid);
4076
4077             if (iter != m_ise_pending_repository.end ()) {
4078                 m_ise_pending_repository.erase (iter);
4079             }
4080
4081             iter = m_ise_pending_repository.find (info.name);
4082
4083             if (iter != m_ise_pending_repository.end ()) {
4084                 m_ise_pending_repository.erase (iter);
4085             }
4086         }
4087
4088         unlock ();
4089     }
4090     //ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT
4091     void socket_helper_update_input_context (int client, uint32 type, uint32 value) {
4092         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_update_input_context (" << client << ")\n";
4093         m_signal_update_input_context ((int)type, (int)value);
4094         int    focused_client;
4095         uint32 focused_context;
4096         get_focused_context (focused_client, focused_context);
4097         ClientInfo client_info = socket_get_client_info (focused_client);
4098
4099         if (client_info.type == FRONTEND_CLIENT) {
4100             m_panel_agent_manager.update_ise_input_context (focused_client, focused_context, type, value);
4101         } else {
4102             std::cerr << "focused client is not existed!!!" << "\n";
4103         }
4104     }
4105     //ISM_TRANS_CMD_UPDATE_ISE_LANGUAGE_LOCALE
4106     void socket_helper_update_language_locale(int client, String locale) {
4107         SCIM_DEBUG_MAIN(4) << "InfoManager::socket_helper_update_language_locale (" << client << ")\n";
4108         m_signal_update_language_locale(locale);
4109
4110         int    focused_client;
4111         uint32 focused_context;
4112         get_focused_context(focused_client, focused_context);
4113         ClientInfo client_info = socket_get_client_info(focused_client);
4114
4115         if (client_info.type == FRONTEND_CLIENT) {
4116             m_panel_agent_manager.update_ise_language_locale(focused_client, focused_context, locale);
4117         } else {
4118             std::cerr << "focused client is not existed!!!" << "\n";
4119         }
4120     }
4121     //SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND
4122     void socket_helper_send_private_command (int client, String command) {
4123         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << " (" << client << ")\n";
4124         int     focused_client;
4125         uint32  focused_context;
4126         get_focused_context (focused_client, focused_context);
4127         ClientInfo client_info = socket_get_client_info (focused_client);
4128
4129         if (client_info.type == FRONTEND_CLIENT) {
4130             m_panel_agent_manager.send_private_command (focused_client, focused_context, command);
4131         }
4132     }
4133     //SCIM_TRANS_CMD_COMMIT_CONTENT
4134     void socket_helper_commit_content (int client, String content, String description, String mime_types) {
4135         SCIM_DEBUG_MAIN (4) << __FUNCTION__ << " (" << client << ")\n";
4136         int     focused_client;
4137         uint32  focused_context;
4138         get_focused_context (focused_client, focused_context);
4139         ClientInfo client_info = socket_get_client_info (focused_client);
4140
4141         if (client_info.type == FRONTEND_CLIENT) {
4142             m_panel_agent_manager.commit_content (focused_client, focused_context, content, description, mime_types);
4143         }
4144     }
4145     //ISM_TRANS_CMD_UPDATE_ISE_EXIT
4146     void UPDATE_ISE_EXIT (int client) {
4147         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
4148         bool launch_ise_on_request = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_LAUNCH_ISE_ON_REQUEST), false);
4149         if (launch_ise_on_request && !m_refocus_needed && !m_reshow_needed)
4150             m_restart_needed = false;
4151     }
4152
4153     void process_key_event_done (KeyEvent &key, uint32 ret, uint32 serial) {
4154         int     focused_client;
4155         uint32  focused_context;
4156         get_focused_context (focused_client, focused_context);
4157         ClientInfo client_info = socket_get_client_info (focused_client);
4158
4159         if (client_info.type == FRONTEND_CLIENT) {
4160             m_panel_agent_manager.process_key_event_done (focused_client, focused_context, key, ret, serial);
4161         }
4162     }
4163
4164     //ISM_TRANS_CMD_REQUEST_ISE_HIDE
4165     void request_ise_hide () {
4166         int     focused_client;
4167         uint32  focused_context;
4168         get_focused_context (focused_client, focused_context);
4169         ClientInfo client_info = socket_get_client_info (focused_client);
4170
4171         if (client_info.type == FRONTEND_CLIENT) {
4172             m_panel_agent_manager.request_ise_hide (focused_client, focused_context);
4173         }
4174     }
4175
4176     void socket_reset_helper_input_context (const String& uuid, int client, uint32 context) {
4177         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
4178
4179         if (it != m_helper_client_index.end ()) {
4180             uint32 ctx = get_helper_ic (client, context);
4181             m_panel_agent_manager.reset_helper_context (it->second.id, ctx, uuid);
4182         }
4183     }
4184
4185     bool helper_select_aux (uint32 item) {
4186         SCIM_DEBUG_MAIN (4) << "InfoManager::helper_select_aux \n";
4187
4188         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
4189             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
4190
4191             if (it != m_helper_client_index.end ()) {
4192                 int    client;
4193                 uint32 context;
4194                 uint32 ctx;
4195                 get_focused_context (client, context);
4196                 ctx = get_helper_ic (client, context);
4197                 m_panel_agent_manager.select_aux (it->second.id, ctx, item);
4198                 return true;
4199             }
4200         }
4201
4202         return false;
4203     }
4204
4205     bool helper_select_candidate (uint32 item) {
4206         SCIM_DEBUG_MAIN (4) << "InfoManager::helper_select_candidate \n";
4207
4208         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
4209             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
4210
4211             if (it != m_helper_client_index.end ()) {
4212                 int    client;
4213                 uint32 context;
4214                 uint32 ctx;
4215                 get_focused_context (client, context);
4216                 ctx = get_helper_ic (client, context);
4217                 m_panel_agent_manager.select_candidate (it->second.id, ctx, item);
4218                 return true;
4219             }
4220         }
4221
4222         return false;
4223     }
4224
4225     bool helper_lookup_table_page_up (void) {
4226         SCIM_DEBUG_MAIN (4) << "InfoManager::helper_lookup_table_page_up \n";
4227
4228         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
4229             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
4230
4231             if (it != m_helper_client_index.end ()) {
4232                 int    client;
4233                 uint32 context;
4234                 uint32 ctx;
4235                 get_focused_context (client, context);
4236                 ctx = get_helper_ic (client, context);
4237                 m_panel_agent_manager.lookup_table_page_up (it->second.id, ctx);
4238                 return true;
4239             }
4240         }
4241
4242         return false;
4243     }
4244
4245     bool helper_lookup_table_page_down (void) {
4246         SCIM_DEBUG_MAIN (4) << "InfoManager::helper_lookup_table_page_down \n";
4247
4248         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
4249             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
4250
4251             if (it != m_helper_client_index.end ()) {
4252                 int    client;
4253                 uint32 context;
4254                 uint32 ctx;
4255                 get_focused_context (client, context);
4256                 ctx = get_helper_ic (client, context);
4257                 m_panel_agent_manager.lookup_table_page_down (it->second.id, ctx);
4258                 return true;
4259             }
4260         }
4261
4262         return false;
4263     }
4264
4265     bool helper_update_lookup_table_page_size (uint32 size) {
4266         SCIM_DEBUG_MAIN (4) << "InfoManager::helper_update_lookup_table_page_size \n";
4267
4268         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
4269             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
4270
4271             if (it != m_helper_client_index.end ()) {
4272                 int    client;
4273                 uint32 context;
4274                 uint32 ctx;
4275                 get_focused_context (client, context);
4276                 ctx = get_helper_ic (client, context);
4277                 m_panel_agent_manager.update_lookup_table_page_size (it->second.id, ctx, size);
4278                 return true;
4279             }
4280         }
4281
4282         return false;
4283     }
4284
4285     bool helper_update_candidate_item_layout (const std::vector<uint32>& row_items) {
4286         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
4287
4288         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
4289             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
4290
4291             if (it != m_helper_client_index.end ()) {
4292                 int    client;
4293                 uint32 context;
4294                 uint32 ctx;
4295                 get_focused_context (client, context);
4296                 ctx = get_helper_ic (client, context);
4297                 m_panel_agent_manager.update_candidate_item_layout (it->second.id, ctx, row_items);
4298                 return true;
4299             }
4300         }
4301
4302         return false;
4303     }
4304
4305     bool helper_select_associate (uint32 item) {
4306         SCIM_DEBUG_MAIN (4) << "InfoManager::helper_select_associate \n";
4307
4308         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
4309             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
4310
4311             if (it != m_helper_client_index.end ()) {
4312                 int    client;
4313                 uint32 context;
4314                 uint32 ctx;
4315                 get_focused_context (client, context);
4316                 ctx = get_helper_ic (client, context);
4317                 m_panel_agent_manager.select_associate (it->second.id, ctx, item);
4318                 return true;
4319             }
4320         }
4321
4322         return false;
4323     }
4324
4325     bool helper_associate_table_page_up (void) {
4326         SCIM_DEBUG_MAIN (4) << "InfoManager::helper_associate_table_page_up \n";
4327
4328         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
4329             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
4330
4331             if (it != m_helper_client_index.end ()) {
4332                 int    client;
4333                 uint32 context;
4334                 uint32 ctx;
4335                 get_focused_context (client, context);
4336                 ctx = get_helper_ic (client, context);
4337                 m_panel_agent_manager.associate_table_page_up (it->second.id, ctx);
4338                 return true;
4339             }
4340         }
4341
4342         return false;
4343     }
4344
4345     bool helper_associate_table_page_down (void) {
4346         SCIM_DEBUG_MAIN (4) << "InfoManager::helper_associate_table_page_down \n";
4347
4348         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
4349             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
4350
4351             if (it != m_helper_client_index.end ()) {
4352                 int    client;
4353                 uint32 context;
4354                 uint32 ctx;
4355                 get_focused_context (client, context);
4356                 ctx = get_helper_ic (client, context);
4357                 m_panel_agent_manager.associate_table_page_down (it->second.id, ctx);
4358                 return true;
4359             }
4360         }
4361
4362         return false;
4363     }
4364
4365     bool helper_update_associate_table_page_size (uint32         size) {
4366         SCIM_DEBUG_MAIN (4) << "InfoManager::helper_update_associate_table_page_size \n";
4367
4368         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
4369             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
4370
4371             if (it != m_helper_client_index.end ()) {
4372                 int    client;
4373                 uint32 context;
4374                 uint32 ctx;
4375                 get_focused_context (client, context);
4376                 ctx = get_helper_ic (client, context);
4377                 m_panel_agent_manager.update_associate_table_page_size (it->second.id, ctx, size);
4378                 return true;
4379             }
4380         }
4381
4382         return false;
4383     }
4384
4385     bool helper_update_displayed_candidate_number (uint32 size) {
4386         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
4387
4388         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
4389             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
4390
4391             if (it != m_helper_client_index.end ()) {
4392                 int    client;
4393                 uint32 context;
4394                 uint32 ctx;
4395                 get_focused_context (client, context);
4396                 ctx = get_helper_ic (client, context);
4397                 m_panel_agent_manager.update_displayed_candidate_number (it->second.id, ctx, size);
4398                 return true;
4399             }
4400         }
4401
4402         return false;
4403     }
4404
4405     bool helper_longpress_candidate (uint32 index) {
4406         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
4407
4408         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
4409             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
4410
4411             if (it != m_helper_client_index.end ()) {
4412                 int    client;
4413                 uint32 context;
4414                 uint32 ctx;
4415                 get_focused_context (client, context);
4416                 ctx = get_helper_ic (client, context);
4417                 m_panel_agent_manager.send_longpress_event (it->second.id, ctx, index);
4418                 return true;
4419             }
4420         }
4421
4422         std::cerr << __func__ << " is failed!!!\n";
4423         return false;
4424     }
4425
4426     void helper_all_update_spot_location (int x, int y) {
4427         SCIM_DEBUG_MAIN (5) << "InfoManager::helper_all_update_spot_location (" << x << "," << y << ")\n";
4428         HelperInfoRepository::iterator hiit = m_helper_info_repository.begin ();
4429         int    client;
4430         uint32 context;
4431         String uuid = get_focused_context (client, context);
4432
4433         for (; hiit != m_helper_info_repository.end (); ++ hiit) {
4434             if (hiit->second.option & SCIM_HELPER_NEED_SPOT_LOCATION_INFO) {
4435                 m_panel_agent_manager.helper_all_update_spot_location (hiit->first, get_helper_ic (client, context), uuid, x, y);
4436             }
4437         }
4438     }
4439
4440     void helper_all_update_cursor_position (int cursor_pos) {
4441         SCIM_DEBUG_MAIN (5) << "InfoManager::helper_all_update_cursor_position (" << cursor_pos << ")\n";
4442         HelperInfoRepository::iterator hiit = m_helper_info_repository.begin ();
4443         int    client;
4444         uint32 context;
4445         String uuid = get_focused_context (client, context);
4446
4447         for (; hiit != m_helper_info_repository.end (); ++ hiit) {
4448             m_panel_agent_manager.helper_all_update_cursor_position (hiit->first, get_helper_ic (client, context), uuid, cursor_pos);
4449         }
4450     }
4451
4452     void helper_all_update_screen (int screen) {
4453         SCIM_DEBUG_MAIN (5) << "InfoManager::helper_all_update_screen (" << screen << ")\n";
4454         HelperInfoRepository::iterator hiit = m_helper_info_repository.begin ();
4455         int    client;
4456         uint32 context;
4457         String uuid;
4458         uuid = get_focused_context (client, context);
4459
4460         for (; hiit != m_helper_info_repository.end (); ++ hiit) {
4461             if (hiit->second.option & SCIM_HELPER_NEED_SCREEN_INFO) {
4462                 m_panel_agent_manager.helper_all_update_screen (hiit->first, get_helper_ic (client, context), uuid, screen);
4463             }
4464         }
4465     }
4466
4467     bool set_autocapital_type (int mode) {
4468         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
4469         if (m_ise_context_buffer != NULL && m_ise_context_length > 0) {
4470             Ise_Context *iseContext = reinterpret_cast<Ise_Context *>(m_ise_context_buffer);
4471             iseContext->autocapital_type = static_cast<Ecore_IMF_Autocapital_Type>(mode);
4472         }
4473         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || (m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)) {
4474             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
4475
4476             if (it != m_helper_client_index.end ()) {
4477                 int    client;
4478                 uint32 context;
4479                 uint32 ctx;
4480                 get_focused_context (client, context);
4481                 ctx = get_helper_ic (client, context);
4482                 m_panel_agent_manager.set_autocapital_type (it->second.id, ctx, m_current_helper_uuid, mode);
4483                 return true;
4484             }
4485         }
4486
4487         std::cerr << __func__ << " is failed!!!\n";
4488         return false;
4489     }
4490
4491     bool set_prediction_allow (int client, int mode) {
4492         SCIM_DEBUG_MAIN (4) << __func__ << "\n";
4493         if (m_ise_context_buffer != NULL && m_ise_context_length > 0) {
4494             Ise_Context *iseContext = reinterpret_cast<Ise_Context *>(m_ise_context_buffer);
4495             iseContext->prediction_allow = static_cast<Eina_Bool>(mode);
4496         }
4497         if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || (m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)) {
4498             HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
4499
4500             if (it != m_helper_client_index.end ()) {
4501                 int    focused_client;
4502                 uint32 focused_context;
4503                 uint32 ctx;
4504                 get_focused_context (focused_client, focused_context);
4505                 ctx = get_helper_ic (focused_client, focused_context);
4506                 m_panel_agent_manager.set_prediction_allow (it->second.id, ctx, m_current_helper_uuid, mode);
4507                 return true;
4508             }
4509         }
4510
4511         std::cerr << __func__ << " is failed!!!\n";
4512         return false;
4513     }
4514
4515     const String& get_focused_context (int& client, uint32& context, bool force_last_context = false) const {
4516         if (m_current_socket_client >= 0) {
4517             client  = m_current_socket_client;
4518             context = m_current_client_context;
4519             return m_current_context_uuid;
4520         } else {
4521             client  = m_last_socket_client;
4522             context = m_last_client_context;
4523             return m_last_context_uuid;
4524         }
4525     }
4526
4527 private:
4528     void socket_transaction_start (void) {
4529         m_signal_transaction_start ();
4530     }
4531
4532     void socket_transaction_end (void) {
4533         m_signal_transaction_end ();
4534     }
4535
4536     void lock (void) {
4537         m_signal_lock ();
4538     }
4539     void unlock (void) {
4540         m_signal_unlock ();
4541     }
4542 };
4543
4544 InfoManager::InfoManager ()
4545     : m_impl (new InfoManagerImpl ())
4546 {
4547 }
4548
4549 InfoManager::~InfoManager ()
4550 {
4551     delete m_impl;
4552 }
4553
4554 bool
4555 InfoManager::initialize (InfoManager* info_manager, const ConfigPointer& config, const String& display, bool resident)
4556 {
4557     return m_impl->initialize (info_manager, config, display, resident);
4558 }
4559
4560 bool
4561 InfoManager::valid (void) const
4562 {
4563     return m_impl->valid ();
4564 }
4565
4566 void
4567 InfoManager::stop (void)
4568 {
4569     if (m_impl != NULL)
4570         m_impl->stop ();
4571 }
4572
4573 const ClientInfo&
4574 InfoManager::socket_get_client_info (int client) const
4575 {
4576     return m_impl->socket_get_client_info (client);
4577 }
4578
4579 void InfoManager::hide_helper (const String& uuid)
4580 {
4581     m_impl->hide_helper (uuid);
4582 }
4583 TOOLBAR_MODE_T
4584 InfoManager::get_current_toolbar_mode () const
4585 {
4586     return m_impl->get_current_toolbar_mode ();
4587 }
4588
4589 void
4590 InfoManager::get_current_ise_geometry (rectinfo& rect)
4591 {
4592     m_impl->get_current_ise_geometry (rect);
4593 }
4594
4595 String
4596 InfoManager::get_current_helper_uuid () const
4597 {
4598     return m_impl->get_current_helper_uuid ();
4599 }
4600
4601 String
4602 InfoManager::get_current_ise_name () const
4603 {
4604     return m_impl->get_current_ise_name ();
4605 }
4606
4607 void
4608 InfoManager::set_current_toolbar_mode (TOOLBAR_MODE_T mode)
4609 {
4610     m_impl->set_current_toolbar_mode (mode);
4611 }
4612
4613 void
4614 InfoManager::set_current_ise_name (String& name)
4615 {
4616     m_impl->set_current_ise_name (name);
4617 }
4618
4619 void
4620 InfoManager::set_current_helper_option (uint32 option)
4621 {
4622     m_impl->set_current_helper_option (option);
4623 }
4624
4625 void
4626 InfoManager::update_candidate_panel_event (uint32 nType, uint32 nValue)
4627 {
4628     m_impl->update_panel_event (ISM_TRANS_CMD_UPDATE_ISF_CANDIDATE_PANEL, nType, nValue);
4629 }
4630
4631 void
4632 InfoManager::update_input_panel_event (uint32 nType, uint32 nValue)
4633 {
4634     m_impl->update_panel_event (ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT, nType, nValue);
4635 }
4636
4637 bool
4638 InfoManager::move_preedit_caret (uint32         position)
4639 {
4640     return m_impl->move_preedit_caret (position);
4641 }
4642
4643 //useless
4644 #if 0
4645 bool
4646 InfoManager::request_help (void)
4647 {
4648     return m_impl->request_help ();
4649 }
4650
4651 bool
4652 InfoManager::request_factory_menu (void)
4653 {
4654     return m_impl->request_factory_menu ();
4655 }
4656 #endif
4657
4658 bool
4659 InfoManager::change_factory (const String&  uuid)
4660 {
4661     return m_impl->change_factory (uuid);
4662 }
4663
4664 bool
4665 InfoManager::helper_candidate_show (void)
4666 {
4667     return m_impl->helper_candidate_show ();
4668 }
4669
4670 bool
4671 InfoManager::helper_candidate_hide (void)
4672 {
4673     return m_impl->helper_candidate_hide ();
4674 }
4675
4676 bool
4677 InfoManager::candidate_more_window_show (void)
4678 {
4679     return m_impl->candidate_more_window_show ();
4680 }
4681
4682 bool
4683 InfoManager::candidate_more_window_hide (void)
4684 {
4685     return m_impl->candidate_more_window_hide ();
4686 }
4687
4688 bool
4689 InfoManager::update_helper_lookup_table (const LookupTable& table)
4690 {
4691     return m_impl->update_helper_lookup_table (table);
4692 }
4693
4694 bool
4695 InfoManager::select_aux (uint32         item)
4696 {
4697     return m_impl->select_aux (item);
4698 }
4699
4700 bool
4701 InfoManager::select_candidate (uint32         item)
4702 {
4703     return m_impl->select_candidate (item);
4704 }
4705
4706 bool
4707 InfoManager::lookup_table_page_up (void)
4708 {
4709     return m_impl->lookup_table_page_up ();
4710 }
4711
4712 bool
4713 InfoManager::lookup_table_page_down (void)
4714 {
4715     return m_impl->lookup_table_page_down ();
4716 }
4717
4718 bool
4719 InfoManager::update_lookup_table_page_size (uint32         size)
4720 {
4721     return m_impl->update_lookup_table_page_size (size);
4722 }
4723
4724 bool
4725 InfoManager::update_candidate_item_layout (const std::vector<uint32>& row_items)
4726 {
4727     return m_impl->update_candidate_item_layout (row_items);
4728 }
4729
4730 bool
4731 InfoManager::select_associate (uint32         item)
4732 {
4733     return m_impl->select_associate (item);
4734 }
4735
4736 bool
4737 InfoManager::associate_table_page_up (void)
4738 {
4739     return m_impl->associate_table_page_up ();
4740 }
4741
4742 bool
4743 InfoManager::associate_table_page_down (void)
4744 {
4745     return m_impl->associate_table_page_down ();
4746 }
4747
4748 bool
4749 InfoManager::update_associate_table_page_size (uint32         size)
4750 {
4751     return m_impl->update_associate_table_page_size (size);
4752 }
4753
4754 bool
4755 InfoManager::update_displayed_candidate_number (uint32        size)
4756 {
4757     return m_impl->update_displayed_candidate_number (size);
4758 }
4759
4760 void
4761 InfoManager::send_longpress_event (int type, int index)
4762 {
4763     m_impl->send_longpress_event (type, index);
4764 }
4765
4766 bool
4767 InfoManager::trigger_property (const String&  property)
4768 {
4769     return m_impl->trigger_property (property);
4770 }
4771
4772 bool
4773 InfoManager::start_helper (const String&  uuid)
4774 {
4775     return m_impl->start_helper (uuid, -2, 0);
4776 }
4777
4778 bool
4779 InfoManager::stop_helper (const String&  uuid)
4780 {
4781     return m_impl->stop_helper (uuid, -2, 0);
4782 }
4783
4784 void
4785 InfoManager::set_default_ise (const DEFAULT_ISE_T&  ise)
4786 {
4787     m_impl->set_default_ise (ise);
4788 }
4789
4790 void
4791 InfoManager::set_should_shared_ise (const bool should_shared_ise)
4792 {
4793     m_impl->set_should_shared_ise (should_shared_ise);
4794 }
4795
4796 //void
4797 //InfoManager::reload_config                  (void)
4798 //{
4799 //    m_impl->reload_config ();
4800 //}
4801
4802 bool
4803 InfoManager::exit (void)
4804 {
4805     return m_impl->exit ();
4806 }
4807 void
4808 InfoManager::update_ise_list (std::vector<String>& strList)
4809 {
4810     m_impl->update_ise_list (strList);
4811 }
4812
4813 bool
4814 InfoManager::remoteinput_update_preedit_string (WideString str, AttributeList &attrs, uint32 caret)
4815 {
4816     return m_impl->remoteinput_update_preedit_string (str, attrs, caret);
4817 }
4818
4819 bool
4820 InfoManager::remoteinput_commit_string (const WideString &str)
4821 {
4822     return m_impl->remoteinput_commit_string (str);
4823 }
4824
4825 bool
4826 InfoManager::remoteinput_send_key_event (const KeyEvent &key)
4827 {
4828     return m_impl->remoteinput_send_key_event (key);
4829 }
4830
4831 bool
4832 InfoManager::remoteinput_forward_key_event (const KeyEvent &key)
4833 {
4834     return m_impl->remoteinput_forward_key_event (key);
4835 }
4836
4837 bool
4838 InfoManager::remoteinput_delete_surrounding_text (uint32 offset, uint32 len)
4839 {
4840     return m_impl->remoteinput_delete_surrounding_text (offset, len);
4841 }
4842
4843 bool
4844 InfoManager::remoteinput_set_cursor_position (uint32 cursor)
4845 {
4846     return m_impl->remoteinput_set_cursor_position (cursor);
4847 }
4848
4849 /////////////////////////////////Message function begin/////////////////////////////////////////
4850
4851 //ISM_TRANS_CMD_PANEL_RESET_KEYBOARD_ISE
4852 bool InfoManager:: reset_keyboard_ise (void)
4853 {
4854     return m_impl->reset_keyboard_ise ();
4855 }
4856
4857 //ISM_TRANS_CMD_SHOW_ISF_CONTROL
4858 void InfoManager::show_isf_panel (int client_id)
4859 {
4860     m_impl->show_isf_panel (client_id);
4861 }
4862
4863 //ISM_TRANS_CMD_HIDE_ISF_CONTROL
4864 void InfoManager::hide_isf_panel (int client_id)
4865 {
4866     m_impl->hide_isf_panel (client_id);
4867 }
4868
4869 //ISM_TRANS_CMD_SHOW_ISE_PANEL
4870 void InfoManager::show_ise_panel (int client_id, uint32 client, uint32 context, char*   data, size_t  len)
4871 {
4872     m_impl->show_ise_panel (client_id, client, context, data, len);
4873 }
4874
4875 //ISM_TRANS_CMD_HIDE_ISE_PANEL
4876 void InfoManager::hide_ise_panel (int client_id, uint32 client, uint32 context)
4877 {
4878     m_impl->hide_ise_panel (client_id, client, context);
4879 }
4880
4881 //ISM_TRANS_CMD_HIDE_ISE_PANEL from ISF control
4882 void InfoManager::hide_helper_ise (void)
4883 {
4884     m_impl->hide_helper_ise ();
4885 }
4886
4887 //ISM_TRANS_CMD_LAUNCH_ISE from ISF control
4888 void InfoManager::prelaunch_helper_ise (void)
4889 {
4890     m_impl->prelaunch_helper_ise ();
4891 }
4892
4893 //SCIM_TRANS_CMD_PROCESS_KEY_EVENT
4894 bool InfoManager::process_key_event (KeyEvent& key, uint32 serial, uint32 keycode)
4895 {
4896     return m_impl->process_key_event (key, serial, keycode);
4897 }
4898
4899 //ISM_TRANS_CMD_GET_ACTIVE_ISE_GEOMETRY
4900 void InfoManager::get_input_panel_geometry (int client_id, _OUT_ struct rectinfo& info)
4901 {
4902     m_impl->get_input_panel_geometry (client_id, info);
4903 }
4904
4905 //ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY
4906 void InfoManager::get_candidate_window_geometry (int client_id, _OUT_ struct rectinfo& info)
4907 {
4908     m_impl->get_candidate_window_geometry (client_id, info);
4909 }
4910
4911 //ISM_TRANS_CMD_GET_ISE_LANGUAGE_LOCALE
4912 void InfoManager::get_ise_language_locale (int client_id, _OUT_ char** data, _OUT_ size_t& len)
4913 {
4914     m_impl->get_ise_language_locale (client_id, data, len);
4915 }
4916
4917 //ISM_TRANS_CMD_SET_LAYOUT
4918 void InfoManager::set_ise_layout (int client_id, uint32 layout)
4919 {
4920     m_impl->set_ise_layout (client_id, layout);
4921 }
4922
4923 //ISM_TRANS_CMD_SET_INPUT_MODE
4924 void InfoManager::set_ise_input_mode (int client_id, uint32 input_mode)
4925 {
4926     m_impl->set_ise_input_mode (client_id, input_mode);
4927 }
4928
4929 //ISM_TRANS_CMD_SET_INPUT_HINT
4930 void InfoManager::set_ise_input_hint (int client_id, uint32 input_hint)
4931 {
4932     m_impl->set_ise_input_hint (client_id, input_hint);
4933 }
4934
4935 //ISM_TRANS_CMD_UPDATE_BIDI_DIRECTION
4936 void InfoManager::update_ise_bidi_direction (int client_id, uint32 bidi_direction)
4937 {
4938     m_impl->update_ise_bidi_direction (client_id, bidi_direction);
4939 }
4940
4941
4942 //ISM_TRANS_CMD_SET_ISE_LANGUAGE
4943 void InfoManager::set_ise_language (int client_id, uint32 language)
4944 {
4945     m_impl->set_ise_language (client_id, language);
4946 }
4947
4948 //ISM_TRANS_CMD_SET_ISE_IMDATA
4949 void InfoManager::set_ise_imdata (int client_id, const char*   imdata, size_t  len)
4950 {
4951     m_impl->set_ise_imdata (client_id, imdata, len);
4952 }
4953
4954 //ISM_TRANS_CMD_GET_ISE_IMDATA
4955 bool InfoManager:: get_ise_imdata (int client_id, _OUT_ char** imdata, _OUT_ size_t& len)
4956 {
4957     return m_impl->get_ise_imdata (client_id, imdata, len);
4958 }
4959
4960 //ISM_TRANS_CMD_GET_LAYOUT
4961 bool InfoManager:: get_ise_layout (int client_id, _OUT_ uint32& layout)
4962 {
4963     return m_impl->get_ise_layout (client_id, layout);
4964 }
4965
4966 //ISM_TRANS_CMD_GET_ISE_STATE
4967 void InfoManager::get_ise_state (int client_id, _OUT_ int& state)
4968 {
4969     m_impl->get_ise_state (client_id, state);
4970 }
4971
4972 //ISM_TRANS_CMD_GET_ACTIVE_ISE
4973 void InfoManager::get_active_ise (int client_id, _OUT_ String& default_uuid)
4974 {
4975     m_impl->get_active_ise (client_id, default_uuid);
4976 }
4977
4978 //ISM_TRANS_CMD_GET_ISE_LIST
4979 void InfoManager::get_ise_list (int client_id, _OUT_ std::vector<String>& strlist)
4980 {
4981     m_impl->get_ise_list (client_id, strlist);
4982 }
4983
4984 //ISM_TRANS_CMD_GET_ALL_HELPER_ISE_INFO
4985 void InfoManager::get_all_helper_ise_info (int client_id, _OUT_ HELPER_ISE_INFO& info)
4986 {
4987     m_impl->get_all_helper_ise_info (client_id, info);
4988 }
4989
4990 //ISM_TRANS_CMD_SET_ENABLE_HELPER_ISE_INFO
4991 //reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
4992 void InfoManager::set_enable_helper_ise_info (int client_id, String appid, uint32 is_enabled)
4993 {
4994     m_impl->set_enable_helper_ise_info (client_id, appid, is_enabled);
4995 }
4996
4997 //ISM_TRANS_CMD_SHOW_HELPER_ISE_LIST
4998 //reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
4999 void InfoManager::show_helper_ise_list (int client_id)
5000 {
5001     m_impl->show_helper_ise_list (client_id);
5002 }
5003
5004 //ISM_TRANS_CMD_SHOW_HELPER_ISE_SELECTOR
5005 //reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
5006 void InfoManager::show_helper_ise_selector (int client_id)
5007 {
5008     m_impl->show_helper_ise_selector (client_id);
5009 }
5010
5011 //ISM_TRANS_CMD_IS_HELPER_ISE_ENABLED
5012 //reply
5013 void InfoManager::is_helper_ise_enabled (int client_id, String strAppid, _OUT_ uint32& nEnabled)
5014 {
5015     m_impl->is_helper_ise_enabled (client_id, strAppid, nEnabled);
5016 }
5017
5018 //ISM_TRANS_CMD_GET_ISE_INFORMATION
5019 void InfoManager::get_ise_information (int client_id, String strUuid, _OUT_ String& strName, _OUT_ String& strLanguage,
5020                                        _OUT_ int& nType,   _OUT_ int& nOption, _OUT_ String& strModuleName)
5021 {
5022     m_impl->get_ise_information (client_id, strUuid, strName, strLanguage, nType, nOption, strModuleName);
5023 }
5024
5025 //ISM_TRANS_CMD_RESET_ISE_OPTION
5026 //reply SCIM_TRANS_CMD_OK
5027 bool InfoManager:: reset_ise_option (int client_id)
5028 {
5029     return m_impl->reset_ise_option (client_id);
5030 }
5031
5032 //ISM_TRANS_CMD_SET_ACTIVE_ISE_BY_UUID
5033 //reply
5034 bool InfoManager:: set_active_ise_by_uuid (int client_id, char*  buf, size_t  len)
5035 {
5036     return m_impl->set_active_ise_by_uuid (client_id, buf, len);
5037 }
5038
5039 //ISM_TRANS_CMD_SET_INITIAL_ISE_BY_UUID
5040 //reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
5041 void InfoManager::set_initial_ise_by_uuid (int client_id, char*  buf, size_t  len)
5042 {
5043     m_impl->set_initial_ise_by_uuid (client_id, buf, len);
5044 }
5045
5046 //ISM_TRANS_CMD_SET_RETURN_KEY_TYPE
5047 void InfoManager::set_ise_return_key_type (int client_id, uint32 type)
5048 {
5049     m_impl->set_ise_return_key_type (client_id, type);
5050 }
5051
5052 //ISM_TRANS_CMD_GET_RETURN_KEY_TYPE
5053 //reply
5054 bool InfoManager:: get_ise_return_key_type (int client_id, _OUT_ uint32& type)
5055 {
5056     return m_impl->get_ise_return_key_type (client_id, type);
5057 }
5058
5059
5060 //ISM_TRANS_CMD_SET_RETURN_KEY_DISABLE
5061 void InfoManager::set_ise_return_key_disable (int client_id, uint32 disabled)
5062 {
5063     m_impl->set_ise_return_key_disable (client_id, disabled);
5064 }
5065
5066 //ISM_TRANS_CMD_GET_RETURN_KEY_DISABLE
5067 bool InfoManager::get_ise_return_key_disable (int client_id, _OUT_ uint32& disabled)
5068 {
5069     return m_impl->get_ise_return_key_disable (client_id, disabled);
5070 }
5071
5072 //ISM_TRANS_CMD_SET_CAPS_MODE
5073 void InfoManager::set_ise_caps_mode (int client_id, uint32 mode)
5074 {
5075     m_impl->set_ise_caps_mode (client_id, mode);
5076 }
5077
5078 //SCIM_TRANS_CMD_RELOAD_CONFIG
5079 void InfoManager::reload_config (void)
5080 {
5081     m_impl->reload_config ();
5082 }
5083
5084 //ISM_TRANS_CMD_SEND_WILL_SHOW_ACK
5085 void InfoManager::will_show_ack (int client_id)
5086 {
5087     m_impl->will_show_ack (client_id);
5088 }
5089
5090 //ISM_TRANS_CMD_SEND_WILL_HIDE_ACK
5091 void InfoManager::will_hide_ack (int client_id)
5092 {
5093     m_impl->will_hide_ack (client_id);
5094 }
5095
5096 //ISM_TRANS_CMD_RESET_DEFAULT_ISE
5097 void InfoManager::reset_default_ise (int client_id)
5098 {
5099     m_impl->reset_default_ise (client_id);
5100 }
5101
5102 //ISM_TRANS_CMD_SET_HARDWARE_KEYBOARD_MODE
5103 void InfoManager::set_keyboard_mode (int client_id, uint32 mode)
5104 {
5105     m_impl->set_keyboard_mode (client_id, mode);
5106 }
5107
5108 //ISM_TRANS_CMD_SEND_CANDIDATE_WILL_HIDE_ACK
5109 void InfoManager::candidate_will_hide_ack (int client_id)
5110 {
5111     m_impl->candidate_will_hide_ack (client_id);
5112 }
5113
5114 //ISM_TRANS_CMD_GET_ACTIVE_HELPER_OPTION
5115 void InfoManager::get_active_helper_option (int client_id, _OUT_ uint32& option)
5116 {
5117     m_impl->get_active_helper_option (client_id, option);
5118 }
5119
5120 //ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW
5121 void InfoManager::show_ise_option_window (int client_id, int caller_pid)
5122 {
5123     m_impl->show_ise_option_window (client_id, caller_pid);
5124 }
5125
5126 //ISM_TRANS_CMD_GET_ISE_SETTING_APPID
5127 void InfoManager::get_ise_setting_appid (int client_id, String &ime_setting_appid)
5128 {
5129     m_impl->get_ise_setting_appid (client_id, ime_setting_appid);
5130 }
5131
5132 //ISM_TRANS_CMD_RESUME_ISE_OPTION_WINDOW
5133 void InfoManager::resume_ise_option_window (int client_id)
5134 {
5135     m_impl->resume_ise_option_window (client_id);
5136 }
5137
5138 //ISM_TRANS_CMD_SET_KEYBOARD_MODE
5139 void InfoManager::set_ise_keyboard_mode (int client_id, uint32 mode)
5140 {
5141     m_impl->set_ise_keyboard_mode (client_id, mode);
5142 }
5143
5144 //ISM_TRANS_CMD_SET_PREDICTION_HINT
5145 void InfoManager::set_prediction_hint (int client_id, String prediction_hint)
5146 {
5147     m_impl->set_prediction_hint (client_id, prediction_hint);
5148 }
5149
5150 //ISM_TRANS_CMD_SET_MIME_TYPE
5151 void InfoManager::set_ise_mime_type (int client_id, String mime_type)
5152 {
5153     m_impl->set_ise_mime_type (client_id, mime_type);
5154 }
5155
5156 //ISM_TRANS_CMD_FINALIZE_CONTENT
5157 void InfoManager::finalize_content (int client_id, String text, uint32 cursor_pos)
5158 {
5159     m_impl->finalize_content (client_id, text, cursor_pos);
5160 }
5161
5162 //ISM_TRANS_CMD_SET_PREDICTION_HINT_DATA
5163 void InfoManager::set_prediction_hint_data (int client_id, String key, String value)
5164 {
5165     m_impl->set_prediction_hint_data (client_id, key, value);
5166 }
5167
5168 //ISM_TRANS_CMD_SET_OPTIMIZATION_HINT
5169 void InfoManager::set_optimization_hint(int client_id, uint32 hint)
5170 {
5171     m_impl->set_optimization_hint(client_id, hint);
5172 }
5173
5174 //ISM_TRANS_CMD_SET_ISE_ENABLE
5175 void InfoManager::set_ise_enable (int client_id, uint32 enabled)
5176 {
5177     m_impl->set_ise_enable (client_id, enabled);
5178 }
5179
5180 //ISM_TRANS_CMD_EXPAND_CANDIDATE
5181 void InfoManager::expand_candidate ()
5182 {
5183     m_impl->expand_candidate ();
5184 }
5185
5186 //ISM_TRANS_CMD_CONTRACT_CANDIDATE
5187 void InfoManager::contract_candidate ()
5188 {
5189     m_impl->contract_candidate ();
5190 }
5191
5192 //ISM_TRANS_CMD_GET_RECENT_ISE_GEOMETRY
5193 void InfoManager::get_recent_ise_geometry (int client_id, uint32 angle, _OUT_ struct rectinfo& info)
5194 {
5195     m_impl->get_recent_ise_geometry (client_id, angle, info);
5196 }
5197
5198 //ISM_TRANS_CMD_SEND_REMOTE_INPUT_MESSAGE
5199 bool InfoManager::remoteinput_send_input_message (int client_id, char* buf, size_t len)
5200 {
5201     return m_impl->send_remote_input_message (client_id, buf, len);
5202 }
5203
5204 void InfoManager::remoteinput_send_surrounding_text (const char* text, uint32 cursor)
5205 {
5206     return m_impl->send_remote_surrounding_text (text, cursor);
5207 }
5208
5209 //ISM_TRANS_CMD_REGISTER_PANEL_CLIENT
5210 void InfoManager::register_panel_client (uint32 client_id, uint32 id)
5211 {
5212     m_impl->register_panel_client (client_id, id);
5213 }
5214
5215 //SCIM_TRANS_CMD_PANEL_REGISTER_INPUT_CONTEXT
5216 void InfoManager::register_input_context (uint32 client_id, uint32 context, String  uuid)
5217 {
5218     m_impl->register_input_context (client_id, context, uuid);
5219 }
5220
5221 //SCIM_TRANS_CMD_PANEL_REMOVE_INPUT_CONTEXT
5222 void InfoManager::remove_input_context (uint32 client_id, uint32 context)
5223 {
5224     m_impl->remove_input_context (client_id, context);
5225 }
5226
5227 //SCIM_TRANS_CMD_PANEL_RESET_INPUT_CONTEXT
5228 void InfoManager::socket_reset_input_context (int client_id, uint32 context)
5229 {
5230     m_impl->socket_reset_input_context (client_id, context);
5231 }
5232
5233 //SCIM_TRANS_CMD_FOCUS_IN
5234 void InfoManager::focus_in (int client_id, uint32 context,  String  uuid)
5235 {
5236     m_impl->focus_in (client_id, context, uuid);
5237 }
5238
5239 //SCIM_TRANS_CMD_FOCUS_OUT
5240 void InfoManager::focus_out (int client_id, uint32 context)
5241 {
5242     m_impl->focus_out (client_id, context);
5243 }
5244
5245 //ISM_TRANS_CMD_PROCESS_INPUT_DEVICE_EVENT
5246 bool InfoManager::process_input_device_event(int client, uint32 type, const char *data, size_t len, _OUT_ uint32& result)
5247 {
5248     return m_impl->process_input_device_event(client, type, data, len, result);
5249 }
5250
5251 //ISM_TRANS_CMD_TURN_ON_LOG
5252 void InfoManager::socket_turn_on_log (uint32 isOn)
5253 {
5254     m_impl->socket_turn_on_log (isOn);
5255 }
5256
5257 //SCIM_TRANS_CMD_PANEL_TURN_ON
5258 void InfoManager::socket_turn_on (void)
5259 {
5260     m_impl->socket_turn_on ();
5261 }
5262
5263 //SCIM_TRANS_CMD_PANEL_TURN_OFF
5264 void InfoManager::socket_turn_off (void)
5265 {
5266     m_impl->socket_turn_off ();
5267 }
5268
5269 //SCIM_TRANS_CMD_UPDATE_SCREEN
5270 void InfoManager::socket_update_screen (int client_id, uint32 num)
5271 {
5272     m_impl->socket_update_screen (client_id, num);
5273 }
5274
5275 //SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION
5276 void InfoManager::socket_update_spot_location (uint32 x, uint32 y, uint32 top_y)
5277 {
5278     m_impl->socket_update_spot_location (x, y, top_y);
5279 }
5280
5281 //ISM_TRANS_CMD_UPDATE_CURSOR_POSITION
5282 void InfoManager::socket_update_cursor_position (uint32 cursor_pos)
5283 {
5284     m_impl->socket_update_cursor_position (cursor_pos);
5285 }
5286
5287 //ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT
5288 void InfoManager::socket_update_surrounding_text (String text, uint32 cursor)
5289 {
5290     m_impl->socket_update_surrounding_text (text, cursor);
5291 }
5292
5293 void InfoManager::remoteinput_callback_focus_in (void)
5294 {
5295     m_impl->remoteinput_callback_focus_in ();
5296 }
5297
5298 void InfoManager::remoteinput_callback_focus_out (void)
5299 {
5300     m_impl->remoteinput_callback_focus_out ();
5301 }
5302
5303 void InfoManager::remoteinput_callback_entry_metadata (uint32 hint, uint32 layout, int variation, uint32 autocapital_type, int return_key_disabled, uint32 return_key_type)
5304 {
5305     m_impl->remoteinput_callback_entry_metadata (hint, layout, variation, autocapital_type, return_key_disabled, return_key_type);
5306 }
5307
5308 void InfoManager::remoteinput_callback_surrounding_text (String text, uint32 cursor)
5309 {
5310     m_impl->remoteinput_callback_surrounding_text (text, cursor);
5311 }
5312
5313 void InfoManager::remoteinput_callback_input_resource (uint32 input_resource)
5314 {
5315     m_impl->remoteinput_callback_input_resource (input_resource);
5316 }
5317
5318 void InfoManager::remoteinput_callback_key_symbol (String key_symbol, bool press, uint32 timestamp)
5319 {
5320     m_impl->remoteinput_callback_key_symbol (key_symbol, press, timestamp);
5321 }
5322
5323 void InfoManager::remoteinput_callback_cursor_position (uint32 cursor)
5324 {
5325     m_impl->remoteinput_callback_cursor_position (cursor);
5326 }
5327
5328 //ISM_TRANS_CMD_UPDATE_SELECTION
5329 void InfoManager::socket_update_selection (String text)
5330 {
5331     m_impl->socket_update_selection (text);
5332 }
5333
5334 //FIXME: useless anymore
5335 //SCIM_TRANS_CMD_PANEL_UPDATE_FACTORY_INFO
5336 void InfoManager::socket_update_factory_info (PanelFactoryInfo& info)
5337 {
5338     m_impl->socket_update_factory_info (info);
5339 }
5340
5341 //SCIM_TRANS_CMD_PANEL_SHOW_HELP
5342 void InfoManager::socket_show_help (String help)
5343 {
5344     m_impl->socket_show_help (help);
5345 }
5346
5347 //SCIM_TRANS_CMD_PANEL_SHOW_FACTORY_MENU
5348 void InfoManager::socket_show_factory_menu (std::vector <PanelFactoryInfo>& vec)
5349 {
5350     m_impl->socket_show_factory_menu (vec);
5351 }
5352
5353 //SCIM_TRANS_CMD_SHOW_PREEDIT_STRING
5354 void InfoManager::socket_show_preedit_string (void)
5355 {
5356     m_impl->socket_show_preedit_string ();
5357 }
5358
5359 //SCIM_TRANS_CMD_SHOW_AUX_STRING
5360 void InfoManager::socket_show_aux_string (void)
5361 {
5362     m_impl->socket_show_aux_string ();
5363 }
5364
5365 //SCIM_TRANS_CMD_SHOW_LOOKUP_TABLE
5366 void InfoManager::socket_show_lookup_table (void)
5367 {
5368     m_impl->socket_show_lookup_table ();
5369 }
5370
5371 //ISM_TRANS_CMD_SHOW_ASSOCIATE_TABLE
5372 void InfoManager::socket_show_associate_table (void)
5373 {
5374     m_impl->socket_show_associate_table ();
5375 }
5376
5377 //SCIM_TRANS_CMD_HIDE_PREEDIT_STRING
5378 void InfoManager::socket_hide_preedit_string (void)
5379 {
5380     m_impl->socket_hide_preedit_string ();
5381 }
5382
5383 //SCIM_TRANS_CMD_HIDE_AUX_STRING
5384 void InfoManager::socket_hide_aux_string (void)
5385 {
5386     m_impl->socket_hide_aux_string ();
5387 }
5388
5389 //SCIM_TRANS_CMD_HIDE_LOOKUP_TABLE
5390 void InfoManager::socket_hide_lookup_table (void)
5391 {
5392     m_impl->socket_hide_lookup_table ();
5393 }
5394
5395 //ISM_TRANS_CMD_HIDE_ASSOCIATE_TABLE
5396 void InfoManager::socket_hide_associate_table (void)
5397 {
5398     m_impl->socket_hide_associate_table ();
5399 }
5400
5401 //SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING
5402 void InfoManager::socket_update_preedit_string (String& str, const AttributeList& attrs, uint32 caret)
5403 {
5404     m_impl->socket_update_preedit_string (str, attrs, caret);
5405 }
5406
5407 //SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET
5408 void InfoManager::socket_update_preedit_caret (uint32 caret)
5409 {
5410     m_impl->socket_update_preedit_caret (caret);
5411 }
5412
5413 //ISM_TRANS_CMD_RECAPTURE_STRING
5414 void InfoManager::socket_recapture_string (int offset, int len, String& preedit, String& commit, const AttributeList& attrs)
5415 {
5416     m_impl->socket_recapture_string (offset, len, preedit, commit, attrs);
5417 }
5418
5419 //SCIM_TRANS_CMD_UPDATE_AUX_STRING
5420 void InfoManager::socket_update_aux_string (String& str, const AttributeList& attrs)
5421 {
5422     m_impl->socket_update_aux_string (str, attrs);
5423 }
5424
5425 //SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE
5426 void InfoManager::socket_update_lookup_table (const LookupTable& table)
5427 {
5428     m_impl->socket_update_lookup_table (table);
5429 }
5430
5431 //ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE
5432 void InfoManager::socket_update_associate_table (const LookupTable& table)
5433 {
5434     m_impl->socket_update_associate_table (table);
5435 }
5436
5437 //SCIM_TRANS_CMD_REGISTER_PROPERTIES
5438 void InfoManager::socket_register_properties (const PropertyList& properties)
5439 {
5440     m_impl->socket_register_properties (properties);
5441 }
5442
5443 //SCIM_TRANS_CMD_UPDATE_PROPERTY
5444 void InfoManager::socket_update_property (const Property& property)
5445 {
5446     m_impl->socket_update_property (property);
5447 }
5448
5449 //ISM_TRANS_CMD_GET_KEYBOARD_ISE_LIST
5450 void InfoManager::socket_get_keyboard_ise_list (String& uuid)
5451 {
5452     m_impl->socket_get_keyboard_ise_list (uuid);
5453 }
5454
5455 //ISM_TRANS_CMD_SET_CANDIDATE_UI
5456 void InfoManager::socket_set_candidate_ui (uint32 portrait_line, uint32 mode)
5457 {
5458     m_impl->socket_set_candidate_ui (portrait_line, mode);
5459 }
5460
5461 //ISM_TRANS_CMD_GET_CANDIDATE_UI
5462 void InfoManager::socket_get_candidate_ui (String uuid)
5463 {
5464     m_impl->socket_get_candidate_ui (uuid);
5465 }
5466
5467 //ISM_TRANS_CMD_SET_CANDIDATE_POSITION
5468 void InfoManager::socket_set_candidate_position (uint32 left, uint32 top)
5469 {
5470     m_impl->socket_set_candidate_position (left, top);
5471 }
5472
5473 //ISM_TRANS_CMD_HIDE_CANDIDATE
5474 void InfoManager::socket_hide_candidate (void)
5475 {
5476     m_impl->socket_hide_candidate ();
5477 }
5478
5479 //ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY
5480 void InfoManager::socket_get_candidate_geometry (String& uuid)
5481 {
5482     m_impl->socket_get_candidate_geometry (uuid);
5483 }
5484
5485 //ISM_TRANS_CMD_SET_KEYBOARD_ISE_BY_UUID
5486 void InfoManager::socket_set_keyboard_ise (String uuid)
5487 {
5488     m_impl->socket_set_keyboard_ise (uuid);
5489 }
5490
5491 //ISM_TRANS_CMD_SELECT_CANDIDATE
5492 void InfoManager::socket_helper_select_candidate (uint32 index)
5493 {
5494     m_impl->socket_helper_select_candidate (index);
5495 }
5496
5497 //ISM_TRANS_CMD_UPDATE_ISE_GEOMETRY
5498 void InfoManager::socket_helper_update_ise_geometry (int client, uint32 x, uint32 y, uint32 width, uint32 height)
5499 {
5500     m_impl->socket_helper_update_ise_geometry (client, x, y, width, height);
5501 }
5502
5503 //ISM_TRANS_CMD_GET_KEYBOARD_ISE
5504 void InfoManager::socket_get_keyboard_ise (String uuid)
5505 {
5506     m_impl->socket_get_keyboard_ise (uuid);
5507 }
5508
5509 //SCIM_TRANS_CMD_START_HELPER
5510 void InfoManager::socket_start_helper (int client_id, uint32 context, String uuid)
5511 {
5512     m_impl->socket_start_helper (client_id, context, uuid);
5513 }
5514
5515 //SCIM_TRANS_CMD_STOP_HELPER
5516 void InfoManager::socket_stop_helper (int client_id, uint32 context, String uuid)
5517 {
5518     m_impl->socket_stop_helper (client_id, context, uuid);
5519 }
5520
5521 //SCIM_TRANS_CMD_SEND_HELPER_EVENT
5522 void InfoManager::socket_send_helper_event (int client_id, uint32 context, String uuid, const Transaction& _nest_trans)
5523 {
5524     m_impl->socket_send_helper_event (client_id, context, uuid, _nest_trans);
5525 }
5526
5527 //SCIM_TRANS_CMD_REGISTER_PROPERTIES
5528 void InfoManager::socket_helper_register_properties (int client, PropertyList& properties)
5529 {
5530     m_impl->socket_helper_register_properties (client, properties);
5531 }
5532
5533 //SCIM_TRANS_CMD_UPDATE_PROPERTY
5534 void InfoManager::socket_helper_update_property (int client, Property& property)
5535 {
5536     m_impl->socket_helper_update_property (client, property);
5537 }
5538
5539 //SCIM_TRANS_CMD_PANEL_SEND_IMENGINE_EVENT
5540 void InfoManager::socket_helper_send_imengine_event (int client, uint32 target_ic, String target_uuid , Transaction& nest_trans)
5541 {
5542     m_impl->socket_helper_send_imengine_event (client, target_ic, target_uuid, nest_trans);
5543 }
5544
5545 //SCIM_TRANS_CMD_PROCESS_KEY_EVENT
5546 //SCIM_TRANS_CMD_PANEL_SEND_KEY_EVENT
5547 void InfoManager::socket_helper_send_key_event (int client, uint32 target_ic, String target_uuid, KeyEvent key)
5548 {
5549     m_impl->socket_helper_send_key_event (client, target_ic, target_uuid, key);
5550 }
5551
5552 //SCIM_TRANS_CMD_FORWARD_KEY_EVENT
5553 void InfoManager::socket_helper_forward_key_event (int client, uint32 target_ic, String target_uuid, KeyEvent key)
5554 {
5555     m_impl->socket_helper_forward_key_event (client, target_ic, target_uuid, key);
5556 }
5557
5558 //SCIM_TRANS_CMD_COMMIT_STRING
5559 void InfoManager::socket_helper_commit_string (int client, uint32 target_ic, String target_uuid, WideString wstr)
5560 {
5561     m_impl->socket_helper_commit_string (client, target_ic, target_uuid, wstr);
5562 }
5563
5564 //SCIM_TRANS_CMD_GET_SURROUNDING_TEXT
5565 void InfoManager::socket_helper_get_surrounding_text (int client, String uuid, uint32 maxlen_before, uint32 maxlen_after)
5566 {
5567     m_impl->socket_helper_get_surrounding_text (client, uuid, maxlen_before, maxlen_after);
5568 }
5569
5570 //SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT
5571 void InfoManager::socket_helper_delete_surrounding_text (int client, uint32 offset, uint32 len)
5572 {
5573     m_impl->socket_helper_delete_surrounding_text (client, offset, len);
5574 }
5575
5576 //SCIM_TRANS_CMD_GET_SELECTION
5577 void InfoManager::socket_helper_get_selection (int client, String uuid)
5578 {
5579     m_impl->socket_helper_get_selection (client, uuid);
5580 }
5581
5582 //SCIM_TRANS_CMD_SET_SELECTION
5583 void InfoManager::socket_helper_set_selection (int client, uint32 start, uint32 end)
5584 {
5585     m_impl->socket_helper_set_selection (client, start, end);
5586 }
5587
5588 //SCIM_TRANS_CMD_SHOW_PREEDIT_STRING
5589 void InfoManager::socket_helper_show_preedit_string (int client, uint32 target_ic, String target_uuid)
5590 {
5591     m_impl->socket_helper_show_preedit_string (client, target_ic, target_uuid);
5592 }
5593
5594 //SCIM_TRANS_CMD_HIDE_PREEDIT_STRING
5595 void InfoManager::socket_helper_hide_preedit_string (int client, uint32 target_ic, String target_uuid)
5596 {
5597     m_impl->socket_helper_hide_preedit_string (client, target_ic, target_uuid);
5598 }
5599
5600 //SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING
5601 void InfoManager::socket_helper_update_preedit_string (int client, uint32 target_ic, String target_uuid, WideString preedit,
5602         WideString commit, AttributeList& attrs, uint32 caret)
5603 {
5604     m_impl->socket_helper_update_preedit_string (client, target_ic, target_uuid, preedit, commit, attrs, caret);
5605 }
5606
5607 //SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET
5608 void InfoManager::socket_helper_update_preedit_caret (int client, uint32 caret)
5609 {
5610     m_impl->socket_helper_update_preedit_caret (client, caret);
5611 }
5612
5613 //ISM_TRANS_CMD_RECAPTURE_STRING
5614 void InfoManager::socket_helper_recapture_string (int client, uint32 target_ic, String target_uuid, int offset, int len, WideString preedit,
5615         WideString commit, AttributeList& attrs)
5616 {
5617     m_impl->socket_helper_recapture_string (client, target_ic, target_uuid, offset, len, preedit, commit, attrs);
5618 }
5619
5620 //SCIM_TRANS_CMD_PANEL_REGISTER_HELPER
5621 void InfoManager::socket_helper_register_helper (int client, HelperInfo& info)
5622 {
5623     m_impl->socket_helper_register_helper (client, info);
5624 }
5625
5626 //SCIM_TRANS_CMD_PANEL_REGISTER_ACTIVE_HELPER
5627 void InfoManager::socket_helper_register_helper_passive (int client, HelperInfo& info)
5628 {
5629     m_impl->socket_helper_register_helper_passive (client, info);
5630 }
5631
5632 //ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT
5633 void InfoManager::socket_helper_update_input_context (int client, uint32 type, uint32 value)
5634 {
5635     m_impl->socket_helper_update_input_context (client, type, value);
5636 }
5637
5638 //ISM_TRANS_CMD_UPDATE_ISE_LANGUAGE_LOCALE
5639 void InfoManager::socket_helper_update_language_locale(int client, String locale)
5640 {
5641     m_impl->socket_helper_update_language_locale(client, locale);
5642 }
5643
5644 //SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND
5645 void InfoManager::socket_helper_send_private_command (int client, String command)
5646 {
5647     m_impl->socket_helper_send_private_command (client, command);
5648 }
5649
5650 //SCIM_TRANS_CMD_COMMIT_CONTENT
5651 void InfoManager::socket_helper_commit_content (int client, String content, String description, String mime_types)
5652 {
5653     m_impl->socket_helper_commit_content (client, content, description, mime_types);
5654 }
5655
5656 //ISM_TRANS_CMD_UPDATE_ISE_EXIT
5657 void InfoManager::UPDATE_ISE_EXIT (int client)
5658 {
5659     m_impl->UPDATE_ISE_EXIT (client);
5660 }
5661
5662 //ISM_TRANS_CMD_PROCESS_KEY_EVENT_DONE
5663 void InfoManager::process_key_event_done (KeyEvent &key, uint32 ret, uint32 serial)
5664 {
5665     m_impl->process_key_event_done (key, ret, serial);
5666 }
5667
5668 //ISM_TRANS_CMD_REQUEST_ISE_HIDE
5669 void InfoManager::request_ise_hide ()
5670 {
5671     m_impl->request_ise_hide ();
5672 }
5673
5674 bool InfoManager::check_privilege_by_sockfd (int client_id, const String& privilege) {
5675     return m_impl->check_privilege_by_sockfd (client_id, privilege);
5676 }
5677
5678 void InfoManager::add_client (int client_id, uint32 key, ClientType type)
5679 {
5680     m_impl->add_client (client_id, key, type);
5681 }
5682
5683 void InfoManager::del_client (int client_id)
5684 {
5685     m_impl->del_client (client_id);
5686 }
5687
5688 bool InfoManager::set_autocapital_type (int mode)
5689 {
5690     return m_impl->set_autocapital_type (mode);
5691 }
5692
5693 void InfoManager::set_prediction_allow (int client, bool mode)
5694 {
5695     m_impl->set_prediction_allow (client, mode);
5696 }
5697
5698 void InfoManager::reshow_input_panel ()
5699 {
5700     m_impl->reshow_input_panel ();
5701 }
5702
5703 void InfoManager::request_ise_terminate ()
5704 {
5705     m_impl->request_ise_terminate ();
5706 }
5707
5708 void InfoManager::set_floating_mode (uint32 floating_mode)
5709 {
5710     m_impl->set_floating_mode (floating_mode);
5711 }
5712
5713 void InfoManager::set_floating_drag_enabled (uint32 enabled)
5714 {
5715     m_impl->set_floating_drag_enabled (enabled);
5716 }
5717
5718 //////////////////////////////////Message function end/////////////////////////////////////////
5719
5720 Connection
5721 InfoManager::signal_connect_turn_on (InfoManagerSlotVoid*                slot)
5722 {
5723     return m_impl->signal_connect_turn_on (slot);
5724 }
5725
5726 Connection
5727 InfoManager::signal_connect_turn_off (InfoManagerSlotVoid*                slot)
5728 {
5729     return m_impl->signal_connect_turn_off (slot);
5730 }
5731
5732 Connection
5733 InfoManager::signal_connect_show_panel (InfoManagerSlotVoid*                slot)
5734 {
5735     return m_impl->signal_connect_show_panel (slot);
5736 }
5737
5738 Connection
5739 InfoManager::signal_connect_hide_panel (InfoManagerSlotVoid*                slot)
5740 {
5741     return m_impl->signal_connect_hide_panel (slot);
5742 }
5743
5744 Connection
5745 InfoManager::signal_connect_update_screen (InfoManagerSlotInt*                 slot)
5746 {
5747     return m_impl->signal_connect_update_screen (slot);
5748 }
5749
5750 Connection
5751 InfoManager::signal_connect_update_spot_location (InfoManagerSlotIntIntInt*           slot)
5752 {
5753     return m_impl->signal_connect_update_spot_location (slot);
5754 }
5755
5756 Connection
5757 InfoManager::signal_connect_update_factory_info (InfoManagerSlotFactoryInfo*         slot)
5758 {
5759     return m_impl->signal_connect_update_factory_info (slot);
5760 }
5761
5762 Connection
5763 InfoManager::signal_connect_start_default_ise (InfoManagerSlotVoid*                slot)
5764 {
5765     return m_impl->signal_connect_start_default_ise (slot);
5766 }
5767
5768 Connection
5769 InfoManager::signal_connect_stop_default_ise (InfoManagerSlotBool*                slot)
5770 {
5771     return m_impl->signal_connect_stop_default_ise (slot);
5772 }
5773
5774 Connection
5775 InfoManager::signal_connect_set_candidate_ui (InfoManagerSlotIntInt*              slot)
5776 {
5777     return m_impl->signal_connect_set_candidate_ui (slot);
5778 }
5779
5780 Connection
5781 InfoManager::signal_connect_get_candidate_ui (InfoManagerSlotIntInt2*             slot)
5782 {
5783     return m_impl->signal_connect_get_candidate_ui (slot);
5784 }
5785
5786 Connection
5787 InfoManager::signal_connect_set_candidate_position (InfoManagerSlotIntInt*              slot)
5788 {
5789     return m_impl->signal_connect_set_candidate_position (slot);
5790 }
5791
5792 Connection
5793 InfoManager::signal_connect_get_candidate_geometry (InfoManagerSlotRect*                slot)
5794 {
5795     return m_impl->signal_connect_get_candidate_geometry (slot);
5796 }
5797
5798 Connection
5799 InfoManager::signal_connect_get_input_panel_geometry (InfoManagerSlotRect*                slot)
5800 {
5801     return m_impl->signal_connect_get_input_panel_geometry (slot);
5802 }
5803
5804 Connection
5805 InfoManager::signal_connect_set_keyboard_ise (InfoManagerSlotString*              slot)
5806 {
5807     return m_impl->signal_connect_set_keyboard_ise (slot);
5808 }
5809
5810 Connection
5811 InfoManager::signal_connect_get_keyboard_ise (InfoManagerSlotString2*             slot)
5812 {
5813     return m_impl->signal_connect_get_keyboard_ise (slot);
5814 }
5815
5816 Connection
5817 InfoManager::signal_connect_show_help (InfoManagerSlotString*              slot)
5818 {
5819     return m_impl->signal_connect_show_help (slot);
5820 }
5821
5822 Connection
5823 InfoManager::signal_connect_show_factory_menu (InfoManagerSlotFactoryInfoVector*   slot)
5824 {
5825     return m_impl->signal_connect_show_factory_menu (slot);
5826 }
5827
5828 Connection
5829 InfoManager::signal_connect_show_preedit_string (InfoManagerSlotVoid*                slot)
5830 {
5831     return m_impl->signal_connect_show_preedit_string (slot);
5832 }
5833
5834 Connection
5835 InfoManager::signal_connect_show_aux_string (InfoManagerSlotVoid*                slot)
5836 {
5837     return m_impl->signal_connect_show_aux_string (slot);
5838 }
5839
5840 Connection
5841 InfoManager::signal_connect_show_lookup_table (InfoManagerSlotVoid*                slot)
5842 {
5843     return m_impl->signal_connect_show_lookup_table (slot);
5844 }
5845
5846 Connection
5847 InfoManager::signal_connect_show_associate_table (InfoManagerSlotVoid*                slot)
5848 {
5849     return m_impl->signal_connect_show_associate_table (slot);
5850 }
5851
5852 Connection
5853 InfoManager::signal_connect_hide_preedit_string (InfoManagerSlotVoid*                slot)
5854 {
5855     return m_impl->signal_connect_hide_preedit_string (slot);
5856 }
5857
5858 Connection
5859 InfoManager::signal_connect_hide_aux_string (InfoManagerSlotVoid*                slot)
5860 {
5861     return m_impl->signal_connect_hide_aux_string (slot);
5862 }
5863
5864 Connection
5865 InfoManager::signal_connect_hide_lookup_table (InfoManagerSlotVoid*                slot)
5866 {
5867     return m_impl->signal_connect_hide_lookup_table (slot);
5868 }
5869
5870 Connection
5871 InfoManager::signal_connect_hide_associate_table (InfoManagerSlotVoid*                slot)
5872 {
5873     return m_impl->signal_connect_hide_associate_table (slot);
5874 }
5875
5876 Connection
5877 InfoManager::signal_connect_update_preedit_string (InfoManagerSlotAttributeStringInt*  slot)
5878 {
5879     return m_impl->signal_connect_update_preedit_string (slot);
5880 }
5881
5882 Connection
5883 InfoManager::signal_connect_update_preedit_caret (InfoManagerSlotInt*                 slot)
5884 {
5885     return m_impl->signal_connect_update_preedit_caret (slot);
5886 }
5887
5888 Connection
5889 InfoManager::signal_connect_update_aux_string (InfoManagerSlotAttributeString*     slot)
5890 {
5891     return m_impl->signal_connect_update_aux_string (slot);
5892 }
5893
5894 Connection
5895 InfoManager::signal_connect_update_lookup_table (InfoManagerSlotLookupTable*         slot)
5896 {
5897     return m_impl->signal_connect_update_lookup_table (slot);
5898 }
5899
5900 Connection
5901 InfoManager::signal_connect_update_associate_table (InfoManagerSlotLookupTable*         slot)
5902 {
5903     return m_impl->signal_connect_update_associate_table (slot);
5904 }
5905
5906 Connection
5907 InfoManager::signal_connect_register_properties (InfoManagerSlotPropertyList*        slot)
5908 {
5909     return m_impl->signal_connect_register_properties (slot);
5910 }
5911
5912 Connection
5913 InfoManager::signal_connect_update_property (InfoManagerSlotProperty*            slot)
5914 {
5915     return m_impl->signal_connect_update_property (slot);
5916 }
5917
5918 Connection
5919 InfoManager::signal_connect_register_helper_properties (InfoManagerSlotIntPropertyList*     slot)
5920 {
5921     return m_impl->signal_connect_register_helper_properties (slot);
5922 }
5923
5924 Connection
5925 InfoManager::signal_connect_update_helper_property (InfoManagerSlotIntProperty*         slot)
5926 {
5927     return m_impl->signal_connect_update_helper_property (slot);
5928 }
5929
5930 Connection
5931 InfoManager::signal_connect_register_helper (InfoManagerSlotIntHelperInfo*       slot)
5932 {
5933     return m_impl->signal_connect_register_helper (slot);
5934 }
5935
5936 Connection
5937 InfoManager::signal_connect_remove_helper (InfoManagerSlotInt*                 slot)
5938 {
5939     return m_impl->signal_connect_remove_helper (slot);
5940 }
5941
5942 Connection
5943 InfoManager::signal_connect_set_active_ise_by_uuid (InfoManagerSlotStringBool*          slot)
5944 {
5945     return m_impl->signal_connect_set_active_ise_by_uuid (slot);
5946 }
5947
5948 Connection
5949 InfoManager::signal_connect_focus_in (InfoManagerSlotVoid*                slot)
5950 {
5951     return m_impl->signal_connect_focus_in (slot);
5952 }
5953
5954 Connection
5955 InfoManager::signal_connect_focus_out (InfoManagerSlotVoid*                slot)
5956 {
5957     return m_impl->signal_connect_focus_out (slot);
5958 }
5959
5960 Connection
5961 InfoManager::signal_connect_expand_candidate (InfoManagerSlotVoid*                slot)
5962 {
5963     return m_impl->signal_connect_expand_candidate (slot);
5964 }
5965
5966 Connection
5967 InfoManager::signal_connect_contract_candidate (InfoManagerSlotVoid*                slot)
5968 {
5969     return m_impl->signal_connect_contract_candidate (slot);
5970 }
5971
5972 Connection
5973 InfoManager::signal_connect_select_candidate (InfoManagerSlotInt*                 slot)
5974 {
5975     return m_impl->signal_connect_select_candidate (slot);
5976 }
5977
5978 Connection
5979 InfoManager::signal_connect_get_ise_list (InfoManagerSlotBoolStringVector*    slot)
5980 {
5981     return m_impl->signal_connect_get_ise_list (slot);
5982 }
5983
5984 Connection
5985 InfoManager::signal_connect_get_all_helper_ise_info (InfoManagerSlotBoolHelperInfo*      slot)
5986 {
5987     return m_impl->signal_connect_get_all_helper_ise_info (slot);
5988 }
5989
5990 Connection
5991 InfoManager::signal_connect_set_has_option_helper_ise_info (InfoManagerSlotStringBool*      slot)
5992 {
5993     return m_impl->signal_connect_set_has_option_helper_ise_info (slot);
5994 }
5995
5996 Connection
5997 InfoManager::signal_connect_set_enable_helper_ise_info (InfoManagerSlotStringBool*     slot)
5998 {
5999     return m_impl->signal_connect_set_enable_helper_ise_info (slot);
6000 }
6001
6002 Connection
6003 InfoManager::signal_connect_show_helper_ise_list (InfoManagerSlotVoid*                slot)
6004 {
6005     return m_impl->signal_connect_show_helper_ise_list (slot);
6006 }
6007
6008 Connection
6009 InfoManager::signal_connect_show_helper_ise_selector (InfoManagerSlotVoid*                slot)
6010 {
6011     return m_impl->signal_connect_show_helper_ise_selector (slot);
6012 }
6013
6014 Connection
6015 InfoManager::signal_connect_is_helper_ise_enabled (InfoManagerSlotStringInt*           slot)
6016 {
6017     return m_impl->signal_connect_is_helper_ise_enabled (slot);
6018 }
6019
6020 Connection
6021 InfoManager::signal_connect_get_ise_information (InfoManagerSlotBoolString4int2*     slot)
6022 {
6023     return m_impl->signal_connect_get_ise_information (slot);
6024 }
6025
6026 Connection
6027 InfoManager::signal_connect_get_keyboard_ise_list (InfoManagerSlotBoolStringVector*    slot)
6028 {
6029     return m_impl->signal_connect_get_keyboard_ise_list (slot);
6030 }
6031
6032 Connection
6033 InfoManager::signal_connect_update_ise_geometry (InfoManagerSlotIntIntIntInt*        slot)
6034 {
6035     return m_impl->signal_connect_update_ise_geometry (slot);
6036 }
6037
6038 Connection
6039 InfoManager::signal_connect_get_language_list (InfoManagerSlotStringVector*        slot)
6040 {
6041     return m_impl->signal_connect_get_language_list (slot);
6042 }
6043
6044 Connection
6045 InfoManager::signal_connect_get_all_language (InfoManagerSlotStringVector*        slot)
6046 {
6047     return m_impl->signal_connect_get_all_language (slot);
6048 }
6049
6050 Connection
6051 InfoManager::signal_connect_get_ise_language (InfoManagerSlotStrStringVector*     slot)
6052 {
6053     return m_impl->signal_connect_get_ise_language (slot);
6054 }
6055
6056 Connection
6057 InfoManager::signal_connect_get_ise_info_by_uuid (InfoManagerSlotStringISEINFO*       slot)
6058 {
6059     return m_impl->signal_connect_get_ise_info_by_uuid (slot);
6060 }
6061
6062 Connection
6063 InfoManager::signal_connect_send_key_event (InfoManagerSlotKeyEvent*            slot)
6064 {
6065     return m_impl->signal_connect_send_key_event (slot);
6066 }
6067
6068 Connection
6069 InfoManager::signal_connect_accept_connection (InfoManagerSlotInt*                 slot)
6070 {
6071     return m_impl->signal_connect_accept_connection (slot);
6072 }
6073
6074 Connection
6075 InfoManager::signal_connect_close_connection (InfoManagerSlotInt*                 slot)
6076 {
6077     return m_impl->signal_connect_close_connection (slot);
6078 }
6079
6080 Connection
6081 InfoManager::signal_connect_exit (InfoManagerSlotVoid*                slot)
6082 {
6083     return m_impl->signal_connect_exit (slot);
6084 }
6085
6086 Connection
6087 InfoManager::signal_connect_transaction_start (InfoManagerSlotVoid*                slot)
6088 {
6089     return m_impl->signal_connect_transaction_start (slot);
6090 }
6091
6092 Connection
6093 InfoManager::signal_connect_transaction_end (InfoManagerSlotVoid*                slot)
6094 {
6095     return m_impl->signal_connect_transaction_end (slot);
6096 }
6097
6098 Connection
6099 InfoManager::signal_connect_lock (InfoManagerSlotVoid*                slot)
6100 {
6101     return m_impl->signal_connect_lock (slot);
6102 }
6103
6104 Connection
6105 InfoManager::signal_connect_unlock (InfoManagerSlotVoid*                slot)
6106 {
6107     return m_impl->signal_connect_unlock (slot);
6108 }
6109
6110 Connection
6111 InfoManager::signal_connect_update_input_context (InfoManagerSlotIntInt*              slot)
6112 {
6113     return m_impl->signal_connect_update_input_context (slot);
6114 }
6115
6116 Connection
6117 InfoManager::signal_connect_show_ise (InfoManagerSlotVoid*                slot)
6118 {
6119     return m_impl->signal_connect_show_ise (slot);
6120 }
6121
6122 Connection
6123 InfoManager::signal_connect_hide_ise (InfoManagerSlotVoid*                slot)
6124 {
6125     return m_impl->signal_connect_hide_ise (slot);
6126 }
6127
6128 Connection
6129 InfoManager::signal_connect_will_show_ack (InfoManagerSlotVoid*                slot)
6130 {
6131     return m_impl->signal_connect_will_show_ack (slot);
6132 }
6133
6134 Connection
6135 InfoManager::signal_connect_will_hide_ack (InfoManagerSlotVoid*                slot)
6136 {
6137     return m_impl->signal_connect_will_hide_ack (slot);
6138 }
6139
6140 Connection
6141 InfoManager::signal_connect_set_keyboard_mode (InfoManagerSlotInt*                 slot)
6142 {
6143     return m_impl->signal_connect_set_keyboard_mode (slot);
6144 }
6145
6146 Connection
6147 InfoManager::signal_connect_candidate_will_hide_ack (InfoManagerSlotVoid*                slot)
6148 {
6149     return m_impl->signal_connect_candidate_will_hide_ack (slot);
6150 }
6151
6152 Connection
6153 InfoManager::signal_connect_get_ise_state (InfoManagerSlotInt2*                slot)
6154 {
6155     return m_impl->signal_connect_get_ise_state (slot);
6156 }
6157
6158 Connection
6159 InfoManager::signal_connect_run_helper (InfoManagerSlotString3*                slot)
6160 {
6161     return m_impl->signal_connect_run_helper (slot);
6162 }
6163
6164 Connection
6165 InfoManager::signal_connect_launch_option_application (InfoManagerSlotBoolString*                slot)
6166 {
6167     return m_impl->signal_connect_launch_option_application (slot);
6168 }
6169
6170 Connection
6171 InfoManager::signal_connect_get_ise_setting_appid (InfoManagerSlotBoolString2*                slot)
6172 {
6173     return m_impl->signal_connect_get_ise_setting_appid (slot);
6174 }
6175
6176 Connection
6177 InfoManager::signal_connect_get_recent_ise_geometry (InfoManagerSlotIntRect*             slot)
6178 {
6179     return m_impl->signal_connect_get_recent_ise_geometry (slot);
6180 }
6181
6182 Connection
6183 InfoManager::signal_connect_check_privilege_by_sockfd  (InfoManagerSlotIntString2* slot)
6184 {
6185     return m_impl->signal_connect_check_privilege_by_sockfd (slot);
6186 }
6187
6188 Connection
6189 InfoManager::signal_connect_remoteinput_send_input_message  (InfoManagerSlotStringBool*          slot)
6190 {
6191     return m_impl->signal_connect_remoteinput_send_input_message (slot);
6192 }
6193
6194 Connection
6195 InfoManager::signal_connect_remoteinput_send_surrounding_text  (InfoManagerSlotIntString*                slot)
6196 {
6197     return m_impl->signal_connect_remoteinput_send_surrounding_text (slot);
6198 }
6199
6200 } /* namespace scim */
6201
6202 /*
6203 vi:ts=4:nowrap:ai:expandtab
6204 */