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