2 * @file isf_panel_agent_manager.h
3 * @brief Defines scim::PanelAgentManager and their related types.
5 * scim::PanelAgentManager is a class used to manage PanelAgent object.
8 /* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
11 * Smart Common Input Method
13 * Copyright (c) 2004-2005 James Su <suzhe@tsinghua.org.cn>
14 * Copyright (c) 2012-2016 Samsung Electronics Co., Ltd.
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License as published by the Free Software Foundation; either
20 * version 2 of the License, or (at your option) any later version.
22 * This library is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU Lesser General Public License for more details.
27 * You should have received a copy of the GNU Lesser General Public
28 * License along with this program; if not, write to the
29 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
30 * Boston, MA 02111-1307 USA
34 #ifndef __ISF_PANEL_AGENT_MANAGER_H
35 #define __ISF_PANEL_AGENT_MANAGER_H
37 #include <scim_panel_common.h>
48 * @brief The class to implement all socket protocol in Panel.
50 * This class acts like a stand alone SocketServer.
51 * It has its own dedicated main loop, and will be blocked when run () is called.
52 * So run () must be called within a separated thread, in order to not block
53 * the main loop of the Panel program itself.
55 * Before calling run (), the panel must hook the callback functions to the
56 * corresponding signals.
58 * Note that, there are two special signals: lock(void) and unlock(void). These
59 * two signals are used to provide a thread lock to PanelAgent, so that PanelAgent
60 * can run correctly within a multi-threading Panel program.
62 class EXAPI PanelAgentManager
64 class PanelAgentManagerImpl;
65 PanelAgentManagerImpl* m_impl;
67 PanelAgentManager (const PanelAgentManager&);
68 const PanelAgentManager& operator = (const PanelAgentManager&);
72 ~PanelAgentManager ();
75 * @brief Initialize this PanelAgent.
77 * @param config The name of the config module to be used by Helpers.
78 * @param display The name of display, on which the Panel should run.
79 * @param resident If this is true then this PanelAgent will keep running
80 * even if there is no more client connected.
82 * @return true if the PanelAgent is initialized correctly and ready to run.
84 bool initialize (InfoManager* info_manager, const ConfigPointer& config, const String& display, bool resident = false);
87 * @brief Check if this PanelAgent is initialized correctly and ready to run.
89 * @return true if this PanelAgent is ready to run.
91 bool valid (void) const;
94 * @brief Stop this PanelAgent.
101 * @brief Notice helper ISE to focus out.
103 * @param uuid The helper ISE uuid.
105 void focus_out_helper (int client, uint32 context, const String& uuid);
108 * @brief Notice helper ISE to focus in.
110 * @param uuid The helper ISE uuid.
112 void focus_in_helper (int client, uint32 context, const String& uuid);
115 * @brief Notice helper ISE to show window.
117 * @param uuid The helper ISE uuid.
119 void show_helper (int client, uint32 context, const String& uuid, char* data, size_t& len);
122 * @brief Notice helper ISE to hide window.
124 * @param uuid The helper ISE uuid.
126 void hide_helper (int client, uint32 context, const String& uuid);
129 * @brief Reset keyboard ISE.
131 * @return true if this operation is successful, otherwise return false.
133 void reset_keyboard_ise (int client, uint32 context);
136 * @brief Change the factory used by the focused IMEngineInstance object.
138 * @param uuid The uuid of the new factory.
139 * @return true if the command was sent correctly.
141 void change_factory (int client, uint32 context, const String& uuid);
144 * @brief Notice Helper ISE that candidate more window is showed.
145 * @return true if the command was sent correctly.
147 void candidate_more_window_show (int client, uint32 context);
150 * @brief Notice Helper ISE that candidate more window is hidden.
151 * @return true if the command was sent correctly.
153 void candidate_more_window_hide (int client, uint32 context);
156 * @brief Notice Helper ISE that show candidate.
157 * @return true if the command was sent correctly.
159 void helper_candidate_show (int client, uint32 context, const String& uuid);
162 * @brief Notice Helper ISE that hide candidate.
163 * @return true if the command was sent correctly.
165 void helper_candidate_hide (int client, uint32 context, const String& uuid);
168 * @brief Update helper lookup table.
169 * @return true if the command was sent correctly.
171 void update_helper_lookup_table (int client, uint32 context, const String& uuid, const LookupTable& table);
174 * @brief Let the focused IMEngineInstance object
175 * select a aux in current aux string.
177 * @param item The index of the selected aux.
178 * @return true if the command was sent correctly.
180 void select_aux (int client, uint32 context, uint32 item);
183 * @brief Let the focused IMEngineInstance object
184 * select a candidate in current lookup table.
186 * @param item The index of the selected candidate.
187 * @return true if the command was sent correctly.
189 void select_candidate (int client, uint32 context, uint32 item);
192 * @brief Let the focused IMEngineInstance object
193 * flip the LookupTable to previous page.
194 * @return true if the command was sent correctly.
196 void lookup_table_page_up (int client, uint32 context);
199 * @brief Let the focused IMEngineInstance object
200 * flip the LookupTable to next page.
201 * @return true if the command was sent correctly.
203 void lookup_table_page_down (int client, uint32 context);
206 * @brief Let the focused IMEngineInstance object
207 * update the page size of the LookupTable.
209 * @param size The new page size.
210 * @return true if the command was sent correctly.
212 void update_lookup_table_page_size (int client, uint32 context, uint32 size);
215 * @brief Let the focused IMEngineInstance object
216 * update candidate items layout.
218 * @param row_items The items of each row.
219 * @return true if the command was sent correctly.
221 void update_candidate_item_layout (int client, uint32 context, const std::vector<uint32>& row_items);
224 * @brief Let the focused IMEngineInstance object
225 * select a associate in current associate table.
227 * @param item The index of the selected associate.
228 * @return true if the command was sent correctly.
230 void select_associate (int client, uint32 context, uint32 item);
233 * @brief Let the focused IMEngineInstance object
234 * flip the AssociateTable to previous page.
235 * @return true if the command was sent correctly.
237 void associate_table_page_up (int client, uint32 context);
240 * @brief Let the focused IMEngineInstance object
241 * flip the AssociateTable to next page.
242 * @return true if the command was sent correctly.
244 void associate_table_page_down (int client, uint32 context);
247 * @brief Let the focused IMEngineInstance object
248 * update the page size of the AssociateTable.
250 * @param size The new page size.
251 * @return true if the command was sent correctly.
253 void update_associate_table_page_size (int client, uint32 context, uint32 size);
256 * @brief Inform helper ISE to update displayed candidate number.
258 * @param size The displayed candidate number.
259 * @return true if the command was sent correctly.
261 void update_displayed_candidate_number (int client, uint32 context, uint32 size);
264 * @brief Trigger a property of the focused IMEngineInstance object.
266 * @param property The property key to be triggered.
267 * @return true if the command was sent correctly.
269 void trigger_property (int client, uint32 context, const String& property);
274 * @brief Let all FrontEnds and Helpers reload configuration.
275 * @return true if the command was sent correctly.
277 void reload_config (int client);
280 * @brief Let all FrontEnds, Helpers and this Panel exit.
281 * @return true if the command was sent correctly.
283 void exit (int client, uint32 context);
286 * @brief Send candidate longpress event to ISE.
288 * @param type The candidate object type.
289 * @param index The candidate object index.
293 void send_longpress_event (int client, uint32 context, uint32 index);
294 void update_panel_event (int id, uint32 contextid, int cmd, uint32 nType, uint32 nValue);
295 void update_keyboard_ise_list (int id, uint32 contextid);
296 void set_helper_mode (int client, uint32 context, const String& uuid, uint32& mode);
297 void set_helper_language (int client, uint32 context, const String& uuid, uint32& language);
298 void set_helper_imdata (int client, uint32 context, const String& uuid, const char* imdata, size_t& len);
299 void set_helper_return_key_type (int client, uint32 context, const String& uuid, uint32 type);
300 void get_helper_return_key_type (int client, uint32 context, const String& uuid, _OUT_ uint32& type);
301 void set_helper_return_key_disable (int client, uint32 context, const String& uuid, uint32 disabled);
302 void get_helper_return_key_disable (int client, uint32 context, const String& uuid, _OUT_ uint32& disabled);
303 void set_helper_layout (int client, uint32 context, const String& uuid, uint32& layout);
304 void set_helper_input_mode (int client, uint32 context, const String& uuid, uint32& mode);
305 void set_helper_input_hint (int client, uint32 context, const String& uuid, uint32& hint);
306 void set_helper_bidi_direction (int client, uint32 context, const String& uuid, uint32& direction);
307 void set_helper_caps_mode (int client, uint32 context, const String& uuid, uint32& mode);
308 void show_helper_option_window (int client, uint32 context, const String& uuid);
309 void resume_helper_option_window (int client, uint32 context, const String& uuid);
310 bool process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, uint32 serial);
311 bool get_helper_geometry (int client, uint32 context, String& uuid, _OUT_ struct rectinfo& info);
312 void get_helper_imdata (int client, uint32 context, String& uuid, _OUT_ char** imdata, _OUT_ size_t& len);
313 void get_helper_layout (int client, uint32 context, String& uuid, uint32& layout);
314 void get_ise_language_locale (int client, uint32 context, String& uuid, _OUT_ char** data, _OUT_ size_t& len);
315 void check_option_window (int client, uint32 context, String& uuid, _OUT_ uint32& avail);
316 void reset_ise_option (int client_id, uint32 context);
317 void reset_helper_context (int client_id, uint32 context, const String& uuid);
318 void socket_update_surrounding_text (int client, uint32 context, const String& uuid, String& text, uint32 cursor);
319 void socket_remoteinput_focus_in (int client);
320 void socket_remoteinput_focus_out (int client);
321 void socket_remoteinput_entry_metadata (int client, uint32 hint, uint32 layout, int variation, uint32 autocapital_type, int return_key_disabled);
322 void socket_remoteinput_surrounding_text (int client, String& text, uint32 cursor);
323 void socket_remoteinput_input_resource (int client, uint32 input_resource);
324 void socket_update_selection (int client, uint32 context, String& uuid, String text);
325 void socket_get_keyboard_ise_list (int client, uint32 context, const String& uuid, std::vector<String>& list);
326 void socket_get_candidate_ui (int client, uint32 context, const String& uuid, int style, int mode);
327 void socket_get_candidate_geometry (int client, uint32 context, const String& uuid, struct rectinfo& info);
328 void socket_get_keyboard_ise (int client, uint32 context, const String& uuid, String& ise_name, String& ise_uuid);
329 void socket_start_helper (int client, uint32 context, const String& ic_uuid);
330 void helper_detach_input_context (int client, uint32 context, const String& ic_uuid);
331 void helper_process_imengine_event (int client, uint32 context, const String& ic_uuid, const Transaction& nest_transaction);
332 void process_helper_event (int client, uint32 context, String target_uuid, String active_uuid, Transaction& nest_trans);
333 void socket_helper_key_event (int client, uint32 context, int cmd , KeyEvent& key);
334 void socket_helper_get_surrounding_text (int client, uint32 context_id, uint32 maxlen_before, uint32 maxlen_after);
335 void socket_helper_delete_surrounding_text (int client, uint32 context_id, uint32 offset, uint32 len);
336 void socket_helper_get_selection (int client, uint32 context_id);
337 void socket_helper_set_selection (int client, uint32 context_id, uint32 start, uint32 end);
338 void update_ise_input_context (int focused_client, uint32 focused_context, uint32 type, uint32 value);
339 void send_private_command (int focused_client, uint32 focused_context, String command);
340 void helper_all_update_spot_location (int client_id, uint32 context_id, String uuid, int x, int y);
341 void helper_all_update_cursor_position (int client_id, uint32 context_id, String uuid, int cursor_pos);
342 void helper_all_update_screen (int client_id, uint32 context_id, String uuid, int screen);
343 void commit_string (int target_client, uint32 target_context, const WideString& wstr);
344 void show_preedit_string (int target_client, uint32 target_context);
345 void hide_preedit_string (int target_client, uint32 target_context);
346 void update_preedit_string (int target_client, uint32 target_context, WideString preedit, WideString commit, AttributeList& attrs, uint32 caret);
347 void update_preedit_caret (int focused_client, uint32 focused_context, uint32 caret);
348 void recapture_string (int target_client, uint32 target_context, int offset, int len, WideString preedit, WideString commit, AttributeList& attrs);
349 void helper_attach_input_context_and_update_screen (int client, std::vector < std::pair <uint32, String> >& helper_ic_index, uint32 current_screen);
350 void hide_helper_ise (int id, uint32 context);
351 bool process_input_device_event(int client, uint32 context, const String& uuid, uint32 type, const char *data, size_t len, _OUT_ uint32& result);
352 void process_key_event_done(int client, uint32 context, KeyEvent &key, uint32 ret, uint32 serial);
353 void request_ise_hide(int client, uint32 context);
354 void set_autocapital_type(int id, uint32 context_id, String uuid, int mode);
355 void update_ise_geometry(int id, uint32 context_id, uint32 x, uint32 y, uint32 width, uint32 height);
356 void remote_update_preedit_string (int target_client, uint32 target_context, const WideString str, const WideString commit,const AttributeList &attrs, uint32 caret);
357 void remote_send_key_event (int target_client, uint32 target_context, const KeyEvent &key);
358 void remote_forward_key_event (int target_client, uint32 target_context, const KeyEvent &key);
359 void remote_commit_string (int target_client, uint32 target_context, const WideString& wstr);
360 void remote_delete_surrounding_text (int client, uint32 context_id, uint32 offset, uint32 len);
361 void set_prediction_allow (int id, uint32 context_id, String uuid, int mode);
362 void send_fail_reply (int client);
367 } /* namespace scim */
369 #endif /* __ISF_PANEL_AGENT_MANAGER_H */
372 vi:ts=4:nowrap:ai:expandtab