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