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