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