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