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);
272 * @brief Let all FrontEnds and Helpers reload configuration.
273 * @return true if the command was sent correctly.
275 void reload_config (int client);
278 * @brief Let all FrontEnds, Helpers and this Panel exit.
279 * @return true if the command was sent correctly.
281 void exit (int client, uint32 context);
284 * @brief Send candidate longpress event to ISE.
286 * @param type The candidate object type.
287 * @param index The candidate object index.
291 void send_longpress_event (int client, uint32 context, uint32 index);
292 void update_panel_event (int id, uint32 contextid, int cmd, uint32 nType, uint32 nValue);
293 void update_keyboard_ise_list (int id, uint32 contextid);
294 void set_helper_mode (int client, uint32 context, const String& uuid, uint32& mode);
295 void set_helper_language (int client, uint32 context, const String& uuid, uint32& language);
296 void set_helper_imdata (int client, uint32 context, const String& uuid, const char* imdata, size_t& len);
297 void set_helper_return_key_type (int client, uint32 context, const String& uuid, uint32 type);
298 void get_helper_return_key_type (int client, uint32 context, const String& uuid, _OUT_ uint32& type);
299 void set_helper_return_key_disable (int client, uint32 context, const String& uuid, uint32 disabled);
300 void get_helper_return_key_disable (int client, uint32 context, const String& uuid, _OUT_ uint32& disabled);
301 void set_helper_layout (int client, uint32 context, const String& uuid, uint32& layout);
302 void set_helper_input_mode (int client, uint32 context, const String& uuid, uint32& mode);
303 void set_helper_input_hint (int client, uint32 context, const String& uuid, uint32& hint);
304 void set_helper_bidi_direction (int client, uint32 context, const String& uuid, uint32& direction);
305 void set_helper_caps_mode (int client, uint32 context, const String& uuid, uint32& mode);
306 void show_helper_option_window (int client, uint32 context, const String& uuid, uint32 caller_pid, uint32 ime_pid);
307 void resume_helper_option_window (int client, uint32 context, const String& uuid);
308 void set_transient_for (uint32 caller_pid, uint32 ime_pid);
309 void set_helper_keyboard_mode (int client, uint32 context, const String& uuid, uint32& mode);
310 void set_helper_prediction_hint (int client, uint32 context, const String& uuid, String& prediction_hint);
311 void set_helper_prediction_hint_data (int id, uint32 context_id, const String& uuid, String& key, String& value);
312 void set_helper_optimization_hint (int id, uint32 context_id, const String& uuid, uint32 hint);
313 void set_helper_mime_type (int client, uint32 context, const String& uuid, String& mime_type);
314 void set_helper_enable (int client, uint32 context, const String& uuid, uint32 enabled);
315 void set_helper_input_panel_position_align (int client, uint32 context, const String& uuid, uint32 x, uint32 y, uint32 align);
316 void finalize_content_helper (int client, uint32 context, const String& uuid, String& text, uint32& cursor_pos);
317 bool process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, uint32 serial, uint32 keycode);
318 bool get_helper_geometry (int client, uint32 context, String& uuid, _OUT_ struct rectinfo& info);
319 void get_helper_imdata (int client, uint32 context, String& uuid, _OUT_ char** imdata, _OUT_ size_t& len);
320 void get_helper_layout (int client, uint32 context, String& uuid, uint32& layout);
321 void get_ise_language_locale (int client, uint32 context, String& uuid, _OUT_ char** data, _OUT_ size_t& len);
322 void check_option_window (int client, uint32 context, String& uuid, _OUT_ uint32& avail);
323 void reset_ise_option (int client_id, uint32 context);
324 void reset_helper_context (int client_id, uint32 context, const String& uuid);
325 void socket_update_surrounding_text (int client, uint32 context, const String& uuid, String& text, uint32 cursor);
326 void socket_remoteinput_focus_in (int client);
327 void socket_remoteinput_focus_out (int client);
328 void socket_remoteinput_entry_metadata (int client, uint32 hint, uint32 layout, int variation, uint32 autocapital_type, int return_key_disabled, uint32 return_key_type);
329 void socket_remoteinput_surrounding_text (int client, String& text, uint32 cursor);
330 void socket_remoteinput_input_resource (int client, uint32 input_resource);
331 void socket_remoteinput_key_symbol (int client, String&key_symbol, int press, uint32_t timestamp);
332 void socket_remoteinput_cursor_position (int client, uint32 cursor);
333 void socket_update_selection (int client, uint32 context, String& uuid, String text);
334 void socket_get_keyboard_ise_list (int client, uint32 context, const String& uuid, std::vector<String>& list);
335 void socket_get_candidate_ui (int client, uint32 context, const String& uuid, int style, int mode);
336 void socket_get_candidate_geometry (int client, uint32 context, const String& uuid, struct rectinfo& info);
337 void socket_get_keyboard_ise (int client, uint32 context, const String& uuid, String& ise_name, String& ise_uuid);
338 void socket_start_helper (int client, uint32 context, const String& ic_uuid);
339 void helper_detach_input_context (int client, uint32 context, const String& ic_uuid);
340 void helper_process_imengine_event (int client, uint32 context, const String& ic_uuid, const Transaction& nest_transaction);
341 void process_helper_event (int client, uint32 context, String target_uuid, String active_uuid, Transaction& nest_trans);
342 void socket_helper_key_event (int client, uint32 context, int cmd , KeyEvent& key);
343 void socket_helper_get_surrounding_text (int client, uint32 context_id, uint32 maxlen_before, uint32 maxlen_after);
344 void socket_helper_delete_surrounding_text (int client, uint32 context_id, uint32 offset, uint32 len);
345 void socket_helper_get_selection (int client, uint32 context_id);
346 void socket_helper_set_selection (int client, uint32 context_id, uint32 start, uint32 end);
347 void update_ise_input_context (int focused_client, uint32 focused_context, uint32 type, uint32 value);
348 void update_ise_language_locale (int focused_client, uint32 focused_context, String locale);
349 void send_private_command (int focused_client, uint32 focused_context, String command);
350 void commit_content (int focused_client, uint32 focused_context, String content, String description, String mime_types);
351 void helper_all_update_spot_location (int client_id, uint32 context_id, String uuid, int x, int y);
352 void helper_all_update_cursor_position (int client_id, uint32 context_id, String uuid, int cursor_pos);
353 void helper_all_update_screen (int client_id, uint32 context_id, String uuid, int screen);
354 void commit_string (int target_client, uint32 target_context, const WideString& wstr);
355 void show_preedit_string (int target_client, uint32 target_context);
356 void hide_preedit_string (int target_client, uint32 target_context);
357 void update_preedit_string (int target_client, uint32 target_context, WideString preedit, WideString commit, AttributeList& attrs, uint32 caret);
358 void update_preedit_caret (int focused_client, uint32 focused_context, uint32 caret);
359 void recapture_string (int target_client, uint32 target_context, int offset, int len, WideString preedit, WideString commit, AttributeList& attrs);
360 void helper_attach_input_context_and_update_screen (int client, std::vector < std::pair <uint32, String> >& helper_ic_index, uint32 current_screen);
361 void hide_helper_ise (int id, uint32 context);
362 bool process_input_device_event(int client, uint32 context, const String& uuid, uint32 type, const char *data, size_t len, _OUT_ uint32& result);
363 void process_key_event_done(int client, uint32 context, KeyEvent &key, uint32 ret, uint32 serial);
364 void request_ise_hide(int client, uint32 context);
365 void set_autocapital_type(int id, uint32 context_id, String uuid, int mode);
366 void update_ise_geometry(int id, uint32 context_id, uint32 x, uint32 y, uint32 width, uint32 height);
367 void remote_update_preedit_string (int target_client, uint32 target_context, const WideString str, const WideString commit, const AttributeList &attrs, uint32 caret);
368 void remote_send_key_event (int target_client, uint32 target_context, const KeyEvent &key);
369 void remote_forward_key_event (int target_client, uint32 target_context, const KeyEvent &key);
370 void remote_commit_string (int target_client, uint32 target_context, const WideString& wstr);
371 void remote_delete_surrounding_text (int client, uint32 context_id, uint32 offset, uint32 len);
372 void set_prediction_allow (int id, uint32 context_id, String uuid, int mode);
373 void send_fail_reply (int client);
374 void update_entry_metadata(int client, uint32 context_id);
375 void request_ise_reshow(int client, uint32 context_id);
376 void set_floating_mode (int client, uint32 context_id, uint32 floating_mode);
377 void set_floating_drag_enabled (int client, uint32 context_id, uint32 enabled);
378 void move_resize_floating_window (int client, uint32 context_id, uint32 x, uint32 y, uint32 width, uint32 height);
383 } /* namespace scim */
385 #endif /* __ISF_PANEL_AGENT_MANAGER_H */
388 vi:ts=4:nowrap:ai:expandtab