ism/modules/imengine/Makefile
ism/modules/filter/Makefile
ism/modules/config/Makefile
+ ism/modules/panelagent/ecoresocket/Makefile
+ ism/modules/panelagent/wayland/Makefile
ism/configs/Makefile
ism/extras/Makefile
ism/extras/gtk2_immodule/Makefile
ism/extras/efl_immodule/Makefile
ism/extras/efl_panel/Makefile
ism/extras/kbd_mode_changer/Makefile
- ism/extras/efl_wsc/Makefile
ism/demos/Makefile
intltool-extract
intltool-merge
MAINTAINERCLEANFILES = Makefile.in
CLEANFILES = *.bak
-SUBDIRS = gtk2_immodule efl_panel efl_immodule kbd_mode_changer efl_wsc
+SUBDIRS = gtk2_immodule efl_panel efl_immodule kbd_mode_changer
static void launch_default_soft_keyboard (keynode_t *key = NULL, void* data = NULL);
/* PanelAgent related functions */
-static bool initialize_panel_agent (const String &config, const String &display, bool resident);
+static bool initialize_panel_agent (const ConfigPointer& config, const String &display, bool resident);
static void slot_reload_config (void);
static void slot_focus_in (void);
static void slot_start_default_ise (void);
static void slot_stop_default_ise (void);
-static Eina_Bool panel_agent_handler (void *data, Ecore_Fd_Handler *fd_handler);
-
#if HAVE_ECOREX
static Eina_Bool efl_create_control_window (void);
static Ecore_X_Window efl_get_app_window (void);
static String _initial_ise_uuid = String ("");
static String _locale_string = String ("");
static ConfigPointer _config;
-static PanelAgent *_panel_agent = 0;
-static std::vector<Ecore_Fd_Handler *> _read_handler_list;
+static InfoManager *_info_manager = 0;
static clock_t _clock_start;
static void show_soft_keyboard (void)
{
/* If the current toolbar mode is not HELPER_MODE, do not proceed */
- if (_panel_agent->get_current_toolbar_mode () != TOOLBAR_HELPER_MODE) {
- LOGD ("Current toolbar mode should be TOOBAR_HELPER_MODE but is %d, returning\n", _panel_agent->get_current_toolbar_mode ());
+ if (_info_manager->get_current_toolbar_mode () != TOOLBAR_HELPER_MODE) {
+ LOGD ("Current toolbar mode should be TOOBAR_HELPER_MODE but is %d, returning\n", _info_manager->get_current_toolbar_mode ());
return;
}
#if HAVE_ECOREX
if (!strncmp (str, HOST_REMOVED, strlen (HOST_REMOVED))) {
LOGD ("HOST_REMOVED\n");
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
change_keyboard_mode (TOOLBAR_HELPER_MODE);
}
return;
}
info.pos_x = (int)info.width > win_w ? 0 : (win_w - info.width) / 2;
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
info.pos_x = 0;
info.pos_y = (win_h > win_w) ? win_h : win_w;
info.width = 0;
LOGD ("angle : %d, w_angle : %d, mode : %d, Geometry : %d %d %d %d\n",
angle, _ise_angle,
- _panel_agent->get_current_toolbar_mode (),
+ _info_manager->get_current_toolbar_mode (),
info.pos_x, info.pos_y, info.width, info.height);
} else {
pos_x = 0;
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
ise_rect.pos_x = 0;
if (_candidate_mode == FIXED_CANDIDATE_WINDOW) {
String IMENGINE_KEY = String (SCIM_CONFIG_DEFAULT_IMENGINE_FACTORY) + String ("/") + String ("~other");
String keyboard_uuid = _config->read (IMENGINE_KEY, String (""));
if (active_uuid != keyboard_uuid) {
- _panel_agent->change_factory (active_uuid);
+ _info_manager->change_factory (active_uuid);
_config->write (IMENGINE_KEY, active_uuid);
_config->flush ();
}
total_appids.push_back(it->appid);
}
if (total_appids.size() > 0)
- _panel_agent->update_ise_list (total_appids);
+ _info_manager->update_ise_list (total_appids);
LOGD("Try to start the initial helper\n");
set_active_ise(_initial_ise_uuid, true);
total_appids.push_back(it->appid);
}
if (total_appids.size() > 0)
- _panel_agent->update_ise_list (total_appids);
+ _info_manager->update_ise_list (total_appids);
if (ret > 1 && _soft_keyboard_launched) { // If the previous appid of pkgid is the current IME, restart it with new appid.
current_ime_appid = scim_global_config_read(String(SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), _initial_ise_uuid);
if (current_ime_appid.compare (appids.front ()) == 0) {
LOGD ("Stop IME(%s)\n", current_ime_appid.c_str ());
- _panel_agent->hide_helper (current_ime_appid);
- _panel_agent->stop_helper (current_ime_appid);
+ _info_manager->hide_helper (current_ime_appid);
+ _info_manager->stop_helper (current_ime_appid);
LOGD ("Start IME(%s)\n", appids.back ().c_str ());
scim_global_config_write (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), appids.back ());
set_keyboard_engine (String (SCIM_COMPOSE_KEY_FACTORY_UUID));
- _panel_agent->start_helper (appids.back ());
+ _info_manager->start_helper (appids.back ());
}
}
}
for (it = _ime_info.begin (); it != _ime_info.end (); it++) {
if (it->mode == TOOLBAR_HELPER_MODE && it->appid.compare(current_ime_appid) == 0) { // Make sure it's Helper ISE...
LOGD ("Restart IME(%s)\n", current_ime_appid.c_str ());
- _panel_agent->hide_helper (current_ime_appid);
- _panel_agent->stop_helper (current_ime_appid);
- _panel_agent->start_helper (current_ime_appid);
+ _info_manager->hide_helper (current_ime_appid);
+ _info_manager->stop_helper (current_ime_appid);
+ _info_manager->start_helper (current_ime_appid);
break;
}
}
for (it = _ime_info.begin (); it != _ime_info.end (); it++) {
if (it->appid.compare(current_ime_appid) == 0 && it->mode == TOOLBAR_HELPER_MODE) { // Make sure it's Helper ISE...
LOGD ("Stop IME(%s)\n", current_ime_appid.c_str ());
- _panel_agent->hide_helper (current_ime_appid);
- _panel_agent->stop_helper (current_ime_appid);
+ _info_manager->hide_helper (current_ime_appid);
+ _info_manager->stop_helper (current_ime_appid);
_soft_keyboard_launched = false;
g_updated_helper_pkgid = package;
break;
total_appids.push_back(it->appid);
}
if (total_appids.size() > 0)
- _panel_agent->update_ise_list (total_appids);
+ _info_manager->update_ise_list (total_appids);
}
}
else {
total_appids.push_back(it->appid);
}
if (total_appids.size() > 0)
- _panel_agent->update_ise_list (total_appids);
+ _info_manager->update_ise_list (total_appids);
LOGD ("Restart IME(%s)\n", appids[0].c_str ());
scim_global_config_write (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), appids[0]);
set_keyboard_engine (String (SCIM_COMPOSE_KEY_FACTORY_UUID));
- _panel_agent->start_helper (appids[0]);
+ _info_manager->start_helper (appids[0]);
_soft_keyboard_launched = true;
g_pkgids_to_be_uninstalled.erase (it3);
total_appids.push_back(it->appid);
}
if (total_appids.size() > 0)
- _panel_agent->update_ise_list (total_appids);
+ _info_manager->update_ise_list (total_appids);
}
}
else {
total_appids.push_back(it->appid);
}
if (total_appids.size() > 0)
- _panel_agent->update_ise_list (total_appids);
+ _info_manager->update_ise_list (total_appids);
///////////////// END /////////////////
/* For example, the following happens if appid is changed in IME project and Run As again. The appid would be changed this time.
LOGD ("Start IME(%s)\n", it->appid.c_str ());
scim_global_config_write (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), it->appid);
set_keyboard_engine (String (SCIM_COMPOSE_KEY_FACTORY_UUID));
- _panel_agent->start_helper (it->appid);
+ _info_manager->start_helper (it->appid);
_soft_keyboard_launched = true;
break;
}
for (it = _ime_info.begin (); it != _ime_info.end (); it++) {
if (it->appid.compare(current_ime_appid) == 0 && it->mode == TOOLBAR_HELPER_MODE) { // Make sure it's Helper ISE...
LOGD ("Stop IME(%s)\n", current_ime_appid.c_str ());
- _panel_agent->hide_helper (current_ime_appid);
- _panel_agent->stop_helper (current_ime_appid);
+ _info_manager->hide_helper (current_ime_appid);
+ _info_manager->stop_helper (current_ime_appid);
_soft_keyboard_launched = false;
g_stopped_helper_pkgid = package;
break;
total_appids.push_back(it->appid);
}
if (total_appids.size() > 0)
- _panel_agent->update_ise_list (total_appids);
+ _info_manager->update_ise_list (total_appids);
break;
}
if (it->appid.compare(appids[0]) == 0 && it->mode == TOOLBAR_HELPER_MODE) { // Make sure it's Helper ISE...
LOGD ("Restart IME(%s)\n", appids[0].c_str ());
set_keyboard_engine (String (SCIM_COMPOSE_KEY_FACTORY_UUID));
- _panel_agent->start_helper (appids[0]);
+ _info_manager->start_helper (appids[0]);
_soft_keyboard_launched = true;
break;
}
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
- TOOLBAR_MODE_T mode = _panel_agent->get_current_toolbar_mode ();
+ TOOLBAR_MODE_T mode = _info_manager->get_current_toolbar_mode ();
if (TOOLBAR_HELPER_MODE == mode) {
- String pre_uuid = _panel_agent->get_current_helper_uuid ();
- _panel_agent->hide_helper (pre_uuid);
- _panel_agent->stop_helper (pre_uuid);
+ String pre_uuid = _info_manager->get_current_helper_uuid ();
+ _info_manager->hide_helper (pre_uuid);
+ _info_manager->stop_helper (pre_uuid);
_soft_keyboard_launched = false;
} else if (TOOLBAR_KEYBOARD_MODE == mode) {
uint32 kbd_option = 0;
return false;
}
- _panel_agent->change_factory (uuid);
+ _info_manager->change_factory (uuid);
String language = String ("~other");/*scim_get_locale_language (scim_get_current_locale ());*/
_config->write (String (SCIM_CONFIG_DEFAULT_IMENGINE_FACTORY) + String ("/") + language, uuid);
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
- TOOLBAR_MODE_T mode = _panel_agent->get_current_toolbar_mode ();
- String pre_uuid = _panel_agent->get_current_helper_uuid ();
+ TOOLBAR_MODE_T mode = _info_manager->get_current_toolbar_mode ();
+ String pre_uuid = _info_manager->get_current_helper_uuid ();
LOGD ("pre_appid=%s, appid=%s, launch_ise=%d, %d\n", pre_uuid.c_str(), uuid.c_str(), launch_ise, _soft_keyboard_launched);
if (pre_uuid == uuid && _soft_keyboard_launched)
return true;
if (TOOLBAR_HELPER_MODE == mode && pre_uuid.length () > 0 && _soft_keyboard_launched) {
- _panel_agent->hide_helper (pre_uuid);
- _panel_agent->stop_helper (pre_uuid);
+ _info_manager->hide_helper (pre_uuid);
+ _info_manager->stop_helper (pre_uuid);
_soft_keyboard_launched = false;
LOGD ("stop helper : %s\n", pre_uuid.c_str ());
}
LOGD ("Start helper (%s)\n", uuid.c_str ());
set_keyboard_engine (String (SCIM_COMPOSE_KEY_FACTORY_UUID));
- if (_panel_agent->start_helper (uuid))
+ if (_info_manager->start_helper (uuid))
_soft_keyboard_launched = true;
}
_config->write (String (SCIM_CONFIG_DEFAULT_HELPER_ISE), uuid);
if (valid)
ise_changed = set_helper_ise (_ime_info[i].appid, launch_ise);
else
- LOGW ("Helper ISE(appid=\"%s\") is not valid.\n", _ime_info[i].appid.c_str ());
+ LOGW ("Helper ISE(appid=\"%s\",moudle_name=\"%s\") is not valid.\n", _ime_info[i].appid.c_str (),_ime_info[i].module_name.c_str ());
}
else {
LOGW ("Helper ISE(appid=\"%s\") is not enabled.\n", _ime_info[i].appid.c_str ());
}
}
- _panel_agent->set_current_toolbar_mode (_ime_info[i].mode);
+ _info_manager->set_current_toolbar_mode (_ime_info[i].mode);
if (ise_changed) {
- _panel_agent->set_current_helper_option (_ime_info[i].options);
- _panel_agent->set_current_ise_name (_ime_info[i].label);
+ _info_manager->set_current_helper_option (_ime_info[i].options);
+ _info_manager->set_current_ise_name (_ime_info[i].label);
_ise_width = 0;
_ise_height = 0;
_ise_state = WINDOW_STATE_HIDE;
_config->flush ();
_config->reload ();
- _panel_agent->reload_config ();
+ _info_manager->reload_config ();
vconf_set_str (VCONFKEY_ISF_ACTIVE_KEYBOARD_UUID, uuid.c_str ());
}
/* Read configurations. */
if (!_config.null ()) {
bool shared_ise = _config->read (String (SCIM_CONFIG_FRONTEND_SHARED_INPUT_METHOD), false);
- _panel_agent->set_should_shared_ise (shared_ise);
+ _info_manager->set_should_shared_ise (shared_ise);
}
_launch_ise_on_request = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_LAUNCH_ISE_ON_REQUEST), _launch_ise_on_request);
_candidate_width = new_width;
_candidate_height = new_height;
if (_candidate_state == WINDOW_STATE_SHOW)
- _panel_agent->update_candidate_panel_event ((uint32)ECORE_IMF_CANDIDATE_PANEL_GEOMETRY_EVENT, 0);
+ _info_manager->update_candidate_panel_event ((uint32)ECORE_IMF_CANDIDATE_PANEL_GEOMETRY_EVENT, 0);
if (_candidate_state == WINDOW_STATE_SHOW && _candidate_mode == FIXED_CANDIDATE_WINDOW) {
height = ui_candidate_get_valid_height ();
#if HAVE_ECOREX
set_keyboard_geometry_atom_info (_app_window, get_ise_geometry ());
#endif
- _panel_agent->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
+ _info_manager->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
}
}
int index = (int)GPOINTER_TO_INT (data);
ui_candidate_delete_longpress_timer ();
_is_click = false;
- _panel_agent->send_longpress_event (_click_object, index);
+ _info_manager->send_longpress_event (_click_object, index);
return ECORE_CALLBACK_CANCEL;
}
/* Update the geometry information for auto scrolling */
set_keyboard_geometry_atom_info (_app_window, get_ise_geometry ());
- _panel_agent->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
- _panel_agent->update_input_panel_event (ECORE_IMF_CANDIDATE_PANEL_GEOMETRY_EVENT, 0);
+ _info_manager->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
+ _info_manager->update_input_panel_event (ECORE_IMF_CANDIDATE_PANEL_GEOMETRY_EVENT, 0);
/* And the state event */
- _panel_agent->update_candidate_panel_event ((uint32)ECORE_IMF_CANDIDATE_PANEL_STATE_EVENT, (uint32)ECORE_IMF_CANDIDATE_PANEL_SHOW);
+ _info_manager->update_candidate_panel_event ((uint32)ECORE_IMF_CANDIDATE_PANEL_STATE_EVENT, (uint32)ECORE_IMF_CANDIDATE_PANEL_SHOW);
/* If we are in hardware keyboard mode, this candidate window is now considered to be a input panel */
if (_candidate_mode == FIXED_CANDIDATE_WINDOW) {
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
- _panel_agent->update_input_panel_event ((uint32)ECORE_IMF_INPUT_PANEL_STATE_EVENT, (uint32)ECORE_IMF_INPUT_PANEL_STATE_SHOW);
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
+ _info_manager->update_input_panel_event ((uint32)ECORE_IMF_INPUT_PANEL_STATE_EVENT, (uint32)ECORE_IMF_INPUT_PANEL_STATE_SHOW);
}
}
}
/* FIXME : SHOULD UNIFY THE METHOD FOR CHECKING THE HW KEYBOARD EXISTENCE */
/* If the ISE is not visible currently, wait for the ISE to be opened and then show our candidate window */
_candidate_show_requested = true;
- if ((_panel_agent->get_current_toolbar_mode () == TOOLBAR_HELPER_MODE) && (_ise_state != WINDOW_STATE_SHOW)) {
+ if ((_info_manager->get_current_toolbar_mode () == TOOLBAR_HELPER_MODE) && (_ise_state != WINDOW_STATE_SHOW)) {
LOGD ("setting _show_candidate_requested to TRUE\n");
return;
}
}
#if HAVE_ECOREX
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
/* WMSYNC, #3 Clear the existing application's conformant area and set transient_for */
// Unset conformant area
Ecore_X_Window current_app_window = efl_get_app_window ();
/* If we are in hardware keyboard mode, this candidate window is now considered to be a input panel */
if (_candidate_mode == FIXED_CANDIDATE_WINDOW) {
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
LOGD ("sending ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW\n");
- _panel_agent->update_input_panel_event ((uint32)ECORE_IMF_INPUT_PANEL_STATE_EVENT, (uint32)ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW);
+ _info_manager->update_input_panel_event ((uint32)ECORE_IMF_INPUT_PANEL_STATE_EVENT, (uint32)ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW);
}
}
#endif
} else {
LOGD ("The candidate window was already in SHOW state, update geometry information\n");
- _panel_agent->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
- _panel_agent->update_input_panel_event (ECORE_IMF_CANDIDATE_PANEL_GEOMETRY_EVENT, 0);
+ _info_manager->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
+ _info_manager->update_input_panel_event (ECORE_IMF_CANDIDATE_PANEL_GEOMETRY_EVENT, 0);
/* And the state event */
- _panel_agent->update_candidate_panel_event ((uint32)ECORE_IMF_CANDIDATE_PANEL_STATE_EVENT, (uint32)ECORE_IMF_CANDIDATE_PANEL_SHOW);
+ _info_manager->update_candidate_panel_event ((uint32)ECORE_IMF_CANDIDATE_PANEL_STATE_EVENT, (uint32)ECORE_IMF_CANDIDATE_PANEL_SHOW);
/* If we are in hardware keyboard mode, this candidate window is now considered to be a input panel */
if (_candidate_mode == FIXED_CANDIDATE_WINDOW) {
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
- _panel_agent->update_input_panel_event ((uint32)ECORE_IMF_INPUT_PANEL_STATE_EVENT, (uint32)ECORE_IMF_INPUT_PANEL_STATE_SHOW);
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
+ _info_manager->update_input_panel_event ((uint32)ECORE_IMF_INPUT_PANEL_STATE_EVENT, (uint32)ECORE_IMF_INPUT_PANEL_STATE_SHOW);
}
}
}
_candidate_area_2_visible = false;
evas_object_hide (_scroller_bg);
evas_object_hide (_close_btn);
- _panel_agent->candidate_more_window_hide ();
+ _info_manager->candidate_more_window_hide ();
ui_candidate_window_adjust ();
}
}
}
if (_candidate_mode == FIXED_CANDIDATE_WINDOW) {
- _panel_agent->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
+ _info_manager->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
/* FIXME : should check if bSetVirtualKbd flag is really needed in this case */
#if HAVE_ECOREX
if (_ise_state == WINDOW_STATE_SHOW) {
}
}
#endif
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
- _panel_agent->update_input_panel_event
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
+ _info_manager->update_input_panel_event
((uint32)ECORE_IMF_INPUT_PANEL_STATE_EVENT, (uint32)ECORE_IMF_INPUT_PANEL_STATE_HIDE);
}
}
/* Update the new keyboard geometry first, and then send the candidate hide event */
- _panel_agent->update_candidate_panel_event ((uint32)ECORE_IMF_CANDIDATE_PANEL_STATE_EVENT, (uint32)ECORE_IMF_CANDIDATE_PANEL_HIDE);
+ _info_manager->update_candidate_panel_event ((uint32)ECORE_IMF_CANDIDATE_PANEL_STATE_EVENT, (uint32)ECORE_IMF_CANDIDATE_PANEL_HIDE);
if (!will_hide) {
/* If we are not in will_hide state, hide the candidate window immediately */
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
- _panel_agent->candidate_more_window_show ();
+ _info_manager->candidate_more_window_show ();
if (candidate_expanded == false) {
candidate_expanded = true;
if (_candidate_area_2 == NULL || !_candidate_area_2_visible)
return;
- _panel_agent->candidate_more_window_hide ();
+ _info_manager->candidate_more_window_hide ();
evas_object_hide (_candidate_area_2);
_candidate_area_2_visible = false;
edje_object_signal_emit (_aux_items [i], "aux,state,unselected", "aux");
}
edje_object_signal_emit (button, "aux,state,selected", "aux");
- _panel_agent->select_aux (index);
+ _info_manager->select_aux (index);
}*/
int r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3;
edje_object_color_class_get (_aux_items [index], "text_color", &r, &g, &b, &a, &r2, &g2, &b2, &a2, &r3, &g3, &b3, &a3);
edje_object_color_class_set (_aux_items [i], "text_color", 249, 249, 249, 255, r2, g2, b2, a2, r3, g3, b3, a3);
}
edje_object_color_class_set (_aux_items [index], "text_color", 62, 207, 255, 255, r2, g2, b2, a2, r3, g3, b3, a3);
- _panel_agent->select_aux (index);
+ _info_manager->select_aux (index);
}
} else if (_click_object == ISF_EFL_CANDIDATE_0 && _is_click) {
ui_candidate_window_close_button_cb (NULL, NULL, _close_btn, NULL);
- _panel_agent->select_candidate (index);
+ _info_manager->select_candidate (index);
} else if (_click_object == ISF_EFL_CANDIDATE_ITEMS && _is_click) {
ui_candidate_window_close_button_cb (NULL, NULL, _close_btn, NULL);
- _panel_agent->select_candidate (index);
+ _info_manager->select_candidate (index);
}
}
get_geometry_result = true;
#endif
if ((_ise_state != WINDOW_STATE_SHOW && _ise_state != WINDOW_STATE_WILL_HIDE) ||
- (get_geometry_result == false) || (_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE)) {
+ (get_geometry_result == false) || (_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE)) {
ise_height = 0;
ise_width = 0;
}
evas_object_move (_preedit_window, spot_x, spot_y);
}
if (_candidate_state == WINDOW_STATE_SHOW) {
- _panel_agent->update_candidate_panel_event ((uint32)ECORE_IMF_CANDIDATE_PANEL_GEOMETRY_EVENT, 0);
+ _info_manager->update_candidate_panel_event ((uint32)ECORE_IMF_CANDIDATE_PANEL_GEOMETRY_EVENT, 0);
}
}
}
LOGD ("candidate geometry x: %d , y: %d , width: %d , height: %d, _ise_state: %d, candidate_mode: %d\n", x, y, width, height, _ise_state, _candidate_mode);
- if ((_candidate_mode != SOFT_CANDIDATE_WINDOW) || (_panel_agent->get_current_toolbar_mode () != TOOLBAR_KEYBOARD_MODE))
+ if ((_candidate_mode != SOFT_CANDIDATE_WINDOW) || (_info_manager->get_current_toolbar_mode () != TOOLBAR_KEYBOARD_MODE))
return;
_soft_candidate_width = width;
#if HAVE_ECOREX
set_keyboard_geometry_atom_info (_app_window, get_ise_geometry());
#endif
- _panel_agent->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
+ _info_manager->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
}
*
* @return true if initialize is successful, otherwise return false.
*/
-static bool initialize_panel_agent (const String &config, const String &display, bool resident)
+static bool initialize_panel_agent (const ConfigPointer& config, const String &display, bool resident)
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
LOGD ("initializing panel agent\n");
- _panel_agent = new PanelAgent ();
+ _info_manager = new InfoManager ();
- if (!_panel_agent || !_panel_agent->initialize (config, display, resident)) {
+ if (!_info_manager || !_info_manager->initialize (_info_manager, config, display, resident)) {
ISF_SAVE_LOG ("panel_agent initialize fail!\n");
return false;
}
- _panel_agent->signal_connect_reload_config (slot (slot_reload_config));
- _panel_agent->signal_connect_focus_in (slot (slot_focus_in));
- _panel_agent->signal_connect_focus_out (slot (slot_focus_out));
- _panel_agent->signal_connect_expand_candidate (slot (slot_expand_candidate));
- _panel_agent->signal_connect_contract_candidate (slot (slot_contract_candidate));
- _panel_agent->signal_connect_set_candidate_ui (slot (slot_set_candidate_style));
- _panel_agent->signal_connect_update_factory_info (slot (slot_update_factory_info));
- _panel_agent->signal_connect_update_spot_location (slot (slot_update_spot_location));
- _panel_agent->signal_connect_update_input_context (slot (slot_update_input_context));
- _panel_agent->signal_connect_update_ise_geometry (slot (slot_update_ise_geometry));
- _panel_agent->signal_connect_show_preedit_string (slot (slot_show_preedit_string));
- _panel_agent->signal_connect_show_aux_string (slot (slot_show_aux_string));
- _panel_agent->signal_connect_show_lookup_table (slot (slot_show_candidate_table));
- _panel_agent->signal_connect_hide_preedit_string (slot (slot_hide_preedit_string));
- _panel_agent->signal_connect_hide_aux_string (slot (slot_hide_aux_string));
- _panel_agent->signal_connect_hide_lookup_table (slot (slot_hide_candidate_table));
- _panel_agent->signal_connect_update_preedit_string (slot (slot_update_preedit_string));
- _panel_agent->signal_connect_update_preedit_caret (slot (slot_update_preedit_caret));
- _panel_agent->signal_connect_update_aux_string (slot (slot_update_aux_string));
- _panel_agent->signal_connect_update_lookup_table (slot (slot_update_candidate_table));
- _panel_agent->signal_connect_select_candidate (slot (slot_select_candidate));
- _panel_agent->signal_connect_get_candidate_geometry (slot (slot_get_candidate_geometry));
- _panel_agent->signal_connect_get_input_panel_geometry (slot (slot_get_input_panel_geometry));
- _panel_agent->signal_connect_set_active_ise_by_uuid (slot (slot_set_active_ise));
- _panel_agent->signal_connect_get_ise_list (slot (slot_get_ise_list));
- _panel_agent->signal_connect_get_all_helper_ise_info (slot (slot_get_all_helper_ise_info));
- _panel_agent->signal_connect_set_has_option_helper_ise_info(slot (slot_set_has_option_helper_ise_info));
- _panel_agent->signal_connect_set_enable_helper_ise_info (slot (slot_set_enable_helper_ise_info));
- _panel_agent->signal_connect_show_helper_ise_list (slot (slot_show_helper_ise_list));
- _panel_agent->signal_connect_show_helper_ise_selector (slot (slot_show_helper_ise_selector));
- _panel_agent->signal_connect_is_helper_ise_enabled (slot (slot_is_helper_ise_enabled));
- _panel_agent->signal_connect_get_ise_information (slot (slot_get_ise_information));
- _panel_agent->signal_connect_get_keyboard_ise_list (slot (slot_get_keyboard_ise_list));
- _panel_agent->signal_connect_get_language_list (slot (slot_get_language_list));
- _panel_agent->signal_connect_get_all_language (slot (slot_get_all_language));
- _panel_agent->signal_connect_get_ise_language (slot (slot_get_ise_language));
- _panel_agent->signal_connect_get_ise_info_by_uuid (slot (slot_get_ise_info));
- _panel_agent->signal_connect_set_keyboard_ise (slot (slot_set_keyboard_ise));
- _panel_agent->signal_connect_get_keyboard_ise (slot (slot_get_keyboard_ise));
- _panel_agent->signal_connect_accept_connection (slot (slot_accept_connection));
- _panel_agent->signal_connect_close_connection (slot (slot_close_connection));
- _panel_agent->signal_connect_exit (slot (slot_exit));
-
- _panel_agent->signal_connect_register_helper_properties (slot (slot_register_helper_properties));
- _panel_agent->signal_connect_show_ise (slot (slot_show_ise));
- _panel_agent->signal_connect_hide_ise (slot (slot_hide_ise));
-
- _panel_agent->signal_connect_will_hide_ack (slot (slot_will_hide_ack));
-
- _panel_agent->signal_connect_set_keyboard_mode (slot (slot_set_keyboard_mode));
-
- _panel_agent->signal_connect_candidate_will_hide_ack (slot (slot_candidate_will_hide_ack));
- _panel_agent->signal_connect_get_ise_state (slot (slot_get_ise_state));
- _panel_agent->signal_connect_start_default_ise (slot (slot_start_default_ise));
- _panel_agent->signal_connect_stop_default_ise (slot (slot_stop_default_ise));
- _panel_agent->signal_connect_show_panel (slot (slot_show_helper_ise_selector));
-
- _panel_agent->signal_connect_get_recent_ise_geometry (slot (slot_get_recent_ise_geometry));
- _panel_agent->signal_connect_check_privilege_by_sockfd (slot (slot_check_privilege_by_sockfd));
-
+ _info_manager->signal_connect_reload_config (slot (slot_reload_config));
+ _info_manager->signal_connect_focus_in (slot (slot_focus_in));
+ _info_manager->signal_connect_focus_out (slot (slot_focus_out));
+ _info_manager->signal_connect_expand_candidate (slot (slot_expand_candidate));
+ _info_manager->signal_connect_contract_candidate (slot (slot_contract_candidate));
+ _info_manager->signal_connect_set_candidate_ui (slot (slot_set_candidate_style));
+ _info_manager->signal_connect_update_factory_info (slot (slot_update_factory_info));
+ _info_manager->signal_connect_update_spot_location (slot (slot_update_spot_location));
+ _info_manager->signal_connect_update_input_context (slot (slot_update_input_context));
+ _info_manager->signal_connect_update_ise_geometry (slot (slot_update_ise_geometry));
+ _info_manager->signal_connect_show_preedit_string (slot (slot_show_preedit_string));
+ _info_manager->signal_connect_show_aux_string (slot (slot_show_aux_string));
+ _info_manager->signal_connect_show_lookup_table (slot (slot_show_candidate_table));
+ _info_manager->signal_connect_hide_preedit_string (slot (slot_hide_preedit_string));
+ _info_manager->signal_connect_hide_aux_string (slot (slot_hide_aux_string));
+ _info_manager->signal_connect_hide_lookup_table (slot (slot_hide_candidate_table));
+ _info_manager->signal_connect_update_preedit_string (slot (slot_update_preedit_string));
+ _info_manager->signal_connect_update_preedit_caret (slot (slot_update_preedit_caret));
+ _info_manager->signal_connect_update_aux_string (slot (slot_update_aux_string));
+ _info_manager->signal_connect_update_lookup_table (slot (slot_update_candidate_table));
+ _info_manager->signal_connect_select_candidate (slot (slot_select_candidate));
+ _info_manager->signal_connect_get_candidate_geometry (slot (slot_get_candidate_geometry));
+ _info_manager->signal_connect_get_input_panel_geometry (slot (slot_get_input_panel_geometry));
+ _info_manager->signal_connect_set_active_ise_by_uuid (slot (slot_set_active_ise));
+ _info_manager->signal_connect_get_ise_list (slot (slot_get_ise_list));
+ _info_manager->signal_connect_get_all_helper_ise_info (slot (slot_get_all_helper_ise_info));
+ _info_manager->signal_connect_set_has_option_helper_ise_info(slot (slot_set_has_option_helper_ise_info));
+ _info_manager->signal_connect_set_enable_helper_ise_info (slot (slot_set_enable_helper_ise_info));
+ _info_manager->signal_connect_show_helper_ise_list (slot (slot_show_helper_ise_list));
+ _info_manager->signal_connect_show_helper_ise_selector (slot (slot_show_helper_ise_selector));
+ _info_manager->signal_connect_is_helper_ise_enabled (slot (slot_is_helper_ise_enabled));
+ _info_manager->signal_connect_get_ise_information (slot (slot_get_ise_information));
+ _info_manager->signal_connect_get_keyboard_ise_list (slot (slot_get_keyboard_ise_list));
+ _info_manager->signal_connect_get_language_list (slot (slot_get_language_list));
+ _info_manager->signal_connect_get_all_language (slot (slot_get_all_language));
+ _info_manager->signal_connect_get_ise_language (slot (slot_get_ise_language));
+ _info_manager->signal_connect_get_ise_info_by_uuid (slot (slot_get_ise_info));
+ _info_manager->signal_connect_set_keyboard_ise (slot (slot_set_keyboard_ise));
+ _info_manager->signal_connect_get_keyboard_ise (slot (slot_get_keyboard_ise));
+ _info_manager->signal_connect_accept_connection (slot (slot_accept_connection));
+ _info_manager->signal_connect_close_connection (slot (slot_close_connection));
+ _info_manager->signal_connect_exit (slot (slot_exit));
+
+ _info_manager->signal_connect_register_helper_properties (slot (slot_register_helper_properties));
+ _info_manager->signal_connect_show_ise (slot (slot_show_ise));
+ _info_manager->signal_connect_hide_ise (slot (slot_hide_ise));
+
+ _info_manager->signal_connect_will_hide_ack (slot (slot_will_hide_ack));
+
+ _info_manager->signal_connect_set_keyboard_mode (slot (slot_set_keyboard_mode));
+
+ _info_manager->signal_connect_candidate_will_hide_ack (slot (slot_candidate_will_hide_ack));
+ _info_manager->signal_connect_get_ise_state (slot (slot_get_ise_state));
+ _info_manager->signal_connect_start_default_ise (slot (slot_start_default_ise));
+ _info_manager->signal_connect_stop_default_ise (slot (slot_stop_default_ise));
+ _info_manager->signal_connect_show_panel (slot (slot_show_helper_ise_selector));
+
+ _info_manager->signal_connect_get_recent_ise_geometry (slot (slot_get_recent_ise_geometry));
+ _info_manager->signal_connect_check_privilege_by_sockfd (slot (slot_check_privilege_by_sockfd));
std::vector<String> load_ise_list;
- _panel_agent->get_active_ise_list (load_ise_list);
+ _info_manager->get_active_ise_list (load_ise_list);
LOGD ("initializing panel agent succeeded\n");
static void hide_ise ()
{
LOGD ("send request to hide helper\n");
- String uuid = _panel_agent->get_current_helper_uuid ();
- _panel_agent->hide_helper (uuid);
+ String uuid = _info_manager->get_current_helper_uuid ();
+ _info_manager->hide_helper (uuid);
/* Only if we are not already in HIDE state */
if (_ise_state != WINDOW_STATE_HIDE) {
ecore_x_event_mask_unset (_app_window, ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE);
#endif
if (_candidate_window) {
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE)
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE)
ui_candidate_hide (true, true, true);
else
ui_candidate_hide (true, false, true);
list.clear ();
list = uuids;
- _panel_agent->update_ise_list (list);
+ _info_manager->update_ise_list (list);
if (_initial_ise_uuid.length () > 0) {
String active_uuid = _initial_ise_uuid;
String default_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
if (std::find (uuids.begin (), uuids.end (), default_uuid) == uuids.end ()) {
- if ((_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) && (modes[get_ise_index (_initial_ise_uuid)] != TOOLBAR_KEYBOARD_MODE)) {
+ if ((_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) && (modes[get_ise_index (_initial_ise_uuid)] != TOOLBAR_KEYBOARD_MODE)) {
active_uuid = String (SCIM_COMPOSE_KEY_FACTORY_UUID);
}
if (set_active_ise (active_uuid, _soft_keyboard_launched) == false) {
if (_initial_ise_uuid.compare (active_uuid))
set_active_ise (_initial_ise_uuid, _soft_keyboard_launched);
}
- } else if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_HELPER_MODE) { // Check whether keyboard engine is installed
+ } else if (_info_manager->get_current_toolbar_mode () == TOOLBAR_HELPER_MODE) { // Check whether keyboard engine is installed
String IMENGINE_KEY = String (SCIM_CONFIG_DEFAULT_IMENGINE_FACTORY) + String ("/") + String ("~other");
String keyboard_uuid = _config->read (IMENGINE_KEY, String (""));
if (std::find (uuids.begin (), uuids.end (), keyboard_uuid) == uuids.end ()) {
active_uuid = String (SCIM_COMPOSE_KEY_FACTORY_UUID);
- _panel_agent->change_factory (active_uuid);
+ _info_manager->change_factory (active_uuid);
_config->write (IMENGINE_KEY, active_uuid);
_config->flush ();
}
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
_focus_in = true;
- if ((_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE)) {
+ if ((_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE)) {
if (_launch_ise_on_request && !_soft_keyboard_launched) {
String uuid = _config->read (SCIM_CONFIG_DEFAULT_HELPER_ISE, String (""));
if (uuid.length () > 0 && (_ime_info[get_ise_index(uuid)].options & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)) {
LOGD ("Start helper (%s)\n", uuid.c_str ());
set_keyboard_engine (String (SCIM_COMPOSE_KEY_FACTORY_UUID));
- if (_panel_agent->start_helper (uuid))
+ if (_info_manager->start_helper (uuid))
_soft_keyboard_launched = true;
}
}
String ise_name = info.name;
String ise_icon = info.icon;
- String old_ise = _panel_agent->get_current_ise_name ();
+ String old_ise = _info_manager->get_current_ise_name ();
if (old_ise != ise_name) {
- if ((_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) && _candidate_window) {
+ if ((_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) && _candidate_window) {
ui_destroy_candidate_window ();
}
}
- TOOLBAR_MODE_T mode = _panel_agent->get_current_toolbar_mode ();
+ TOOLBAR_MODE_T mode = _info_manager->get_current_toolbar_mode ();
if (TOOLBAR_HELPER_MODE == mode)
- ise_name = _ime_info[get_ise_index (_panel_agent->get_current_helper_uuid())].label;
+ ise_name = _ime_info[get_ise_index (_info_manager->get_current_helper_uuid())].label;
if (ise_name.length () > 0)
- _panel_agent->set_current_ise_name (ise_name);
+ _info_manager->set_current_ise_name (ise_name);
#ifdef HAVE_NOTIFICATION
if (old_ise != ise_name) {
LOGD ("x : %d , y : %d , width : %d , height : %d, _ise_state : %d\n", x, y, width, height, _ise_state);
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
if (_candidate_mode == SOFT_CANDIDATE_WINDOW) {
/*IF ISE sent the ise_geometry information when the current_keyboard_mode is H/W mode and candidate_mode is SOFT_CANDIDATE,
It means that given geometry information is for the candidate window */
#if HAVE_ECOREX
set_keyboard_geometry_atom_info (_app_window, _ise_reported_geometry.geometry);
#endif
- _panel_agent->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
+ _info_manager->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
}
}
}
static void slot_show_candidate_table (void)
{
if (_candidate_mode == SOFT_CANDIDATE_WINDOW) {
- _panel_agent->helper_candidate_show ();
+ _info_manager->helper_candidate_show ();
return;
}
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
if (_candidate_mode == SOFT_CANDIDATE_WINDOW) {
- _panel_agent->helper_candidate_hide ();
+ _info_manager->helper_candidate_hide ();
return;
}
_candidate_area_2_visible = false;
evas_object_hide (_scroller_bg);
evas_object_hide (_close_btn);
- _panel_agent->candidate_more_window_hide ();
+ _info_manager->candidate_more_window_hide ();
}
ui_candidate_window_adjust ();
}
_candidate_row_items.push_back (item_num - nLast); /* Add the number of last row */
- _panel_agent->update_displayed_candidate_number (_candidate_display_number);
- _panel_agent->update_candidate_item_layout (_candidate_row_items);
+ _info_manager->update_displayed_candidate_number (_candidate_display_number);
+ _info_manager->update_candidate_item_layout (_candidate_row_items);
if (more_item_count == 0) {
ui_candidate_window_close_button_cb (NULL, NULL, NULL, NULL);
evas_object_hide (_more_btn);
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
if (_candidate_mode == SOFT_CANDIDATE_WINDOW) {
- _panel_agent->update_helper_lookup_table (table);
+ _info_manager->update_helper_lookup_table (table);
return ;
}
static void slot_select_candidate (int index)
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
- _panel_agent->select_candidate (index);
+ _info_manager->select_candidate (index);
}
/**
*/
static void slot_get_input_panel_geometry (struct rectinfo &info)
{
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
info.pos_x = 0;
info.width = 0;
info.height = 0;
isf_pkg_select_all_ime_info_db (_ime_info);
//active_ime_appid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
- if (_panel_agent) {
- active_ime_appid = _panel_agent->get_current_helper_uuid ();
+ if (_info_manager) {
+ active_ime_appid = _info_manager->get_current_helper_uuid ();
}
if (_ime_info.size () > 0) {
isf_get_all_languages (lang_list);
isf_get_keyboard_ises_in_languages (lang_list, uuid_list, name_list, false);
- _panel_agent->update_ise_list (uuid_list);
+ _info_manager->update_ise_list (uuid_list);
return true;
}
_config->flush ();
_config->reload ();
- _panel_agent->change_factory (uuid);
- _panel_agent->reload_config ();
+ _info_manager->change_factory (uuid);
+ _info_manager->reload_config ();
}
/**
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
- Ecore_Fd_Handler *panel_agent_read_handler = ecore_main_fd_handler_add (fd, ECORE_FD_READ, panel_agent_handler, NULL, NULL, NULL);
- _read_handler_list.push_back (panel_agent_read_handler);
#if HAVE_ECOREX
get_input_window ();
#endif
static void slot_close_connection (int fd)
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
- int i = 0;
- std::vector<Ecore_Fd_Handler *>::iterator IterPos;
- for (IterPos = _read_handler_list.begin (); IterPos != _read_handler_list.end (); ++IterPos,++i) {
- if (ecore_main_fd_handler_fd_get (_read_handler_list[i]) == fd) {
- ecore_main_fd_handler_del (_read_handler_list[i]);
- _read_handler_list.erase (IterPos);
- break;
- }
- }
}
/**
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
/* If the current toolbar mode is not HELPER_MODE, do not proceed */
- if (_panel_agent->get_current_toolbar_mode () != TOOLBAR_HELPER_MODE) {
+ if (_info_manager->get_current_toolbar_mode () != TOOLBAR_HELPER_MODE) {
LOGD ("Current toolbar mode should be TOOLBAR_HELPER_MODE but is %d, returning\n",
- _panel_agent->get_current_toolbar_mode ());
+ _info_manager->get_current_toolbar_mode ());
return;
}
//ecore_x_e_virtual_keyboard_off_prepare_done_send (root_window, _control_window);
LOGD ("_ecore_x_e_virtual_keyboard_off_prepare_done_send (%x, %x)\n",
root_window, _control_window);
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_HELPER_MODE) {
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_HELPER_MODE) {
LOGD ("calling ui_candidate_hide (true, false)\n");
ui_candidate_hide (true, false);
}
static void slot_get_ise_state (int &state)
{
if (_ise_state == WINDOW_STATE_SHOW ||
- ((_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) && (_candidate_state == WINDOW_STATE_SHOW))) {
+ ((_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) && (_candidate_state == WINDOW_STATE_SHOW))) {
state = ECORE_IMF_INPUT_PANEL_STATE_SHOW;
} else {
/* Currently we don't have WILL_HIDE / HIDE state distinction in Ecore_IMF */
static void slot_start_default_ise (void)
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
- if ((_panel_agent->get_current_toolbar_mode () == TOOLBAR_HELPER_MODE)) {
+ if ((_info_manager->get_current_toolbar_mode () == TOOLBAR_HELPER_MODE)) {
if (_launch_ise_on_request && !_soft_keyboard_launched) {
String uuid = _config->read (SCIM_CONFIG_DEFAULT_HELPER_ISE, String (""));
LOGD ("Start helper (%s)\n", uuid.c_str ());
set_keyboard_engine (String (SCIM_COMPOSE_KEY_FACTORY_UUID));
- if (_panel_agent->start_helper (uuid))
+ if (_info_manager->start_helper (uuid))
_soft_keyboard_launched = true;
}
}
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
if (_launch_ise_on_request && _soft_keyboard_launched) {
- String uuid = _panel_agent->get_current_helper_uuid ();
+ String uuid = _info_manager->get_current_helper_uuid ();
if (uuid.length () > 0) {
- _panel_agent->hide_helper (uuid);
- _panel_agent->stop_helper (uuid);
+ _info_manager->hide_helper (uuid);
+ _info_manager->stop_helper (uuid);
_soft_keyboard_launched = false;
LOGD ("stop helper (%s)\n", uuid.c_str ());
}
/**
- * @brief Callback function for ecore fd handler.
- *
- * @param data The data to pass to this callback.
- * @param fd_handler The ecore fd handler.
- *
- * @return ECORE_CALLBACK_RENEW
- */
-static Eina_Bool panel_agent_handler (void *data, Ecore_Fd_Handler *fd_handler)
-{
- if (fd_handler == NULL)
- return ECORE_CALLBACK_RENEW;
-
- int fd = ecore_main_fd_handler_fd_get (fd_handler);
- for (unsigned int i = 0; i < _read_handler_list.size (); i++) {
- if (fd_handler == _read_handler_list [i]) {
- if (!_panel_agent->filter_event (fd)) {
- std::cerr << "_panel_agent->filter_event () is failed!!!\n";
- ecore_main_fd_handler_del (fd_handler);
-
- ISF_SAVE_LOG ("_panel_agent->filter_event (fd=%d) is failed!!!\n", fd);
- }
- return ECORE_CALLBACK_RENEW;
- }
- }
- std::cerr << "panel_agent_handler () has received exception event!!!\n";
- _panel_agent->filter_exception_event (fd);
- ecore_main_fd_handler_del (fd_handler);
-
- ISF_SAVE_LOG ("Received exception event (fd=%d)!!!\n", fd);
- return ECORE_CALLBACK_RENEW;
-}
-
-/**
* @brief Handler function for HelperManager input.
*
* @param data The data to pass to this callback.
*/
static Eina_Bool helper_manager_input_handler (void *data, Ecore_Fd_Handler *fd_handler)
{
- if (_panel_agent->has_helper_manager_pending_event ()) {
- if (!_panel_agent->filter_helper_manager_event ()) {
- std::cerr << "_panel_agent->filter_helper_manager_event () is failed!!!\n";
- LOGE ("_panel_agent->filter_helper_manager_event () is failed!!!");
+ if (_info_manager->has_helper_manager_pending_event ()) {
+ if (!_info_manager->filter_helper_manager_event ()) {
+ std::cerr << "_info_manager->filter_helper_manager_event () is failed!!!\n";
+ LOGE ("_info_manager->filter_helper_manager_event () is failed!!!");
elm_exit ();
}
} else {
- std::cerr << "_panel_agent->has_helper_manager_pending_event () is failed!!!\n";
- LOGE ("_panel_agent->has_helper_manager_pending_event () is failed!!!");
+ std::cerr << "_info_manager->has_helper_manager_pending_event () is failed!!!\n";
+ LOGE ("_info_manager->has_helper_manager_pending_event () is failed!!!");
}
return ECORE_CALLBACK_RENEW;
if (ise_idx < _ime_info.size ()) {
String default_name = _ime_info[ise_idx].label;
- _panel_agent->set_current_ise_name (default_name);
+ _info_manager->set_current_ise_name (default_name);
_config->reload ();
}
}
static void change_keyboard_mode (TOOLBAR_MODE_T mode)
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
-
+ LOGD("");
uint32 option = 0;
String uuid, name;
bool _support_hw_keyboard_mode = false;
_support_hw_keyboard_mode = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_SUPPORT_HW_KEYBOARD_MODE), _support_hw_keyboard_mode);
if (mode == TOOLBAR_KEYBOARD_MODE && _support_hw_keyboard_mode) {
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
LOGD ("HARDWARE_KEYBOARD_MODE return\n");
return;
}
_soft_candidate_width = 0;
_soft_candidate_height = 0;
_ise_state = WINDOW_STATE_HIDE;
- _panel_agent->set_current_toolbar_mode (TOOLBAR_KEYBOARD_MODE);
- _panel_agent->hide_helper (helper_uuid);
- _panel_agent->reload_config ();
+ _info_manager->set_current_toolbar_mode (TOOLBAR_KEYBOARD_MODE);
+ _info_manager->hide_helper (helper_uuid);
+ _info_manager->reload_config ();
/* Check whether stop soft keyboard */
if (_focus_in && (_ime_info[get_ise_index (helper_uuid)].options & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)) {
/* If focus in and soft keyboard can support hardware key event, then don't stop it */
;
} else if (_launch_ise_on_request && _soft_keyboard_launched) {
- _panel_agent->stop_helper (helper_uuid);
+ _info_manager->stop_helper (helper_uuid);
_soft_keyboard_launched = false;
}
#if HAVE_ECOREX
ui_candidate_hide (true, true, true);
_config->write (ISF_CONFIG_HARDWARE_KEYBOARD_DETECT, 0);
_config->flush ();
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
uuid = helper_uuid.length () > 0 ? helper_uuid : _initial_ise_uuid;
if (_launch_ise_on_request) {
if (set_active_ise (uuid, false) == false) {
{
if (connected == false) {
LOGD ("Bluetooth keyboard disconnected\n");
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
change_keyboard_mode (TOOLBAR_HELPER_MODE);
}
}
unsigned int val = 0;
if (ecore_x_window_prop_card32_get (_input_win, ecore_x_atom_get (PROP_X_EXT_KEYBOARD_EXIST), &val, 1) > 0) {
if (val == 0) {
- _panel_agent->reset_keyboard_ise ();
+ _info_manager->reset_keyboard_ise ();
change_keyboard_mode (TOOLBAR_HELPER_MODE);
set_keyboard_geometry_atom_info (_app_window, get_ise_geometry ());
- _panel_agent->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
+ _info_manager->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
show_soft_keyboard ();
}
}
}
set_keyboard_geometry_atom_info (_app_window, get_ise_geometry ());
- _panel_agent->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
- _panel_agent->update_input_panel_event (
+ _info_manager->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
+ _info_manager->update_input_panel_event (
ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_SHOW);
vconf_set_int (VCONFKEY_ISF_INPUT_PANEL_STATE, VCONFKEY_ISF_INPUT_PANEL_STATE_SHOW);
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_HELPER_MODE) {
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_HELPER_MODE) {
if (get_ise_count (TOOLBAR_HELPER_MODE, true) >= 2) {
ecore_x_event_mask_set (efl_get_quickpanel_window (), ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
#ifdef HAVE_NOTIFICATION
String ise_name;
- unsigned int idx = get_ise_index (_panel_agent->get_current_helper_uuid ());
+ unsigned int idx = get_ise_index (_info_manager->get_current_helper_uuid ());
if (idx < _ime_info.size ())
ise_name = _ime_info[idx].label;
/* WMSYNC, #9 The keyboard window is hidden fully so send HIDE state */
LOGD ("ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF\n");
// For now don't send HIDE signal here
- //_panel_agent->update_input_panel_event (
+ //_info_manager->update_input_panel_event (
// ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_HIDE);
_ise_state = WINDOW_STATE_HIDE;
_ise_angle = -1;
/* When the ISE gets hidden by the window manager forcefully without OFF_PREPARE,
the application might not have updated its autoscroll area */
set_keyboard_geometry_atom_info (_app_window, get_ise_geometry ());
- _panel_agent->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
- _panel_agent->update_input_panel_event (
+ _info_manager->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
+ _info_manager->update_input_panel_event (
ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_HIDE);
_updated_hide_state_geometry = true;
}
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_HELPER_MODE) {
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_HELPER_MODE) {
LOGD ("calling ui_candidate_hide (true, false)\n");
ui_candidate_hide (true, false);
} else {
LOGD ("_ecore_x_e_virtual_keyboard_on_prepare_done_send (%x, %x)\n",
root_window, _control_window);
- _panel_agent->update_input_panel_event (
+ _info_manager->update_input_panel_event (
ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW);
ui_create_candidate_window ();
_ise_reported_geometry.valid = false;
set_keyboard_geometry_atom_info (_app_window, get_ise_geometry ());
- _panel_agent->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
+ _info_manager->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
_updated_hide_state_geometry = true;
/* If the input panel is getting hidden because of hw keyboard mode while
"input panel being resized" event instead of "input panel being hidden",
since the candidate window will work as an "input panel" afterwards */
bool send_input_panel_hide_event = true;
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) {
LOGD ("_candidate_state : %d", _candidate_state);
if (_candidate_state == WINDOW_STATE_SHOW) {
send_input_panel_hide_event = false;
}
}
if (send_input_panel_hide_event) {
- _panel_agent->update_input_panel_event (
+ _info_manager->update_input_panel_event (
ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_HIDE);
}
// For now don't send WILL_HIDE signal here
- //_panel_agent->update_input_panel_event (
+ //_info_manager->update_input_panel_event (
// ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_WILL_HIDE);
// Instead send HIDE signal
vconf_set_int (VCONFKEY_ISF_INPUT_PANEL_STATE, VCONFKEY_ISF_INPUT_PANEL_STATE_WILL_HIDE);
}
if (_ise_state == WINDOW_STATE_SHOW) {
set_keyboard_geometry_atom_info (_app_window, get_ise_geometry ());
- _panel_agent->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
+ _info_manager->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
}
ui_settle_candidate_window ();
ui_candidate_window_rotate (_candidate_angle);
_ise_angle = ise_angle;
if (_ise_state == WINDOW_STATE_SHOW) {
set_keyboard_geometry_atom_info (_app_window, get_ise_geometry ());
- _panel_agent->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
+ _info_manager->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
ui_settle_candidate_window ();
}
}
Ecore_X_Event_Window_Focus_Out *e = (Ecore_X_Event_Window_Focus_Out*)event;
if (e && e->win == _app_window) {
- if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_HELPER_MODE) {
+ if (_info_manager->get_current_toolbar_mode () == TOOLBAR_HELPER_MODE) {
if (check_focus_out_by_popup_win ())
return ECORE_CALLBACK_RENEW;
if (!_ise_hide_timer) {
LOGD ("Panel hides ISE\n");
- _panel_agent->hide_helper (_panel_agent->get_current_helper_uuid ());
+ _info_manager->hide_helper (_info_manager->get_current_helper_uuid ());
slot_hide_ise ();
ui_candidate_hide (true, false, false);
}
#else
LOGD ("Application window focus OUT! Panel hides ISE\n");
- _panel_agent->hide_helper (_panel_agent->get_current_helper_uuid ());
+ _info_manager->hide_helper (_info_manager->get_current_helper_uuid ());
slot_hide_ise ();
ui_candidate_hide (true, false, false);
#endif
return ret;
}
+static int launch_socket_frontend ()
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ LOGD("Launching a ISF daemon with Socket FrontEnd");
+ std::vector<String> engine_list;
+ std::vector<String> helper_list;
+ std::vector<String> load_engine_list;
+
+ std::vector<String>::iterator it;
+
+ std::cerr << "Launching a ISF daemon with Socket FrontEnd...\n";
+ //get modules list
+ scim_get_imengine_module_list (engine_list);
+ scim_get_helper_module_list (helper_list);
+
+ for (it = engine_list.begin (); it != engine_list.end (); it++) {
+ if (*it != "socket")
+ load_engine_list.push_back (*it);
+ }
+ for (it = helper_list.begin (); it != helper_list.end (); it++)
+ load_engine_list.push_back (*it);
+
+ return scim_launch (true,
+ "simple",
+ (load_engine_list.size () > 0 ? scim_combine_string_list (load_engine_list, ',') : "none"),
+ "socket",
+ NULL);
+}
+
int main (int argc, char *argv [])
{
struct tms tiks_buf;
String display_name = String ();
char buf[256] = {0};
- Ecore_Fd_Handler *panel_agent_read_handler = NULL;
Ecore_Fd_Handler *helper_manager_handler = NULL;
#if HAVE_ECOREX
Ecore_Event_Handler *xclient_message_handler = NULL;
goto cleanup;
}
+ /* Get current display. */
+ {
+ const char *p = getenv ("DISPLAY");
+ if (p)
+ display_name = String (p);
+ }
+
+ snprintf (buf, sizeof (buf), "config_name=%s display_name=%s", config_name.c_str (), display_name.c_str ());
+ check_time (buf);
+
+ if (daemon) {
+ check_time ("ISF Panel EFL run as daemon");
+ scim_daemon ();
+ }
+
+ elm_init (argc, argv);
+ check_time ("elm_init");
+
+ elm_policy_set (ELM_POLICY_THROTTLE, ELM_POLICY_THROTTLE_NEVER);
+
+ //FIXME: frontend name shoule be got from paramter,set socket as dead code
+ launch_socket_frontend ();
+
if (config_name != "dummy") {
/* Load config module */
config_module = new ConfigModule (config_name);
_config = new DummyConfig ();
}
- /* Get current display. */
- {
- const char *p = getenv ("DISPLAY");
- if (p)
- display_name = String (p);
+ /* Create config instance */
+ if (_config.null () && config_module && config_module->valid ())
+ _config = config_module->create_config ();
+ if (_config.null ()) {
+ std::cerr << "Failed to create Config instance from " << config_name << " Config module.\n";
+ ret = -1;
+ goto cleanup;
}
-
- snprintf (buf, sizeof (buf), "config_name=%s display_name=%s", config_name.c_str (), display_name.c_str ());
- check_time (buf);
+ check_time ("create config instance");
try {
- if (!initialize_panel_agent (config_name, display_name, should_resident)) {
+ if (!initialize_panel_agent (_config, display_name, should_resident)) {
check_time ("Failed to initialize Panel Agent!");
std::cerr << "Failed to initialize Panel Agent!\n";
ISF_SAVE_LOG ("Failed to initialize Panel Agent!\n");
}
check_time ("initialize_panel_agent");
- /* Create config instance */
- if (_config.null () && config_module && config_module->valid ())
- _config = config_module->create_config ();
- if (_config.null ()) {
- std::cerr << "Failed to create Config instance from " << config_name << " Config module.\n";
- ret = -1;
- goto cleanup;
- }
- check_time ("create config instance");
-
/* Initialize global variables and pointers for candidate items and etc. */
for (i = 0; i < SCIM_LOOKUP_TABLE_MAX_PAGESIZE; i++) {
_candidate_0 [i] = NULL;
}
try {
- _panel_agent->send_display_name (display_name);
+ _info_manager->send_display_name (display_name);
} catch (scim::Exception & e) {
std::cerr << e.what () << "\n";
ret = -1;
goto cleanup;
}
- if (daemon) {
- check_time ("ISF Panel EFL run as daemon");
- scim_daemon ();
- }
-
/* Connect the configuration reload signal. */
_config->signal_connect_reload (slot (config_reload_cb));
- elm_init (argc, argv);
- check_time ("elm_init");
-
- elm_policy_set (ELM_POLICY_THROTTLE, ELM_POLICY_THROTTLE_NEVER);
-
#if HAVE_ECOREX
if (!efl_create_control_window ()) {
LOGW ("Failed to create control window\n");
load_config ();
check_time ("load_config");
- helper_manager_handler = ecore_main_fd_handler_add (_panel_agent->get_helper_manager_id (), ECORE_FD_READ, helper_manager_input_handler, NULL, NULL, NULL);
- panel_agent_read_handler = ecore_main_fd_handler_add (_panel_agent->get_server_id (), ECORE_FD_READ, panel_agent_handler, NULL, NULL, NULL);
- _read_handler_list.push_back (panel_agent_read_handler);
- check_time ("run_panel_agent");
+ helper_manager_handler = ecore_main_fd_handler_add (_info_manager->get_helper_manager_id (), ECORE_FD_READ, helper_manager_input_handler, NULL, NULL, NULL);
+ check_time ("run_info_manager");
set_language_and_locale ();
helper_manager_handler = NULL;
}
- for (unsigned int ii = 0; ii < _read_handler_list.size (); ++ii) {
- ecore_main_fd_handler_del (_read_handler_list[ii]);
- }
- _read_handler_list.clear ();
+
#if HAVE_VCONF
/* Remove callback function for input language and display language */
_config.reset ();
if (config_module)
delete config_module;
- if (_panel_agent) {
+ if (_info_manager) {
try {
- _panel_agent->stop ();
+ _info_manager->stop ();
} catch (scim::Exception & e) {
- std::cerr << "Exception is thrown from _panel_agent->stop (), error is " << e.what () << "\n";
+ std::cerr << "Exception is thrown from _info_manager->stop (), error is " << e.what () << "\n";
}
- delete _panel_agent;
+ delete _info_manager;
}
if ((display_name_c > 0) && new_argv [display_name_c]) {
free (new_argv [display_name_c]);
+++ /dev/null
-/*
- * ISF(Input Service Framework)
- *
- * ISF is based on SCIM 1.4.7 and extended for supporting more fitable.
- * Copyright (c) 2012-2014 Intel Co., Ltd.
- *
- * Contact: Yan Wang <yan.wang@intel.com>
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#define Uses_SCIM_CONFIG_PATH
-#define Uses_SCIM_HELPER_MODULE
-#define Uses_SCIM_PANEL_AGENT
-#define Uses_SCIM_COMPOSE_KEY
-#define Uses_SCIM_IMENGINE_MODULE
-
-#include <sys/wait.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/times.h>
-#include <signal.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <Ecore.h>
-#include <Ecore_Wayland.h>
-#include <malloc.h>
-#include "scim_private.h"
-#include "scim.h"
-#include <dlog.h>
-
-#include <linux/input.h>
-#include <xkbcommon/xkbcommon.h>
-#include <sys/mman.h>
-#include <input-method-client-protocol.h>
-#include <text-client-protocol.h>
-#include "isf_wsc_context.h"
-#include "isf_wsc_control_ui.h"
-
-using namespace scim;
-
-/////////////////////////////////////////////////////////////////////////////
-// Declaration of macro.
-/////////////////////////////////////////////////////////////////////////////
-#ifdef LOG_TAG
-# undef LOG_TAG
-#endif
-#define LOG_TAG "ISF_WSC_EFL"
-
-static struct weescim _wsc = {0};
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Implementation of Wayland Input Method functions.
-/////////////////////////////////////////////////////////////////////////////
-static void
-_wsc_im_ctx_surrounding_text(void *data, struct wl_input_method_context *im_ctx, const char *text, uint32_t cursor, uint32_t anchor)
-{
- WSCContextISF *wsc_ctx = (WSCContextISF*)data;
- if (!wsc_ctx) return;
-
- if (wsc_ctx->surrounding_text)
- free (wsc_ctx->surrounding_text);
-
- wsc_ctx->surrounding_text = strdup (text ? text : "");
- wsc_ctx->surrounding_cursor = cursor;
-
- isf_wsc_context_cursor_position_set(wsc_ctx, cursor);
-
- LOGD ("text : '%s', cursor : %d\n", text, cursor);
-}
-
-static void
-_wsc_im_ctx_reset(void *data, struct wl_input_method_context *im_ctx)
-{
- WSCContextISF *wsc_ctx = (WSCContextISF*)data;
- if (!wsc_ctx) return;
- isf_wsc_context_reset(wsc_ctx);
-}
-
-static void
-_wsc_im_ctx_content_type(void *data, struct wl_input_method_context *im_ctx, uint32_t hint, uint32_t purpose)
-{
- WSCContextISF *wsc_ctx = (WSCContextISF*)data;
- if (!wsc_ctx) return;
-
- LOGD ("im_context = %p hint = %d purpose = %d\n", im_ctx, hint, purpose);
-
- if (!wsc_ctx->context_changed) return;
-
- wsc_ctx->content_hint = hint;
- wsc_ctx->content_purpose = purpose;
-
- isf_wsc_context_input_panel_layout_set (wsc_ctx,
- wsc_context_input_panel_layout_get (wsc_ctx));
-
- isf_wsc_context_autocapital_type_set (wsc_ctx, wsc_context_autocapital_type_get(wsc_ctx));
-
- isf_wsc_context_input_panel_language_set (wsc_ctx, wsc_context_input_panel_language_get(wsc_ctx));
-
- caps_mode_check (wsc_ctx, EINA_TRUE, EINA_TRUE);
-
- wsc_ctx->context_changed = EINA_FALSE;
-}
-
-static void
-_wsc_im_ctx_invoke_action(void *data, struct wl_input_method_context *im_ctx, uint32_t button, uint32_t index)
-{
- WSCContextISF *wsc_ctx = (WSCContextISF*)data;
- if (!wsc_ctx) return;
-
- LOGD ("invoke action. button : %d\n", button);
-
- if (button != BTN_LEFT)
- return;
-
- wsc_context_send_preedit_string (wsc_ctx);
-}
-
-static void
-_wsc_im_ctx_commit_state(void *data, struct wl_input_method_context *im_ctx, uint32_t serial)
-{
- WSCContextISF *wsc_ctx = (WSCContextISF*)data;
- if (!wsc_ctx) return;
-
- wsc_ctx->serial = serial;
-
- if (wsc_ctx->surrounding_text)
- LOGD ("Surrounding text updated: '%s'\n", wsc_ctx->surrounding_text);
-
- if (wsc_ctx->language)
- wl_input_method_context_language (im_ctx, wsc_ctx->serial, wsc_ctx->language);
-}
-
-static void
-_wsc_im_ctx_preferred_language(void *data, struct wl_input_method_context *im_ctx, const char *language)
-{
- WSCContextISF *wsc_ctx = (WSCContextISF*)data;
- if (!wsc_ctx) return;
-
- if (language && wsc_ctx->language && !strcmp (language, wsc_ctx->language))
- return;
-
- if (wsc_ctx->language) {
- free (wsc_ctx->language);
- wsc_ctx->language = NULL;
- }
-
- if (language) {
- wsc_ctx->language = strdup (language);
- LOGD ("Language changed, new: '%s'\n", language);
- }
-}
-
-static void
-_wsc_im_ctx_return_key_type(void *data, struct wl_input_method_context *im_ctx, uint32_t return_key_type)
-{
- WSCContextISF *wsc_ctx = (WSCContextISF*)data;
-
- LOGD ("im_context = %p return key type = %d\n", im_ctx, return_key_type);
- if (!wsc_ctx) return;
-
- if (wsc_ctx->return_key_type != return_key_type) {
- wsc_ctx->return_key_type = return_key_type;
- isf_wsc_context_input_panel_return_key_type_set (wsc_ctx, (Ecore_IMF_Input_Panel_Return_Key_Type)wsc_ctx->return_key_type);
- }
-}
-
-static void
-_wsc_im_ctx_return_key_disabled(void *data, struct wl_input_method_context *im_ctx, uint32_t disabled)
-{
- WSCContextISF *wsc_ctx = (WSCContextISF*)data;
- Eina_Bool return_key_disabled = !!disabled;
-
- LOGD ("im_context = %p return key disabled = %d\n", im_ctx, return_key_disabled);
- if (!wsc_ctx) return;
-
- if (wsc_ctx->return_key_disabled != return_key_disabled) {
- wsc_ctx->return_key_disabled = return_key_disabled;
- isf_wsc_context_input_panel_return_key_disabled_set (wsc_ctx, wsc_ctx->return_key_disabled);
- }
-}
-
-static void
-_wsc_im_ctx_input_panel_data(void *data, struct wl_input_method_context *im_ctx, const char *input_panel_data, uint32_t input_panel_data_length)
-{
- WSCContextISF *wsc_ctx = (WSCContextISF*)data;
- LOGD ("im_context = %p input panel data = %s len = %d\n", im_ctx, input_panel_data, input_panel_data_length);
- if (!wsc_ctx) return;
-
- isf_wsc_context_input_panel_imdata_set (wsc_ctx, (void *)input_panel_data, input_panel_data_length);
-}
-
-static void
-_wsc_im_ctx_bidi_direction(void *data, struct wl_input_method_context *im_ctx, uint32_t bidi_direction)
-{
- WSCContextISF *wsc_ctx = (WSCContextISF*)data;
-
- LOGD ("im_context = %p bidi_direction = %d\n", im_ctx, bidi_direction);
- if (!wsc_ctx) return;
-
- if (wsc_ctx->bidi_direction != bidi_direction) {
- wsc_ctx->bidi_direction = bidi_direction;
-
- isf_wsc_context_bidi_direction_set (wsc_ctx, (Ecore_IMF_BiDi_Direction)wsc_ctx->bidi_direction);
- }
-}
-
-static const struct wl_input_method_context_listener wsc_im_context_listener = {
- _wsc_im_ctx_surrounding_text,
- _wsc_im_ctx_reset,
- _wsc_im_ctx_content_type,
- _wsc_im_ctx_invoke_action,
- _wsc_im_ctx_commit_state,
- _wsc_im_ctx_preferred_language,
- _wsc_im_ctx_return_key_type,
- _wsc_im_ctx_return_key_disabled,
- _wsc_im_ctx_input_panel_data,
- _wsc_im_ctx_bidi_direction
-};
-
-static void
-_init_keysym2keycode(WSCContextISF *wsc_ctx)
-{
- uint32_t i = 0;
- uint32_t code;
- uint32_t num_syms;
- const xkb_keysym_t *syms;
-
- if (!wsc_ctx || !wsc_ctx->state)
- return;
-
- for (i = 0; i < 256; i++) {
- code = i + 8;
- num_syms = xkb_key_get_syms(wsc_ctx->state, code, &syms);
-
- if (num_syms == 1)
- wsc_ctx->_keysym2keycode[syms[0]] = i;
- }
-}
-
-static void
-_fini_keysym2keycode(WSCContextISF *wsc_ctx)
-{
- wsc_ctx->_keysym2keycode.clear();
-}
-
-static void
-_wsc_im_keyboard_keymap(void *data,
- struct wl_keyboard *wl_keyboard,
- uint32_t format,
- int32_t fd,
- uint32_t size)
-{
- WSCContextISF *wsc_ctx = (WSCContextISF*)data;
- char *map_str;
-
- if (!wsc_ctx) return;
-
- _fini_keysym2keycode(wsc_ctx);
-
- if (wsc_ctx->state) {
- xkb_state_unref(wsc_ctx->state);
- wsc_ctx->state = NULL;
- }
-
- if (wsc_ctx->keymap) {
- xkb_map_unref(wsc_ctx->keymap);
- wsc_ctx->keymap = NULL;
- }
-
- if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
- close(fd);
- return;
- }
-
- map_str = (char*)mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
- if (map_str == MAP_FAILED) {
- close(fd);
- return;
- }
-
- wsc_ctx->keymap =
- xkb_map_new_from_string(wsc_ctx->xkb_context,
- map_str,
- XKB_KEYMAP_FORMAT_TEXT_V1,
- (xkb_keymap_compile_flags)0);
-
- munmap(map_str, size);
- close(fd);
-
- if (!wsc_ctx->keymap) {
- LOGW ("failed to compile keymap\n");
- return;
- }
-
- wsc_ctx->state = xkb_state_new(wsc_ctx->keymap);
- if (!wsc_ctx->state) {
- LOGW ("failed to create XKB state\n");
- xkb_map_unref(wsc_ctx->keymap);
- return;
- }
-
- wsc_ctx->control_mask =
- 1 << xkb_map_mod_get_index(wsc_ctx->keymap, "Control");
- wsc_ctx->alt_mask =
- 1 << xkb_map_mod_get_index(wsc_ctx->keymap, "Mod1");
- wsc_ctx->shift_mask =
- 1 << xkb_map_mod_get_index(wsc_ctx->keymap, "Shift");
-
- LOGW ("create _keysym2keycode\n");
- _init_keysym2keycode(wsc_ctx);
-}
-
-static void
-_wsc_im_keyboard_key(void *data,
- struct wl_keyboard *wl_keyboard,
- uint32_t serial,
- uint32_t time,
- uint32_t key,
- uint32_t state_w)
-{
- WSCContextISF *wsc_ctx = (WSCContextISF*)data;
- uint32_t code;
- uint32_t num_syms;
- const xkb_keysym_t *syms;
- xkb_keysym_t sym;
- char keyname[64] = {0};
- enum wl_keyboard_key_state state = (wl_keyboard_key_state)state_w;
-
- if (!wsc_ctx || !wsc_ctx->state)
- return;
-
- code = key + 8;
- num_syms = xkb_key_get_syms(wsc_ctx->state, code, &syms);
-
- sym = XKB_KEY_NoSymbol;
- if (num_syms == 1)
- {
- sym = syms[0];
- xkb_keysym_get_name(sym, keyname, 64);
- }
-
- if (wsc_ctx->key_handler)
- (*wsc_ctx->key_handler)(wsc_ctx, serial, time, code, sym, keyname,
- state);
-}
-
-static void
-_wsc_im_keyboard_modifiers(void *data,
- struct wl_keyboard *wl_keyboard,
- uint32_t serial,
- uint32_t mods_depressed,
- uint32_t mods_latched,
- uint32_t mods_locked,
- uint32_t group)
-{
- WSCContextISF *wsc_ctx = (WSCContextISF*)data;
- if (!wsc_ctx || !wsc_ctx->state)
- return;
-
- struct wl_input_method_context *context = wsc_ctx->im_ctx;
- xkb_mod_mask_t mask;
-
- xkb_state_update_mask(wsc_ctx->state, mods_depressed,
- mods_latched, mods_locked, 0, 0, group);
- mask = xkb_state_serialize_mods(wsc_ctx->state,
- (xkb_state_component)(XKB_STATE_DEPRESSED | XKB_STATE_LATCHED));
-
- wsc_ctx->modifiers = 0;
- if (mask & wsc_ctx->control_mask)
- wsc_ctx->modifiers |= SCIM_KEY_ControlMask;
- if (mask & wsc_ctx->alt_mask)
- wsc_ctx->modifiers |= SCIM_KEY_AltMask;
- if (mask & wsc_ctx->shift_mask)
- wsc_ctx->modifiers |= SCIM_KEY_ShiftMask;
-
- wl_input_method_context_modifiers(context, serial,
- mods_depressed, mods_depressed,
- mods_latched, group);
-}
-
-static const struct wl_keyboard_listener wsc_im_keyboard_listener = {
- _wsc_im_keyboard_keymap,
- NULL, /* enter */
- NULL, /* leave */
- _wsc_im_keyboard_key,
- _wsc_im_keyboard_modifiers
-};
-
-static void
-_wsc_im_activate(void *data, struct wl_input_method *input_method, struct wl_input_method_context *im_ctx, uint32_t text_input_id)
-{
- struct weescim *wsc = (weescim*)data;
- if (!wsc) return;
-
- WSCContextISF *wsc_ctx = new WSCContextISF;
- if (!wsc_ctx) {
- return;
- }
- wsc_ctx->xkb_context = xkb_context_new((xkb_context_flags)0);
- if (wsc_ctx->xkb_context == NULL) {
- LOGW ("Failed to create XKB context\n");
- delete wsc_ctx;
- return;
- }
- wsc_ctx->id = text_input_id;
- wsc->wsc_ctx = wsc_ctx;
- wsc_ctx->ctx = wsc;
- wsc_ctx->state = NULL;
- wsc_ctx->keymap = NULL;
- wsc_ctx->surrounding_text = NULL;
- wsc_ctx->key_handler = isf_wsc_context_filter_key_event;
-
- get_language(&wsc_ctx->language);
-
- wsc_ctx->preedit_str = strdup ("");
- wsc_ctx->content_hint = WL_TEXT_INPUT_CONTENT_HINT_NONE;
- wsc_ctx->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NORMAL;
-
- wsc_ctx->im_ctx = im_ctx;
- wl_input_method_context_add_listener (im_ctx, &wsc_im_context_listener, wsc_ctx);
-
- wsc_ctx->keyboard = wl_input_method_context_grab_keyboard(im_ctx);
- if (wsc_ctx->keyboard)
- wl_keyboard_add_listener(wsc_ctx->keyboard, &wsc_im_keyboard_listener, wsc_ctx);
-
- if (wsc_ctx->language)
- wl_input_method_context_language (im_ctx, wsc_ctx->serial, wsc_ctx->language);
-
- isf_wsc_context_add (wsc_ctx);
-
- wsc_ctx->context_changed = EINA_TRUE;
-
- isf_wsc_context_focus_in (wsc_ctx);
-}
-
-static void
-_wsc_im_deactivate(void *data, struct wl_input_method *input_method, struct wl_input_method_context *im_ctx)
-{
- struct weescim *wsc = (weescim*)data;
- if (!wsc || !wsc->wsc_ctx) return;
- WSCContextISF *wsc_ctx = wsc->wsc_ctx;
-
- isf_wsc_context_input_panel_hide (wsc_ctx);
- isf_wsc_context_focus_out (wsc_ctx);
-
- if (wsc_ctx->keyboard) {
- wl_keyboard_destroy (wsc_ctx->keyboard);
- wsc_ctx->keyboard = NULL;
- }
-
- _fini_keysym2keycode (wsc_ctx);
-
- if (wsc_ctx->state) {
- xkb_state_unref (wsc_ctx->state);
- wsc_ctx->state = NULL;
- }
-
- if (wsc_ctx->keymap) {
- xkb_map_unref (wsc_ctx->keymap);
- wsc_ctx->keymap = NULL;
- }
-
- if (wsc_ctx->im_ctx) {
- wl_input_method_context_destroy (wsc_ctx->im_ctx);
- wsc_ctx->im_ctx = NULL;
- }
-
- if (wsc_ctx->preedit_str) {
- free (wsc_ctx->preedit_str);
- wsc_ctx->preedit_str = NULL;
- }
-
- if (wsc_ctx->surrounding_text) {
- free (wsc_ctx->surrounding_text);
- wsc_ctx->surrounding_text = NULL;
- }
-
- if (wsc_ctx->language) {
- free (wsc_ctx->language);
- wsc_ctx->language = NULL;
- }
-
- isf_wsc_context_del (wsc_ctx);
- delete wsc_ctx;
- wsc->wsc_ctx = NULL;
-}
-
-static void
-_wsc_im_show_input_panel(void *data, struct wl_input_method *input_method, struct wl_input_method_context *im_ctx)
-{
- struct weescim *wsc = (weescim*)data;
- if (!wsc || !wsc->wsc_ctx) return;
-
- isf_wsc_context_input_panel_show (wsc->wsc_ctx);
-}
-
-static void
-_wsc_im_hide_input_panel(void *data, struct wl_input_method *input_method, struct wl_input_method_context *im_ctx)
-{
- struct weescim *wsc = (weescim*)data;
- if (!wsc || !wsc->wsc_ctx) return;
-
- isf_wsc_context_input_panel_hide (wsc->wsc_ctx);
-}
-
-static const struct wl_input_method_listener wsc_im_listener = {
- _wsc_im_activate,
- _wsc_im_deactivate,
- _wsc_im_show_input_panel,
- _wsc_im_hide_input_panel
-};
-
-static bool
-_wsc_setup(struct weescim *wsc)
-{
- Eina_Inlist *globals;
- struct wl_registry *registry;
- Ecore_Wl_Global *global;
-
- if (!wsc) return false;
-
- if (!(registry = ecore_wl_registry_get()))
- return false;
-
- if (!(globals = ecore_wl_globals_get()))
- return false;
-
- EINA_INLIST_FOREACH(globals, global) {
- if (strcmp (global->interface, "wl_input_method") == 0)
- wsc->im = (wl_input_method*)wl_registry_bind (registry, global->id, &wl_input_method_interface, 1);
- }
-
- if (wsc->im == NULL) {
- LOGW ("Failed because wl_input_method is null\n");
- return false;
- }
-
- /* Input method listener */
- LOGD ("Adding wl_input_method listener\n");
-
- if (wsc->im)
- wl_input_method_add_listener (wsc->im, &wsc_im_listener, wsc);
- else {
- LOGW ("Couldn't get wayland input method interface\n");
- return false;
- }
-
- return true;
-}
-
-int main (int argc EINA_UNUSED, char **argv EINA_UNUSED)
-{
- sleep(1);
-
- isf_wsc_context_init ();
-
- if (!_wsc_setup (&_wsc)) {
- return 0;
- }
-
- ecore_main_loop_begin();
-
- isf_wsc_context_shutdown ();
-
- return 0;
-}
-
-/*
-vi:ts=4:nowrap:expandtab
-*/
MAINTAINERCLEANFILES = Makefile.in
CLEANFILES = *.bak
-SUBDIRS = frontend imengine config filter
+SUBDIRS = frontend imengine config filter panelagent/ecoresocket panelagent/wayland
--- /dev/null
+MAINTAINERCLEANFILES = Makefile.in
+CLEANFILES = *.bak *.edj
+EXTRA_DIST = ecoresocket.version-script
+
+INCLUDES = -I$(top_builddir) \
+ -I$(top_builddir)/ism/src \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/ism/src \
+ -I$(top_srcdir)/ism/intl \
+ -I$(top_srcdir)/ism/data \
+ -I$(top_srcdir)/ism/utils \
+ -I$(includedir) \
+ -DSCIM_DATADIR=\"@SCIM_DATADIR@\" \
+ -DSCIM_LOCALEDIR=\"@SCIM_LOCALEDIR@\" \
+ -DSCIM_SYSCONFDIR=\"@SCIM_SYSCONFDIR@\" \
+ -DSCIM_LIBEXECDIR=\"@SCIM_LIBEXECDIR@\" \
+ -DSCIM_ICONDIR=\"@SCIM_ICONDIR@\" \
+ -DSCIM_MODULE_PATH=\"@SCIM_MODULE_PATH@\" \
+ -DSCIM_TEMPDIR=\"@SCIM_TEMPDIR@\"
+
+noinst_HEADERS =
+
+
+CONFIG_ECORESOCKET_PANELAGENT_MODULE = ecoresocket.la
+
+
+if SCIM_LD_VERSION_SCRIPT
+LD_VERSION_SCRIPT_OPTION="-Wl,--version-script=$(srcdir)/ecoresocket.version-script"
+endif
+
+moduledir = @SCIM_MODULE_PATH@/$(SCIM_BINARY_VERSION)/PanelAgent
+module_LTLIBRARIES = $(CONFIG_ECORESOCKET_PANELAGENT_MODULE)
+
+ecoresocket_la_SOURCES = ecore_socket_panel_agent_module.cpp
+
+ecoresocket_la_CXXFLAGS = @DLOG_CFLAGS@ @ECORE_CFLAGS@
+
+ecoresocket_la_LDFLAGS = -avoid-version \
+ -rpath $(moduledir) \
+ -module \
+ $(LD_VERSION_SCRIPT_OPTION) \
+ @LIBTOOL_EXPORT_OPTIONS@ \
+ @LTLIBINTL@ \
+ @DLOG_LIBS@ \
+ @ECORE_LIBS@
+
+ecoresocket_la_LIBADD = $(top_builddir)/ism/src/libscim@SCIM_EPOCH@.la
--- /dev/null
+/** @file scim_panel.cpp
+ * @brief Implementation of class PanelAgent.
+ */
+
+/* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
+
+/*
+ * Smart Common Input Method
+ *
+ * Copyright (c) 2005 James Su <suzhe@tsinghua.org.cn>
+ * Copyright (c) 2012-2015 Samsung Electronics Co., Ltd.
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307 USA
+ *
+ * Modifications by Samsung Electronics Co., Ltd.
+ * 1. Add new signals
+ * a. m_signal_set_keyboard_ise and m_signal_get_keyboard_ise
+ * b. m_signal_focus_in and m_signal_focus_out
+ * c. m_signal_expand_candidate, m_signal_contract_candidate and m_signal_set_candidate_ui
+ * d. m_signal_get_ise_list, m_signal_get_keyboard_ise_list, m_signal_update_ise_geometry and m_signal_get_ise_information
+ * e. m_signal_set_active_ise_by_uuid and m_signal_get_ise_info_by_uuid
+ * f. m_signal_accept_connection, m_signal_close_connection and m_signal_exit
+ * 2. Add new interface APIs in PanelClient class
+ * a. get_helper_manager_id (), has_helper_manager_pending_event () and filter_helper_manager_event ()
+ * b. update_candidate_panel_event (), update_input_panel_event () and select_aux ()
+ * c. candidate_more_window_show () and candidate_more_window_hide ()
+ * d. update_displayed_candidate_number () and update_candidate_item_layout ()
+ * e. stop_helper (), send_longpress_event () and update_ise_list ()
+ * f. filter_event (), filter_exception_event () and get_server_id ()
+ * 3. Donot use thread to receive message
+ * 4. Monitor socket frontend for self-recovery function
+ *
+ * $Id: scim_panel_agent.cpp,v 1.8.2.1 2006/01/09 14:32:18 suzhe Exp $
+ *
+ */
+
+#define Uses_SCIM_TRANSACTION
+#define Uses_SCIM_TRANS_COMMANDS
+#define Uses_SCIM_PANEL_AGENT
+#define Uses_SCIM_HELPER
+#define Uses_SCIM_SOCKET
+#define Uses_SCIM_EVENT
+#define Uses_SCIM_CONFIG
+#define Uses_SCIM_CONFIG_MODULE
+#define Uses_SCIM_CONFIG_PATH
+#define Uses_SCIM_UTILITY
+
+#include <string.h>
+#include <sys/types.h>
+#include <sys/times.h>
+#include <dlog.h>
+#include <unistd.h>
+#include <Ecore.h>
+#include "scim_private.h"
+#include "scim.h"
+#include "scim_stl_map.h"
+
+#ifdef LOG_TAG
+# undef LOG_TAG
+#endif
+#define LOG_TAG "ISF_ECORE_SOCKET_MODULE"
+
+#define MIN_REPEAT_TIME 2.0
+
+#define IMEMANAGER_PRIVILEGE "http://tizen.org/privilege/imemanager"
+
+EXAPI scim::CommonLookupTable g_isf_candidate_table;
+
+
+namespace scim
+{
+
+struct HelperClientStub {
+ int id;
+ int ref;
+
+ HelperClientStub(int i = 0, int r = 0) : id(i), ref(r) { }
+};
+
+struct IMControlStub {
+ std::vector<ISE_INFO> info;
+ std::vector<int> count;
+};
+
+#define DEFAULT_CONTEXT_VALUE 0xfff
+
+#define scim_module_init ecoresocket_LTX_scim_module_init
+#define scim_module_exit ecoresocket_LTX_scim_module_exit
+#define scim_panel_agent_module_init ecoresocket_LTX_scim_panel_agent_module_init
+#define scim_panel_agent_module_get_instance ecoresocket_LTX_scim_panel_agent_module_get_instance
+
+
+//==================================== PanelAgent ===========================
+class EcoreSocketPanelAgent: public PanelAgentBase
+{
+ bool m_should_exit;
+
+ int m_socket_timeout;
+ String m_socket_address;
+ SocketServer m_socket_server;
+
+ Transaction m_send_trans;
+ Transaction m_recv_trans;
+ Transaction m_nest_trans;
+
+ bool m_should_shared_ise;
+ bool m_ise_exiting;
+
+ std::vector<Ecore_Fd_Handler*> _read_handler_list;
+
+ InfoManager* m_info_manager;
+
+public:
+ EcoreSocketPanelAgent()
+ : PanelAgentBase ("ecore_socket"),
+ m_should_exit(false),
+ m_socket_timeout(scim_get_default_socket_timeout()),
+ m_should_shared_ise(false),
+ m_ise_exiting(false) {
+ m_socket_server.signal_connect_accept(slot(this, &EcoreSocketPanelAgent::socket_accept_callback));
+ m_socket_server.signal_connect_receive(slot(this, &EcoreSocketPanelAgent::socket_receive_callback));
+ m_socket_server.signal_connect_exception(slot(this, &EcoreSocketPanelAgent::socket_exception_callback));
+ }
+
+ ~EcoreSocketPanelAgent() {
+ for (unsigned int ii = 0; ii < _read_handler_list.size(); ++ii) {
+ ecore_main_fd_handler_del(_read_handler_list[ii]);
+ }
+ _read_handler_list.clear();
+ }
+
+ bool initialize(InfoManager* info_manager, const String& display, bool resident) {
+ LOGD("");
+ m_info_manager = info_manager;
+ m_socket_address = scim_get_default_panel_socket_address(display);
+
+ m_socket_server.shutdown();
+
+ if (m_socket_server.create(SocketAddress(m_socket_address))) {
+ Ecore_Fd_Handler* panel_agent_read_handler = NULL;
+ panel_agent_read_handler = ecore_main_fd_handler_add(get_server_id(), ECORE_FD_READ, panel_agent_handler, this, NULL, NULL);
+ _read_handler_list.push_back(panel_agent_read_handler);
+ return true;
+ }
+ LOGE("create server failed");
+ return false;
+ }
+
+ bool valid(void) const {
+ return m_socket_server.valid();
+ }
+
+ void stop(void) {
+ SCIM_DEBUG_MAIN(1) << "PanelAgent::stop ()\n";
+ LOGD("");
+ lock();
+ m_should_exit = true;
+ unlock();
+ SocketClient client;
+ if (client.connect(SocketAddress(m_socket_address))) {
+ client.close();
+ }
+ }
+private:
+ void update_panel_event(int client, uint32 context_id, int cmd, uint32 nType, uint32 nValue) {
+ LOGD("client id:%d", client);
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context_id);
+ m_send_trans.put_command(cmd);
+ m_send_trans.put_data(nType);
+ m_send_trans.put_data(nValue);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void move_preedit_caret(int client, uint32 context_id, uint32 position) {
+ SCIM_DEBUG_MAIN(1) << "PanelAgent::move_preedit_caret (" << position << ")\n";
+ LOGD("client id:%d", client);
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context_id);
+ m_send_trans.put_command(SCIM_TRANS_CMD_MOVE_PREEDIT_CARET);
+ m_send_trans.put_data((uint32) position);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+//useless
+#if 0
+ void request_help(int client_id, uint32 context_id) {
+ SCIM_DEBUG_MAIN(1) << "PanelAgent::request_help ()\n";
+ LOGD("client id:%d", client_id);
+
+ Socket client_socket(client_id);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context_id);
+ m_send_trans.put_command(SCIM_TRANS_CMD_PANEL_REQUEST_HELP);
+ m_send_trans.write_to_socket(client_socket);
+
+ }
+
+ void request_factory_menu(int client_id, uint32 context_id) {
+ LOGD("client id:%d", client_id);
+ Socket client_socket(client_id);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context_id);
+ m_send_trans.put_command(SCIM_TRANS_CMD_PANEL_REQUEST_FACTORY_MENU);
+ m_send_trans.write_to_socket(client_socket);
+ }
+#endif
+
+ void reset_keyboard_ise(int client, uint32 context_id) {
+ LOGD("client id:%d", client);
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context_id);
+ m_send_trans.put_command(ISM_TRANS_CMD_PANEL_RESET_KEYBOARD_ISE);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void update_keyboard_ise_list(int client, uint32 context) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context);
+ m_send_trans.put_command(ISM_TRANS_CMD_PANEL_UPDATE_KEYBOARD_ISE);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void change_factory(int client, uint32 context, const String& uuid) {
+ SCIM_DEBUG_MAIN(1) << "PanelAgent::change_factory (" << uuid << ")\n";
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context);
+ m_send_trans.put_command(SCIM_TRANS_CMD_PANEL_CHANGE_FACTORY);
+ m_send_trans.put_data(uuid);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void helper_candidate_show(int client, uint32 context, const String& uuid) {
+ SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n";
+ LOGD("client id:%d", client);
+
+
+ Socket client_socket(client);
+
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_CANDIDATE_SHOW);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void helper_candidate_hide(int client, uint32 context, const String& uuid) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_CANDIDATE_HIDE);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void candidate_more_window_show(int client, uint32 context) {
+ SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n";
+ LOGD("client id:%d", client);
+
+
+ Socket client_socket(client);
+
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ if (m_info_manager->socket_get_client_info(client).type == HELPER_CLIENT)
+ m_send_trans.put_data(m_info_manager->get_current_helper_uuid());
+ m_send_trans.put_command(ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_SHOW);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void candidate_more_window_hide(int client, uint32 context) {
+ SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n";
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ if (m_info_manager->socket_get_client_info(client).type == HELPER_CLIENT)
+ m_send_trans.put_data(m_info_manager->get_current_helper_uuid());
+ m_send_trans.put_command(ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_HIDE);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void update_helper_lookup_table(int client, uint32 context, const String& uuid, const LookupTable& table) {
+ SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n";
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_UPDATE_LOOKUP_TABLE);
+ m_send_trans.put_data(table);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void select_aux(int client, uint32 contextid, uint32 item) {
+ SCIM_DEBUG_MAIN(1) << "PanelAgent::select_aux (" << item << ")\n";
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) contextid);
+
+ if (m_info_manager->socket_get_client_info(client).type == HELPER_CLIENT)
+ m_send_trans.put_data(m_info_manager->get_current_helper_uuid());
+
+ m_send_trans.put_command(ISM_TRANS_CMD_SELECT_AUX);
+ m_send_trans.put_data((uint32)item);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void select_candidate(int client, uint32 context, uint32 item) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context);
+
+ if (m_info_manager->socket_get_client_info(client).type == HELPER_CLIENT)
+ m_send_trans.put_data(m_info_manager->get_current_helper_uuid());
+
+ m_send_trans.put_command(SCIM_TRANS_CMD_SELECT_CANDIDATE);
+ m_send_trans.put_data((uint32)item);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void lookup_table_page_up(int client, uint32 context) {
+ SCIM_DEBUG_MAIN(1) << "PanelAgent::lookup_table_page_up ()\n";
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context);
+
+ if (m_info_manager->socket_get_client_info(client).type == HELPER_CLIENT)
+ m_send_trans.put_data(m_info_manager->get_current_helper_uuid());
+
+ m_send_trans.put_command(SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_UP);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void lookup_table_page_down(int client, uint32 context) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context);
+
+ if (m_info_manager->socket_get_client_info(client).type == HELPER_CLIENT)
+ m_send_trans.put_data(m_info_manager->get_current_helper_uuid());
+
+ m_send_trans.put_command(SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_DOWN);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void update_lookup_table_page_size(int client, uint32 context, uint32 size) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context);
+
+ if (m_info_manager->socket_get_client_info(client).type == HELPER_CLIENT)
+ m_send_trans.put_data(m_info_manager->get_current_helper_uuid());
+
+ m_send_trans.put_command(SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE_PAGE_SIZE);
+ m_send_trans.put_data(size);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void update_candidate_item_layout(int client, uint32 context, const std::vector<uint32>& row_items) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context);
+
+ if (m_info_manager->socket_get_client_info(client).type == HELPER_CLIENT)
+ m_send_trans.put_data(m_info_manager->get_current_helper_uuid());
+
+ m_send_trans.put_command(ISM_TRANS_CMD_UPDATE_CANDIDATE_ITEM_LAYOUT);
+ m_send_trans.put_data(row_items);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void select_associate(int client, uint32 context, uint32 item) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context);
+
+ if (m_info_manager->socket_get_client_info(client).type == HELPER_CLIENT)
+ m_send_trans.put_data(m_info_manager->get_current_helper_uuid());
+
+ m_send_trans.put_command(ISM_TRANS_CMD_SELECT_ASSOCIATE);
+ m_send_trans.put_data((uint32)item);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void associate_table_page_up(int client, uint32 context) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context);
+
+ if (m_info_manager->socket_get_client_info(client).type == HELPER_CLIENT)
+ m_send_trans.put_data(m_info_manager->get_current_helper_uuid());
+
+ m_send_trans.put_command(ISM_TRANS_CMD_ASSOCIATE_TABLE_PAGE_UP);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void associate_table_page_down(int client, uint32 context) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context);
+
+ if (m_info_manager->socket_get_client_info(client).type == HELPER_CLIENT)
+ m_send_trans.put_data(m_info_manager->get_current_helper_uuid());
+
+ m_send_trans.put_command(ISM_TRANS_CMD_ASSOCIATE_TABLE_PAGE_DOWN);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void update_associate_table_page_size(int client, uint32 context, uint32 size) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context);
+
+ if (m_info_manager->socket_get_client_info(client).type == HELPER_CLIENT)
+ m_send_trans.put_data(m_info_manager->get_current_helper_uuid());
+
+ m_send_trans.put_command(ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE_PAGE_SIZE);
+ m_send_trans.put_data(size);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void update_displayed_candidate_number(int client, uint32 context, uint32 size) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context);
+
+ if (m_info_manager->socket_get_client_info(client).type == HELPER_CLIENT)
+ m_send_trans.put_data(m_info_manager->get_current_helper_uuid());
+
+ m_send_trans.put_command(ISM_TRANS_CMD_UPDATE_DISPLAYED_CANDIDATE);
+ m_send_trans.put_data(size);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void send_longpress_event(int client, uint32 context, int index) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context);
+
+ if (m_info_manager->socket_get_client_info(client).type == HELPER_CLIENT)
+ m_send_trans.put_data(m_info_manager->get_current_helper_uuid());
+
+ m_send_trans.put_command(ISM_TRANS_CMD_LONGPRESS_CANDIDATE);
+ m_send_trans.put_data(index);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void trigger_property(int client, uint32 context, const String& property) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context);
+
+ if (m_info_manager->socket_get_client_info(client).type == HELPER_CLIENT)
+ m_send_trans.put_data(m_info_manager->get_current_helper_uuid());
+
+ m_send_trans.put_command(SCIM_TRANS_CMD_TRIGGER_PROPERTY);
+ m_send_trans.put_data(property);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void focus_out_helper(int client, uint32 context, const String& uuid) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(SCIM_TRANS_CMD_FOCUS_OUT);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void focus_in_helper(int client, uint32 context, const String& uuid) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(SCIM_TRANS_CMD_FOCUS_IN);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void show_helper(int client, uint32 context, const String& uuid, char* data, size_t& len) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_SHOW_ISE_PANEL);
+ m_send_trans.put_data(data, len);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void hide_helper(int client, uint32 context, const String& uuid) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_HIDE_ISE_PANEL);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void set_helper_mode(int client, uint32 context, const String& uuid, uint32& mode) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_SET_ISE_MODE);
+ m_send_trans.put_data(mode);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void set_helper_language(int client, uint32 context, const String& uuid, uint32& language) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_SET_ISE_LANGUAGE);
+ m_send_trans.put_data(language);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void set_helper_imdata(int client, uint32 context, const String& uuid, char* imdata, size_t& len) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_SET_ISE_IMDATA);
+ m_send_trans.put_data(imdata, len);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void set_helper_return_key_type(int client, uint32 context, const String& uuid, uint32 type) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_SET_RETURN_KEY_TYPE);
+ m_send_trans.put_data(type);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void get_helper_return_key_type(int client, uint32 context, const String& uuid, _OUT_ uint32& type) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ Transaction trans;
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_data(context);
+ trans.put_data(uuid);
+ trans.put_command(ISM_TRANS_CMD_GET_RETURN_KEY_TYPE);
+
+ int cmd;
+
+ if (trans.write_to_socket(client_socket)
+ && trans.read_from_socket(client_socket)
+ && trans.get_command(cmd) && cmd == SCIM_TRANS_CMD_REPLY
+ && trans.get_data(type)) {
+ SCIM_DEBUG_MAIN(1) << __func__ << " success\n";
+
+ } else {
+ LOGW("read failed");
+ }
+ }
+
+ void set_helper_return_key_disable(int client, uint32 context, const String& uuid, uint32 disabled) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_SET_RETURN_KEY_DISABLE);
+ m_send_trans.put_data(disabled);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void get_helper_return_key_disable(int client, uint32 context, const String& uuid, _OUT_ uint32& disabled) {
+
+ Socket client_socket(client);
+ LOGD("client id:%d", client);
+
+ Transaction trans;
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_data(context);
+ trans.put_data(uuid);
+ trans.put_command(ISM_TRANS_CMD_GET_RETURN_KEY_DISABLE);
+
+ int cmd;
+
+ if (trans.write_to_socket(client_socket)
+ && trans.read_from_socket(client_socket)
+ && trans.get_command(cmd) && cmd == SCIM_TRANS_CMD_REPLY
+ && trans.get_data(disabled)) {
+ SCIM_DEBUG_MAIN(1) << __func__ << " success\n";
+
+ } else {
+ LOGW("read failed");
+ }
+ }
+
+ void set_helper_layout(int client, uint32 context, const String& uuid, uint32& layout) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_SET_LAYOUT);
+ m_send_trans.put_data(layout);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void set_helper_input_mode(int client, uint32 context, const String& uuid, uint32& mode) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_SET_INPUT_MODE);
+ m_send_trans.put_data(mode);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void set_helper_input_hint(int client, uint32 context, const String& uuid, uint32& hint) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_SET_INPUT_HINT);
+ m_send_trans.put_data(hint);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void set_helper_bidi_direction(int client, uint32 context, const String& uuid, uint32& direction) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_UPDATE_BIDI_DIRECTION);
+ m_send_trans.put_data(direction);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void set_helper_caps_mode(int client, uint32 context, const String& uuid, uint32& mode) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_SET_CAPS_MODE);
+ m_send_trans.put_data(mode);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void show_helper_option_window(int client, uint32 context, const String& uuid) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ bool process_key_event(int client, uint32 context, const String& uuid, KeyEvent& key, _OUT_ uint32& result) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+
+ Transaction trans;
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_data(context);
+ trans.put_data(uuid);
+ trans.put_command(SCIM_TRANS_CMD_PROCESS_KEY_EVENT);
+ trans.put_data(key);
+ int cmd;
+
+ if (trans.write_to_socket(client_socket)
+ && trans.read_from_socket(client_socket)
+ && trans.get_command(cmd) && cmd == SCIM_TRANS_CMD_REPLY
+ && trans.get_data(result)) {
+ SCIM_DEBUG_MAIN(1) << __func__ << " success\n";
+ return true;
+ } else {
+ LOGW("read failed");
+ }
+
+ return false;
+ }
+
+ bool get_helper_geometry(int client, uint32 context, String& uuid, _OUT_ struct rectinfo& info) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+
+ Transaction trans;
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_data(context);
+ trans.put_data(uuid);
+ trans.put_command(ISM_TRANS_CMD_GET_ACTIVE_ISE_GEOMETRY);
+
+ if (trans.write_to_socket(client_socket)) {
+ int cmd;
+
+ trans.clear();
+
+ if (trans.read_from_socket(client_socket)
+ && trans.get_command(cmd) && cmd == SCIM_TRANS_CMD_REPLY
+ && trans.get_data(info.pos_x)
+ && trans.get_data(info.pos_y)
+ && trans.get_data(info.width)
+ && trans.get_data(info.height)) {
+ SCIM_DEBUG_MAIN(1) << __func__ << " is successful\n";
+ return true;
+ } else
+ LOGW("read failed");
+ } else
+ LOGW("write failed");
+
+ return false;
+ }
+
+ void get_helper_imdata(int client, uint32 context, String& uuid, char** imdata, size_t& len) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+
+ Transaction trans;
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_data(context);
+ trans.put_data(uuid);
+ trans.put_command(ISM_TRANS_CMD_GET_ISE_IMDATA);
+
+ int cmd;
+
+ if (trans.write_to_socket(client_socket)
+ && trans.read_from_socket(client_socket)
+ && trans.get_command(cmd) && cmd == SCIM_TRANS_CMD_REPLY
+ && trans.get_data(imdata, len)) {
+ SCIM_DEBUG_MAIN(1) << "get_helper_imdata success\n";
+ } else {
+ LOGW("read failed");
+ }
+ }
+
+ void get_helper_layout(int client, uint32 context, String& uuid, uint32& layout) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+
+ Transaction trans;
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_data(context);
+ trans.put_data(uuid);
+ trans.put_command(ISM_TRANS_CMD_GET_LAYOUT);
+
+ int cmd;
+
+ if (trans.write_to_socket(client_socket)
+ && trans.read_from_socket(client_socket)
+ && trans.get_command(cmd) && cmd == SCIM_TRANS_CMD_REPLY
+ && trans.get_data(layout)) {
+ SCIM_DEBUG_MAIN(1) << "get_helper_layout success\n";
+ } else
+ LOGW("failed");
+ }
+
+ void get_ise_language_locale(int client, uint32 context, String& uuid, char* data, size_t& len) {
+ SCIM_DEBUG_MAIN(4) << __func__ << "\n";
+ LOGD("client id:%d", client);
+
+ Transaction trans;
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_data(context);
+ trans.put_data(uuid);
+ trans.put_command(ISM_TRANS_CMD_GET_ISE_LANGUAGE_LOCALE);
+
+ int cmd;
+ Socket client_socket(client);
+
+ if (trans.write_to_socket(client_socket)
+ && trans.read_from_socket(client_socket)
+ && trans.get_command(cmd) && cmd == SCIM_TRANS_CMD_REPLY
+ && trans.get_data(&data, len)) {
+ } else {
+ LOGW("failed");
+ }
+ }
+
+ void check_option_window(int client, uint32 context, String& uuid, _OUT_ uint32& avail) {
+ LOGD("client id:%d", client);
+
+ int cmd;
+ Socket client_socket(client);
+
+ Transaction trans;
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_data(context);
+ trans.put_data(uuid);
+ trans.put_command(ISM_TRANS_CMD_CHECK_OPTION_WINDOW);
+ trans.write_to_socket(client_socket);
+
+ if (!trans.read_from_socket(client_socket, m_socket_timeout) ||
+ !trans.get_command(cmd) || cmd != SCIM_TRANS_CMD_REPLY ||
+ !trans.get_data(avail)) {
+ LOGW("ISM_TRANS_CMD_CHECK_OPTION_WINDOW failed");
+ }
+ }
+
+ void reset_ise_option(int client, uint32 context) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data((uint32) context);
+ m_send_trans.put_command(ISM_TRANS_CMD_RESET_ISE_OPTION);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void reset_helper_context(int client, uint32 context, const String& uuid) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_RESET_ISE_CONTEXT);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void reload_config(int client) {
+ SCIM_DEBUG_MAIN(1) << "PanelAgent::reload_config ()\n";
+ LOGD("client id:%d", client);
+
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_command(SCIM_TRANS_CMD_RELOAD_CONFIG);
+
+ Socket client_socket(client);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void exit(int client, uint32 context) {
+ SCIM_DEBUG_MAIN(1) << "PanelAgent::exit ()\n";
+ LOGD("client id:%d", client);
+
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+
+ if (m_info_manager->socket_get_client_info(client).type == HELPER_CLIENT)
+ m_send_trans.put_data(m_info_manager->get_current_helper_uuid());
+
+ m_send_trans.put_command(SCIM_TRANS_CMD_EXIT);
+
+ Socket client_socket(client);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void socket_update_surrounding_text(int client, uint32 context, const String& uuid, String text, uint32 cursor) {
+ SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n";
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT);
+ m_send_trans.put_data(text);
+ m_send_trans.put_data(cursor);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void socket_update_selection(int client, uint32 context, const String& uuid, String text) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_UPDATE_SELECTION);
+ m_send_trans.put_data(text);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void socket_get_keyboard_ise_list(int client, uint32 context, const String& uuid, std::vector<String>& list) {
+ LOGD("client id:%d", client);
+
+ Socket socket_client(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_UPDATE_KEYBOARD_ISE_LIST);
+ m_send_trans.put_data(list.size());
+
+ for (unsigned int i = 0; i < list.size(); i++)
+ m_send_trans.put_data(list[i]);
+
+ m_send_trans.write_to_socket(socket_client);
+ }
+
+ void socket_get_candidate_ui(int client, uint32 context, const String& uuid, int style, int mode) {
+ SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_get_candidate_ui ()\n";
+
+ LOGD("client id:%d", client);
+
+ Socket socket_client(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_UPDATE_CANDIDATE_UI);
+ m_send_trans.put_data(style);
+ m_send_trans.put_data(mode);
+ m_send_trans.write_to_socket(socket_client);
+ }
+
+ void socket_get_candidate_geometry(int client, uint32 context, const String& uuid, struct rectinfo& info) {
+ SCIM_DEBUG_MAIN(4) << __func__ << " \n";
+
+ LOGD("client id:%d", client);
+
+ Socket socket_client(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_UPDATE_CANDIDATE_GEOMETRY);
+ m_send_trans.put_data(info.pos_x);
+ m_send_trans.put_data(info.pos_y);
+ m_send_trans.put_data(info.width);
+ m_send_trans.put_data(info.height);
+ m_send_trans.write_to_socket(socket_client);
+ }
+
+ void socket_get_keyboard_ise(int client, uint32 context, const String& uuid, String& ise_name, String& ise_uuid) {
+ LOGD("client id:%d", client);
+
+ Socket socket_client(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_UPDATE_KEYBOARD_ISE);
+ m_send_trans.put_data(ise_name);
+ m_send_trans.put_data(ise_uuid);
+ m_send_trans.write_to_socket(socket_client);
+ }
+
+ void socket_start_helper(int client, uint32 context, const String& ic_uuid) {
+ SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_start_helper ()\n";
+
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(ic_uuid);
+ m_send_trans.put_command(SCIM_TRANS_CMD_HELPER_ATTACH_INPUT_CONTEXT);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void helper_detach_input_context(int client, uint32 context, const String& ic_uuid) {
+ SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_stop_helper ()\n";
+
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(ic_uuid);
+ m_send_trans.put_command(SCIM_TRANS_CMD_HELPER_DETACH_INPUT_CONTEXT);
+ m_send_trans.write_to_socket(client_socket);
+ }
+
+ void helper_process_imengine_event(int client, uint32 context, const String& ic_uuid, const Transaction& _nest_trans) {
+ SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_send_helper_event ()\n";
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+
+ lock();
+
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+
+ /* FIXME: We presume that client and context are both less than 65536.
+ * Hopefully, it should be true in any UNIXs.
+ * So it's ok to combine client and context into one uint32. */
+ m_send_trans.put_data(context);
+ m_send_trans.put_data(ic_uuid);
+ m_send_trans.put_command(SCIM_TRANS_CMD_HELPER_PROCESS_IMENGINE_EVENT);
+ m_send_trans.put_data(_nest_trans);
+ m_send_trans.write_to_socket(client_socket);
+
+ unlock();
+ }
+
+ void process_helper_event(int client, uint32 context, String target_uuid, String active_uuid, Transaction& nest_trans) {
+ LOGD("client id:%d", client);
+
+ SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_helper_send_imengine_event (" << client << ")\n";
+ Socket socket_client(client);
+ lock();
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_command(SCIM_TRANS_CMD_PROCESS_HELPER_EVENT);
+ m_send_trans.put_data(target_uuid);
+ m_send_trans.put_data(active_uuid);
+ m_send_trans.put_data(nest_trans);
+ m_send_trans.write_to_socket(socket_client);
+ unlock();
+
+ }
+
+ void socket_helper_key_event(int client, uint32 context, int cmd, KeyEvent& key) {
+ LOGD("client id:%d", client);
+
+ Socket socket_client(client);
+ lock();
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context);
+ m_send_trans.put_command(cmd);
+ m_send_trans.put_data(key);
+ m_send_trans.write_to_socket(socket_client);
+ unlock();
+ }
+
+ void commit_string(int client, uint32 target_context, const WideString& wstr) {
+ LOGD("client id:%d", client);
+
+ Socket socket_client(client);
+ lock();
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(target_context);
+ m_send_trans.put_command(SCIM_TRANS_CMD_COMMIT_STRING);
+ m_send_trans.put_data(wstr);
+ m_send_trans.write_to_socket(socket_client);
+ unlock();
+ }
+
+ void socket_helper_get_surrounding_text(int client, uint32 context_id, uint32 maxlen_before, uint32 maxlen_after) {
+ SCIM_DEBUG_MAIN(4) << __FUNCTION__ << " (" << client << ")\n";
+ LOGD("client id:%d", client);
+
+ Socket socket_client(client);
+ lock();
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context_id);
+ m_send_trans.put_command(SCIM_TRANS_CMD_GET_SURROUNDING_TEXT);
+ m_send_trans.put_data(maxlen_before);
+ m_send_trans.put_data(maxlen_after);
+ m_send_trans.write_to_socket(socket_client);
+ unlock();
+ }
+
+ void socket_helper_delete_surrounding_text(int client, uint32 context_id, uint32 offset, uint32 len) {
+ SCIM_DEBUG_MAIN(4) << __FUNCTION__ << " (" << client << ")\n";
+ LOGD("client id:%d", client);
+
+ Socket socket_client(client);
+ lock();
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context_id);
+ m_send_trans.put_command(SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT);
+ m_send_trans.put_data(offset);
+ m_send_trans.put_data(len);
+ m_send_trans.write_to_socket(socket_client);
+ unlock();
+ }
+
+ void socket_helper_get_selection(int client, uint32 context_id) {
+ SCIM_DEBUG_MAIN(4) << __FUNCTION__ << " (" << client << ")\n";
+ LOGD("client id:%d", client);
+
+
+ Socket socket_client(client);
+ lock();
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context_id);
+ m_send_trans.put_command(SCIM_TRANS_CMD_GET_SELECTION);
+ m_send_trans.write_to_socket(socket_client);
+ unlock();
+ }
+
+ void socket_helper_set_selection(int client, uint32 context_id, uint32 start, uint32 end) {
+ LOGD("client id:%d", client);
+
+ Socket socket_client(client);
+ lock();
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context_id);
+ m_send_trans.put_command(SCIM_TRANS_CMD_SET_SELECTION);
+ m_send_trans.put_data(start);
+ m_send_trans.put_data(end);
+ m_send_trans.write_to_socket(socket_client);
+ unlock();
+ }
+
+ void show_preedit_string(int client, uint32 target_context) {
+ LOGD("client id:%d", client);
+
+ Socket socket_client(client);
+ lock();
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(target_context);
+ m_send_trans.put_command(SCIM_TRANS_CMD_SHOW_PREEDIT_STRING);
+ m_send_trans.write_to_socket(socket_client);
+ unlock();
+ }
+
+ void hide_preedit_string(int client, uint32 target_context) {
+ LOGD("client id:%d", client);
+
+ Socket socket_client(client);
+ lock();
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(target_context);
+ m_send_trans.put_command(SCIM_TRANS_CMD_HIDE_PREEDIT_STRING);
+ m_send_trans.write_to_socket(socket_client);
+ unlock();
+ }
+
+ void update_preedit_string(int client, uint32 target_context, WideString wstr, AttributeList& attrs, uint32 caret) {
+ LOGD("client id:%d", client);
+
+ Socket socket_client(client);
+ lock();
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(target_context);
+ m_send_trans.put_command(SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING);
+ m_send_trans.put_data(wstr);
+ m_send_trans.put_data(attrs);
+ m_send_trans.put_data(caret);
+ m_send_trans.write_to_socket(socket_client);
+ unlock();
+
+ }
+
+ void update_preedit_caret(int client, uint32 focused_context, uint32 caret) {
+
+ LOGD("client id:%d", client);
+
+ Socket socket_client(client);
+ lock();
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(focused_context);
+ m_send_trans.put_command(SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET);
+ m_send_trans.put_data(caret);
+ m_send_trans.write_to_socket(socket_client);
+ unlock();
+
+ }
+
+ void helper_attach_input_context_and_update_screen(int client, std::vector < std::pair <uint32, String> >& helper_ic_index, uint32 current_screen) {
+ LOGD("client id:%d", client);
+
+ Socket socket_client(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_command(SCIM_TRANS_CMD_OK);
+ m_send_trans.put_command(SCIM_TRANS_CMD_HELPER_ATTACH_INPUT_CONTEXT);
+
+ for (size_t i = 0; i < helper_ic_index.size(); ++i) {
+ m_send_trans.put_data(helper_ic_index[i].first);
+ m_send_trans.put_data(helper_ic_index[i].second);
+ }
+
+ m_send_trans.put_command(SCIM_TRANS_CMD_UPDATE_SCREEN);
+ m_send_trans.put_data((uint32)current_screen);
+ m_send_trans.write_to_socket(socket_client);
+ }
+
+ void update_ise_input_context(int client, uint32 focused_context, uint32 type, uint32 value) {
+ LOGD("client id:%d", client);
+
+ Socket client_socket(client);
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(focused_context);
+ m_send_trans.put_command(ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT);
+ m_send_trans.put_data(type);
+ m_send_trans.put_data(value);
+ m_send_trans.write_to_socket(client_socket);
+
+ }
+
+ void send_private_command(int client, uint32 focused_context, String command) {
+ LOGD("client id:%d", client);
+
+ Socket socket_client(client);
+ lock();
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(focused_context);
+ m_send_trans.put_command(SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND);
+ m_send_trans.put_data(command);
+ m_send_trans.write_to_socket(socket_client);
+
+ }
+
+
+ void helper_all_update_spot_location(int client, uint32 context_id, String uuid, int x, int y) {
+
+ LOGD("client id:%d", client);
+
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+
+ /* FIXME: We presume that client and context are both less than 65536.
+ * Hopefully, it should be true in any UNIXs.
+ * So it's ok to combine client and context into one uint32. */
+ m_send_trans.put_data(context_id);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION);
+ m_send_trans.put_data((uint32) x);
+ m_send_trans.put_data((uint32) y);
+
+ Socket client_socket(client);
+ m_send_trans.write_to_socket(client_socket);
+
+ }
+
+ void helper_all_update_cursor_position(int client, uint32 context_id, String uuid, int cursor_pos) {
+
+ LOGD("client id:%d", client);
+
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data(context_id);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(ISM_TRANS_CMD_UPDATE_CURSOR_POSITION);
+ m_send_trans.put_data((uint32) cursor_pos);
+
+ Socket client_socket(client);
+ m_send_trans.write_to_socket(client_socket);
+
+ }
+
+ void helper_all_update_screen(int client, uint32 context_id, String uuid, int screen) {
+
+ LOGD("client id:%d", client);
+
+ m_send_trans.clear();
+ m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+
+ /* FIXME: We presume that client and context are both less than 65536.
+ * Hopefully, it should be true in any UNIXs.
+ * So it's ok to combine client and context into one uint32. */
+ m_send_trans.put_data(context_id);
+ m_send_trans.put_data(uuid);
+ m_send_trans.put_command(SCIM_TRANS_CMD_UPDATE_SCREEN);
+ m_send_trans.put_data((uint32) screen);
+
+ Socket client_socket(client);
+ m_send_trans.write_to_socket(client_socket);
+
+ }
+
+private:
+
+ static void send_fail_reply (int client_id)
+ {
+ Socket client_socket (client_id);
+ Transaction trans;
+ trans.clear ();
+ trans.put_command (SCIM_TRANS_CMD_REPLY);
+ trans.put_command (SCIM_TRANS_CMD_FAIL);
+ trans.write_to_socket (client_socket);
+ }
+
+ bool filter_event(int fd) {
+ SCIM_DEBUG_MAIN(1) << "PanelAgent::filter_event ()\n";
+
+ return m_socket_server.filter_event(fd);
+ }
+
+ bool filter_exception_event(int fd) {
+ SCIM_DEBUG_MAIN(1) << "PanelAgent::filter_exception_event ()\n";
+
+ return m_socket_server.filter_exception_event(fd);
+ }
+
+ int get_server_id() {
+ SCIM_DEBUG_MAIN(1) << "PanelAgent::get_server_id ()\n";
+
+ return m_socket_server.get_id();
+ }
+
+ bool socket_check_client_connection(const Socket& client) {
+ SCIM_DEBUG_MAIN(3) << "PanelAgent::socket_check_client_connection (" << client.get_id() << ")\n";
+
+ unsigned char buf [sizeof(uint32)];
+
+ int nbytes = client.read_with_timeout(buf, sizeof(uint32), m_socket_timeout);
+
+ if (nbytes == sizeof(uint32))
+ return true;
+
+ if (nbytes < 0) {
+ LOGW("Error occurred when reading socket: %s", client.get_error_message().c_str());
+ } else {
+ LOGW("Timeout when reading socket");
+ }
+
+ return false;
+ }
+
+ /**
+ * @brief Callback function for ecore fd handler.
+ *
+ * @param data The data to pass to this callback.
+ * @param fd_handler The ecore fd handler.
+ *
+ * @return ECORE_CALLBACK_RENEW
+ */
+ static Eina_Bool panel_agent_handler(void* data, Ecore_Fd_Handler* fd_handler) {
+ if (fd_handler == NULL || data == NULL)
+ return ECORE_CALLBACK_RENEW;
+
+ EcoreSocketPanelAgent* _agent = (EcoreSocketPanelAgent*)data;
+
+ int fd = ecore_main_fd_handler_fd_get(fd_handler);
+
+ for (unsigned int i = 0; i < _agent->_read_handler_list.size(); i++) {
+ if (fd_handler == _agent->_read_handler_list [i]) {
+ if (!_agent->filter_event(fd)) {
+ std::cerr << "_panel_agent->filter_event () is failed!!!\n";
+ ecore_main_fd_handler_del(fd_handler);
+
+ ISF_SAVE_LOG("_panel_agent->filter_event (fd=%d) is failed!!!\n", fd);
+ }
+
+ return ECORE_CALLBACK_RENEW;
+ }
+ }
+
+ std::cerr << "panel_agent_handler () has received exception event!!!\n";
+ _agent->filter_exception_event(fd);
+ ecore_main_fd_handler_del(fd_handler);
+
+ ISF_SAVE_LOG("Received exception event (fd=%d)!!!\n", fd);
+ return ECORE_CALLBACK_RENEW;
+ }
+
+ void socket_accept_callback(SocketServer* server,
+ const Socket& client) {
+ SCIM_DEBUG_MAIN(2) << "PanelAgent::socket_accept_callback (" << client.get_id() << ")\n";
+ LOGD("");
+ lock();
+
+ if (m_should_exit) {
+ SCIM_DEBUG_MAIN(3) << "Exit Socket Server Thread.\n";
+ server->shutdown();
+ } else {
+ //m_signal_accept_connection (client.get_id ());
+ Ecore_Fd_Handler* panel_agent_read_handler = ecore_main_fd_handler_add(client.get_id(), ECORE_FD_READ, panel_agent_handler, this, NULL, NULL);
+ _read_handler_list.push_back(panel_agent_read_handler);
+ }
+
+ unlock();
+ }
+
+ void socket_receive_callback(SocketServer* server,
+ const Socket& client) {
+ int client_id = client.get_id();
+ int cmd = 0;
+ uint32 key = 0;
+ uint32 context = 0;
+ String uuid;
+
+ ClientInfo client_info;
+
+ SCIM_DEBUG_MAIN(1) << "PanelAgent::socket_receive_callback (" << client_id << ")\n";
+
+ /* If the connection is closed then close this client. */
+ if (!socket_check_client_connection(client)) {
+ LOGW("check client connection failed");
+ socket_close_connection(server, client);
+ return;
+ }
+
+ client_info = m_info_manager->socket_get_client_info(client_id);
+
+ /* If it's a new client, then request to open the connection first. */
+ if (client_info.type == UNKNOWN_CLIENT) {
+ socket_open_connection(server, client);
+ return;
+ }
+
+ /* If can not read the transaction,
+ * or the transaction is not started with SCIM_TRANS_CMD_REQUEST,
+ * or the key is mismatch,
+ * just return. */
+ if (!m_recv_trans.read_from_socket(client, m_socket_timeout) ||
+ !m_recv_trans.get_command(cmd) || cmd != SCIM_TRANS_CMD_REQUEST ||
+ !m_recv_trans.get_data(key) || key != (uint32) client_info.key) {
+ LOGW("cmd:%d key:%d client info key: %d", cmd, key, client_info.key);
+ return;
+ }
+
+ if (client_info.type == FRONTEND_ACT_CLIENT) {
+ if (m_recv_trans.get_data(context)) {
+ SCIM_DEBUG_MAIN(1) << "PanelAgent::FrontEnd Client, context = " << context << "\n";
+ socket_transaction_start();
+
+ while (m_recv_trans.get_command(cmd)) {
+ LOGD("PanelAgent::cmd = %d", cmd);
+
+ if (cmd == ISM_TRANS_CMD_REGISTER_PANEL_CLIENT) {
+ uint32 id = 0;
+
+ if (m_recv_trans.get_data(id)) {
+ m_info_manager->register_panel_client(client_id, id);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ continue;
+ }
+
+ else if (cmd == SCIM_TRANS_CMD_PANEL_REGISTER_INPUT_CONTEXT) {
+ if (m_recv_trans.get_data(uuid)) {
+ m_info_manager->register_input_context(client_id, context, uuid);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ continue;
+ }
+
+ else if (cmd == SCIM_TRANS_CMD_PANEL_REMOVE_INPUT_CONTEXT) {
+ m_info_manager->remove_input_context(client_id, context);
+ continue;
+ }
+
+ else if (cmd == SCIM_TRANS_CMD_PANEL_RESET_INPUT_CONTEXT) {
+ m_info_manager->socket_reset_input_context(client_id, context);
+ continue;
+ }
+
+ else if (cmd == SCIM_TRANS_CMD_FOCUS_IN) {
+ SCIM_DEBUG_MAIN(4) << " SCIM_TRANS_CMD_FOCUS_IN (" << "client:" << client_id << " context:" << context << ")\n";
+
+ if (m_recv_trans.get_data(uuid)) {
+ m_info_manager->focus_in(client_id, context, uuid);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ continue;
+ }
+
+ else if (cmd == ISM_TRANS_CMD_TURN_ON_LOG) {
+ uint32 isOn;
+
+ if (m_recv_trans.get_data(isOn)) {
+ m_info_manager->socket_turn_on_log(isOn);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ continue;
+ }
+
+ else if (cmd == ISM_TRANS_CMD_SHOW_ISF_CONTROL) {
+ m_info_manager->show_isf_panel(client_id);
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_HIDE_ISF_CONTROL) {
+ m_info_manager->hide_isf_panel(client_id);
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_SHOW_ISE_PANEL) {
+ uint32 client;
+ uint32 context;
+ char* data = NULL;
+ size_t len;
+ bool ret = false;
+
+ if (m_recv_trans.get_data(client) && m_recv_trans.get_data(context) && m_recv_trans.get_data(&data, len)) {
+ ret = true;
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_command(ret ? SCIM_TRANS_CMD_OK : SCIM_TRANS_CMD_FAIL);
+ trans.put_data(ret);
+ trans.write_to_socket(client_socket);
+
+ if (data != NULL)
+ delete[] data;
+
+ if (ret)
+ m_info_manager->show_ise_panel(client_id, client, context, data, len);
+
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_HIDE_ISE_PANEL) {
+ uint32 client;
+ uint32 context;
+
+ if (m_recv_trans.get_data(client) && m_recv_trans.get_data(context)) {
+ m_info_manager->hide_ise_panel(client_id, client, context);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_GET_ACTIVE_ISE_GEOMETRY) {
+ struct rectinfo info;
+ m_info_manager->get_input_panel_geometry(client_id, info);
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.put_data(info.pos_x);
+ trans.put_data(info.pos_y);
+ trans.put_data(info.width);
+ trans.put_data(info.height);
+ trans.write_to_socket(client_socket);
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY) {
+ struct rectinfo info;
+ m_info_manager->get_candidate_window_geometry(client_id, info);
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.put_data(info.pos_x);
+ trans.put_data(info.pos_y);
+ trans.put_data(info.width);
+ trans.put_data(info.height);
+ trans.write_to_socket(client_socket);
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_GET_ISE_LANGUAGE_LOCALE) {
+ size_t len;
+ char* data = NULL;
+ m_info_manager->get_ise_language_locale(client_id, data, len);
+ Transaction trans;
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+
+ if (data != NULL && len > 0) {
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.put_data(data, len);
+ } else {
+ trans.put_command(SCIM_TRANS_CMD_FAIL);
+ }
+
+ Socket client_socket(client_id);
+ trans.write_to_socket(client_socket);
+
+ if (NULL != data)
+ delete [] data;
+
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_SET_ISE_LANGUAGE) {
+ uint32 language;
+
+ if (m_recv_trans.get_data(language)) {
+ m_info_manager->set_ise_language(client_id, language);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_SET_ISE_IMDATA) {
+ char* imdata = NULL;
+ size_t len;
+
+ if (m_recv_trans.get_data(&imdata, len)) {
+ m_info_manager->set_ise_imdata(client_id, imdata, len);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ if (NULL != imdata)
+ delete [] imdata;
+
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_GET_ISE_IMDATA) {
+ char* imdata = NULL;
+ size_t len = 0;
+ m_info_manager->get_ise_imdata(client_id, &imdata, len);
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+
+ if (len) {
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.put_data(imdata, len);
+ } else {
+ trans.put_command(SCIM_TRANS_CMD_FAIL);
+ }
+
+ trans.write_to_socket(client_socket);
+
+ if (NULL != imdata)
+ delete [] imdata;
+
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_SET_RETURN_KEY_TYPE) {
+ uint32 type;
+
+ if (m_recv_trans.get_data(type)) {
+ m_info_manager->set_ise_return_key_type(client_id, type);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_GET_RETURN_KEY_TYPE) {
+ uint32 type;
+ bool ret = m_info_manager->get_ise_return_key_type(client_id, type);
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+
+ if (ret) {
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.put_data(type);
+ } else {
+ trans.put_command(SCIM_TRANS_CMD_FAIL);
+ }
+
+ trans.write_to_socket(client_socket);
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_SET_RETURN_KEY_DISABLE) {
+ uint32 disabled;
+
+ if (m_recv_trans.get_data(disabled)) {
+ m_info_manager->set_ise_return_key_disable(client_id, disabled);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_GET_RETURN_KEY_DISABLE) {
+ uint32 disabled;
+ bool ret = true;
+ m_info_manager->get_ise_return_key_disable(client_id, disabled);
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+
+ if (ret) {
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.put_data(disabled);
+ } else {
+ trans.put_command(SCIM_TRANS_CMD_FAIL);
+ }
+
+ trans.write_to_socket(client_socket);
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_GET_LAYOUT) {
+ uint32 layout;
+ bool ret = m_info_manager->get_ise_layout(client_id, layout);
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+
+ if (ret) {
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.put_data(layout);
+ } else {
+ trans.put_command(SCIM_TRANS_CMD_FAIL);
+ }
+
+ trans.write_to_socket(client_socket);
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_SET_LAYOUT) {
+ uint32 layout;
+
+ if (m_recv_trans.get_data(layout)) {
+ m_info_manager->set_ise_layout(client_id, layout);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_SET_CAPS_MODE) {
+ uint32 mode;
+
+ if (m_recv_trans.get_data(mode)) {
+ m_info_manager->set_ise_caps_mode(client_id, mode);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_SEND_WILL_SHOW_ACK) {
+ m_info_manager->will_show_ack(client_id);
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_SEND_WILL_HIDE_ACK) {
+ m_info_manager->will_hide_ack(client_id);
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_SET_HARDWARE_KEYBOARD_MODE) {
+ uint32 mode;
+
+ if (m_recv_trans.get_data(mode)) {
+ m_info_manager->set_keyboard_mode(client_id, mode);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_SEND_CANDIDATE_WILL_HIDE_ACK) {
+ m_info_manager->candidate_will_hide_ack(client_id);
+ continue;
+ } else if (cmd == SCIM_TRANS_CMD_PROCESS_KEY_EVENT) {
+ uint32 result = 0;
+ bool ret = false;
+
+ KeyEvent key;
+
+ if (m_recv_trans.get_data(key)) {
+ ret = true;
+ m_info_manager->process_key_event(key, result);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+
+ if (ret) {
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.put_data(result);
+ } else {
+ trans.put_command(SCIM_TRANS_CMD_FAIL);
+ }
+
+ trans.write_to_socket(client_socket);
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_GET_ACTIVE_HELPER_OPTION) {
+ uint32 option;
+ m_info_manager->get_active_helper_option(client_id, option);
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.put_data(option);
+ SCIM_DEBUG_MAIN(4) << __func__ << " option " << option << "\n";
+ trans.write_to_socket(client_socket);
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_GET_ISE_STATE) {
+ int state = 0;
+ m_info_manager->get_ise_state(client_id, state);
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.put_data(state);
+ trans.write_to_socket(client_socket);
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_SET_INPUT_MODE) {
+ uint32 input_mode;
+
+ if (m_recv_trans.get_data(input_mode)) {
+ m_info_manager->set_ise_input_mode(client_id, input_mode);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_SET_INPUT_HINT) {
+ uint32 input_hint;
+
+ if (m_recv_trans.get_data(input_hint)) {
+ m_info_manager->set_ise_input_hint(client_id, input_hint);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_UPDATE_BIDI_DIRECTION) {
+ uint32 bidi_direction;
+
+ if (m_recv_trans.get_data(bidi_direction)) {
+ m_info_manager->update_ise_bidi_direction(client_id, bidi_direction);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ continue;
+ } else if (cmd == ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW) {
+ m_info_manager->show_ise_option_window(client_id);
+ continue;
+ }
+
+ //FIXME
+ //skip data
+
+ else if (cmd == SCIM_TRANS_CMD_START_HELPER) {
+ String uuid;
+
+ if (m_recv_trans.get_data(uuid) && uuid.length()) {
+ m_info_manager->socket_start_helper(client_id, context, uuid);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ continue;
+ } else if (cmd == SCIM_TRANS_CMD_SEND_HELPER_EVENT) {
+ String uuid;
+
+ if (m_recv_trans.get_data(uuid) && m_recv_trans.get_data(m_nest_trans) &&
+ uuid.length() && m_nest_trans.valid()) {
+ m_info_manager->socket_send_helper_event(client_id, context, uuid, m_nest_trans);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ continue;
+ } else if (cmd == SCIM_TRANS_CMD_STOP_HELPER) {
+ String uuid;
+
+ if (m_recv_trans.get_data(uuid) && uuid.length()) {
+ m_info_manager->socket_stop_helper(client_id, context, uuid);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ continue;
+ }
+
+ //FIXME
+ //skip data
+
+ /* Client must focus in before do any other things. */
+ else if (cmd == SCIM_TRANS_CMD_PANEL_TURN_ON)
+ m_info_manager->socket_turn_on();
+ else if (cmd == SCIM_TRANS_CMD_PANEL_TURN_OFF)
+ m_info_manager->socket_turn_off();
+ else if (cmd == SCIM_TRANS_CMD_UPDATE_SCREEN) {
+ uint32 num;
+
+ if (m_recv_trans.get_data(num))
+ m_info_manager->socket_update_screen(client_id, num);
+ else
+ LOGW("wrong format of transaction");
+ } else if (cmd == SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION) {
+ uint32 x, y, top_y;
+
+ if (m_recv_trans.get_data(x) && m_recv_trans.get_data(y) && m_recv_trans.get_data(top_y)) {
+ m_info_manager->socket_update_spot_location(x, y, top_y);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == ISM_TRANS_CMD_UPDATE_CURSOR_POSITION) {
+ uint32 cursor_pos;
+
+ if (m_recv_trans.get_data(cursor_pos)) {
+ m_info_manager->socket_update_cursor_position(cursor_pos);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT) {
+ String text;
+ uint32 cursor;
+
+ if (m_recv_trans.get_data(text) && m_recv_trans.get_data(cursor)) {
+ m_info_manager->socket_update_surrounding_text(text, cursor);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == ISM_TRANS_CMD_UPDATE_SELECTION) {
+ String text;
+
+ if (m_recv_trans.get_data(text)) {
+ m_info_manager->socket_update_selection(text);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == ISM_TRANS_CMD_EXPAND_CANDIDATE)
+ m_info_manager->expand_candidate();
+ else if (cmd == ISM_TRANS_CMD_CONTRACT_CANDIDATE)
+ m_info_manager->contract_candidate();
+ else if (cmd == ISM_TRANS_CMD_SET_CANDIDATE_UI) {
+ uint32 portrait_line, mode;
+
+ if (m_recv_trans.get_data(portrait_line) && m_recv_trans.get_data(mode))
+ m_info_manager->socket_set_candidate_ui(portrait_line, mode);
+ else
+ LOGW("wrong format of transaction");
+ } else if (cmd == SCIM_TRANS_CMD_PANEL_UPDATE_FACTORY_INFO) {
+ PanelFactoryInfo info;
+
+ if (m_recv_trans.get_data(info.uuid) && m_recv_trans.get_data(info.name) &&
+ m_recv_trans.get_data(info.lang) && m_recv_trans.get_data(info.icon)) {
+ m_info_manager->socket_update_factory_info(info);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == SCIM_TRANS_CMD_SHOW_PREEDIT_STRING)
+ m_info_manager->socket_show_preedit_string();
+ else if (cmd == SCIM_TRANS_CMD_SHOW_AUX_STRING)
+ m_info_manager->socket_show_aux_string();
+ else if (cmd == SCIM_TRANS_CMD_SHOW_LOOKUP_TABLE)
+ m_info_manager->socket_show_lookup_table();
+ else if (cmd == ISM_TRANS_CMD_SHOW_ASSOCIATE_TABLE)
+ m_info_manager->socket_show_associate_table();
+ else if (cmd == SCIM_TRANS_CMD_HIDE_PREEDIT_STRING)
+ m_info_manager->socket_hide_preedit_string();
+ else if (cmd == SCIM_TRANS_CMD_HIDE_AUX_STRING)
+ m_info_manager->socket_hide_aux_string();
+ else if (cmd == SCIM_TRANS_CMD_HIDE_LOOKUP_TABLE)
+ m_info_manager->socket_hide_lookup_table();
+ else if (cmd == ISM_TRANS_CMD_HIDE_ASSOCIATE_TABLE)
+ m_info_manager->socket_hide_associate_table();
+ else if (cmd == SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING) {
+ String str;
+ AttributeList attrs;
+ uint32 caret;
+
+ if (m_recv_trans.get_data(str) && m_recv_trans.get_data(attrs) && m_recv_trans.get_data(caret))
+ m_info_manager->socket_update_preedit_string(str, attrs, caret);
+ else
+ LOGW("wrong format of transaction");
+ } else if (cmd == SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET) {
+ uint32 caret;
+
+ if (m_recv_trans.get_data(caret))
+ m_info_manager->socket_update_preedit_caret(caret);
+ else
+ LOGW("wrong format of transaction");
+ } else if (cmd == SCIM_TRANS_CMD_UPDATE_AUX_STRING) {
+ String str;
+ AttributeList attrs;
+
+ if (m_recv_trans.get_data(str) && m_recv_trans.get_data(attrs))
+ m_info_manager->socket_update_aux_string(str, attrs);
+ else
+ LOGW("wrong format of transaction");
+ } else if (cmd == SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE) {
+ CommonLookupTable _isf_candidate_table;
+
+ if (m_recv_trans.get_data(_isf_candidate_table))
+ m_info_manager->socket_update_lookup_table(_isf_candidate_table);
+ else
+ LOGW("wrong format of transaction");
+
+ } else if (cmd == ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE) {
+ CommonLookupTable table;
+
+ if (m_recv_trans.get_data(table))
+ m_info_manager->socket_update_associate_table(table);
+ else
+ LOGW("wrong format of transaction");
+ } else if (cmd == SCIM_TRANS_CMD_REGISTER_PROPERTIES) {
+ PropertyList properties;
+
+ if (m_recv_trans.get_data(properties))
+ m_info_manager->socket_register_properties(properties);
+ else
+ LOGW("wrong format of transaction");
+ } else if (cmd == SCIM_TRANS_CMD_UPDATE_PROPERTY) {
+ Property property;
+
+ if (m_recv_trans.get_data(property))
+ m_info_manager->socket_update_property(property);
+ else
+ LOGW("wrong format of transaction");
+ } else if (cmd == SCIM_TRANS_CMD_PANEL_SHOW_HELP) {
+ String help;
+
+ if (m_recv_trans.get_data(help))
+ m_info_manager->socket_show_help(help);
+ else
+ LOGW("wrong format of transaction");
+ } else if (cmd == SCIM_TRANS_CMD_PANEL_SHOW_FACTORY_MENU) {
+ PanelFactoryInfo info;
+ std::vector <PanelFactoryInfo> vec;
+
+ while (m_recv_trans.get_data(info.uuid) && m_recv_trans.get_data(info.name) &&
+ m_recv_trans.get_data(info.lang) && m_recv_trans.get_data(info.icon)) {
+ info.lang = scim_get_normalized_language(info.lang);
+ vec.push_back(info);
+ }
+
+ m_info_manager->socket_show_factory_menu(vec);
+ } else if (cmd == SCIM_TRANS_CMD_FOCUS_OUT) {
+ m_info_manager->focus_out(client_id, context);
+ } else {
+ LOGW("unknow cmd: %d", cmd);
+ }
+ }
+
+ socket_transaction_end();
+ }
+ } else if (client_info.type == FRONTEND_CLIENT) {
+ if (m_recv_trans.get_data(context)) {
+ SCIM_DEBUG_MAIN(1) << "client_info.type == FRONTEND_CLIENT\n";
+ socket_transaction_start();
+
+ while (m_recv_trans.get_command(cmd)) {
+ LOGD("PanelAgent::cmd = %d", cmd);
+
+ if (cmd == ISM_TRANS_CMD_GET_PANEL_CLIENT_ID) {
+ Socket client_socket(client_id);
+
+ Transaction trans;
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.put_data(client_id);
+ trans.write_to_socket(client_socket);
+ continue;
+ } else {
+ LOGW("unknow cmd: %d", cmd);
+ }
+ }
+
+ socket_transaction_end();
+ }
+ } else if (client_info.type == HELPER_CLIENT) {
+ socket_transaction_start();
+
+ while (m_recv_trans.get_command(cmd)) {
+ LOGD("PanelAgent::cmd = %d", cmd);
+
+ if (cmd == SCIM_TRANS_CMD_PANEL_REGISTER_HELPER) {
+ HelperInfo info;
+
+ if (m_recv_trans.get_data(info.uuid) &&
+ m_recv_trans.get_data(info.name) &&
+ m_recv_trans.get_data(info.icon) &&
+ m_recv_trans.get_data(info.description) &&
+ m_recv_trans.get_data(info.option) &&
+ info.uuid.length()) {
+ m_info_manager->socket_helper_register_helper(client_id, info);
+ }
+ } else {
+ LOGW("unknow cmd: %d", cmd);
+ }
+ }
+
+ socket_transaction_end();
+ } else if (client_info.type == HELPER_ACT_CLIENT) {
+ socket_transaction_start();
+
+ while (m_recv_trans.get_command(cmd)) {
+ LOGD("PanelAgent::cmd = %d", cmd);
+
+ if (cmd == SCIM_TRANS_CMD_PANEL_REGISTER_ACTIVE_HELPER) {
+ HelperInfo info;
+
+ if (m_recv_trans.get_data(info.uuid) &&
+ m_recv_trans.get_data(info.name) &&
+ m_recv_trans.get_data(info.icon) &&
+ m_recv_trans.get_data(info.description) &&
+ m_recv_trans.get_data(info.option) &&
+ info.uuid.length()) {
+ m_info_manager->socket_helper_register_helper_passive(client_id, info);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == SCIM_TRANS_CMD_COMMIT_STRING) {
+ uint32 target_ic;
+ String target_uuid;
+ WideString wstr;
+
+ if (m_recv_trans.get_data(target_ic) &&
+ m_recv_trans.get_data(target_uuid) &&
+ m_recv_trans.get_data(wstr) &&
+ wstr.length()) {
+ m_info_manager->socket_helper_commit_string(client_id, target_ic, target_uuid, wstr);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == SCIM_TRANS_CMD_SHOW_PREEDIT_STRING) {
+ uint32 target_ic;
+ String target_uuid;
+
+ if (m_recv_trans.get_data(target_ic) && m_recv_trans.get_data(target_uuid)) {
+ m_info_manager->socket_helper_show_preedit_string(client_id, target_ic, target_uuid);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == SCIM_TRANS_CMD_SHOW_AUX_STRING) {
+ m_info_manager->socket_show_aux_string();
+ } else if (cmd == SCIM_TRANS_CMD_SHOW_LOOKUP_TABLE) {
+ m_info_manager->socket_show_lookup_table();
+ } else if (cmd == ISM_TRANS_CMD_SHOW_ASSOCIATE_TABLE) {
+ m_info_manager->socket_show_associate_table();
+ } else if (cmd == SCIM_TRANS_CMD_HIDE_PREEDIT_STRING) {
+ uint32 target_ic;
+ String target_uuid;
+
+ if (m_recv_trans.get_data(target_ic) && m_recv_trans.get_data(target_uuid)) {
+ m_info_manager->socket_helper_hide_preedit_string(client_id, target_ic, target_uuid);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == SCIM_TRANS_CMD_HIDE_AUX_STRING) {
+ m_info_manager->socket_hide_aux_string();
+ } else if (cmd == SCIM_TRANS_CMD_HIDE_LOOKUP_TABLE) {
+ m_info_manager->socket_hide_lookup_table();
+ } else if (cmd == ISM_TRANS_CMD_HIDE_ASSOCIATE_TABLE) {
+ m_info_manager->socket_hide_associate_table();
+ } else if (cmd == SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING) {
+ uint32 target_ic;
+ String target_uuid;
+ WideString wstr;
+ AttributeList attrs;
+ uint32 caret;
+
+ if (m_recv_trans.get_data(target_ic) &&
+ m_recv_trans.get_data(target_uuid) &&
+ m_recv_trans.get_data(wstr) &&
+ m_recv_trans.get_data(attrs) &&
+ m_recv_trans.get_data(caret)) {
+ m_info_manager->socket_helper_update_preedit_string(client_id, target_ic, target_uuid, wstr, attrs, caret);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET) {
+ uint32 caret;
+
+ if (m_recv_trans.get_data(caret)) {
+ m_info_manager->socket_helper_update_preedit_caret(client_id, caret);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == SCIM_TRANS_CMD_UPDATE_AUX_STRING) {
+ String str;
+ AttributeList attrs;
+
+ if (m_recv_trans.get_data(str) && m_recv_trans.get_data(attrs))
+ m_info_manager->socket_update_aux_string(str, attrs);
+ else
+ LOGW("wrong format of transaction");
+
+ } else if (cmd == SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE) {
+ CommonLookupTable _isf_candidate_table;
+
+ if (m_recv_trans.get_data(_isf_candidate_table)) {
+ m_info_manager->socket_update_lookup_table(_isf_candidate_table);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE) {
+ CommonLookupTable _isf_candidate_table;
+
+ if (m_recv_trans.get_data(_isf_candidate_table)) {
+ m_info_manager->socket_update_associate_table(_isf_candidate_table);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == SCIM_TRANS_CMD_PROCESS_KEY_EVENT ||
+ cmd == SCIM_TRANS_CMD_PANEL_SEND_KEY_EVENT) {
+ uint32 target_ic;
+ String target_uuid;
+ KeyEvent key;
+
+ if (m_recv_trans.get_data(target_ic) &&
+ m_recv_trans.get_data(target_uuid) &&
+ m_recv_trans.get_data(key) &&
+ !key.empty()) {
+ m_info_manager->socket_helper_send_key_event(client_id, target_ic, target_uuid, key);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == SCIM_TRANS_CMD_FORWARD_KEY_EVENT) {
+ uint32 target_ic;
+ String target_uuid;
+ KeyEvent key;
+
+ if (m_recv_trans.get_data(target_ic) &&
+ m_recv_trans.get_data(target_uuid) &&
+ m_recv_trans.get_data(key) &&
+ !key.empty()) {
+ m_info_manager->socket_helper_forward_key_event(client_id, target_ic, target_uuid, key);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == SCIM_TRANS_CMD_PANEL_SEND_IMENGINE_EVENT) {
+ uint32 target_ic;
+ String target_uuid;
+
+ if (m_recv_trans.get_data(target_ic) &&
+ m_recv_trans.get_data(target_uuid) &&
+ m_recv_trans.get_data(m_nest_trans) &&
+ m_nest_trans.valid()) {
+ m_info_manager->socket_helper_send_imengine_event(client_id, target_ic, target_uuid, m_nest_trans);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == SCIM_TRANS_CMD_REGISTER_PROPERTIES) {
+ PropertyList properties;
+
+ if (m_recv_trans.get_data(properties))
+ m_info_manager->socket_helper_register_properties(client_id, properties);
+ else
+ LOGW("wrong format of transaction");
+ } else if (cmd == SCIM_TRANS_CMD_UPDATE_PROPERTY) {
+ Property property;
+
+ if (m_recv_trans.get_data(property))
+ m_info_manager->socket_helper_update_property(client_id, property);
+ else
+ LOGW("wrong format of transaction");
+ } else if (cmd == SCIM_TRANS_CMD_RELOAD_CONFIG) {
+ m_info_manager->reload_config();
+ } else if (cmd == ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT) {
+ uint32 type;
+ uint32 value;
+
+ if (m_recv_trans.get_data(type) && m_recv_trans.get_data(value)) {
+ m_info_manager->socket_helper_update_input_context(client_id, type, value);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == ISM_TRANS_CMD_GET_KEYBOARD_ISE_LIST) {
+ String uuid;
+
+ if (m_recv_trans.get_data(uuid)) {
+ m_info_manager->socket_get_keyboard_ise_list(uuid);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == ISM_TRANS_CMD_SET_CANDIDATE_UI) {
+ uint32 portrait_line, mode;
+
+ if (m_recv_trans.get_data(portrait_line) && m_recv_trans.get_data(mode))
+ m_info_manager->socket_set_candidate_ui(portrait_line, mode);
+ else
+ LOGW("wrong format of transaction");
+ } else if (cmd == ISM_TRANS_CMD_GET_CANDIDATE_UI) {
+ String uuid;
+
+ if (m_recv_trans.get_data(uuid)) {
+ m_info_manager->socket_get_candidate_ui(uuid);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == ISM_TRANS_CMD_SET_CANDIDATE_POSITION) {
+ uint32 left, top;
+
+ if (m_recv_trans.get_data(left) && m_recv_trans.get_data(top))
+ m_info_manager->socket_set_candidate_position(left, top);
+ else
+ LOGW("wrong format of transaction");
+ } else if (cmd == ISM_TRANS_CMD_HIDE_CANDIDATE) {
+ m_info_manager->socket_hide_candidate();
+ } else if (cmd == ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY) {
+ String uuid;
+
+ if (m_recv_trans.get_data(uuid)) {
+ m_info_manager->socket_get_candidate_geometry(uuid);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == ISM_TRANS_CMD_PANEL_RESET_KEYBOARD_ISE) {
+ m_info_manager->reset_keyboard_ise();
+ } else if (cmd == ISM_TRANS_CMD_SET_KEYBOARD_ISE_BY_UUID) {
+ String uuid;
+
+ if (m_recv_trans.get_data(uuid)) {
+ m_info_manager->socket_set_keyboard_ise(uuid);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == ISM_TRANS_CMD_GET_KEYBOARD_ISE) {
+ String uuid;
+
+ if (m_recv_trans.get_data(uuid)) {
+ m_info_manager->socket_get_keyboard_ise(uuid);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == ISM_TRANS_CMD_UPDATE_ISE_GEOMETRY) {
+ uint32 x, y, width, height;
+
+ if (m_recv_trans.get_data(x) && m_recv_trans.get_data(y) &&
+ m_recv_trans.get_data(width) && m_recv_trans.get_data(height)) {
+ m_info_manager->socket_helper_update_ise_geometry(client_id, x, y, width, height);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == ISM_TRANS_CMD_EXPAND_CANDIDATE) {
+ m_info_manager->expand_candidate();
+ } else if (cmd == ISM_TRANS_CMD_CONTRACT_CANDIDATE) {
+ m_info_manager->contract_candidate();
+ } else if (cmd == ISM_TRANS_CMD_SELECT_CANDIDATE) {
+ uint32 index;
+
+ if (m_recv_trans.get_data(index))
+ m_info_manager->socket_helper_select_candidate(index);
+ else
+ LOGW("wrong format of transaction");
+ } else if (cmd == SCIM_TRANS_CMD_GET_SURROUNDING_TEXT) {
+ String uuid;
+ uint32 maxlen_before;
+ uint32 maxlen_after;
+
+ if (m_recv_trans.get_data(uuid) &&
+ m_recv_trans.get_data(maxlen_before) &&
+ m_recv_trans.get_data(maxlen_after)) {
+ m_info_manager->socket_helper_get_surrounding_text(client_id, uuid, maxlen_before, maxlen_after);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT) {
+ uint32 offset;
+ uint32 len;
+
+ if (m_recv_trans.get_data(offset) && m_recv_trans.get_data(len)) {
+ m_info_manager->socket_helper_delete_surrounding_text(client_id, offset, len);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == SCIM_TRANS_CMD_GET_SELECTION) {
+ String uuid;
+
+ if (m_recv_trans.get_data(uuid)) {
+ m_info_manager->socket_helper_get_selection(client_id, uuid);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == SCIM_TRANS_CMD_SET_SELECTION) {
+ uint32 start;
+ uint32 end;
+
+ if (m_recv_trans.get_data(start) && m_recv_trans.get_data(end)) {
+ m_info_manager->socket_helper_set_selection(client_id, start, end);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ } else if (cmd == SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND) {
+ String command;
+
+ if (m_recv_trans.get_data(command)) {
+ m_info_manager->socket_helper_send_private_command(client_id, command);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+ //FIXME: useless
+ //} else if (cmd == ISM_TRANS_CMD_UPDATE_ISE_EXIT) {
+ // m_info_manager->UPDATE_ISE_EXIT(client_id);
+ } else {
+ LOGW("unknow cmd: %d", cmd);
+ }
+ }
+
+ socket_transaction_end();
+ } else if (client_info.type == IMCONTROL_ACT_CLIENT) {
+ socket_transaction_start();
+
+ while (m_recv_trans.get_command(cmd)) {
+ LOGD("PanelAgent::cmd = %d", cmd);
+
+ if (cmd == ISM_TRANS_CMD_GET_ACTIVE_ISE) {
+
+ if (m_info_manager->check_privilege_by_sockfd(client_id, IMEMANAGER_PRIVILEGE)) {
+ String default_uuid;
+ m_info_manager->get_active_ise(client_id, default_uuid);
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.put_data(default_uuid);
+ trans.write_to_socket(client_socket);
+ }
+ else {
+ LOGW("Access denied to get active ise");
+ send_fail_reply (client_id);
+ }
+ } else if (cmd == ISM_TRANS_CMD_SET_ACTIVE_ISE_BY_UUID) {
+ if (m_info_manager->check_privilege_by_sockfd(client_id, IMEMANAGER_PRIVILEGE)) {
+ char* buf = NULL;
+ size_t len;
+ bool ret = false;
+
+ if (!(m_recv_trans.get_data(&buf, len))) {
+ ret = m_info_manager->set_active_ise_by_uuid(client_id, buf, len);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_command(ret ? SCIM_TRANS_CMD_OK : SCIM_TRANS_CMD_FAIL);
+ trans.write_to_socket(client_socket);
+
+ if (NULL != buf)
+ delete[] buf;
+ }
+ else {
+ LOGW("Access denied to set active ise");
+ send_fail_reply (client_id);
+ }
+ } else if (cmd == ISM_TRANS_CMD_SET_INITIAL_ISE_BY_UUID) {
+ if (m_info_manager->check_privilege_by_sockfd(client_id, IMEMANAGER_PRIVILEGE)) {
+ char* buf = NULL;
+ size_t len;
+ bool ret = true;
+
+ //FIXME
+ //ret need be checked
+ if (!(m_recv_trans.get_data(&buf, len))) {
+ m_info_manager->set_initial_ise_by_uuid(client_id, buf, len);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_command(ret ? SCIM_TRANS_CMD_OK : SCIM_TRANS_CMD_FAIL);
+ trans.write_to_socket(client_socket);
+
+ if (NULL != buf)
+ delete[] buf;
+ }
+ else {
+ LOGW("Access denied to set initial ise");
+ send_fail_reply (client_id);
+ }
+ } else if (cmd == ISM_TRANS_CMD_GET_ISE_LIST) {
+ if (m_info_manager->check_privilege_by_sockfd(client_id, IMEMANAGER_PRIVILEGE)) {
+ std::vector<String> strlist;
+ m_info_manager->get_ise_list(client_id, strlist);
+ Transaction trans;
+ Socket client_socket(client_id);
+ char* buf = NULL;
+ size_t len;
+ uint32 num;
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_command(SCIM_TRANS_CMD_OK);
+
+ num = strlist.size();
+ trans.put_data(num);
+
+ for (unsigned int i = 0; i < num; i++) {
+ buf = const_cast<char*>(strlist[i].c_str());
+ len = strlen(buf) + 1;
+ trans.put_data(buf, len);
+ }
+
+ trans.write_to_socket(client_socket);
+ }
+ else {
+ LOGW("Access denied to get ise list");
+ send_fail_reply (client_id);
+ }
+ } else if (cmd == ISM_TRANS_CMD_GET_ALL_HELPER_ISE_INFO) {
+ if (m_info_manager->check_privilege_by_sockfd(client_id, IMEMANAGER_PRIVILEGE)) {
+ HELPER_ISE_INFO info;
+ m_info_manager->get_all_helper_ise_info(client_id, info);
+
+ do {
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_command(SCIM_TRANS_CMD_OK);
+
+ if (info.appid.size() > 0) {
+ trans.put_data(info.appid);
+ trans.put_data(info.label);
+ trans.put_data(info.is_enabled);
+ trans.put_data(info.is_preinstalled);
+ trans.put_data(info.has_option);
+ }
+
+ trans.write_to_socket(client_socket);
+ } while (0);
+ }
+ else {
+ LOGW("Access denied to get all helper ise info");
+ send_fail_reply (client_id);
+ }
+ } else if (cmd == ISM_TRANS_CMD_SET_ENABLE_HELPER_ISE_INFO) {
+ if (m_info_manager->check_privilege_by_sockfd(client_id, IMEMANAGER_PRIVILEGE)) {
+ String appid;
+ uint32 is_enabled;
+ bool ret = false;
+
+ if (m_recv_trans.get_data(appid) && appid.length() != 0 && m_recv_trans.get_data(is_enabled)) {
+ m_info_manager->set_enable_helper_ise_info(client_id, appid, is_enabled);
+ ret = true;
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_command(ret ? SCIM_TRANS_CMD_OK : SCIM_TRANS_CMD_FAIL);
+ trans.write_to_socket(client_socket);
+ }
+ else {
+ LOGW("Access denied to set enable helper ise info");
+ send_fail_reply (client_id);
+ }
+ } else if (cmd == ISM_TRANS_CMD_GET_ISE_INFORMATION) {
+ if (m_info_manager->check_privilege_by_sockfd(client_id, IMEMANAGER_PRIVILEGE)) {
+ String strUuid, strName, strLanguage, strModuleName;
+ int nType = 0;
+ int nOption = 0;
+
+ if (m_recv_trans.get_data(strUuid)) {
+ m_info_manager->get_ise_information(client_id, strUuid, strName, strLanguage, nType, nOption, strModuleName);
+ } else {
+ LOGW("wrong format of transaction");
+ }
+
+ Transaction trans;
+ Socket client_socket(client_id);
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.put_data(strName);
+ trans.put_data(strLanguage);
+ trans.put_data(nType);
+ trans.put_data(nOption);
+ trans.put_data(strModuleName);
+ trans.write_to_socket(client_socket);
+ }
+ else {
+ LOGW("Access denied to get ise information");
+ send_fail_reply (client_id);
+ }
+ } else if (cmd == ISM_TRANS_CMD_RESET_ISE_OPTION) {
+ if (m_info_manager->check_privilege_by_sockfd(client_id, IMEMANAGER_PRIVILEGE)) {
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.write_to_socket(client_socket);
+ m_info_manager->show_helper_ise_selector(client_id);
+ m_info_manager->reset_ise_option(client_id);
+ }
+ else {
+ LOGW("Access denied to reset ise option");
+ send_fail_reply (client_id);
+ }
+ } else if (cmd == ISM_TRANS_CMD_RESET_DEFAULT_ISE) {
+ if (m_info_manager->check_privilege_by_sockfd(client_id, IMEMANAGER_PRIVILEGE)) {
+ m_info_manager->reset_default_ise(client_id);
+ }
+ else {
+ LOGW("Access denied to reset default ise");
+ send_fail_reply (client_id);
+ }
+ } else if (cmd == ISM_TRANS_CMD_SHOW_ISF_CONTROL) {
+ if (m_info_manager->check_privilege_by_sockfd(client_id, IMEMANAGER_PRIVILEGE)) {
+ m_info_manager->show_isf_panel(client_id);
+ }
+ else {
+ LOGW("Access denied to show isf control");
+ send_fail_reply (client_id);
+ }
+ } else if (cmd == ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW) {
+ if (m_info_manager->check_privilege_by_sockfd(client_id, IMEMANAGER_PRIVILEGE)) {
+ m_info_manager->show_ise_option_window(client_id);
+ }
+ else {
+ LOGW("Access denied to show ise option window");
+ send_fail_reply (client_id);
+ }
+ } else if (cmd == ISM_TRANS_CMD_SHOW_HELPER_ISE_LIST) {
+ if (m_info_manager->check_privilege_by_sockfd(client_id, IMEMANAGER_PRIVILEGE)) {
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.write_to_socket(client_socket);
+
+ m_info_manager->show_helper_ise_list(client_id);
+ }
+ else {
+ LOGW("Access denied to show helper ise list");
+ send_fail_reply (client_id);
+ }
+ } else if (cmd == ISM_TRANS_CMD_SHOW_HELPER_ISE_SELECTOR) {
+ if (m_info_manager->check_privilege_by_sockfd(client_id, IMEMANAGER_PRIVILEGE)) {
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.write_to_socket(client_socket);
+ m_info_manager->show_helper_ise_selector(client_id);
+ }
+ else {
+ LOGW("Access denied to show helper ise selector");
+ send_fail_reply (client_id);
+ }
+ } else if (cmd == ISM_TRANS_CMD_IS_HELPER_ISE_ENABLED) {
+ if (m_info_manager->check_privilege_by_sockfd(client_id, IMEMANAGER_PRIVILEGE)) {
+ String strAppid;
+ uint32 nEnabled = 0;
+ bool ret = true;
+ //FIXME
+ //ret need be checked
+ m_info_manager->is_helper_ise_enabled(client_id, strAppid, nEnabled);
+ Transaction trans;
+ Socket client_socket(client_id);
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+
+ if (ret) {
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.put_data(static_cast<uint32>(nEnabled));
+ } else {
+ trans.put_command(SCIM_TRANS_CMD_FAIL);
+ }
+
+ trans.write_to_socket(client_socket);
+ }
+ else {
+ LOGW("Access denied to check helper ise enabled");
+ send_fail_reply (client_id);
+ }
+ } else if (cmd == ISM_TRANS_CMD_GET_RECENT_ISE_GEOMETRY) {
+ uint32 angle;
+
+ Transaction trans;
+ Socket client_socket(client_id);
+
+ trans.clear();
+ trans.put_command(SCIM_TRANS_CMD_REPLY);
+
+ if (m_recv_trans.get_data(angle)) {
+ struct rectinfo info = {0, 0, 0, 0};
+ m_info_manager->get_recent_ise_geometry(client_id, angle, info);
+
+ trans.put_command(SCIM_TRANS_CMD_OK);
+ trans.put_data(info.pos_x);
+ trans.put_data(info.pos_y);
+ trans.put_data(info.width);
+ trans.put_data(info.height);
+ } else {
+ trans.put_command(SCIM_TRANS_CMD_FAIL);
+ }
+
+ trans.write_to_socket(client_socket);
+ } else {
+ LOGW("unknow cmd: %d", cmd);
+ }
+ }
+
+ socket_transaction_end();
+ }
+ }
+
+ void socket_exception_callback(SocketServer* server,
+ const Socket& client) {
+ SCIM_DEBUG_MAIN(2) << "PanelAgent::socket_exception_callback (" << client.get_id() << ")\n";
+ LOGD("client id:%d", client.get_id());
+ socket_close_connection(server, client);
+ }
+
+ bool socket_open_connection(SocketServer* server,
+ const Socket& client) {
+ SCIM_DEBUG_MAIN(3) << "PanelAgent::socket_open_connection (" << client.get_id() << ")\n";
+ LOGD("client id:%d", client.get_id());
+ uint32 key;
+ String type = scim_socket_accept_connection(key,
+ String("Panel"),
+ String("FrontEnd,FrontEnd_Active,Helper,Helper_Active,IMControl_Active,IMControl_Passive"),
+ client,
+ m_socket_timeout);
+
+ if (type.length()) {
+ ClientType _type = ((type == "FrontEnd") ? FRONTEND_CLIENT :
+ ((type == "FrontEnd_Active") ? FRONTEND_ACT_CLIENT :
+ ((type == "IMControl_Active") ? IMCONTROL_ACT_CLIENT :
+ ((type == "Helper_Active") ? HELPER_ACT_CLIENT :
+ ((type == "IMControl_Passive") ? IMCONTROL_CLIENT : HELPER_CLIENT)))));
+ lock();
+ m_info_manager->add_client(client.get_id(), key, _type);
+ unlock();
+ return true;
+ }
+ LOGW("open_connection failed");
+
+ SCIM_DEBUG_MAIN(4) << "Close client connection " << client.get_id() << "\n";
+ server->close_connection(client);
+ return false;
+ }
+
+ void socket_close_connection(SocketServer* server,
+ const Socket& client) {
+ SCIM_DEBUG_MAIN(3) << "PanelAgent::socket_close_connection (" << client.get_id() << ")\n";
+ LOGD("client id:%d", client.get_id());
+ int i = 0;
+ std::vector<Ecore_Fd_Handler *>::iterator IterPos;
+
+ for (IterPos = _read_handler_list.begin (); IterPos != _read_handler_list.end (); ++IterPos,++i) {
+ if (ecore_main_fd_handler_fd_get (_read_handler_list[i]) == client.get_id()) {
+ ecore_main_fd_handler_del (_read_handler_list[i]);
+ _read_handler_list.erase (IterPos);
+ break;
+ }
+ }
+ m_info_manager->del_client(client.get_id());
+ }
+
+ void socket_transaction_start(void) {
+ //m_signal_transaction_start ();
+ }
+
+ void socket_transaction_end(void) {
+ //m_signal_transaction_end ();
+ }
+
+ void lock(void) {
+ //m_signal_lock ();
+ }
+ void unlock(void) {
+ //m_signal_unlock ();
+ }
+};
+
+} /* namespace scim */
+
+/***************************************************/
+/*** Beginning of panel agent interface for ISF ***/
+/***************************************************/
+static scim::PanelAgentBase* instance = NULL;
+
+extern "C" {
+
+ EXAPI void scim_module_init(void)
+ {
+ }
+
+ EXAPI void scim_module_exit(void)
+ {
+ if (instance) {
+ delete instance;
+ instance = NULL;
+ }
+ }
+
+ EXAPI void scim_panel_agent_module_init(const scim::ConfigPointer& config)
+ {
+ }
+
+ EXAPI scim::PanelAgentPointer scim_panel_agent_module_get_instance()
+ {
+
+ if (!instance) {
+ try {
+ instance = new scim::EcoreSocketPanelAgent();
+ } catch (...) {
+ delete instance;
+ instance = NULL;
+ }
+ }
+
+ return scim::PanelAgentPointer(instance);
+ }
+}
+
+/*
+vi:ts=4:nowrap:ai:expandtab
+*/
--- /dev/null
+SCIM_IMENGINE_1.0 {
+ global:
+ extern "C" {
+ *scim_panel_agent_module_create_instance*;
+ *scim_panel_agent_module_init*;
+ *scim_module_exit*;
+ *scim_module_init*;
+ };
+
+ local:
+ extern "C++" {
+ scim::*;
+ std::*;
+ __gnu_cxx::*;
+ };
+};
MAINTAINERCLEANFILES = Makefile.in
CLEANFILES = *.bak *.edj
+EXTRA_DIST = wayland.version-script
INCLUDES = -I$(top_builddir) \
-I$(top_builddir)/ism/src \
isf_wsc_control.h \
isf_wsc_control_ui.h
-if ISF_BUILD_WSC_EFL
-CONFIG_WSC_EFL = isf-wsc-efl
+#if ISF_BUILD_WSC_EFL
+CONFIG_WSC_PANELAGENT_MODULE = wayland.la
+#endif
+
+if SCIM_LD_VERSION_SCRIPT
+LD_VERSION_SCRIPT_OPTION="-Wl,--version-script=$(srcdir)/wayland.version-script"
endif
-bin_PROGRAMS = $(CONFIG_WSC_EFL)
+moduledir = @SCIM_MODULE_PATH@/$(SCIM_BINARY_VERSION)/PanelAgent
+module_LTLIBRARIES = $(CONFIG_WSC_PANELAGENT_MODULE)
-isf_wsc_efl_SOURCES = isf_wsc_efl.cpp \
- isf_wsc_context.cpp \
+wayland_la_SOURCES = wayland_panel_agent_module.cpp \
isf_wsc_control.cpp \
isf_wsc_control_ui.cpp
-isf_wsc_efl_CXXFLAGS = @ECORE_CFLAGS@ \
+wayland_la_CXXFLAGS = @DLOG_CFLAGS@ \
+ @ECORE_CFLAGS@ \
@ECORE_IMF_CFLAGS@ \
@EINA_CFLAGS@ \
@VCONF_CFLAGS@ \
@WAYLAND_CFLAGS@ \
@WL_TEXT_INPUT_CFLAGS@ \
@WL_INPUT_METHOD_CFLAGS@ \
- @XKBCOMMON_CFLAGS@ \
- @DLOG_CFLAGS@ \
- -fPIE
-
-isf_wsc_efl_LDFLAGS = @ECORE_LIBS@ @LTLIBINTL@ -rpath $(libdir) \
- @EINA_LIBS@ \
- @VCONF_LIBS@ \
- @WAYLAND_LIBS@ \
- @WL_INPUT_METHOD_LIBS@ \
- @XKBCOMMON_LIBS@ \
- @DLOG_LIBS@ \
- -pie
-
-isf_wsc_efl_LDADD = $(top_builddir)/ism/src/libscim@SCIM_EPOCH@.la
+ @XKBCOMMON_CFLAGS@
+
+wayland_la_LDFLAGS = -avoid-version \
+ -rpath $(moduledir) \
+ -module \
+ $(LD_VERSION_SCRIPT_OPTION) \
+ @LIBTOOL_EXPORT_OPTIONS@ \
+ @LTLIBINTL@ \
+ @DLOG_LIBS@ \
+ @ECORE_LIBS@ \
+ @EINA_LIBS@ \
+ @VCONF_LIBS@ \
+ @WAYLAND_LIBS@ \
+ @WL_INPUT_METHOD_LIBS@ \
+ @XKBCOMMON_LIBS@
+
+wayland_la_LIBADD = $(top_builddir)/ism/src/libscim@SCIM_EPOCH@.la
char *keyname,
enum wl_keyboard_key_state state);
-void isf_wsc_context_init (void);
-void isf_wsc_context_shutdown (void);
-
bool wsc_context_surrounding_get (WSCContextISF *wsc_ctx, char **text, int *cursor_pos);
Ecore_IMF_Input_Panel_Layout wsc_context_input_panel_layout_get(WSCContextISF *wsc_ctx);
int wsc_context_input_panel_layout_variation_get (WSCContextISF *wsc_ctx);
#define IMFCONTROLDBG(str...)
#define IMFCONTROLERR(str...) printf(str)
+int get_panel_client_id ();
-extern PanelClient _panel_client;
+extern InfoManager* g_info_manager;
-int _isf_wsc_context_input_panel_show (int client_id, int context, void *data, int length, bool &input_panel_show)
+int _isf_wsc_context_input_panel_show (int client_id, int context, void* data, int length, bool& input_panel_show)
{
- int temp = 0;
- _panel_client.prepare (context);
- _panel_client.show_ise (client_id, context, data, length, &temp);
- _panel_client.send ();
- input_panel_show = (bool)temp;
+ g_info_manager->show_ise_panel (get_panel_client_id (), client_id, context, (char*)data, length);
+ input_panel_show = true;
return 0;
}
int _isf_wsc_context_input_panel_hide (int client_id, int context)
{
- _panel_client.prepare (context);
- _panel_client.hide_ise (client_id, context);
- _panel_client.send ();
+ g_info_manager->hide_ise_panel (get_panel_client_id (), client_id, context);
return 0;
}
int _isf_wsc_context_control_panel_show (int context)
{
- _panel_client.prepare (context);
- _panel_client.show_control_panel ();
- _panel_client.send ();
+ g_info_manager->show_isf_panel (get_panel_client_id ());
return 0;
}
int _isf_wsc_context_control_panel_hide (int context)
{
- _panel_client.prepare (context);
- _panel_client.hide_control_panel ();
- _panel_client.send ();
+ g_info_manager->hide_isf_panel (get_panel_client_id ());
return 0;
}
int _isf_wsc_context_input_panel_language_set (int context, Ecore_IMF_Input_Panel_Lang lang)
{
- _panel_client.prepare (context);
- _panel_client.set_ise_language (lang);
- _panel_client.send ();
+ g_info_manager->set_ise_language (get_panel_client_id (), lang);
return 0;
}
-int _isf_wsc_context_input_panel_language_locale_get (int context, char **locale)
+int _isf_wsc_context_input_panel_language_locale_get (int context, char** locale)
{
- _panel_client.prepare (context);
- _panel_client.get_ise_language_locale (locale);
- _panel_client.send ();
+ size_t datalen = 0;
+ char* data = NULL;
+ g_info_manager->get_ise_language_locale (get_panel_client_id (), data, datalen);
+
+ if (locale)
+ *locale = strndup (data, datalen);
+
+ if (data)
+ delete [] data;
+
return 0;
}
-int _isf_wsc_context_input_panel_imdata_set (int context, const void *data, int len)
+int _isf_wsc_context_input_panel_imdata_set (int context, const void* data, int len)
{
- _panel_client.prepare (context);
- _panel_client.set_imdata ((const char *)data, len);
- _panel_client.send ();
+ g_info_manager->set_ise_imdata (get_panel_client_id (), (const char*)data, (size_t)len);
return 0;
}
-int _isf_wsc_context_input_panel_imdata_get (int context, void *data, int *len)
+int _isf_wsc_context_input_panel_imdata_get (int context, void* data, int* len)
{
- _panel_client.prepare (context);
- _panel_client.get_imdata ((char *)data, len);
- _panel_client.send ();
+ g_info_manager->get_ise_imdata (get_panel_client_id (), (char**)&data, (size_t&)*len);
return 0;
}
-int _isf_wsc_context_input_panel_geometry_get (int context, int *x, int *y, int *w, int *h)
+int _isf_wsc_context_input_panel_geometry_get (int context, int* x, int* y, int* w, int* h)
{
- _panel_client.prepare (context);
- _panel_client.get_ise_window_geometry (x, y, w, h);
- _panel_client.send ();
+ struct rectinfo info;
+ g_info_manager->get_input_panel_geometry (get_panel_client_id (), info);
+ *x = info.pos_x;
+ *y = info.pos_y;
+ *w = info.width;
+ *h = info.height;
return 0;
}
int _isf_wsc_context_input_panel_return_key_type_set (int context, Ecore_IMF_Input_Panel_Return_Key_Type type)
{
- _panel_client.prepare (context);
- _panel_client.set_return_key_type ((int)type);
- _panel_client.send ();
+ g_info_manager->set_ise_return_key_type (get_panel_client_id (), (int)type);
return 0;
}
-int _isf_wsc_context_input_panel_return_key_type_get (int context, Ecore_IMF_Input_Panel_Return_Key_Type &type)
+int _isf_wsc_context_input_panel_return_key_type_get (int context, Ecore_IMF_Input_Panel_Return_Key_Type& type)
{
- int temp = 0;
- _panel_client.prepare (context);
- _panel_client.get_return_key_type (temp);
- _panel_client.send ();
+ uint32 temp = 0;
+ g_info_manager->get_ise_return_key_type (get_panel_client_id (), temp);
type = (Ecore_IMF_Input_Panel_Return_Key_Type)temp;
return 0;
}
int _isf_wsc_context_input_panel_return_key_disabled_set (int context, Eina_Bool disabled)
{
- _panel_client.prepare (context);
- _panel_client.set_return_key_disable ((int)disabled);
- _panel_client.send ();
+ g_info_manager->set_ise_return_key_disable (get_panel_client_id (), (int)disabled);
return 0;
}
-int _isf_wsc_context_input_panel_return_key_disabled_get (int context, Eina_Bool &disabled)
+int _isf_wsc_context_input_panel_return_key_disabled_get (int context, Eina_Bool& disabled)
{
- int temp = 0;
- _panel_client.prepare (context);
- _panel_client.get_return_key_disable (temp);
- _panel_client.send ();
+ uint32 temp = 0;
+ g_info_manager->get_ise_return_key_disable (get_panel_client_id (), temp);
disabled = (Eina_Bool)temp;
return 0;
}
int _isf_wsc_context_input_panel_layout_set (int context, Ecore_IMF_Input_Panel_Layout layout)
{
- _panel_client.prepare (context);
- _panel_client.set_layout (layout);
- _panel_client.send ();
+ g_info_manager->set_ise_layout (get_panel_client_id (), layout);
return 0;
}
-int _isf_wsc_context_input_panel_layout_get (int context, Ecore_IMF_Input_Panel_Layout *layout)
+int _isf_wsc_context_input_panel_layout_get (int context, Ecore_IMF_Input_Panel_Layout* layout)
{
- int layout_temp;
- _panel_client.prepare (context);
- _panel_client.get_layout (&layout_temp);
- _panel_client.send ();
+ uint32 layout_temp;
+ g_info_manager->get_ise_layout (get_panel_client_id (), layout_temp);
*layout = (Ecore_IMF_Input_Panel_Layout)layout_temp;
return 0;
}
-int _isf_wsc_context_input_panel_state_get (int context, Ecore_IMF_Input_Panel_State &state)
+int _isf_wsc_context_input_panel_state_get (int context, Ecore_IMF_Input_Panel_State& state)
{
int temp = 1; // Hide state
- _panel_client.prepare (context);
- _panel_client.get_ise_state (temp);
- _panel_client.send ();
+ g_info_manager->get_ise_state (get_panel_client_id (), temp);
state = (Ecore_IMF_Input_Panel_State)temp;
return 0;
}
int _isf_wsc_context_input_panel_caps_mode_set (int context, unsigned int mode)
{
- _panel_client.prepare (context);
- _panel_client.set_caps_mode (mode);
- _panel_client.send ();
+ g_info_manager->set_ise_caps_mode (get_panel_client_id (), mode);
return 0;
}
-int _isf_wsc_context_candidate_window_geometry_get (int context, int *x, int *y, int *w, int *h)
+int _isf_wsc_context_candidate_window_geometry_get (int context, int* x, int* y, int* w, int* h)
{
- _panel_client.prepare (context);
- _panel_client.get_candidate_window_geometry (x, y, w, h);
- _panel_client.send ();
+ struct rectinfo info;
+ g_info_manager->get_candidate_window_geometry (get_panel_client_id (), info);
+ *x = info.pos_x;
+ *y = info.pos_y;
+ *w = info.width;
+ *h = info.height;
return 0;
}
int _isf_wsc_context_input_panel_send_will_show_ack (int context)
{
- _panel_client.prepare (context);
- _panel_client.send_will_show_ack ();
- _panel_client.send ();
+ g_info_manager->will_show_ack (get_panel_client_id ());
return 0;
}
int _isf_wsc_context_input_panel_send_will_hide_ack (int context)
{
- _panel_client.prepare (context);
- _panel_client.send_will_hide_ack ();
- _panel_client.send ();
+ g_info_manager->will_hide_ack (get_panel_client_id ());
return 0;
}
int _isf_wsc_context_set_keyboard_mode (int context, TOOLBAR_MODE_T mode)
{
- _panel_client.prepare (context);
- _panel_client.set_keyboard_mode (mode);
- _panel_client.send ();
+ g_info_manager->set_keyboard_mode (get_panel_client_id (), mode);
return 0;
}
int _isf_wsc_context_input_panel_send_candidate_will_hide_ack (int context)
{
- _panel_client.prepare (context);
- _panel_client.send_candidate_will_hide_ack ();
- _panel_client.send ();
+ g_info_manager->candidate_will_hide_ack (get_panel_client_id ());
return 0;
}
--- /dev/null
+SCIM_IMENGINE_1.0 {
+ global:
+ extern "C" {
+ *scim_panel_agent_module_create_instance*;
+ *scim_panel_agent_module_init*;
+ *scim_module_exit*;
+ *scim_module_init*;
+ };
+
+ local:
+ extern "C++" {
+ scim::*;
+ std::*;
+ __gnu_cxx::*;
+ };
+};
#define Uses_SCIM_HELPER_MODULE
#define Uses_SCIM_HOTKEY
#define Uses_SCIM_PANEL_CLIENT
+#define Uses_SCIM_CONFIG_PATH
+#define Uses_SCIM_PANEL_AGENT
+#define Uses_SCIM_COMPOSE_KEY
#include <sys/types.h>
#include <sys/wait.h>
#include <langinfo.h>
#include <unistd.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <malloc.h>
+#include <dlog.h>
+
#include <Eina.h>
#include <Ecore.h>
#include <Ecore_Wayland.h>
#include "isf_wsc_context.h"
#include "isf_wsc_control_ui.h"
+#include <linux/input.h>
+#include <xkbcommon/xkbcommon.h>
+#include <sys/mman.h>
+
+
#ifdef LOG_TAG
# undef LOG_TAG
#endif
-#define LOG_TAG "ISF_WSC_EFL"
+#define LOG_TAG "ISF_WAYLAND_MODULE"
using namespace scim;
};
/* private functions */
-static void panel_slot_reload_config (int context);
+//static void panel_slot_reload_config (int context);
static void panel_slot_exit (int context);
static void panel_slot_update_candidate_item_layout (int context,
const std::vector<uint32> &row_items);
const String &target_uuid,
const String &helper_uuid,
const Transaction &trans);
-static void panel_slot_move_preedit_caret (int context,
- int caret_pos);
+//static void panel_slot_move_preedit_caret (int context,
+// int caret_pos);
static void panel_slot_update_preedit_caret (int context,
int caret);
static void panel_slot_select_aux (int context,
const WideString &wstr);
static void panel_slot_forward_key_event (int context,
const KeyEvent &key);
-static void panel_slot_request_help (int context);
-static void panel_slot_request_factory_menu (int context);
+//static void panel_slot_request_help (int context);
+//static void panel_slot_request_factory_menu (int context);
static void panel_slot_change_factory (int context,
const String &uuid);
static void panel_slot_reset_keyboard_ise (int context);
static void panel_req_update_factory_info (WSCContextISF *ic);
static void panel_req_update_cursor_position (WSCContextISF *ic, int cursor_pos);
static void panel_req_update_bidi_direction (WSCContextISF *ic, int direction);
-static void panel_req_show_help (WSCContextISF *ic);
+//static void panel_req_show_help (WSCContextISF *ic);
static void panel_req_show_factory_menu (WSCContextISF *ic);
/* Panel iochannel handler*/
static bool panel_initialize (void);
static void panel_finalize (void);
-static Eina_Bool panel_iochannel_handler (void *data,
- Ecore_Fd_Handler *fd_handler);
+
/* utility functions */
static bool filter_hotkeys (WSCContextISF *ic,
static void slot_send_private_command (IMEngineInstanceBase *si,
const String &command);
-static void reload_config_callback (const ConfigPointer &config);
+//static void reload_config_callback (const ConfigPointer &config);
static void fallback_commit_string_cb (IMEngineInstanceBase *si,
const WideString &str);
static IMEngineInstancePointer _default_instance;
static ConfigPointer _config;
-static Connection _config_connection;
static BackEndPointer _backend;
static WSCContextISF *_focused_ic = 0;
static IMEngineFactoryPointer _fallback_factory;
static IMEngineInstancePointer _fallback_instance;
-PanelClient _panel_client;
static int _panel_client_id = 0;
-static int _active_helper_option = 0;
+static uint32 _active_helper_option = 0;
-static Ecore_Fd_Handler *_panel_iochannel_read_handler = 0;
-static Ecore_Fd_Handler *_panel_iochannel_err_handler = 0;
static bool _on_the_spot = true;
static bool _shared_input_method = false;
#define SHIFT_MODE_ENABLE 0x9fe7
#define SHIFT_MODE_DISABLE 0x9fe8
+#define WAYLAND_MODULE_CLIENT_ID (0)
+
+//////////////////////////////wayland_panel_agent_module begin//////////////////////////////////////////////////
+
+#define scim_module_init wayland_LTX_scim_module_init
+#define scim_module_exit wayland_LTX_scim_module_exit
+#define scim_panel_agent_module_init wayland_LTX_scim_panel_agent_module_init
+#define scim_panel_agent_module_get_instance wayland_LTX_scim_panel_agent_module_get_instance
+
+static struct weescim _wsc = {0};
+
+InfoManager* g_info_manager = NULL;
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Implementation of Wayland Input Method functions.
+/////////////////////////////////////////////////////////////////////////////
+static void
+_wsc_im_ctx_surrounding_text(void *data, struct wl_input_method_context *im_ctx, const char *text, uint32_t cursor, uint32_t anchor)
+{
+ WSCContextISF *wsc_ctx = (WSCContextISF*)data;
+ if (!wsc_ctx) return;
+
+ if (wsc_ctx->surrounding_text)
+ free (wsc_ctx->surrounding_text);
+
+ wsc_ctx->surrounding_text = strdup (text ? text : "");
+ wsc_ctx->surrounding_cursor = cursor;
+
+ isf_wsc_context_cursor_position_set(wsc_ctx, cursor);
+
+ LOGD ("text : '%s', cursor : %d\n", text, cursor);
+}
+
+static void
+_wsc_im_ctx_reset(void *data, struct wl_input_method_context *im_ctx)
+{
+ WSCContextISF *wsc_ctx = (WSCContextISF*)data;
+ if (!wsc_ctx) return;
+ isf_wsc_context_reset(wsc_ctx);
+}
+
+static void
+_wsc_im_ctx_content_type(void *data, struct wl_input_method_context *im_ctx, uint32_t hint, uint32_t purpose)
+{
+ WSCContextISF *wsc_ctx = (WSCContextISF*)data;
+ if (!wsc_ctx) return;
+
+ LOGD ("im_context = %p hint = %d purpose = %d\n", im_ctx, hint, purpose);
+
+ if (!wsc_ctx->context_changed) return;
+
+ wsc_ctx->content_hint = hint;
+ wsc_ctx->content_purpose = purpose;
+
+ isf_wsc_context_input_panel_layout_set (wsc_ctx,
+ wsc_context_input_panel_layout_get (wsc_ctx));
+
+ isf_wsc_context_autocapital_type_set (wsc_ctx, wsc_context_autocapital_type_get(wsc_ctx));
+
+ isf_wsc_context_input_panel_language_set (wsc_ctx, wsc_context_input_panel_language_get(wsc_ctx));
+
+ caps_mode_check (wsc_ctx, EINA_TRUE, EINA_TRUE);
+
+ wsc_ctx->context_changed = EINA_FALSE;
+}
+
+static void
+_wsc_im_ctx_invoke_action(void *data, struct wl_input_method_context *im_ctx, uint32_t button, uint32_t index)
+{
+ WSCContextISF *wsc_ctx = (WSCContextISF*)data;
+ if (!wsc_ctx) return;
+
+ LOGD ("invoke action. button : %d\n", button);
+
+ if (button != BTN_LEFT)
+ return;
+
+ wsc_context_send_preedit_string (wsc_ctx);
+}
+
+static void
+_wsc_im_ctx_commit_state(void *data, struct wl_input_method_context *im_ctx, uint32_t serial)
+{
+ WSCContextISF *wsc_ctx = (WSCContextISF*)data;
+ if (!wsc_ctx) return;
+
+ wsc_ctx->serial = serial;
+
+ if (wsc_ctx->surrounding_text)
+ LOGD ("Surrounding text updated: '%s'\n", wsc_ctx->surrounding_text);
+
+ if (wsc_ctx->language)
+ wl_input_method_context_language (im_ctx, wsc_ctx->serial, wsc_ctx->language);
+}
+
+static void
+_wsc_im_ctx_preferred_language(void *data, struct wl_input_method_context *im_ctx, const char *language)
+{
+ WSCContextISF *wsc_ctx = (WSCContextISF*)data;
+ if (!wsc_ctx) return;
+
+ if (language && wsc_ctx->language && !strcmp (language, wsc_ctx->language))
+ return;
+
+ if (wsc_ctx->language) {
+ free (wsc_ctx->language);
+ wsc_ctx->language = NULL;
+ }
+
+ if (language) {
+ wsc_ctx->language = strdup (language);
+ LOGD ("Language changed, new: '%s'\n", language);
+ }
+}
+
+static void
+_wsc_im_ctx_return_key_type(void *data, struct wl_input_method_context *im_ctx, uint32_t return_key_type)
+{
+ WSCContextISF *wsc_ctx = (WSCContextISF*)data;
+
+ LOGD ("im_context = %p return key type = %d\n", im_ctx, return_key_type);
+ if (!wsc_ctx) return;
+
+ if (wsc_ctx->return_key_type != return_key_type) {
+ wsc_ctx->return_key_type = return_key_type;
+ isf_wsc_context_input_panel_return_key_type_set (wsc_ctx, (Ecore_IMF_Input_Panel_Return_Key_Type)wsc_ctx->return_key_type);
+ }
+}
+
+static void
+_wsc_im_ctx_return_key_disabled(void *data, struct wl_input_method_context *im_ctx, uint32_t disabled)
+{
+ WSCContextISF *wsc_ctx = (WSCContextISF*)data;
+ Eina_Bool return_key_disabled = !!disabled;
+
+ LOGD ("im_context = %p return key disabled = %d\n", im_ctx, return_key_disabled);
+ if (!wsc_ctx) return;
+
+ if (wsc_ctx->return_key_disabled != return_key_disabled) {
+ wsc_ctx->return_key_disabled = return_key_disabled;
+ isf_wsc_context_input_panel_return_key_disabled_set (wsc_ctx, wsc_ctx->return_key_disabled);
+ }
+}
+
+static void
+_wsc_im_ctx_input_panel_data(void *data, struct wl_input_method_context *im_ctx, const char *input_panel_data, uint32_t input_panel_data_length)
+{
+ WSCContextISF *wsc_ctx = (WSCContextISF*)data;
+ LOGD ("im_context = %p input panel data = %s len = %d\n", im_ctx, input_panel_data, input_panel_data_length);
+ if (!wsc_ctx) return;
+
+ isf_wsc_context_input_panel_imdata_set (wsc_ctx, (void *)input_panel_data, input_panel_data_length);
+}
+
+static void
+_wsc_im_ctx_bidi_direction(void *data, struct wl_input_method_context *im_ctx, uint32_t bidi_direction)
+{
+ WSCContextISF *wsc_ctx = (WSCContextISF*)data;
+
+ LOGD ("im_context = %p bidi_direction = %d\n", im_ctx, bidi_direction);
+ if (!wsc_ctx) return;
+
+ if (wsc_ctx->bidi_direction != bidi_direction) {
+ wsc_ctx->bidi_direction = bidi_direction;
+
+ isf_wsc_context_bidi_direction_set (wsc_ctx, (Ecore_IMF_BiDi_Direction)wsc_ctx->bidi_direction);
+ }
+}
+
+static const struct wl_input_method_context_listener wsc_im_context_listener = {
+ _wsc_im_ctx_surrounding_text,
+ _wsc_im_ctx_reset,
+ _wsc_im_ctx_content_type,
+ _wsc_im_ctx_invoke_action,
+ _wsc_im_ctx_commit_state,
+ _wsc_im_ctx_preferred_language,
+ _wsc_im_ctx_return_key_type,
+ _wsc_im_ctx_return_key_disabled,
+ _wsc_im_ctx_input_panel_data,
+ _wsc_im_ctx_bidi_direction
+};
+
+static void
+_init_keysym2keycode(WSCContextISF *wsc_ctx)
+{
+ uint32_t i = 0;
+ uint32_t code;
+ uint32_t num_syms;
+ const xkb_keysym_t *syms;
+
+ if (!wsc_ctx || !wsc_ctx->state)
+ return;
+
+ for (i = 0; i < 256; i++) {
+ code = i + 8;
+ num_syms = xkb_key_get_syms(wsc_ctx->state, code, &syms);
+
+ if (num_syms == 1)
+ wsc_ctx->_keysym2keycode[syms[0]] = i;
+ }
+}
+
+static void
+_fini_keysym2keycode(WSCContextISF *wsc_ctx)
+{
+ wsc_ctx->_keysym2keycode.clear();
+}
+
+static void
+_wsc_im_keyboard_keymap(void *data,
+ struct wl_keyboard *wl_keyboard,
+ uint32_t format,
+ int32_t fd,
+ uint32_t size)
+{
+ WSCContextISF *wsc_ctx = (WSCContextISF*)data;
+ char *map_str;
+
+ if (!wsc_ctx) return;
+
+ _fini_keysym2keycode(wsc_ctx);
+
+ if (wsc_ctx->state) {
+ xkb_state_unref(wsc_ctx->state);
+ wsc_ctx->state = NULL;
+ }
+
+ if (wsc_ctx->keymap) {
+ xkb_map_unref(wsc_ctx->keymap);
+ wsc_ctx->keymap = NULL;
+ }
+
+ if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
+ close(fd);
+ return;
+ }
+
+ map_str = (char*)mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
+ if (map_str == MAP_FAILED) {
+ close(fd);
+ return;
+ }
+
+ wsc_ctx->keymap =
+ xkb_map_new_from_string(wsc_ctx->xkb_context,
+ map_str,
+ XKB_KEYMAP_FORMAT_TEXT_V1,
+ (xkb_keymap_compile_flags)0);
+
+ munmap(map_str, size);
+ close(fd);
+
+ if (!wsc_ctx->keymap) {
+ LOGW ("failed to compile keymap\n");
+ return;
+ }
+
+ wsc_ctx->state = xkb_state_new(wsc_ctx->keymap);
+ if (!wsc_ctx->state) {
+ LOGW ("failed to create XKB state\n");
+ xkb_map_unref(wsc_ctx->keymap);
+ return;
+ }
+
+ wsc_ctx->control_mask =
+ 1 << xkb_map_mod_get_index(wsc_ctx->keymap, "Control");
+ wsc_ctx->alt_mask =
+ 1 << xkb_map_mod_get_index(wsc_ctx->keymap, "Mod1");
+ wsc_ctx->shift_mask =
+ 1 << xkb_map_mod_get_index(wsc_ctx->keymap, "Shift");
+
+ LOGW ("create _keysym2keycode\n");
+ _init_keysym2keycode(wsc_ctx);
+}
+
+static void
+_wsc_im_keyboard_key(void *data,
+ struct wl_keyboard *wl_keyboard,
+ uint32_t serial,
+ uint32_t time,
+ uint32_t key,
+ uint32_t state_w)
+{
+ WSCContextISF *wsc_ctx = (WSCContextISF*)data;
+ uint32_t code;
+ uint32_t num_syms;
+ const xkb_keysym_t *syms;
+ xkb_keysym_t sym;
+ char keyname[64] = {0};
+ enum wl_keyboard_key_state state = (wl_keyboard_key_state)state_w;
+
+ if (!wsc_ctx || !wsc_ctx->state)
+ return;
+
+ code = key + 8;
+ num_syms = xkb_key_get_syms(wsc_ctx->state, code, &syms);
+
+ sym = XKB_KEY_NoSymbol;
+ if (num_syms == 1)
+ {
+ sym = syms[0];
+ xkb_keysym_get_name(sym, keyname, 64);
+ }
+
+ if (wsc_ctx->key_handler)
+ (*wsc_ctx->key_handler)(wsc_ctx, serial, time, code, sym, keyname,
+ state);
+}
+
+static void
+_wsc_im_keyboard_modifiers(void *data,
+ struct wl_keyboard *wl_keyboard,
+ uint32_t serial,
+ uint32_t mods_depressed,
+ uint32_t mods_latched,
+ uint32_t mods_locked,
+ uint32_t group)
+{
+ WSCContextISF *wsc_ctx = (WSCContextISF*)data;
+ if (!wsc_ctx || !wsc_ctx->state)
+ return;
+
+ struct wl_input_method_context *context = wsc_ctx->im_ctx;
+ xkb_mod_mask_t mask;
+
+ xkb_state_update_mask(wsc_ctx->state, mods_depressed,
+ mods_latched, mods_locked, 0, 0, group);
+ mask = xkb_state_serialize_mods(wsc_ctx->state,
+ (xkb_state_component)(XKB_STATE_DEPRESSED | XKB_STATE_LATCHED));
+
+ wsc_ctx->modifiers = 0;
+ if (mask & wsc_ctx->control_mask)
+ wsc_ctx->modifiers |= SCIM_KEY_ControlMask;
+ if (mask & wsc_ctx->alt_mask)
+ wsc_ctx->modifiers |= SCIM_KEY_AltMask;
+ if (mask & wsc_ctx->shift_mask)
+ wsc_ctx->modifiers |= SCIM_KEY_ShiftMask;
+
+ wl_input_method_context_modifiers(context, serial,
+ mods_depressed, mods_depressed,
+ mods_latched, group);
+}
+
+static const struct wl_keyboard_listener wsc_im_keyboard_listener = {
+ _wsc_im_keyboard_keymap,
+ NULL, /* enter */
+ NULL, /* leave */
+ _wsc_im_keyboard_key,
+ _wsc_im_keyboard_modifiers
+};
+
+static void
+_wsc_im_activate(void *data, struct wl_input_method *input_method, struct wl_input_method_context *im_ctx, uint32_t text_input_id)
+{
+ struct weescim *wsc = (weescim*)data;
+ if (!wsc) return;
+
+ WSCContextISF *wsc_ctx = new WSCContextISF;
+ if (!wsc_ctx) {
+ return;
+ }
+ wsc_ctx->xkb_context = xkb_context_new((xkb_context_flags)0);
+ if (wsc_ctx->xkb_context == NULL) {
+ LOGW ("Failed to create XKB context\n");
+ delete wsc_ctx;
+ return;
+ }
+ wsc_ctx->id = text_input_id;
+ wsc->wsc_ctx = wsc_ctx;
+ wsc_ctx->ctx = wsc;
+ wsc_ctx->state = NULL;
+ wsc_ctx->keymap = NULL;
+ wsc_ctx->surrounding_text = NULL;
+ wsc_ctx->key_handler = isf_wsc_context_filter_key_event;
+
+ get_language(&wsc_ctx->language);
+
+ wsc_ctx->preedit_str = strdup ("");
+ wsc_ctx->content_hint = WL_TEXT_INPUT_CONTENT_HINT_NONE;
+ wsc_ctx->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NORMAL;
+
+ wsc_ctx->im_ctx = im_ctx;
+ wl_input_method_context_add_listener (im_ctx, &wsc_im_context_listener, wsc_ctx);
+
+ wsc_ctx->keyboard = wl_input_method_context_grab_keyboard(im_ctx);
+ if (wsc_ctx->keyboard)
+ wl_keyboard_add_listener(wsc_ctx->keyboard, &wsc_im_keyboard_listener, wsc_ctx);
+
+ if (wsc_ctx->language)
+ wl_input_method_context_language (im_ctx, wsc_ctx->serial, wsc_ctx->language);
+
+ isf_wsc_context_add (wsc_ctx);
+
+ wsc_ctx->context_changed = EINA_TRUE;
+
+ isf_wsc_context_focus_in (wsc_ctx);
+}
+
+static void
+_wsc_im_deactivate(void *data, struct wl_input_method *input_method, struct wl_input_method_context *im_ctx)
+{
+ struct weescim *wsc = (weescim*)data;
+ if (!wsc || !wsc->wsc_ctx) return;
+ WSCContextISF *wsc_ctx = wsc->wsc_ctx;
+
+ isf_wsc_context_input_panel_hide (wsc_ctx);
+ isf_wsc_context_focus_out (wsc_ctx);
+
+ if (wsc_ctx->keyboard) {
+ wl_keyboard_destroy (wsc_ctx->keyboard);
+ wsc_ctx->keyboard = NULL;
+ }
+
+ _fini_keysym2keycode (wsc_ctx);
+
+ if (wsc_ctx->state) {
+ xkb_state_unref (wsc_ctx->state);
+ wsc_ctx->state = NULL;
+ }
+
+ if (wsc_ctx->keymap) {
+ xkb_map_unref (wsc_ctx->keymap);
+ wsc_ctx->keymap = NULL;
+ }
+
+ if (wsc_ctx->im_ctx) {
+ wl_input_method_context_destroy (wsc_ctx->im_ctx);
+ wsc_ctx->im_ctx = NULL;
+ }
+
+ if (wsc_ctx->preedit_str) {
+ free (wsc_ctx->preedit_str);
+ wsc_ctx->preedit_str = NULL;
+ }
+
+ if (wsc_ctx->surrounding_text) {
+ free (wsc_ctx->surrounding_text);
+ wsc_ctx->surrounding_text = NULL;
+ }
+
+ if (wsc_ctx->language) {
+ free (wsc_ctx->language);
+ wsc_ctx->language = NULL;
+ }
+
+ isf_wsc_context_del (wsc_ctx);
+ delete wsc_ctx;
+ wsc->wsc_ctx = NULL;
+}
+
+static void
+_wsc_im_show_input_panel(void *data, struct wl_input_method *input_method, struct wl_input_method_context *im_ctx)
+{
+ struct weescim *wsc = (weescim*)data;
+ if (!wsc || !wsc->wsc_ctx) return;
+
+ isf_wsc_context_input_panel_show (wsc->wsc_ctx);
+}
+
+static void
+_wsc_im_hide_input_panel(void *data, struct wl_input_method *input_method, struct wl_input_method_context *im_ctx)
+{
+ struct weescim *wsc = (weescim*)data;
+ if (!wsc || !wsc->wsc_ctx) return;
+
+ isf_wsc_context_input_panel_hide (wsc->wsc_ctx);
+}
+
+static const struct wl_input_method_listener wsc_im_listener = {
+ _wsc_im_activate,
+ _wsc_im_deactivate,
+ _wsc_im_show_input_panel,
+ _wsc_im_hide_input_panel
+};
+
+static bool
+_wsc_setup(struct weescim *wsc)
+{
+ Eina_Inlist *globals;
+ struct wl_registry *registry;
+ Ecore_Wl_Global *global;
+
+ if (!wsc) return false;
+
+ if (!(registry = ecore_wl_registry_get()))
+ return false;
+
+ if (!(globals = ecore_wl_globals_get()))
+ return false;
+
+ EINA_INLIST_FOREACH(globals, global) {
+ if (strcmp (global->interface, "wl_input_method") == 0)
+ wsc->im = (wl_input_method*)wl_registry_bind (registry, global->id, &wl_input_method_interface, 1);
+ }
+
+ if (wsc->im == NULL) {
+ LOGW ("Failed because wl_input_method is null\n");
+ return false;
+ }
+
+ /* Input method listener */
+ LOGD ("Adding wl_input_method listener\n");
+
+ if (wsc->im)
+ wl_input_method_add_listener (wsc->im, &wsc_im_listener, wsc);
+ else {
+ LOGW ("Couldn't get wayland input method interface\n");
+ return false;
+ }
+
+ return true;
+}
+
+
+//////////////////////////////wayland_panel_agent_module end//////////////////////////////////////////////////
+
+
WSCContextISF *
get_focused_ic ()
{
WSCContextISF *context_scim = ctx;
if (context_scim && context_scim->impl && context_scim->impl->si && context_scim == _focused_ic) {
- _panel_client.prepare (context_scim->id);
context_scim->impl->si->set_prediction_allow (prediction);
- _panel_client.send ();
}
}
ret = EINA_TRUE;
goto done;
- }
- else {
+ } else {
ret = EINA_FALSE;
goto done;
}
void context_scim_imdata_get (WSCContextISF *wsc_ctx, void* data, int* length)
{
- WSCContextISF *context_scim = wsc_ctx;
-
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ WSCContextISF* context_scim = wsc_ctx;
+ LOGD ("");
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
if (context_scim && context_scim->impl) {
if (data && context_scim->impl->imdata)
void
imengine_layout_set (WSCContextISF *wsc_ctx, Ecore_IMF_Input_Panel_Layout layout)
{
- WSCContextISF *context_scim = wsc_ctx;
+ LOGD ("");
+ WSCContextISF* context_scim = wsc_ctx;
if (context_scim && context_scim->impl && context_scim->impl->si && context_scim == _focused_ic) {
- _panel_client.prepare (context_scim->id);
context_scim->impl->si->set_layout (layout);
- _panel_client.send ();
}
}
void
isf_wsc_context_init (void)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
int val;
if (!_scim_initialized) {
void
isf_wsc_context_shutdown (void)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
- ConfigBase::set (0);
+ LOGD ("");
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+
if (_scim_initialized) {
_scim_initialized = false;
void
isf_wsc_context_add (WSCContextISF *wsc_ctx)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *context_scim = wsc_ctx;
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* context_scim = wsc_ctx;
if (!context_scim) return;
if (_shared_input_method)
context_scim->impl->is_on = _config->read (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on);
- _panel_client.prepare (context_scim->id);
- _panel_client.register_input_context (context_scim->id, si->get_factory_uuid ());
+ g_info_manager->register_input_context (WAYLAND_MODULE_CLIENT_ID, context_scim->id, si->get_factory_uuid ());
set_ic_capabilities (context_scim);
- _panel_client.send ();
-
- SCIM_DEBUG_FRONTEND(2) << "input context created: id = " << context_scim->id << "\n";
+ SCIM_DEBUG_FRONTEND (2) << "input context created: id = " << context_scim->id << "\n";
}
void
isf_wsc_context_del (WSCContextISF *wsc_ctx)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
if (!_ic_list) return;
}
if (context_scim && context_scim->impl) {
- _panel_client.prepare (context_scim->id);
-
if (context_scim == _focused_ic && context_scim->impl->si)
context_scim->impl->si->focus_out ();
// In case the instance send out some helper event,
// and this context has been focused out,
// we need set the focused_ic to this context temporary.
- WSCContextISF *old_focused = _focused_ic;
+ WSCContextISF* old_focused = _focused_ic;
_focused_ic = context_scim;
context_scim->impl->si.reset ();
_focused_ic = old_focused;
if (context_scim == _focused_ic) {
- _panel_client.turn_off (context_scim->id);
- _panel_client.focus_out (context_scim->id);
+ g_info_manager->socket_turn_off ();
+ g_info_manager->focus_out (WAYLAND_MODULE_CLIENT_ID, context_scim->id);
}
- _panel_client.remove_input_context (context_scim->id);
- _panel_client.send ();
+ g_info_manager->remove_input_context (WAYLAND_MODULE_CLIENT_ID, context_scim->id);
if (context_scim->impl) {
delete_ic_impl (context_scim->impl);
void
isf_wsc_context_focus_in (WSCContextISF *wsc_ctx)
{
- WSCContextISF *context_scim = wsc_ctx;
+ WSCContextISF* context_scim = wsc_ctx;
+ LOGD ("");
if (!context_scim)
return;
if (context_scim && context_scim->impl) {
_focused_ic = context_scim;
- _panel_client.prepare (context_scim->id);
-
// Handle the "Shared Input Method" mode.
if (_shared_input_method) {
- SCIM_DEBUG_FRONTEND(2) << "shared input method.\n";
+ SCIM_DEBUG_FRONTEND (2) << "shared input method.\n";
IMEngineFactoryPointer factory = _backend->get_default_factory (_language, "UTF-8");
+
if (!factory.null ()) {
if (_default_instance.null () || _default_instance->get_factory_uuid () != factory->get_uuid ()) {
_default_instance = factory->create_instance ("UTF-8", _default_instance.null () ? _instance_count++ : _default_instance->get_id ());
attach_instance (_default_instance);
- SCIM_DEBUG_FRONTEND(2) << "create new default instance: " << _default_instance->get_id () << " " << _default_instance->get_factory_uuid () << "\n";
+ SCIM_DEBUG_FRONTEND (2) << "create new default instance: " << _default_instance->get_id () << " " << _default_instance->get_factory_uuid () << "\n";
}
context_scim->impl->shared_si = true;
context_scim->impl->si = _default_instance;
-
context_scim->impl->is_on = _config->read (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on);
context_scim->impl->preedit_string.clear ();
context_scim->impl->preedit_attrlist.clear ();
need_reg = true;
}
} else if (context_scim->impl->shared_si) {
- SCIM_DEBUG_FRONTEND(2) << "exit shared input method.\n";
+ SCIM_DEBUG_FRONTEND (2) << "exit shared input method.\n";
IMEngineFactoryPointer factory = _backend->get_default_factory (_language, "UTF-8");
+
if (!factory.null ()) {
context_scim->impl->si = factory->create_instance ("UTF-8", _instance_count++);
context_scim->impl->preedit_string.clear ();
need_cap = true;
need_reg = true;
context_scim->impl->shared_si = false;
- SCIM_DEBUG_FRONTEND(2) << "create new instance: " << context_scim->impl->si->get_id () << " " << context_scim->impl->si->get_factory_uuid () << "\n";
+ SCIM_DEBUG_FRONTEND (2) << "create new instance: " << context_scim->impl->si->get_id () << " " << context_scim->impl->si->get_factory_uuid () << "\n";
}
}
if (context_scim->impl->si) {
context_scim->impl->si->set_frontend_data (static_cast <void*> (context_scim));
- if (need_reg) _panel_client.register_input_context (context_scim->id, context_scim->impl->si->get_factory_uuid ());
+ if (need_reg) g_info_manager->register_input_context (WAYLAND_MODULE_CLIENT_ID, context_scim->id, context_scim->impl->si->get_factory_uuid ());
+
if (need_cap) set_ic_capabilities (context_scim);
panel_req_focus_in (context_scim);
- // panel_req_update_factory_info (context_scim);
+ // panel_req_update_factory_info (context_scim);
if (need_reset) context_scim->impl->si->reset ();
+
if (context_scim->impl->is_on) {
- _panel_client.turn_on (context_scim->id);
- // _panel_client.hide_preedit_string (context_scim->id);
- // _panel_client.hide_aux_string (context_scim->id);
- // _panel_client.hide_lookup_table (context_scim->id);
+ g_info_manager->socket_turn_on ();
+ // _panel_client.hide_preedit_string (context_scim->id);
+ // _panel_client.hide_aux_string (context_scim->id);
+ // _panel_client.hide_lookup_table (context_scim->id);
context_scim->impl->si->focus_in ();
context_scim->impl->si->set_layout (wsc_context_input_panel_layout_get (wsc_ctx));
context_scim->impl->si->set_prediction_allow (context_scim->impl->prediction_allow);
+
if (context_scim->impl->imdata)
- context_scim->impl->si->set_imdata ((const char *)context_scim->impl->imdata, context_scim->impl->imdata_size);
+ context_scim->impl->si->set_imdata ((const char*)context_scim->impl->imdata, context_scim->impl->imdata_size);
} else {
- _panel_client.turn_off (context_scim->id);
+ g_info_manager->socket_turn_off ();
}
- _panel_client.get_active_helper_option (&_active_helper_option);
- _panel_client.send ();
+ g_info_manager->get_active_helper_option (WAYLAND_MODULE_CLIENT_ID, _active_helper_option);
+
if (caps_mode_check (wsc_ctx, EINA_FALSE, EINA_TRUE) == EINA_FALSE) {
context_scim->impl->next_shift_status = 0;
}
void
isf_wsc_context_focus_out (WSCContextISF *wsc_ctx)
{
- WSCContextISF *context_scim = wsc_ctx;
+ WSCContextISF* context_scim = wsc_ctx;
+ LOGD ("");
if (!context_scim) return;
_hide_preedit_string (context_scim->id, false);
wsc_context_commit_preedit_string (context_scim);
- _panel_client.prepare (context_scim->id);
- _panel_client.reset_input_context (context_scim->id);
- _panel_client.send ();
+ g_info_manager->socket_reset_input_context (WAYLAND_MODULE_CLIENT_ID, context_scim->id);
}
if (context_scim->impl->si) {
- _panel_client.prepare (context_scim->id);
-
context_scim->impl->si->focus_out ();
context_scim->impl->si->reset ();
context_scim->impl->cursor_pos = -1;
-
// if (context_scim->impl->shared_si) context_scim->impl->si->reset ();
-
- _panel_client.focus_out (context_scim->id);
- _panel_client.send ();
+ g_info_manager->focus_out (WAYLAND_MODULE_CLIENT_ID, context_scim->id);
}
+
_focused_ic = 0;
}
_x_key_event_is_valid = false;
if (context_scim && context_scim->impl && context_scim == _focused_ic) {
if (context_scim->impl->si) {
- _panel_client.prepare (context_scim->id);
context_scim->impl->si->reset ();
- _panel_client.reset_input_context (context_scim->id);
- _panel_client.send ();
+ g_info_manager->socket_reset_input_context (WAYLAND_MODULE_CLIENT_ID, context_scim->id);
}
if (context_scim->impl->need_commit_preedit) {
void
isf_wsc_context_cursor_position_set (WSCContextISF *wsc_ctx, int cursor_pos)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *context_scim = wsc_ctx;
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* context_scim = wsc_ctx;
if (context_scim && context_scim->impl && context_scim == _focused_ic) {
if (context_scim->impl->cursor_pos != cursor_pos) {
return;
if (context_scim->impl->si) {
- _panel_client.prepare (context_scim->id);
context_scim->impl->si->update_cursor_position (cursor_pos);
panel_req_update_cursor_position (context_scim, cursor_pos);
- _panel_client.send ();
}
}
}
void
isf_wsc_context_preedit_string_get (WSCContextISF *wsc_ctx, char** str, int *cursor_pos)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *context_scim = wsc_ctx;
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* context_scim = wsc_ctx;
if (context_scim && context_scim->impl && context_scim->impl->is_on) {
String mbs = utf8_wcstombs (context_scim->impl->preedit_string);
void
isf_wsc_context_prediction_allow_set (WSCContextISF* wsc_ctx, Eina_Bool prediction)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (prediction == EINA_TRUE ? "true" : "false") << "...\n";
-
- WSCContextISF *context_scim = wsc_ctx;
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " = " << (prediction == EINA_TRUE ? "true" : "false") << "...\n";
+ LOGD ("");
+ WSCContextISF* context_scim = wsc_ctx;
if (context_scim && context_scim->impl && context_scim->impl->prediction_allow != prediction) {
context_scim->impl->prediction_allow = prediction;
Eina_Bool
isf_wsc_context_prediction_allow_get (WSCContextISF* wsc_ctx)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *context_scim = wsc_ctx;
-
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* context_scim = wsc_ctx;
Eina_Bool ret = EINA_FALSE;
if (context_scim && context_scim->impl) {
ret = context_scim->impl->prediction_allow;
void
isf_wsc_context_autocapital_type_set (WSCContextISF* wsc_ctx, Ecore_IMF_Autocapital_Type autocapital_type)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << autocapital_type << "...\n";
-
- WSCContextISF *context_scim = wsc_ctx;
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " = " << autocapital_type << "...\n";
+ LOGD ("");
+ WSCContextISF* context_scim = wsc_ctx;
if (context_scim && context_scim->impl && context_scim->impl->autocapital_type != autocapital_type) {
context_scim->impl->autocapital_type = autocapital_type;
if (context_scim->impl->si && context_scim == _focused_ic) {
LOGD ("ctx : %p. set autocapital type : %d\n", wsc_ctx, autocapital_type);
- _panel_client.prepare (context_scim->id);
context_scim->impl->si->set_autocapital_type (autocapital_type);
- _panel_client.send ();
}
}
}
if (context_scim->impl->si && context_scim == _focused_ic) {
LOGD ("ctx : %p, bidi direction : %#x\n", wsc_ctx, direction);
- _panel_client.prepare (context_scim->id);
context_scim->impl->si->update_bidi_direction (direction);
panel_req_update_bidi_direction (context_scim, direction);
- _panel_client.send ();
}
}
}
enum wl_keyboard_key_state state)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
if (!wsc_ctx) return;
if (state == WL_KEYBOARD_KEY_STATE_RELEASED) {
key.mask = SCIM_KEY_ReleaseMask;
- }
- else if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
+ } else if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
if (!ignore_key) {
/* Hardware input detect code */
#ifdef _TV
}
if (!ignore_key) {
- _panel_client.prepare (wsc_ctx->id);
-
ret = EINA_TRUE;
+
if (!filter_hotkeys (wsc_ctx, key)) {
if (!_focused_ic || !_focused_ic->impl || !_focused_ic->impl->is_on) {
ret = EINA_FALSE;
#ifdef _TV
- } else if (get_keyboard_mode() == TOOLBAR_HELPER_MODE
+ } else if (get_keyboard_mode () == TOOLBAR_HELPER_MODE
&& _active_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- void *pvoid = &ret;
- _panel_client.process_key_event (key, (int*)pvoid);
+ uint32 _ret;
+ g_info_manager->process_key_event (key, _ret);
+ ret = (Eina_Bool)_ret;
+
if (!ret) {
if (_focused_ic->impl->si)
ret = _focused_ic->impl->si->process_key_event (key);
ret = EINA_FALSE;
}
#else
- } else if (get_keyboard_mode() == TOOLBAR_HELPER_MODE
+ } else if (get_keyboard_mode () == TOOLBAR_HELPER_MODE
&& _active_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- void *pvoid = &ret;
- _panel_client.process_key_event (key, (int*)pvoid);
- if (!ret && !(_active_helper_option & ISM_HELPER_WITHOUT_IMENGINE)) {
+ uint32 _ret;
+ g_info_manager->process_key_event (key, _ret);
+ ret = (Eina_Bool)_ret;
+
+ if (!ret && ! (_active_helper_option & ISM_HELPER_WITHOUT_IMENGINE)) {
if (_focused_ic->impl->si)
ret = _focused_ic->impl->si->process_key_event (key);
else
}
}
}
- _panel_client.send ();
}
if (ret == EINA_FALSE) {
static void
wsc_commit_preedit (WSCContextISF* wsc_ctx)
{
- char *surrounding_text;
+ LOGD ("");
+ char* surrounding_text;
if (!wsc_ctx || !wsc_ctx->preedit_str ||
strlen (wsc_ctx->preedit_str) == 0)
static void
wsc_send_preedit (WSCContextISF* wsc_ctx, int32_t cursor)
{
+ LOGD ("");
+
if (!wsc_ctx) return;
uint32_t index = strlen (wsc_ctx->preedit_str);
Eina_Bool wsc_context_prediction_allow_get (WSCContextISF *wsc_ctx)
{
+ LOGD ("");
+
if (!wsc_ctx)
return EINA_FALSE;
void wsc_context_delete_surrounding (WSCContextISF *wsc_ctx, int offset, int len)
{
+ LOGD ("");
+
if (!wsc_ctx)
return;
void wsc_context_set_selection (WSCContextISF *wsc_ctx, int start, int end)
{
+ LOGD ("");
+
if (!wsc_ctx)
return;
void wsc_context_commit_string (WSCContextISF *wsc_ctx, const char *str)
{
+ LOGD ("");
+
if (!wsc_ctx)
return;
void wsc_context_commit_preedit_string (WSCContextISF *wsc_ctx)
{
- char *preedit_str = NULL;
+ LOGD ("");
+ char* preedit_str = NULL;
int cursor_pos = 0;
if (!wsc_ctx)
void wsc_context_send_preedit_string (WSCContextISF *wsc_ctx)
{
- char *preedit_str = NULL;
+ LOGD ("");
+ char* preedit_str = NULL;
int cursor_pos = 0;
if (!wsc_ctx)
void wsc_context_send_key (WSCContextISF *wsc_ctx, uint32_t keysym, uint32_t modifiers, uint32_t time, bool press)
{
+ LOGD ("");
+
if (!wsc_ctx)
return;
static void
turn_on_ic (WSCContextISF *ic)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
if (ic && ic->impl && ic->impl->si && !ic->impl->is_on) {
ic->impl->is_on = true;
if (ic == _focused_ic) {
panel_req_focus_in (ic);
panel_req_update_factory_info (ic);
- _panel_client.turn_on (ic->id);
+ g_info_manager->socket_turn_on ();
// _panel_client.hide_preedit_string (ic->id);
// _panel_client.hide_aux_string (ic->id);
// _panel_client.hide_lookup_table (ic->id);
static void
turn_off_ic (WSCContextISF *ic)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
if (ic && ic->impl && ic->impl->si && ic->impl->is_on) {
ic->impl->is_on = false;
ic->impl->si->focus_out ();
// panel_req_update_factory_info (ic);
- _panel_client.turn_off (ic->id);
+ g_info_manager->socket_turn_off ();
}
//Record the IC on/off status
static void
set_ic_capabilities (WSCContextISF *ic)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
if (ic && ic->impl) {
unsigned int cap = SCIM_CLIENT_CAP_ALL_CAPABILITIES;
static bool
check_socket_frontend (void)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
SocketAddress address;
SocketClient client;
return true;
}
+//useless
+#if 0
/* Panel Requestion functions. */
static void
panel_req_show_help (WSCContextISF *ic)
help += utf8_wcstombs (sf->get_credits ());
}
- _panel_client.show_help (ic->id, help);
+
+ g_info_manager->socket_show_help (help);
}
}
+#endif
static void
panel_req_show_factory_menu (WSCContextISF *ic)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
std::vector<IMEngineFactoryPointer> factories;
std::vector <PanelFactoryInfo> menu;
}
if (menu.size ())
- _panel_client.show_factory_menu (ic->id, menu);
+ g_info_manager->socket_show_factory_menu (menu);
}
static void
panel_req_update_factory_info (WSCContextISF *ic)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
if (ic && ic->impl && ic == _focused_ic) {
PanelFactoryInfo info;
} else {
info = PanelFactoryInfo (String (""), String (_("English Keyboard")), String ("C"), String (SCIM_KEYBOARD_ICON_FILE));
}
- _panel_client.update_factory_info (ic->id, info);
+
+ g_info_manager->socket_update_factory_info (info);
}
}
static void
panel_req_focus_in (WSCContextISF *ic)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
if (ic && ic->impl && ic->impl->si)
- _panel_client.focus_in (ic->id, ic->impl->si->get_factory_uuid ());
+ g_info_manager->focus_in (WAYLAND_MODULE_CLIENT_ID, ic->id, ic->impl->si->get_factory_uuid ());
}
static void
panel_req_update_cursor_position (WSCContextISF *ic, int cursor_pos)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
if (ic)
- _panel_client.update_cursor_position (ic->id, cursor_pos);
+ g_info_manager->socket_update_cursor_position (cursor_pos);
}
static void
SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
if (ic)
- _panel_client.update_bidi_direction (ic->id, direction);
+ g_info_manager->update_ise_bidi_direction (WAYLAND_MODULE_CLIENT_ID, direction);
}
static bool
filter_hotkeys (WSCContextISF *ic, const KeyEvent &key)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
bool ret = false;
if (!check_valid_ic (ic))
turn_on_ic (ic);
} else {
turn_off_ic (ic);
- _panel_client.hide_aux_string (ic->id);
- _panel_client.hide_lookup_table (ic->id);
+ g_info_manager->socket_hide_aux_string ();
+ g_info_manager->socket_hide_lookup_table ();
}
_display_input_language (ic);
if (type == IMENGINE_T)
open_specific_factory (ic, info.uuid);
else if (type == HELPER_T)
- _panel_client.start_helper (ic->id, info.uuid);
+ g_info_manager->start_helper (info.uuid);
+
ret = true;
}
return ret;
static bool
filter_keys (const char *keyname, const char *config_path)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
if (!keyname)
return false;
static bool
panel_initialize (void)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
String display_name;
{
const char *p = getenv ("DISPLAY");
if (p) display_name = String (p);
}
-
- if (_panel_client.open_connection (_config->get_name (), display_name) >= 0) {
- if (_panel_client.get_client_id (_panel_client_id)) {
- _panel_client.prepare (0);
- _panel_client.register_client (_panel_client_id);
- _panel_client.send ();
- }
-
- int fd = _panel_client.get_connection_number ();
-
- _panel_iochannel_read_handler = ecore_main_fd_handler_add (fd, ECORE_FD_READ, panel_iochannel_handler, NULL, NULL, NULL);
-// _panel_iochannel_err_handler = ecore_main_fd_handler_add (fd, ECORE_FD_ERROR, panel_iochannel_handler, NULL, NULL, NULL);
-
- SCIM_DEBUG_FRONTEND(2) << " Panel FD= " << fd << "\n";
-
- WSCContextISF *context_scim = _ic_list;
- while (context_scim != NULL) {
- if (context_scim->impl && context_scim->impl->si) {
- _panel_client.prepare (context_scim->id);
- _panel_client.register_input_context (context_scim->id, context_scim->impl->si->get_factory_uuid ());
- _panel_client.send ();
- }
- context_scim = context_scim->next;
+ g_info_manager->add_client (WAYLAND_MODULE_CLIENT_ID, 2, FRONTEND_CLIENT);
+ _panel_client_id = WAYLAND_MODULE_CLIENT_ID;
+ g_info_manager->register_panel_client (_panel_client_id, _panel_client_id);
+ WSCContextISF* context_scim = _ic_list;
+
+ while (context_scim != NULL) {
+ if (context_scim->impl && context_scim->impl->si) {
+ g_info_manager->register_input_context (WAYLAND_MODULE_CLIENT_ID, context_scim->id, context_scim->impl->si->get_factory_uuid ());
}
- if (_focused_ic) {
- _focused_ic = 0;
- }
-
- return true;
+ context_scim = context_scim->next;
}
- std::cerr << "panel_initialize () failed!!!\n";
- return false;
-}
-
-static void
-panel_finalize (void)
-{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
- _panel_client.close_connection ();
-
- if (_panel_iochannel_read_handler) {
- ecore_main_fd_handler_del (_panel_iochannel_read_handler);
- _panel_iochannel_read_handler = 0;
- }
- if (_panel_iochannel_err_handler) {
- ecore_main_fd_handler_del (_panel_iochannel_err_handler);
- _panel_iochannel_err_handler = 0;
+ if (_focused_ic) {
+ _focused_ic = 0;
}
-}
-
-static Eina_Bool
-panel_iochannel_handler (void *data, Ecore_Fd_Handler *fd_handler)
-{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
- if (fd_handler == _panel_iochannel_read_handler) {
- if (_panel_client.has_pending_event () && !_panel_client.filter_event ()) {
- panel_finalize ();
- panel_initialize ();
- return ECORE_CALLBACK_CANCEL;
- }
- } else if (fd_handler == _panel_iochannel_err_handler) {
- panel_finalize ();
- panel_initialize ();
- return ECORE_CALLBACK_CANCEL;
- }
- return ECORE_CALLBACK_RENEW;
+ return true;
}
-/* Panel Slot functions */
static void
-panel_slot_reload_config (int context)
+panel_finalize (void)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ g_info_manager->del_client (WAYLAND_MODULE_CLIENT_ID);
}
static void
panel_slot_exit (int /* context */)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
finalize ();
}
static void
panel_slot_update_candidate_item_layout (int context, const std::vector<uint32> &row_items)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " row size=" << row_items.size () << " ic=" << ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " row size=" << row_items.size () << " ic=" << ic << "\n";
+
if (ic && ic->impl && ic->impl->si && _focused_ic == ic) {
- _panel_client.prepare (ic->id);
ic->impl->si->update_candidate_item_layout (row_items);
- _panel_client.send ();
}
}
static void
panel_slot_update_lookup_table_page_size (int context, int page_size)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " page_size=" << page_size << " ic=" << ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " page_size=" << page_size << " ic=" << ic << "\n";
+
if (ic && ic->impl && ic->impl->si && _focused_ic == ic) {
- _panel_client.prepare (ic->id);
ic->impl->si->update_lookup_table_page_size (page_size);
- _panel_client.send ();
}
}
static void
panel_slot_lookup_table_page_up (int context)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+
if (ic && ic->impl && ic->impl->si && _focused_ic == ic) {
- _panel_client.prepare (ic->id);
ic->impl->si->lookup_table_page_up ();
- _panel_client.send ();
}
}
static void
panel_slot_lookup_table_page_down (int context)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+
if (ic && ic->impl && ic->impl->si && _focused_ic == ic) {
- _panel_client.prepare (ic->id);
ic->impl->si->lookup_table_page_down ();
- _panel_client.send ();
}
}
static void
panel_slot_trigger_property (int context, const String &property)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " property=" << property << " ic=" << ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " property=" << property << " ic=" << ic << "\n";
+
if (ic && ic->impl && ic->impl->si) {
- _panel_client.prepare (ic->id);
ic->impl->si->trigger_property (property);
- _panel_client.send ();
}
}
static void
panel_slot_process_helper_event (int context, const String &target_uuid, const String &helper_uuid, const Transaction &trans)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " target=" << target_uuid
- << " helper=" << helper_uuid << " ic=" << ic << " ic->impl=" << (ic != NULL ? ic->impl : 0) << " ic-uuid="
- << ((ic && ic->impl && ic->impl->si) ? ic->impl->si->get_factory_uuid () : "" ) << " _focused_ic=" << _focused_ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " target=" << target_uuid
+ << " helper=" << helper_uuid << " ic=" << ic << " ic->impl=" << (ic != NULL ? ic->impl : 0) << " ic-uuid="
+ << ((ic && ic->impl && ic->impl->si) ? ic->impl->si->get_factory_uuid () : "") << " _focused_ic=" << _focused_ic << "\n";
+
if (ic && ic->impl && _focused_ic == ic && ic->impl->is_on && ic->impl->si &&
ic->impl->si->get_factory_uuid () == target_uuid) {
- _panel_client.prepare (ic->id);
- SCIM_DEBUG_FRONTEND(2) << "call process_helper_event\n";
+ SCIM_DEBUG_FRONTEND (2) << "call process_helper_event\n";
ic->impl->si->process_helper_event (helper_uuid, trans);
- _panel_client.send ();
}
}
+//useless
+#if 0
static void
panel_slot_move_preedit_caret (int context, int caret_pos)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " caret=" << caret_pos << " ic=" << ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " caret=" << caret_pos << " ic=" << ic << "\n";
+
if (ic && ic->impl && ic->impl->si && _focused_ic == ic) {
- _panel_client.prepare (ic->id);
ic->impl->si->move_preedit_caret (caret_pos);
- _panel_client.send ();
}
}
+#endif
static void
panel_slot_update_preedit_caret (int context, int caret)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " caret=" << caret << " ic=" << ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " caret=" << caret << " ic=" << ic << "\n";
if (ic && ic->impl && _focused_ic == ic && ic->impl->preedit_caret != caret) {
ic->impl->preedit_caret = caret;
ic->impl->preedit_started = true;
}
} else {
- _panel_client.prepare (ic->id);
- _panel_client.update_preedit_caret (ic->id, caret);
- _panel_client.send ();
+ g_info_manager->socket_update_preedit_caret (caret);
}
}
}
static void
panel_slot_select_aux (int context, int aux_index)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " aux=" << aux_index << " ic=" << ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " aux=" << aux_index << " ic=" << ic << "\n";
+
if (ic && ic->impl && ic->impl->si && _focused_ic == ic) {
- _panel_client.prepare (ic->id);
ic->impl->si->select_aux (aux_index);
- _panel_client.send ();
}
}
static void
panel_slot_select_candidate (int context, int cand_index)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " candidate=" << cand_index << " ic=" << ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " candidate=" << cand_index << " ic=" << ic << "\n";
+
if (ic && ic->impl && ic->impl->si && _focused_ic == ic) {
- _panel_client.prepare (ic->id);
ic->impl->si->select_candidate (cand_index);
- _panel_client.send ();
}
}
static Eina_Bool
feed_key_event (WSCContextISF *ic, const KeyEvent &key, bool fake)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
if (key.code <= 0x7F ||
(key.code >= SCIM_KEY_BackSpace && key.code <= SCIM_KEY_Delete) ||
static void
panel_slot_process_key_event (int context, const KeyEvent &key)
{
- WSCContextISF *ic = find_ic (context);
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
Eina_Bool process_key = EINA_TRUE;
SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string () << " ic=" << ic << "\n";
process_key = EINA_FALSE;
}
- _panel_client.prepare (ic->id);
-
if (filter_hotkeys (ic, _key) == false && process_key) {
if (!_focused_ic || !_focused_ic->impl->is_on || !_focused_ic->impl->si ||
- !_focused_ic->impl->si->process_key_event (_key)) {
+ !_focused_ic->impl->si->process_key_event (_key)) {
if (_key.is_key_press ()) {
char code = _key.get_ascii_code ();
+
if (isgraph (code)) {
char string[2] = {0};
snprintf (string, sizeof (string), "%c", code);
if (strlen (string) != 0) {
- wsc_context_commit_string(ic, string);
+ wsc_context_commit_string (ic, string);
caps_mode_check (ic, EINA_FALSE, EINA_TRUE);
}
} else {
if (key.code == SCIM_KEY_space ||
key.code == SCIM_KEY_KP_Space)
autoperiod_insert (ic);
+
feed_key_event (ic, _key, false);
}
}
}
}
-
- _panel_client.send ();
}
static void
panel_slot_commit_string (int context, const WideString &wstr)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " str=" << utf8_wcstombs (wstr) << " ic=" << ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " str=" << utf8_wcstombs (wstr) << " ic=" << ic << "\n";
if (ic && ic->impl) {
if (_focused_ic != ic)
static void
panel_slot_forward_key_event (int context, const KeyEvent &key)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string () << " ic=" << ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string () << " ic=" << ic << "\n";
if (!(ic && ic->impl))
return;
feed_key_event (ic, key, true);
}
+//useless
+#if 0
static void
panel_slot_request_help (int context)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+
if (ic && ic->impl) {
- _panel_client.prepare (ic->id);
panel_req_show_help (ic);
- _panel_client.send ();
}
}
+
static void
panel_slot_request_factory_menu (int context)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+
if (ic && ic->impl) {
- _panel_client.prepare (ic->id);
panel_req_show_factory_menu (ic);
- _panel_client.send ();
}
}
+#endif
static void
panel_slot_change_factory (int context, const String &uuid)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " factory=" << uuid << " ic=" << ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " factory=" << uuid << " ic=" << ic << "\n";
+
if (ic && ic->impl && ic->impl->si) {
- _panel_client.prepare (ic->id);
ic->impl->si->reset ();
open_specific_factory (ic, uuid);
- _panel_client.send ();
}
}
static void
panel_slot_reset_keyboard_ise (int context)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+
if (ic && ic->impl) {
WideString wstr = ic->impl->preedit_string;
if (ic->impl->need_commit_preedit) {
}
if (ic->impl->si) {
- _panel_client.prepare (ic->id);
ic->impl->si->reset ();
- _panel_client.send ();
}
}
}
static void
panel_slot_update_keyboard_ise (int context)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
-
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
_backend->add_module (_config, "socket", false);
}
static void
panel_slot_show_preedit_string (int context)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << "\n";
if (ic && ic->impl && _focused_ic == ic) {
if (!ic->impl->is_on)
}
}
} else {
- _panel_client.prepare (ic->id);
- _panel_client.show_preedit_string (ic->id);
- _panel_client.send ();
+ g_info_manager->socket_show_preedit_string ();
}
}
}
static void
_hide_preedit_string (int context, bool update_preedit)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
if (ic && ic->impl && _focused_ic == ic) {
if (!ic->impl->is_on)
}
wsc_context_send_preedit_string (ic);
} else {
- _panel_client.prepare (ic->id);
- _panel_client.hide_preedit_string (ic->id);
- _panel_client.send ();
+ g_info_manager->socket_hide_preedit_string ();
}
}
}
static void
panel_slot_hide_preedit_string (int context)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
_hide_preedit_string (context, true);
}
const AttributeList &attrs,
int caret)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
if (ic && ic->impl && _focused_ic == ic) {
if (!ic->impl->is_on)
ic->impl->preedit_updating = false;
wsc_context_send_preedit_string (ic);
} else {
- _panel_client.prepare (ic->id);
- _panel_client.update_preedit_string (ic->id, str, attrs, caret);
- _panel_client.send ();
+ String _str = utf8_wcstombs (str);
+ g_info_manager->socket_update_preedit_string (_str, attrs, (uint32)caret);
}
}
}
static void
panel_slot_get_surrounding_text (int context, int maxlen_before, int maxlen_after)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
if (ic && ic->impl && ic->impl->si && _focused_ic == ic) {
int cursor = 0;
WideString text = WideString ();
slot_get_surrounding_text (ic->impl->si, text, cursor, maxlen_before, maxlen_after);
- _panel_client.prepare (ic->id);
- _panel_client.update_surrounding_text (ic->id, text, cursor);
- _panel_client.send ();
+ String _str = utf8_wcstombs (text);
+ g_info_manager->socket_update_surrounding_text (_str, (uint32)cursor);
}
}
static void
panel_slot_delete_surrounding_text (int context, int offset, int len)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
if (ic && ic->impl && ic->impl->si && _focused_ic == ic)
slot_delete_surrounding_text (ic->impl->si, offset, len);
static void
panel_slot_set_selection (int context, int start, int end)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
if (ic && ic->impl && ic->impl->si && _focused_ic == ic)
slot_set_selection (ic->impl->si, start, end);
static void
panel_slot_send_private_command (int context, const String &command)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
if (ic && ic->impl && ic->impl->si && _focused_ic == ic)
slot_send_private_command (ic->impl->si, command);
static void
panel_slot_update_displayed_candidate_number (int context, int number)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " number=" << number << " ic=" << ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " number=" << number << " ic=" << ic << "\n";
+
if (ic && ic->impl && ic->impl->si && _focused_ic == ic) {
- _panel_client.prepare (ic->id);
ic->impl->si->update_displayed_candidate_number (number);
- _panel_client.send ();
}
}
static void
panel_slot_candidate_more_window_show (int context)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+
if (ic && ic->impl && ic->impl->si && _focused_ic == ic) {
- _panel_client.prepare (ic->id);
ic->impl->si->candidate_more_window_show ();
- _panel_client.send ();
}
}
static void
panel_slot_candidate_more_window_hide (int context)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+
if (ic && ic->impl && ic->impl->si && _focused_ic == ic) {
- _panel_client.prepare (ic->id);
ic->impl->si->candidate_more_window_hide ();
- _panel_client.send ();
}
}
static void
panel_slot_longpress_candidate (int context, int index)
{
- WSCContextISF *ic = find_ic (context);
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " index=" << index << " ic=" << ic << "\n";
+ LOGD ("");
+ WSCContextISF* ic = find_ic (context);
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " context=" << context << " index=" << index << " ic=" << ic << "\n";
+
if (ic && ic->impl && ic->impl->si && _focused_ic == ic) {
- _panel_client.prepare (ic->id);
ic->impl->si->longpress_candidate (index);
- _panel_client.send ();
}
}
static void
panel_slot_update_ise_input_context (int context, int type, int value)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
}
static void
panel_slot_update_isf_candidate_panel (int context, int type, int value)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
}
void
}
}
- if (config_module_name != "dummy") {
- _config = ConfigBase::get (true, config_module_name);
- }
-
- if (_config.null ()) {
- LOGD ("Config module cannot be loaded, using dummy Config.\n");
- _config = new DummyConfig ();
- config_module_name = "dummy";
- }
-
- reload_config_callback (_config);
- _config_connection = _config->signal_connect_reload (slot (reload_config_callback));
-
// create backend
_backend = new CommonBackEnd (_config, load_engine_list.size () > 0 ? load_engine_list : engine_list);
_fallback_instance = _fallback_factory->create_instance (String ("UTF-8"), 0);
_fallback_instance->signal_connect_commit_string (slot (fallback_commit_string_cb));
- // Attach Panel Client signal.
- _panel_client.signal_connect_reload_config (slot (panel_slot_reload_config));
- _panel_client.signal_connect_exit (slot (panel_slot_exit));
- _panel_client.signal_connect_update_candidate_item_layout (slot (panel_slot_update_candidate_item_layout));
- _panel_client.signal_connect_update_lookup_table_page_size (slot (panel_slot_update_lookup_table_page_size));
- _panel_client.signal_connect_lookup_table_page_up (slot (panel_slot_lookup_table_page_up));
- _panel_client.signal_connect_lookup_table_page_down (slot (panel_slot_lookup_table_page_down));
- _panel_client.signal_connect_trigger_property (slot (panel_slot_trigger_property));
- _panel_client.signal_connect_process_helper_event (slot (panel_slot_process_helper_event));
- _panel_client.signal_connect_move_preedit_caret (slot (panel_slot_move_preedit_caret));
- _panel_client.signal_connect_update_preedit_caret (slot (panel_slot_update_preedit_caret));
- _panel_client.signal_connect_select_aux (slot (panel_slot_select_aux));
- _panel_client.signal_connect_select_candidate (slot (panel_slot_select_candidate));
- _panel_client.signal_connect_process_key_event (slot (panel_slot_process_key_event));
- _panel_client.signal_connect_commit_string (slot (panel_slot_commit_string));
- _panel_client.signal_connect_forward_key_event (slot (panel_slot_forward_key_event));
- _panel_client.signal_connect_request_help (slot (panel_slot_request_help));
- _panel_client.signal_connect_request_factory_menu (slot (panel_slot_request_factory_menu));
- _panel_client.signal_connect_change_factory (slot (panel_slot_change_factory));
- _panel_client.signal_connect_reset_keyboard_ise (slot (panel_slot_reset_keyboard_ise));
- _panel_client.signal_connect_update_keyboard_ise (slot (panel_slot_update_keyboard_ise));
- _panel_client.signal_connect_show_preedit_string (slot (panel_slot_show_preedit_string));
- _panel_client.signal_connect_hide_preedit_string (slot (panel_slot_hide_preedit_string));
- _panel_client.signal_connect_update_preedit_string (slot (panel_slot_update_preedit_string));
- _panel_client.signal_connect_get_surrounding_text (slot (panel_slot_get_surrounding_text));
- _panel_client.signal_connect_delete_surrounding_text (slot (panel_slot_delete_surrounding_text));
- _panel_client.signal_connect_set_selection (slot (panel_slot_set_selection));
- _panel_client.signal_connect_update_displayed_candidate_number (slot (panel_slot_update_displayed_candidate_number));
- _panel_client.signal_connect_candidate_more_window_show (slot (panel_slot_candidate_more_window_show));
- _panel_client.signal_connect_candidate_more_window_hide (slot (panel_slot_candidate_more_window_hide));
- _panel_client.signal_connect_longpress_candidate (slot (panel_slot_longpress_candidate));
- _panel_client.signal_connect_update_ise_input_context (slot (panel_slot_update_ise_input_context));
- _panel_client.signal_connect_update_isf_candidate_panel (slot (panel_slot_update_isf_candidate_panel));
- _panel_client.signal_connect_send_private_command (slot (panel_slot_send_private_command));
-
if (!panel_initialize ()) {
std::cerr << "Ecore IM Module: Cannot connect to Panel!\n";
}
SCIM_DEBUG_FRONTEND(2) << " Releasing Config...\n";
_config.reset ();
- _config_connection.disconnect ();
-
_focused_ic = NULL;
_ic_list = NULL;
_scim_initialized = false;
-
- _panel_client.reset_signal_handler ();
panel_finalize ();
}
static void
open_next_factory (WSCContextISF *ic)
{
+ LOGD ("");
+
if (!check_valid_ic (ic))
return;
ic->impl->preedit_caret = 0;
attach_instance (ic->impl->si);
_backend->set_default_factory (_language, sf->get_uuid ());
- _panel_client.register_input_context (ic->id, sf->get_uuid ());
- _panel_client.set_candidate_style (ic->id, ONE_LINE_CANDIDATE, FIXED_CANDIDATE_WINDOW);
+ g_info_manager->register_input_context (WAYLAND_MODULE_CLIENT_ID, ic->id, sf->get_uuid ());
+ g_info_manager->socket_set_candidate_ui (ONE_LINE_CANDIDATE, FIXED_CANDIDATE_WINDOW);
set_ic_capabilities (ic);
turn_on_ic (ic);
static void
open_previous_factory (WSCContextISF *ic)
{
+ LOGD ("");
+
if (!check_valid_ic (ic))
return;
ic->impl->preedit_caret = 0;
attach_instance (ic->impl->si);
_backend->set_default_factory (_language, sf->get_uuid ());
- _panel_client.register_input_context (ic->id, sf->get_uuid ());
- _panel_client.set_candidate_style (ic->id, ONE_LINE_CANDIDATE, FIXED_CANDIDATE_WINDOW);
+ g_info_manager->register_input_context (WAYLAND_MODULE_CLIENT_ID, ic->id, sf->get_uuid ());
+ g_info_manager->socket_set_candidate_ui (ONE_LINE_CANDIDATE, FIXED_CANDIDATE_WINDOW);
set_ic_capabilities (ic);
turn_on_ic (ic);
open_specific_factory (WSCContextISF *ic,
const String &uuid)
{
+ LOGD ("");
+
if (!check_valid_ic (ic))
return;
ic->impl->preedit_caret = 0;
attach_instance (ic->impl->si);
_backend->set_default_factory (_language, sf->get_uuid ());
- _panel_client.register_input_context (ic->id, sf->get_uuid ());
+ g_info_manager->register_input_context (WAYLAND_MODULE_CLIENT_ID, ic->id, sf->get_uuid ());
set_ic_capabilities (ic);
turn_on_ic (ic);
ic->impl->si->focus_out ();
panel_req_update_factory_info (ic);
- _panel_client.turn_off (ic->id);
+ g_info_manager->socket_turn_off ();
}
//Record the IC on/off status
if ((keyname >= '0' && keyname <= '9') ||
(keyname >= 'a' && keyname <= 'z')) {
return keyname;
- }
- else if (keyname >= 'A' && keyname <= 'Z') {
+ } else if (keyname >= 'A' && keyname <= 'Z') {
*modifiers |= MOD_SHIFT_MASK;
return keyname + 32;
}
static void send_wl_key_event (WSCContextISF *ic, const KeyEvent &key, bool fake)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
uint32_t time = 0;
if (!fake)
static void
slot_show_preedit_string (IMEngineInstanceBase *si)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic && ic->impl && _focused_ic == ic) {
if (ic->impl->use_preedit) {
ic->impl->preedit_started = true;
}
} else {
- _panel_client.show_preedit_string (ic->id);
+ g_info_manager->socket_show_preedit_string ();
}
}
}
static void
slot_show_aux_string (IMEngineInstanceBase *si)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic && ic->impl && _focused_ic == ic)
- _panel_client.show_aux_string (ic->id);
+ g_info_manager->socket_show_aux_string ();
}
static void
slot_show_lookup_table (IMEngineInstanceBase *si)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic && ic->impl && _focused_ic == ic)
- _panel_client.show_lookup_table (ic->id);
+ g_info_manager->socket_show_lookup_table ();
}
static void
slot_hide_preedit_string (IMEngineInstanceBase *si)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic && ic->impl && _focused_ic == ic) {
if (ic->impl->preedit_string.length ()) {
}
wsc_context_send_preedit_string (ic);
} else {
- _panel_client.hide_preedit_string (ic->id);
+ g_info_manager->socket_hide_preedit_string ();
}
}
}
static void
slot_hide_aux_string (IMEngineInstanceBase *si)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic && ic->impl && _focused_ic == ic)
- _panel_client.hide_aux_string (ic->id);
+ g_info_manager->socket_hide_aux_string ();
}
static void
slot_hide_lookup_table (IMEngineInstanceBase *si)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic && ic->impl && _focused_ic == ic)
- _panel_client.hide_lookup_table (ic->id);
+ g_info_manager->socket_hide_lookup_table ();
}
static void
slot_update_preedit_caret (IMEngineInstanceBase *si, int caret)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic && ic->impl && _focused_ic == ic && ic->impl->preedit_caret != caret) {
ic->impl->preedit_caret = caret;
ic->impl->preedit_started = true;
}
} else {
- _panel_client.update_preedit_caret (ic->id, caret);
+ g_info_manager->socket_update_preedit_caret (caret);
}
}
}
const AttributeList & attrs,
int caret)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic && ic->impl && _focused_ic == ic && (ic->impl->preedit_string != str || str.length ())) {
ic->impl->preedit_string = str;
ic->impl->preedit_updating = false;
wsc_context_send_preedit_string (ic);
} else {
- _panel_client.update_preedit_string (ic->id, str, attrs, caret);
+ String _str = utf8_wcstombs (str);
+ g_info_manager->socket_update_preedit_string (_str, attrs, caret);
}
}
}
const WideString & str,
const AttributeList & attrs)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
-
- if (ic && ic->impl && _focused_ic == ic)
- _panel_client.update_aux_string (ic->id, str, attrs);
+ if (ic && ic->impl && _focused_ic == ic) {
+ String _str = utf8_wcstombs (str);
+ g_info_manager->socket_update_aux_string (_str, attrs);
+ }
}
static void
slot_commit_string (IMEngineInstanceBase *si,
const WideString & str)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic) {
if (utf8_wcstombs (str) == String (" ") || utf8_wcstombs (str) == String (" "))
slot_forward_key_event (IMEngineInstanceBase *si,
const KeyEvent & key)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic && _focused_ic == ic) {
if (!_fallback_instance->process_key_event (key)) {
slot_update_lookup_table (IMEngineInstanceBase *si,
const LookupTable & table)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic && ic->impl && _focused_ic == ic)
- _panel_client.update_lookup_table (ic->id, table);
+ g_info_manager->socket_update_lookup_table (table);
}
static void
slot_register_properties (IMEngineInstanceBase *si,
const PropertyList & properties)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic && ic->impl && _focused_ic == ic)
- _panel_client.register_properties (ic->id, properties);
+ g_info_manager->socket_register_properties (properties);
}
static void
slot_update_property (IMEngineInstanceBase *si,
const Property & property)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic && ic->impl && _focused_ic == ic)
- _panel_client.update_property (ic->id, property);
+ g_info_manager->socket_update_property (property);
}
static void
slot_start_helper (IMEngineInstanceBase *si,
const String &helper_uuid)
{
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
-
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context="
- << (ic != NULL ? ic->id : -1) << " ic=" << ic
- << " ic-uuid=" << ((ic && ic->impl && ic->impl->si) ? ic->impl->si->get_factory_uuid () : "") << "...\n";
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
+ LOGD ("");
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " helper= " << helper_uuid << " context="
+ << (ic != NULL ? ic->id : -1) << " ic=" << ic
+ << " ic-uuid=" << ((ic && ic->impl && ic->impl->si) ? ic->impl->si->get_factory_uuid () : "") << "...\n";
if (ic && ic->impl)
- _panel_client.start_helper (ic->id, helper_uuid);
+ g_info_manager->socket_start_helper (WAYLAND_MODULE_CLIENT_ID, ic->id, helper_uuid);
}
static void
slot_stop_helper (IMEngineInstanceBase *si,
const String &helper_uuid)
{
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
-
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" << (ic != NULL ? ic->id : -1) << " ic=" << ic << "...\n";
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
+ LOGD ("");
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" << (ic != NULL ? ic->id : -1) << " ic=" << ic << "...\n";
if (ic && ic->impl)
- _panel_client.stop_helper (ic->id, helper_uuid);
+ g_info_manager->socket_stop_helper (WAYLAND_MODULE_CLIENT_ID, ic->id, helper_uuid);
}
static void
const String &helper_uuid,
const Transaction &trans)
{
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
-
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context="
- << (ic != NULL ? ic->id : -1) << " ic=" << ic
- << " ic-uuid=" << ((ic && ic->impl && ic->impl->si) ? ic->impl->si->get_factory_uuid () : "") << "...\n";
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
+ LOGD ("");
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << " helper= " << helper_uuid << " context="
+ << (ic != NULL ? ic->id : -1) << " ic=" << ic
+ << " ic-uuid=" << ((ic && ic->impl && ic->impl->si) ? ic->impl->si->get_factory_uuid () : "") << "...\n";
if (ic && ic->impl)
- _panel_client.send_helper_event (ic->id, helper_uuid, trans);
+ g_info_manager->socket_send_helper_event (WAYLAND_MODULE_CLIENT_ID, ic->id, helper_uuid, trans);
}
static bool
int maxlen_before,
int maxlen_after)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic && ic->impl && _focused_ic == ic) {
char *surrounding = NULL;
int offset,
int len)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic && _focused_ic == ic) {
wsc_context_delete_surrounding (_focused_ic, offset, len);
int start,
int end)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (_focused_ic && _focused_ic == ic) {
wsc_context_set_selection (_focused_ic, start, end);
static void
slot_expand_candidate (IMEngineInstanceBase *si)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic && ic->impl && _focused_ic == ic)
- _panel_client.expand_candidate (ic->id);
+ g_info_manager->expand_candidate ();
}
static void
slot_contract_candidate (IMEngineInstanceBase *si)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic && ic->impl && _focused_ic == ic)
- _panel_client.contract_candidate (ic->id);
+ g_info_manager->contract_candidate ();
}
static void
slot_set_candidate_style (IMEngineInstanceBase *si, ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line, ISF_CANDIDATE_MODE_T mode)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (ic && ic->impl && _focused_ic == ic)
- _panel_client.set_candidate_style (ic->id, portrait_line, mode);
+ g_info_manager->socket_set_candidate_ui (portrait_line, mode);
}
static void
slot_send_private_command (IMEngineInstanceBase *si,
const String &command)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
- WSCContextISF *ic = static_cast<WSCContextISF *> (si->get_frontend_data ());
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ WSCContextISF* ic = static_cast<WSCContextISF*> (si->get_frontend_data ());
if (_focused_ic && _focused_ic == ic) {
if (_focused_ic->im_ctx)
static void
reload_config_callback (const ConfigPointer &config)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
_frontend_hotkey_matcher.load_hotkeys (config);
_imengine_hotkey_matcher.load_hotkeys (config);
fallback_commit_string_cb (IMEngineInstanceBase *si,
const WideString &str)
{
- SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n";
+ LOGD ("");
if (_focused_ic && _focused_ic->impl) {
wsc_context_commit_string (_focused_ic, utf8_wcstombs (str).c_str ());
}
}
+
+class WaylandPanelAgent: public PanelAgentBase
+{
+public:
+ WaylandPanelAgent ()
+ : PanelAgentBase ("wayland") {
+ }
+ ~WaylandPanelAgent () {
+ stop ();
+ }
+ bool initialize (InfoManager* info_manager, const String& display, bool resident) {
+ LOGD ("");
+ g_info_manager = info_manager;
+ isf_wsc_context_init ();
+
+ if (!_wsc_setup (&_wsc)) {
+ return false;
+ }
+
+ return true;
+ }
+ bool valid (void) const {
+ return true;
+ }
+
+ void stop (void) {
+ isf_wsc_context_shutdown ();
+ }
+
+public:
+ void
+ exit (int id, uint32 contextid) {
+ LOGD ("client id:%d", id);
+ panel_slot_exit (id);
+ }
+
+ void
+ update_candidate_item_layout (int id, uint32 contextid, const std::vector<uint32>& row_items) {
+ LOGD ("client id:%d", id);
+ panel_slot_update_candidate_item_layout (contextid, row_items);
+ }
+
+ void
+ update_lookup_table_page_size (int id, uint32 context_id, int page_size) {
+ LOGD ("client id:%d", id);
+ panel_slot_update_lookup_table_page_size (context_id, page_size);
+ }
+
+ void
+ lookup_table_page_up (int id, uint32 context_id) {
+ LOGD ("client id:%d", id);
+ panel_slot_lookup_table_page_up (context_id);
+ }
+
+ void
+ lookup_table_page_down (int id, uint32 context_id) {
+ LOGD ("client id:%d", id);
+ panel_slot_lookup_table_page_down (context_id);
+ }
+
+ void
+ trigger_property (int id, uint32 context_id, const String& property) {
+ LOGD ("client id:%d", id);
+ panel_slot_trigger_property (context_id, property);
+ }
+
+ void
+ process_helper_event (int id, uint32 context_id, const String target_uuid, const String helper_uuid, Transaction& trans) {
+ LOGD ("client id:%d", id);
+ panel_slot_process_helper_event (context_id, target_uuid, helper_uuid, trans);
+ }
+
+ //FIXME
+ //useless
+ //void
+ //move_preedit_caret(int id, uint32 context_id, int caret_pos)
+ //{
+ // LOGD("client id:%d", id);
+ // panel_slot_move_preedit_caret(context_id, caret_pos);
+ //}
+
+ void
+ update_preedit_caret (int id, uint32 context_id, int caret) {
+ LOGD ("client id:%d", id);
+ panel_slot_update_preedit_caret (context_id, caret);
+ }
+
+ void
+ select_aux (int id, uint32 context_id, int aux_index) {
+ LOGD ("client id:%d", id);
+ panel_slot_select_aux (context_id, aux_index);
+ }
+
+ void
+ select_candidate (int id, uint32 context_id, uint32 cand_index) {
+ LOGD ("client id:%d", id);
+ panel_slot_select_candidate (context_id, cand_index);
+ }
+
+ void
+ socket_helper_key_event (int id, uint32 context_id, int cmd , KeyEvent& key) {
+ LOGD ("client id:%d", id);
+
+ if (cmd == SCIM_TRANS_CMD_PROCESS_KEY_EVENT)
+ panel_slot_process_key_event (context_id, key);
+ else
+ panel_slot_forward_key_event (context_id, key);
+ }
+
+ void
+ commit_string (int id, uint32 context_id, const WideString& wstr) {
+ LOGD ("client id:%d", id);
+ panel_slot_commit_string (context_id, wstr);
+ }
+#if 0
+ void
+ request_help (int id, uint32 context_id) {
+ LOGD ("client id:%d", id);
+ panel_slot_request_help (context_id);
+ }
+
+
+ void
+ request_factory_menu (int id, uint32 context_id) {
+ LOGD ("client id:%d", id);
+ panel_slot_request_factory_menu (context_id);
+ }
+#endif
+
+ void
+ change_factory (int id, uint32 context_id, const String& uuid) {
+ LOGD ("client id:%d", id);
+ panel_slot_change_factory (context_id, uuid);
+ }
+
+ void
+ reset_keyboard_ise (int id, uint32 context_id) {
+ LOGD ("client id:%d", id);
+ panel_slot_reset_keyboard_ise (context_id);
+ }
+
+ void
+ update_keyboard_ise (int id, uint32 context_id) {
+ LOGD ("client id:%d", id);
+ panel_slot_update_keyboard_ise (context_id);
+ }
+
+ void
+ show_preedit_string (int id, uint32 context_id) {
+ LOGD ("client id:%d", id);
+ panel_slot_show_preedit_string (context_id);
+ }
+
+ void
+ hide_preedit_string (int id, uint32 context_id) {
+ LOGD ("client id:%d", id);
+ panel_slot_hide_preedit_string (context_id);
+ }
+
+ void
+ update_preedit_string (int id, uint32 context_id,
+ const WideString& str,
+ const AttributeList& attrs,
+ int caret) {
+ LOGD ("client id:%d", id);
+ panel_slot_update_preedit_string (context_id, str, attrs, caret);
+ }
+
+ void
+ get_surrounding_text (int id, uint32 context_id, int maxlen_before, int maxlen_after) {
+ LOGD ("client id:%d", id);
+ panel_slot_get_surrounding_text (context_id, maxlen_before, maxlen_after);
+ }
+
+ void
+ delete_surrounding_text (int id, uint32 context_id, int offset, int len) {
+ LOGD ("client id:%d", id);
+ panel_slot_delete_surrounding_text (context_id, offset, len);
+ }
+
+ void
+ set_selection (int id, uint32 context_id, int start, int end) {
+ LOGD ("client id:%d", id);
+ panel_slot_set_selection (context_id, start, end);
+ }
+
+ void
+ send_private_command (int id, uint32 context_id, const String& command) {
+ LOGD ("client id:%d", id);
+ panel_slot_send_private_command (context_id, command);
+ }
+
+ void
+ update_displayed_candidate_number (int id, uint32 context_id, int number) {
+ LOGD ("client id:%d", id);
+ panel_slot_update_displayed_candidate_number (context_id, number);
+ }
+
+ void
+ candidate_more_window_show (int id, uint32 context_id) {
+ LOGD ("client id:%d", id);
+ panel_slot_candidate_more_window_show (context_id);
+ }
+
+ void
+ candidate_more_window_hide (int id, uint32 context_id) {
+ LOGD ("client id:%d", id);
+ panel_slot_candidate_more_window_hide (context_id);
+ }
+
+ void
+ longpress_candidate (int id, uint32 context_id, int index) {
+ LOGD ("client id:%d", id);
+ panel_slot_longpress_candidate (context_id, index);
+ }
+
+ void
+ update_ise_input_context (int id, uint32 context_id, uint32 type, uint32 value) {
+ LOGD ("client id:%d", id);
+ panel_slot_update_ise_input_context ((int)context_id, (int)type, (int)value);
+ }
+
+ void
+ update_isf_candidate_panel (int id, uint32 context_id, int type, int value) {
+ LOGD ("client id:%d", id);
+ panel_slot_update_isf_candidate_panel (context_id, type, value);
+ }
+
+ void
+ reload_config (int id)
+ {
+ LOGD ("client id:%d", id);
+ reload_config_callback (_config);
+ }
+
+};
+
+static scim::PanelAgentBase* instance = NULL;
+extern "C" {
+
+ EXAPI void scim_module_init (void)
+ {
+ LOGD ("");
+ }
+
+ EXAPI void scim_module_exit (void)
+ {
+ LOGD ("");
+ if (instance) {
+ delete instance;
+ instance = NULL;
+ }
+ }
+
+ EXAPI void scim_panel_agent_module_init (const scim::ConfigPointer& config)
+ {
+ LOGD ("");
+ _config = config;
+ }
+
+ EXAPI scim::PanelAgentPointer scim_panel_agent_module_get_instance ()
+ {
+ if (!instance) {
+ try {
+ LOGD ("");
+ instance = new WaylandPanelAgent ();
+ } catch (...) {
+ delete instance;
+ instance = NULL;
+ }
+ }
+
+ return scim::PanelAgentPointer (instance);
+ }
+}
+
+/*
+vi:ts=4:nowrap:expandtab
+*/
\ No newline at end of file
scim_lookup_table.h \
scim_module.h \
scim_object.h \
- scim_panel_agent.h \
scim_panel_client.h \
scim_panel_common.h \
scim_pointer.h \
isf_control.h \
isf_imcontrol_client.h \
ise_context.h \
- scim_visibility.h
+ scim_visibility.h \
+ isf_panel_agent_manager.h \
+ isf_info_manager.h \
+ isf_panel_agent_base.h \
+ isf_panel_agent_module.h
noinst_LTLIBRARIES = libltdlc.la
scim_imengine_module.cpp \
scim_lookup_table.cpp \
scim_object.cpp \
- scim_panel_agent.cpp \
scim_panel_client.cpp \
scim_private.cpp \
scim_signals.cpp \
scim_setup_module_efl.cpp \
isf_control.cpp \
isf_imcontrol_client.cpp \
- isf_query_utility.cpp
+ isf_query_utility.cpp \
+ isf_panel_agent_manager.cpp \
+ isf_info_manager.cpp \
+ isf_panel_agent_base.cpp \
+ isf_panel_agent_module.cpp
libscim@SCIM_EPOCH@_la_CXXFLAGS = @EVAS_CFLAGS@ \
@DLOG_CFLAGS@ \
--- /dev/null
+/** @file scim_panel.cpp
+ * @brief Implementation of class InfoManager.
+ */
+
+/* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
+
+/*
+ * Smart Common Input Method
+ *
+ * Copyright (c) 2005 James Su <suzhe@tsinghua.org.cn>
+ * Copyright (c) 2012-2015 Samsung Electronics Co., Ltd.
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307 USA
+ *
+ * Modifications by Samsung Electronics Co., Ltd.
+ * 1. Add new signals
+ * a. m_signal_set_keyboard_ise and m_signal_get_keyboard_ise
+ * b. m_signal_focus_in and m_signal_focus_out
+ * c. m_signal_expand_candidate, m_signal_contract_candidate and m_signal_set_candidate_ui
+ * d. m_signal_get_ise_list, m_signal_get_keyboard_ise_list, m_signal_update_ise_geometry and m_signal_get_ise_information
+ * e. m_signal_set_active_ise_by_uuid and m_signal_get_ise_info_by_uuid
+ * f. m_signal_accept_connection, m_signal_close_connection and m_signal_exit
+ * 2. Add new interface APIs in PanelClient class
+ * a. get_helper_manager_id (), has_helper_manager_pending_event () and filter_helper_manager_event ()
+ * b. update_candidate_panel_event (), update_input_panel_event () and select_aux ()
+ * c. candidate_more_window_show () and candidate_more_window_hide ()
+ * d. update_displayed_candidate_number () and update_candidate_item_layout ()
+ * e. stop_helper (), send_longpress_event () and update_ise_list ()
+ * f. filter_event (), filter_exception_event () and get_server_id ()
+ * 3. Donot use thread to receive message
+ * 4. Monitor socket frontend for self-recovery function
+ *
+ * $Id: scim_panel_agent.cpp,v 1.8.2.1 2006/01/09 14:32:18 suzhe Exp $
+ *
+ */
+
+
+#define Uses_SCIM_PANEL_AGENT
+#define Uses_SCIM_HELPER
+#define Uses_SCIM_EVENT
+#define Uses_SCIM_CONFIG
+#define Uses_SCIM_CONFIG_MODULE
+#define Uses_SCIM_CONFIG_PATH
+#define Uses_SCIM_UTILITY
+
+#include <string.h>
+#include <sys/types.h>
+#include <sys/times.h>
+#include <dlog.h>
+#include <unistd.h>
+#include "scim_private.h"
+#include "scim.h"
+#include "scim_stl_map.h"
+#include "privilege_checker.h"
+#include "isf_panel_agent_manager.h"
+
+#ifdef LOG_TAG
+# undef LOG_TAG
+#endif
+#define LOG_TAG "ISF_PANEL_EFL"
+
+#define MIN_REPEAT_TIME 2.0
+
+
+EXAPI scim::CommonLookupTable g_isf_candidate_table;
+
+
+namespace scim
+{
+
+typedef Signal0<void>
+InfoManagerSignalVoid;
+
+typedef Signal1<void, int>
+InfoManagerSignalInt;
+
+typedef Signal1<void, int&>
+InfoManagerSignalInt2;
+
+typedef Signal1<void, const String&>
+InfoManagerSignalString;
+
+typedef Signal2<void, const String&, bool>
+InfoManagerSignalStringBool;
+
+typedef Signal2<void, String&, String&>
+InfoManagerSignalString2;
+
+typedef Signal2<void, int, const String&>
+InfoManagerSignalIntString;
+
+typedef Signal1<void, const PanelFactoryInfo&>
+InfoManagerSignalFactoryInfo;
+
+typedef Signal1<void, const std::vector <PanelFactoryInfo> &>
+InfoManagerSignalFactoryInfoVector;
+
+typedef Signal1<void, const LookupTable&>
+InfoManagerSignalLookupTable;
+
+typedef Signal1<void, const Property&>
+InfoManagerSignalProperty;
+
+typedef Signal1<void, const PropertyList&>
+InfoManagerSignalPropertyList;
+
+typedef Signal2<void, int, int>
+InfoManagerSignalIntInt;
+
+typedef Signal2<void, int&, int&>
+InfoManagerSignalIntInt2;
+
+typedef Signal3<void, int, int, int>
+InfoManagerSignalIntIntInt;
+
+typedef Signal4<void, int, int, int, int>
+InfoManagerSignalIntIntIntInt;
+
+typedef Signal2<void, int, const Property&>
+InfoManagerSignalIntProperty;
+
+typedef Signal2<void, int, const PropertyList&>
+InfoManagerSignalIntPropertyList;
+
+typedef Signal2<void, int, const HelperInfo&>
+InfoManagerSignalIntHelperInfo;
+
+typedef Signal3<void, const String&, const AttributeList&, int>
+InfoManagerSignalAttributeStringInt;
+
+typedef Signal2<void, const String&, const AttributeList&>
+InfoManagerSignalAttributeString;
+
+typedef Signal1<void, std::vector <String> &>
+InfoManagerSignalStringVector;
+
+typedef Signal1<bool, HELPER_ISE_INFO&>
+InfoManagerSignalBoolHelperInfo;
+
+typedef Signal1<bool, std::vector <String> &>
+InfoManagerSignalBoolStringVector;
+
+typedef Signal2<void, char*, std::vector <String> &>
+InfoManagerSignalStrStringVector;
+
+typedef Signal2<bool, const String&, ISE_INFO&>
+InfoManagerSignalStringISEINFO;
+
+typedef Signal2<bool, String, int&>
+InfoManagerSignalStringInt;
+
+typedef Signal1<void, const KeyEvent&>
+InfoManagerSignalKeyEvent;
+
+typedef Signal1<void, struct rectinfo&>
+InfoManagerSignalRect;
+
+typedef Signal6<bool, String, String&, String&, int&, int&, String&>
+InfoManagerSignalBoolString4int2;
+
+typedef Signal2<void, int, struct rectinfo&>
+InfoManagerSignalIntRect;
+
+typedef Signal2<bool, int, String>
+InfoManagerSignalIntString2;
+
+struct HelperClientStub {
+ int id;
+ int ref;
+
+ HelperClientStub (int i = 0, int r = 0) : id (i), ref (r) { }
+};
+
+struct IMControlStub {
+ std::vector<ISE_INFO> info;
+ std::vector<int> count;
+};
+
+static int _id_count = -4;
+
+#define DEFAULT_CONTEXT_VALUE 0xfff
+
+#if SCIM_USE_STL_EXT_HASH_MAP
+typedef __gnu_cxx::hash_map <int, ClientInfo, __gnu_cxx::hash <int> > ClientRepository;
+typedef __gnu_cxx::hash_map <int, HelperInfo, __gnu_cxx::hash <int> > HelperInfoRepository;
+typedef __gnu_cxx::hash_map <uint32, String, __gnu_cxx::hash <unsigned int> > ClientContextUUIDRepository;
+typedef __gnu_cxx::hash_map <String, HelperClientStub, scim_hash_string> HelperClientIndex;
+typedef __gnu_cxx::hash_map <String, std::vector < std::pair <uint32, String> >, scim_hash_string> StartHelperICIndex;
+#elif SCIM_USE_STL_HASH_MAP
+typedef std::hash_map <int, ClientInfo, std::hash <int> > ClientRepository;
+typedef std::hash_map <int, HelperInfo, std::hash <int> > HelperInfoRepository;
+typedef std::hash_map <uint32, String, std::hash <unsigned int> > ClientContextUUIDRepository;
+typedef std::hash_map <String, HelperClientStub, scim_hash_string> HelperClientIndex;
+typedef std::hash_map <String, std::vector < std::pair <uint32, String> >, scim_hash_string> StartHelperICIndex;
+#else
+typedef std::map <int, ClientInfo> ClientRepository;
+typedef std::map <int, HelperInfo> HelperInfoRepository;
+typedef std::map <uint32, String> ClientContextUUIDRepository;
+typedef std::map <String, HelperClientStub> HelperClientIndex;
+typedef std::map <String, std::vector < std::pair <uint32, String> > > StartHelperICIndex;
+#endif
+
+typedef std::map <String, uint32> UUIDCountRepository;
+typedef std::map <String, enum HelperState> UUIDStateRepository;
+typedef std::map <String, int> StringIntRepository;
+typedef std::map <int, struct IMControlStub> IMControlRepository;
+typedef std::map <int, int> IntIntRepository;
+
+static uint32
+get_helper_ic (int client, uint32 context)
+{
+ return (uint32) (client & 0xFFFF) | ((context & 0x7FFF) << 16);
+}
+
+static void
+get_imengine_client_context (uint32 helper_ic, int& client, uint32& context)
+{
+ client = (int) (helper_ic & 0xFFFF);
+ context = ((helper_ic >> 16) & 0x7FFF);
+}
+
+//==================================== InfoManager ===========================
+class InfoManager::InfoManagerImpl
+{
+ int m_current_screen;
+
+ String m_config_name;
+ String m_display_name;
+
+ int m_current_socket_client;
+ uint32 m_current_client_context;
+ String m_current_context_uuid;
+ TOOLBAR_MODE_T m_current_toolbar_mode;
+ uint32 m_current_helper_option;
+ String m_current_helper_uuid;
+ String m_last_helper_uuid;
+ String m_current_ise_name;
+ int m_pending_active_imcontrol_id;
+ int m_show_request_client_id;
+ int m_active_client_id;
+ IntIntRepository m_panel_client_map;
+ IntIntRepository m_imcontrol_map;
+ bool m_should_shared_ise;
+ bool m_ise_exiting;
+ bool m_is_imengine_aux;
+ bool m_is_imengine_candidate;
+
+ int m_last_socket_client;
+ uint32 m_last_client_context;
+ String m_last_context_uuid;
+
+ char* m_ise_context_buffer;
+ size_t m_ise_context_length;
+
+ ClientRepository m_client_repository;
+ /*
+ * Each Helper ISE has two socket connect between InfoManager and HelperAgent.
+ * m_helper_info_repository records the active connection.
+ * m_helper_active_info_repository records the passive connection.
+ */
+ HelperInfoRepository m_helper_info_repository;
+ HelperInfoRepository m_helper_active_info_repository;
+ HelperClientIndex m_helper_client_index;
+
+ /* when helper register, notify imcontrol client */
+ StringIntRepository m_ise_pending_repository;
+ IMControlRepository m_imcontrol_repository;
+
+ StartHelperICIndex m_start_helper_ic_index;
+
+ /* Keyboard ISE */
+ ClientContextUUIDRepository m_client_context_uuids;
+
+ /* Helper ISE */
+ ClientContextUUIDRepository m_client_context_helper;
+ UUIDCountRepository m_helper_uuid_count;
+
+ HelperManager m_helper_manager;
+
+ InfoManagerSignalVoid m_signal_reload_config;
+ InfoManagerSignalVoid m_signal_turn_on;
+ InfoManagerSignalVoid m_signal_turn_off;
+ InfoManagerSignalVoid m_signal_show_panel;
+ InfoManagerSignalVoid m_signal_hide_panel;
+ InfoManagerSignalInt m_signal_update_screen;
+ InfoManagerSignalIntIntInt m_signal_update_spot_location;
+ InfoManagerSignalFactoryInfo m_signal_update_factory_info;
+ InfoManagerSignalVoid m_signal_start_default_ise;
+ InfoManagerSignalVoid m_signal_stop_default_ise;
+ InfoManagerSignalIntInt m_signal_update_input_context;
+ InfoManagerSignalIntInt m_signal_set_candidate_ui;
+ InfoManagerSignalIntInt2 m_signal_get_candidate_ui;
+ InfoManagerSignalIntInt m_signal_set_candidate_position;
+ InfoManagerSignalRect m_signal_get_candidate_geometry;
+ InfoManagerSignalRect m_signal_get_input_panel_geometry;
+ InfoManagerSignalString m_signal_set_keyboard_ise;
+ InfoManagerSignalString2 m_signal_get_keyboard_ise;
+ InfoManagerSignalString m_signal_show_help;
+ InfoManagerSignalFactoryInfoVector m_signal_show_factory_menu;
+ InfoManagerSignalVoid m_signal_show_preedit_string;
+ InfoManagerSignalVoid m_signal_show_aux_string;
+ InfoManagerSignalVoid m_signal_show_lookup_table;
+ InfoManagerSignalVoid m_signal_show_associate_table;
+ InfoManagerSignalVoid m_signal_hide_preedit_string;
+ InfoManagerSignalVoid m_signal_hide_aux_string;
+ InfoManagerSignalVoid m_signal_hide_lookup_table;
+ InfoManagerSignalVoid m_signal_hide_associate_table;
+ InfoManagerSignalAttributeStringInt m_signal_update_preedit_string;
+ InfoManagerSignalInt m_signal_update_preedit_caret;
+ InfoManagerSignalAttributeString m_signal_update_aux_string;
+ InfoManagerSignalLookupTable m_signal_update_lookup_table;
+ InfoManagerSignalLookupTable m_signal_update_associate_table;
+ InfoManagerSignalPropertyList m_signal_register_properties;
+ InfoManagerSignalProperty m_signal_update_property;
+ InfoManagerSignalIntPropertyList m_signal_register_helper_properties;
+ InfoManagerSignalIntProperty m_signal_update_helper_property;
+ InfoManagerSignalIntHelperInfo m_signal_register_helper;
+ InfoManagerSignalInt m_signal_remove_helper;
+ InfoManagerSignalStringBool m_signal_set_active_ise_by_uuid;
+ InfoManagerSignalVoid m_signal_focus_in;
+ InfoManagerSignalVoid m_signal_focus_out;
+ InfoManagerSignalVoid m_signal_expand_candidate;
+ InfoManagerSignalVoid m_signal_contract_candidate;
+ InfoManagerSignalInt m_signal_select_candidate;
+ InfoManagerSignalBoolStringVector m_signal_get_ise_list;
+ InfoManagerSignalBoolHelperInfo m_signal_get_all_helper_ise_info;
+ InfoManagerSignalStringBool m_signal_set_has_option_helper_ise_info;
+ InfoManagerSignalStringBool m_signal_set_enable_helper_ise_info;
+ InfoManagerSignalVoid m_signal_show_helper_ise_list;
+ InfoManagerSignalVoid m_signal_show_helper_ise_selector;
+ InfoManagerSignalStringInt m_signal_is_helper_ise_enabled;
+ InfoManagerSignalBoolString4int2 m_signal_get_ise_information;
+ InfoManagerSignalBoolStringVector m_signal_get_keyboard_ise_list;
+ InfoManagerSignalIntIntIntInt m_signal_update_ise_geometry;
+ InfoManagerSignalStringVector m_signal_get_language_list;
+ InfoManagerSignalStringVector m_signal_get_all_language;
+ InfoManagerSignalStrStringVector m_signal_get_ise_language;
+ InfoManagerSignalStringISEINFO m_signal_get_ise_info_by_uuid;
+ InfoManagerSignalKeyEvent m_signal_send_key_event;
+
+ InfoManagerSignalInt m_signal_accept_connection;
+ InfoManagerSignalInt m_signal_close_connection;
+ InfoManagerSignalVoid m_signal_exit;
+
+ InfoManagerSignalVoid m_signal_transaction_start;
+ InfoManagerSignalVoid m_signal_transaction_end;
+
+ InfoManagerSignalVoid m_signal_lock;
+ InfoManagerSignalVoid m_signal_unlock;
+
+ InfoManagerSignalVoid m_signal_show_ise;
+ InfoManagerSignalVoid m_signal_hide_ise;
+
+ InfoManagerSignalVoid m_signal_will_show_ack;
+ InfoManagerSignalVoid m_signal_will_hide_ack;
+
+ InfoManagerSignalInt m_signal_set_keyboard_mode;
+
+ InfoManagerSignalVoid m_signal_candidate_will_hide_ack;
+ InfoManagerSignalInt2 m_signal_get_ise_state;
+
+ InfoManagerSignalIntRect m_signal_get_recent_ise_geometry;
+
+ InfoManagerSignalIntString2 m_signal_check_privilege_by_sockfd;
+
+ PanelAgentManager m_panel_agent_manager;
+
+
+public:
+ InfoManagerImpl ()
+ : m_current_screen (0),
+ m_current_socket_client (-1), m_current_client_context (0),
+ m_current_toolbar_mode (TOOLBAR_KEYBOARD_MODE),
+ m_current_helper_option (0),
+ m_pending_active_imcontrol_id (-1),
+ m_show_request_client_id (-1),
+ m_active_client_id (-1),
+ m_should_shared_ise (false),
+ m_ise_exiting (false), m_is_imengine_aux (false), m_is_imengine_candidate (false),
+ m_last_socket_client (-1), m_last_client_context (0),
+ m_ise_context_buffer (NULL), m_ise_context_length (0) {
+ m_current_ise_name = String (_ ("English Keyboard"));
+ m_imcontrol_repository.clear ();
+ m_imcontrol_map.clear ();
+ m_panel_client_map.clear ();
+ }
+
+ ~InfoManagerImpl () {
+ delete_ise_context_buffer ();
+ }
+
+ void delete_ise_context_buffer (void) {
+ if (m_ise_context_buffer != NULL) {
+ delete[] m_ise_context_buffer;
+ m_ise_context_buffer = NULL;
+ m_ise_context_length = 0;
+ }
+ }
+
+ bool initialize (InfoManager* info_manager, const ConfigPointer& config, const String& display, bool resident) {
+
+
+ //set config name as empty, scim_helper_launcher will read from global config
+ m_config_name = "";
+ m_display_name = display;
+
+ /* If our helper manager could not connect to the HelperManager process,
+ this panel agent's initialization has failed - since we are assuming
+ the helper manager process should be launched beforehand */
+ if (m_helper_manager.get_connection_number () == -1) {
+ ISF_SAVE_LOG ("Fail to get connection with HelperManager!\n");
+ return false;
+ }
+
+ return m_panel_agent_manager.initialize (info_manager, config, display, resident);
+ }
+
+ bool valid (void) const {
+ return m_panel_agent_manager.valid ();
+ }
+
+public:
+
+ void stop (void) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::stop ()\n";
+ LOGD ("");
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ String helper_uuid = get_current_helper_uuid ();
+ hide_helper (helper_uuid);
+ stop_helper (helper_uuid, -2, 0);
+ }
+
+ m_panel_agent_manager.stop ();
+ }
+
+ int get_helper_list (std::vector <HelperInfo>& helpers) const {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::get_helper_list ()\n";
+ LOGD ("");
+ helpers.clear ();
+ m_helper_manager.get_helper_list ();
+ unsigned int num = m_helper_manager.number_of_helpers ();
+ HelperInfo info;
+ SCIM_DEBUG_MAIN (2) << "Found " << num << " Helper objects\n";
+
+ for (unsigned int i = 0; i < num; ++i) {
+ if (m_helper_manager.get_helper_info (i, info) && info.uuid.length ()
+ && (info.option & SCIM_HELPER_STAND_ALONE))
+ helpers.push_back (info);
+
+ SCIM_DEBUG_MAIN (3) << "Helper " << i << " : " << info.uuid << " : " << info.name << " : "
+ << ((info.option & SCIM_HELPER_STAND_ALONE) ? "SA " : "")
+ << ((info.option & SCIM_HELPER_AUTO_START) ? "AS " : "")
+ << ((info.option & SCIM_HELPER_AUTO_RESTART) ? "AR " : "") << "\n";
+ }
+
+ return (int) (helpers.size ());
+ }
+
+ TOOLBAR_MODE_T get_current_toolbar_mode () const {
+ return m_current_toolbar_mode;
+ }
+
+ String get_current_ise_name () const {
+ return m_current_ise_name;
+ }
+
+ String get_current_helper_uuid () const {
+ return m_current_helper_uuid;
+ }
+
+ String get_current_helper_name () const {
+ std::vector<HelperInfo> helpers;
+ get_helper_list (helpers);
+ std::vector<HelperInfo>::iterator iter;
+
+ for (iter = helpers.begin (); iter != helpers.end (); iter++) {
+ if (iter->uuid == m_current_helper_uuid)
+ return iter->name;
+ }
+
+ return String ("");
+ }
+
+ uint32 get_current_helper_option () const {
+ return m_current_helper_option;
+ }
+
+ void set_current_ise_name (String& name) {
+ m_current_ise_name = name;
+ }
+
+ void set_current_toolbar_mode (TOOLBAR_MODE_T mode) {
+ m_current_toolbar_mode = mode;
+ }
+
+ void set_current_helper_option (uint32 option) {
+ m_current_helper_option = option;
+ }
+
+ void update_panel_event (int cmd, uint32 nType, uint32 nValue) {
+ LOGD ("");
+ int focused_client;
+ uint32 focused_context;
+ get_focused_context (focused_client, focused_context);
+
+ if (focused_client == -1 && m_active_client_id != -1) {
+ focused_client = m_panel_client_map[m_active_client_id];
+ focused_context = 0;
+ }
+
+ SCIM_DEBUG_MAIN (1) << __func__ << " (" << nType << ", " << nValue << "), client=" << focused_client << "\n";
+ ClientInfo client_info = socket_get_client_info (focused_client);
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ m_panel_agent_manager.update_panel_event (focused_client, focused_context, cmd, nType, nValue);
+ } else {
+ std::cerr << __func__ << " focused client is not existed!!!" << "\n";
+ }
+
+ if (m_panel_client_map[m_show_request_client_id] != focused_client) {
+ client_info = socket_get_client_info (m_panel_client_map[m_show_request_client_id]);
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ m_panel_agent_manager.update_panel_event (m_panel_client_map[m_show_request_client_id], 0, cmd, nType, nValue);
+ std::cerr << __func__ << " show request client=" << m_panel_client_map[m_show_request_client_id] << "\n";
+ } else {
+ std::cerr << __func__ << " show request client is not existed!!!" << "\n";
+ }
+ }
+ }
+
+ bool move_preedit_caret (uint32 position) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::move_preedit_caret (" << position << ")\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ lock ();
+ get_focused_context (client, context);
+
+ if (client >= 0) {
+ m_panel_agent_manager.update_preedit_caret (client, context, position);
+ }
+
+ unlock ();
+ return client >= 0;
+ }
+//useless
+#if 0
+ bool request_help (void) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::request_help ()\n";
+ int client;
+ uint32 context;
+ lock ();
+ get_focused_context (client, context);
+
+ if (client >= 0) {
+ m_panel_agent_manager.request_help (client, context);
+ }
+
+ unlock ();
+ return client >= 0;
+ }
+
+ bool request_factory_menu (void) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::request_factory_menu ()\n";
+ int client;
+ uint32 context;
+ lock ();
+ get_focused_context (client, context);
+
+ if (client >= 0) {
+ m_panel_agent_manager.request_factory_menu (client, context);
+ }
+
+ unlock ();
+ return client >= 0;
+ }
+#endif
+
+ //ISM_TRANS_CMD_PANEL_RESET_KEYBOARD_ISE
+ bool reset_keyboard_ise (void) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (1) << "InfoManager::reset_keyboard_ise ()\n";
+ int client = -1;
+ uint32 context = 0;
+ lock ();
+ get_focused_context (client, context);
+
+ if (client >= 0) {
+ m_panel_agent_manager.reset_keyboard_ise (client, context);
+ }
+
+ unlock ();
+ return client >= 0;
+ }
+
+ bool update_keyboard_ise_list (void) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (1) << "InfoManager::update_keyboard_ise_list ()\n";
+ int client = -1;
+ uint32 context = 0;
+ lock ();
+ get_focused_context (client, context);
+
+ if (client >= 0) {
+ m_panel_agent_manager.update_keyboard_ise_list (client, context);
+ }
+
+ unlock ();
+ return client >= 0;
+ }
+
+ bool change_factory (const String& uuid) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::change_factory (" << uuid << ")\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+
+ if (scim_global_config_read (SCIM_GLOBAL_CONFIG_PRELOAD_KEYBOARD_ISE, false))
+ m_helper_manager.preload_keyboard_ise (uuid);
+
+ lock ();
+ get_focused_context (client, context);
+
+ if (client >= 0) {
+ m_panel_agent_manager.change_factory (client, context, uuid);
+ }
+
+ unlock ();
+ return client >= 0;
+ }
+
+ bool helper_candidate_show (void) {
+ SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ get_focused_context (client, context);
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ uint32 ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.helper_candidate_show (it->second.id, ctx, m_current_helper_uuid);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool helper_candidate_hide (void) {
+ SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ get_focused_context (client, context);
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ uint32 ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.helper_candidate_hide (it->second.id, ctx, m_current_helper_uuid);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool candidate_more_window_show (void) {
+ SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ get_focused_context (client, context);
+
+ if (m_is_imengine_candidate) {
+ if (client >= 0) {
+ m_panel_agent_manager.candidate_more_window_show (client, context);
+ return true;
+ }
+ } else {
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ uint32 ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.candidate_more_window_show (it->second.id, ctx);
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ bool candidate_more_window_hide (void) {
+ SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ get_focused_context (client, context);
+
+ if (m_is_imengine_candidate) {
+ if (client >= 0) {
+ m_panel_agent_manager.candidate_more_window_hide (client, context);
+ return true;
+ }
+ } else {
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ uint32 ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.candidate_more_window_hide (it->second.id, ctx);
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ bool update_helper_lookup_table (const LookupTable& table) {
+ SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.update_helper_lookup_table (it->second.id, ctx, m_current_helper_uuid, table);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool select_aux (uint32 item) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::select_aux (" << item << ")\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ lock ();
+ get_focused_context (client, context);
+
+ if (m_is_imengine_aux) {
+ if (client >= 0) {
+ m_panel_agent_manager.select_aux (client, context, item);
+ }
+ } else {
+ helper_select_aux (item);
+ }
+
+ unlock ();
+ return client >= 0;
+ }
+
+ bool select_candidate (uint32 item) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::select_candidate (" << item << ")\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ lock ();
+ get_focused_context (client, context);
+
+ if (m_is_imengine_candidate) {
+ if (client >= 0) {
+ m_panel_agent_manager.select_candidate (client, context, item);
+ }
+ } else {
+ helper_select_candidate (item);
+ }
+
+ unlock ();
+ return client >= 0;
+ }
+
+ bool lookup_table_page_up (void) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::lookup_table_page_up ()\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ lock ();
+ get_focused_context (client, context);
+
+ if (m_is_imengine_candidate) {
+ if (client >= 0) {
+ m_panel_agent_manager.lookup_table_page_up (client, context);
+ }
+ } else {
+ helper_lookup_table_page_up ();
+ }
+
+ unlock ();
+ return client >= 0;
+ }
+
+ bool lookup_table_page_down (void) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::lookup_table_page_down ()\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ lock ();
+ get_focused_context (client, context);
+
+ if (m_is_imengine_candidate) {
+ if (client >= 0) {
+ m_panel_agent_manager.lookup_table_page_down (client, context);
+ }
+ } else {
+ helper_lookup_table_page_down ();
+ }
+
+ unlock ();
+ return client >= 0;
+ }
+
+ bool update_lookup_table_page_size (uint32 size) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::update_lookup_table_page_size (" << size << ")\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ lock ();
+ get_focused_context (client, context);
+
+ if (m_is_imengine_candidate) {
+ if (client >= 0) {
+ m_panel_agent_manager.update_lookup_table_page_size (client, context, size);
+ }
+ } else {
+ helper_update_lookup_table_page_size (size);
+ }
+
+ unlock ();
+ return client >= 0;
+ }
+
+ bool update_candidate_item_layout (const std::vector<uint32>& row_items) {
+ SCIM_DEBUG_MAIN (1) << __func__ << " (" << row_items.size () << ")\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ lock ();
+ get_focused_context (client, context);
+
+ if (m_is_imengine_candidate) {
+ if (client >= 0) {
+ m_panel_agent_manager.update_candidate_item_layout (client, context, row_items);
+ }
+ } else {
+ helper_update_candidate_item_layout (row_items);
+ }
+
+ unlock ();
+ return client >= 0;
+ }
+
+ bool select_associate (uint32 item) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::select_associate (" << item << ")\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ lock ();
+ get_focused_context (client, context);
+
+ if (client >= 0) {
+ m_panel_agent_manager.select_associate (client, context, item);
+ }
+
+ unlock ();
+ helper_select_associate (item);
+ return client >= 0;
+ }
+
+ bool associate_table_page_up (void) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::associate_table_page_up ()\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ lock ();
+ get_focused_context (client, context);
+
+ if (client >= 0) {
+ m_panel_agent_manager.associate_table_page_up (client, context);
+ }
+
+ unlock ();
+ helper_associate_table_page_up ();
+ return client >= 0;
+ }
+
+ bool associate_table_page_down (void) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::associate_table_page_down ()\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ lock ();
+ get_focused_context (client, context);
+
+ if (client >= 0) {
+ m_panel_agent_manager.associate_table_page_down (client, context);
+ }
+
+ unlock ();
+ helper_associate_table_page_down ();
+ return client >= 0;
+ }
+
+ bool update_associate_table_page_size (uint32 size) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::update_associate_table_page_size (" << size << ")\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ lock ();
+ get_focused_context (client, context);
+
+ if (client >= 0) {
+ m_panel_agent_manager.update_associate_table_page_size (client, context, size);
+ }
+
+ unlock ();
+ helper_update_associate_table_page_size (size);
+ return client >= 0;
+ }
+
+ bool update_displayed_candidate_number (uint32 size) {
+ SCIM_DEBUG_MAIN (1) << __func__ << " (" << size << ")\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ lock ();
+ get_focused_context (client, context);
+
+ if (m_is_imengine_candidate) {
+ if (client >= 0) {
+ m_panel_agent_manager.update_displayed_candidate_number (client, context, size);
+ }
+ } else {
+ helper_update_displayed_candidate_number (size);
+ }
+
+ unlock ();
+ return client >= 0;
+ }
+
+ void send_longpress_event (int type, int index) {
+ SCIM_DEBUG_MAIN (1) << __func__ << " (" << type << ", " << index << ")\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ get_focused_context (client, context);
+
+ if (m_is_imengine_candidate) {
+ if (client >= 0) {
+ m_panel_agent_manager.send_longpress_event (client, context, index);
+ }
+ } else {
+ helper_longpress_candidate (index);
+ }
+ }
+
+ bool trigger_property (const String& property) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::trigger_property (" << property << ")\n";
+ LOGD ("");
+ int client;
+ uint32 context;
+ lock ();
+ get_focused_context (client, context);
+
+ if (client >= 0) {
+ m_panel_agent_manager.trigger_property (client, context, property);
+ }
+
+ unlock ();
+ return client >= 0;
+ }
+
+ bool start_helper (const String& uuid, int client, uint32 context) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::start_helper (" << uuid << ")\n";
+ LOGD ("start ISE(%s)", uuid.c_str ());
+
+ if (uuid.length () <= 0)
+ return false;
+
+ lock ();
+ /*if (m_current_toolbar_mode != TOOLBAR_HELPER_MODE || m_current_helper_uuid.compare (uuid) != 0)*/ {
+ SCIM_DEBUG_MAIN (1) << "Run_helper\n";
+ m_helper_manager.run_helper (uuid, m_config_name, m_display_name);
+ }
+ m_current_helper_uuid = uuid;
+ unlock ();
+ return true;
+ }
+
+ bool stop_helper (const String& uuid, int client, uint32 context) {
+ char buf[256] = {0};
+ snprintf (buf, sizeof (buf), "time:%ld pid:%d %s %s prepare to stop ISE(%s)\n",
+ time (0), getpid (), __FILE__, __func__, uuid.c_str ());
+ LOGD ("prepare to stop ISE(%s)", uuid.c_str ());
+ SCIM_DEBUG_MAIN (1) << "InfoManager::stop_helper (" << uuid << ")\n";
+
+ if (uuid.length () <= 0)
+ return false;
+
+ lock ();
+ uint32 ctx = get_helper_ic (client, context);
+ HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ m_ise_exiting = true;
+ m_current_helper_uuid = String ("");
+ m_panel_agent_manager.exit (it->second.id, ctx);
+ SCIM_DEBUG_MAIN (1) << "Stop helper\n";
+ ISF_SAVE_LOG ("send SCIM_TRANS_CMD_EXIT message to %s\n", uuid.c_str ());
+ }
+
+ unlock ();
+ return true;
+ }
+
+ void focus_out_helper (const String& uuid, int client, uint32 context) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ uint32 ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.focus_out_helper (it->second.id, ctx, uuid);
+ }
+ }
+
+ void focus_in_helper (const String& uuid, int client, uint32 context) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ uint32 ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.focus_in_helper (it->second.id, ctx, uuid);
+ }
+ }
+
+ bool show_helper (const String& uuid, char* data, size_t& len, uint32 ctx) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ Socket client_socket (it->second.id);
+ m_panel_agent_manager.show_helper (it->second.id, ctx, uuid, data, len);
+ LOGD ("Send ISM_TRANS_CMD_SHOW_ISE_PANEL message");
+ return true;
+ }
+
+ LOGW ("Can't find %s", m_current_helper_uuid.c_str ());
+ return false;
+ }
+
+ void hide_helper (const String& uuid, uint32 ctx = 0) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+ LOGD ("");
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+
+ if (ctx == 0) {
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ }
+
+ m_panel_agent_manager.hide_helper (it->second.id, ctx, uuid);
+ LOGD ("Send ISM_TRANS_CMD_HIDE_ISE_PANEL message");
+ }
+ }
+
+ bool set_helper_mode (const String& uuid, uint32& mode) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.set_helper_mode (it->second.id, ctx, uuid, mode);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool set_helper_language (const String& uuid, uint32& language) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client = -1;
+ uint32 context = 0;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.set_helper_language (it->second.id, ctx, uuid, language);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool set_helper_imdata (const String& uuid, const char* imdata, size_t& len) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client = -1;
+ uint32 context = 0;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.set_helper_imdata (it->second.id, ctx, uuid, imdata, len);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool set_helper_return_key_type (const String& uuid, int type) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client = -1;
+ uint32 context = 0;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.set_helper_return_key_type (it->second.id, ctx, uuid, type);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool get_helper_return_key_type (const String& uuid, uint32& type) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.get_helper_return_key_type (it->second.id, ctx, uuid, type);
+ }
+
+ return false;
+ }
+
+ bool set_helper_return_key_disable (const String& uuid, bool disabled) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client = -1;
+ uint32 context = 0;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.set_helper_return_key_disable (it->second.id, ctx, uuid, disabled);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool get_helper_return_key_disable (const String& uuid, uint32& disabled) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.get_helper_return_key_disable (it->second.id, ctx, uuid, disabled);
+ }
+
+ return false;
+ }
+
+ bool set_helper_layout (const String& uuid, uint32& layout) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.set_helper_layout (it->second.id, ctx, uuid, layout);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool set_helper_input_mode (const String& uuid, uint32& mode) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.set_helper_input_mode (it->second.id, ctx, uuid, mode);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool set_helper_input_hint (const String& uuid, uint32& hint) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.set_helper_input_hint (it->second.id, ctx, uuid, hint);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool set_helper_bidi_direction (const String& uuid, uint32& direction) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.set_helper_bidi_direction (it->second.id, ctx, uuid, direction);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool set_helper_caps_mode (const String& uuid, uint32& mode) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.set_helper_caps_mode (it->second.id, ctx, uuid, mode);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool show_helper_option_window (const String& uuid) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ LOGD ("Send ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW message");
+ m_panel_agent_manager.show_helper_option_window (it->second.id, ctx, uuid);
+ return true;
+ }
+
+ return false;
+ }
+ //ISM_TRANS_CMD_SHOW_ISF_CONTROL
+ void show_isf_panel (int client_id) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "InfoManager::show_isf_panel ()\n";
+ m_signal_show_panel ();
+ }
+ //ISM_TRANS_CMD_HIDE_ISF_CONTROL
+ void hide_isf_panel (int client_id) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "InfoManager::hide_isf_panel ()\n";
+ m_signal_hide_panel ();
+ }
+
+ //ISM_TRANS_CMD_SHOW_ISE_PANEL
+ void show_ise_panel (int client_id, uint32 client, uint32 context, char* data, size_t len) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::show_ise_panel ()\n";
+ LOGD ("");
+ String initial_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String (""));
+ String default_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
+ LOGD ("prepare to show ISE %d [%s] [%s]", client_id, initial_uuid.c_str (), default_uuid.c_str ());
+ bool ret = false;
+ m_show_request_client_id = client_id;
+ m_active_client_id = client_id;
+ SCIM_DEBUG_MAIN (4) << __func__ << " (client:" << client << " context:" << context << ")\n";
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode) {
+ uint32 ctx = get_helper_ic (client, context);
+ ret = show_helper (m_current_helper_uuid, data, len, ctx);
+ }
+
+ /* Save ISE context for ISE panel re-showing */
+ if (data && len > 0) {
+ delete_ise_context_buffer ();
+ m_ise_context_buffer = new char [len];
+
+ if (m_ise_context_buffer) {
+ m_ise_context_length = len;
+ memcpy (m_ise_context_buffer, data, m_ise_context_length);
+ }
+ }
+
+ if (ret) {
+ m_signal_show_ise ();
+ } else {
+ m_signal_start_default_ise ();
+ }
+ }
+
+ //ISM_TRANS_CMD_HIDE_ISE_PANEL
+ void hide_ise_panel (int client_id, uint32 client, uint32 context) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::hide_ise_panel ()\n";
+ LOGD ("prepare to hide ISE, %d %d", client_id, m_show_request_client_id);
+ SCIM_DEBUG_MAIN (4) << __func__ << " (client:" << client << " context:" << context << ")\n";
+
+ if ((m_panel_client_map[client_id] == m_current_socket_client || client_id == m_show_request_client_id)
+ && (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)) {
+ int focused_client;
+ uint32 focused_context;
+ get_focused_context (focused_client, focused_context);
+
+ if (focused_client == -1 && m_active_client_id != -1) {
+ focused_client = m_panel_client_map[m_active_client_id];
+ focused_context = 0;
+ }
+
+ m_signal_hide_ise ();
+ }
+
+ /* Release ISE context buffer */
+ delete_ise_context_buffer ();
+ }
+
+ void set_default_ise (const DEFAULT_ISE_T& ise) {
+ LOGD ("");
+ scim_global_config_write (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), ise.uuid);
+ scim_global_config_flush ();
+ }
+
+ void set_should_shared_ise (const bool should_shared_ise) {
+ LOGD ("");
+ m_should_shared_ise = should_shared_ise;
+ }
+ //SCIM_TRANS_CMD_PROCESS_KEY_EVENT
+ bool process_key_event (KeyEvent& key, _OUT_ uint32& result) {
+ LOGD ("");
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ return m_panel_agent_manager.process_key_event (it->second.id, ctx, m_current_helper_uuid, key, result);
+ }
+
+ return false;
+ }
+
+ bool get_helper_geometry (String& uuid, struct rectinfo& info) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ return m_panel_agent_manager.get_helper_geometry (it->second.id, ctx, uuid, info);
+ }
+
+ return false;
+ }
+
+ bool get_helper_imdata (String& uuid, char** imdata, size_t& len) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.get_helper_imdata (it->second.id, ctx, uuid, imdata, len);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool get_helper_layout (String& uuid, uint32& layout) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.get_helper_layout (it->second.id, ctx, uuid, layout);
+ return true;
+ }
+
+ return false;
+ }
+ //ISM_TRANS_CMD_GET_ACTIVE_ISE_GEOMETRY
+ void get_input_panel_geometry (int client_id, _OUT_ struct rectinfo& info) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+ LOGD ("");
+ m_signal_get_input_panel_geometry (info);
+ }
+ //ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY
+ void get_candidate_window_geometry (int client_id, _OUT_ struct rectinfo& info) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+ LOGD ("");
+ m_signal_get_candidate_geometry (info);
+ }
+ //ISM_TRANS_CMD_GET_ISE_LANGUAGE_LOCALE
+ void get_ise_language_locale (int client_id, _OUT_ char* data, _OUT_ size_t& len) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+ LOGD ("");
+ Transaction trans;
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ get_focused_context (client, context);
+ uint32 ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.get_ise_language_locale (it->second.id, ctx, m_current_helper_uuid, data, len);
+ }
+ }
+ }
+
+ void get_current_ise_geometry (rectinfo& rect) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << __func__ << " \n";
+ bool ret = false;
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ ret = get_helper_geometry (m_current_helper_uuid, rect);
+
+ if (!ret) {
+ rect.pos_x = 0;
+ rect.pos_y = 0;
+ rect.width = 0;
+ rect.height = 0;
+ }
+ }
+
+ void set_ise_mode (int client_id, uint32 mode) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::set_ise_mode ()\n";
+ LOGD ("");
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ set_helper_mode (m_current_helper_uuid, mode);
+ }
+ //ISM_TRANS_CMD_SET_LAYOUT
+ void set_ise_layout (int client_id, uint32 layout) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::set_ise_layout ()\n";
+ LOGD ("");
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ set_helper_layout (m_current_helper_uuid, layout);
+ }
+ //ISM_TRANS_CMD_SET_INPUT_MODE
+ void set_ise_input_mode (int client_id, uint32 input_mode) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::set_ise_input_mode ()\n";
+ LOGD ("");
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ set_helper_input_mode (m_current_helper_uuid, input_mode);
+ }
+ //ISM_TRANS_CMD_SET_INPUT_HINT
+ void set_ise_input_hint (int client_id, uint32 input_hint) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::set_ise_input_hint ()\n";
+ LOGD ("");
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ set_helper_input_hint (m_current_helper_uuid, input_hint);
+ }
+ //ISM_TRANS_CMD_UPDATE_BIDI_DIRECTION
+ void update_ise_bidi_direction (int client_id, uint32 bidi_direction) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "InfoManager::update_ise_bidi_direction ()\n";
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ set_helper_bidi_direction (m_current_helper_uuid, bidi_direction);
+ }
+ //ISM_TRANS_CMD_SET_ISE_LANGUAGE
+ void set_ise_language (int client_id, uint32 language) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::set_ise_language ()\n";
+ LOGD ("");
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ set_helper_language (m_current_helper_uuid, language);
+ }
+ //ISM_TRANS_CMD_SET_ISE_IMDATA
+ void set_ise_imdata (int client_id, const char* imdata, size_t len) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::set_ise_imdata ()\n";
+ LOGD ("");
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ set_helper_imdata (m_current_helper_uuid, imdata, len);
+ }
+ //ISM_TRANS_CMD_GET_ISE_IMDATA
+ bool get_ise_imdata (int client_id, _OUT_ char** imdata, _OUT_ size_t& len) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::get_ise_imdata ()\n";
+ bool ret = false;
+ LOGD ("");
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ ret = get_helper_imdata (m_current_helper_uuid, imdata, len);
+
+ return ret;
+ }
+ //ISM_TRANS_CMD_GET_LAYOUT
+ bool get_ise_layout (int client_id, _OUT_ uint32& layout) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::get_ise_layout ()\n";
+ bool ret = false;
+ LOGD ("");
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ ret = get_helper_layout (m_current_helper_uuid, layout);
+
+ return ret;
+ }
+ //ISM_TRANS_CMD_GET_ISE_STATE
+ void get_ise_state (int client_id, _OUT_ int& state) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+ LOGD ("");
+ m_signal_get_ise_state (state);
+ }
+ //ISM_TRANS_CMD_GET_ACTIVE_ISE
+ void get_active_ise (int client_id, _OUT_ String& default_uuid) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+ default_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
+ }
+ //ISM_TRANS_CMD_GET_ISE_LIST
+ void get_ise_list (int client_id, _OUT_ std::vector<String>& strlist) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "InfoManager::get_ise_list ()\n";
+ m_signal_get_ise_list (strlist);
+ }
+ //ISM_TRANS_CMD_GET_ALL_HELPER_ISE_INFO
+ void get_all_helper_ise_info (int client_id, _OUT_ HELPER_ISE_INFO& info) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::get_all_helper_ise_info ()\n";
+ LOGD ("");
+ m_signal_get_all_helper_ise_info (info);
+
+ //1 Check if the current IME's option (setting) is available or not.
+ for (uint32 i = 0; i < info.appid.size (); i++) {
+ if (m_current_helper_uuid.compare (info.appid [i]) == 0) { // Find the current IME
+ // If the current IME's "has_option" is unknown (-1), get it through ISM_TRANS_CMD_CHECK_OPTION_WINDOW command.
+ // And it's saved to ime_info DB. Then next time this will be skipped.
+ if (info.has_option [i] >= 2) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ get_focused_context (client, context);
+ uint32 ctx = get_helper_ic (client, context);
+ uint32 avail = static_cast<uint32> (-1);
+ m_panel_agent_manager.check_option_window (it->second.id, ctx, m_current_helper_uuid, avail);
+
+ if (avail < 2) {
+ info.has_option [i] = avail;
+ // Update "has_option" column of ime_info DB and global variable.
+ m_signal_set_has_option_helper_ise_info (info.appid [i], static_cast<bool> (avail));
+ }
+ }
+ }
+ }
+ }
+ }
+ //ISM_TRANS_CMD_SET_ENABLE_HELPER_ISE_INFO
+ //reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
+ void set_enable_helper_ise_info (int client_id, String appid, uint32 is_enabled) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "InfoManager::set_enable_helper_ise_info ()\n";
+ m_signal_set_enable_helper_ise_info (appid, static_cast<bool> (is_enabled));
+ }
+ //ISM_TRANS_CMD_SHOW_HELPER_ISE_LIST
+ //reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
+ void show_helper_ise_list (int client_id) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::show_helper_ise_list ()\n";
+ LOGD ("");
+ m_signal_show_helper_ise_list ();
+ }
+ //ISM_TRANS_CMD_SHOW_HELPER_ISE_SELECTOR
+ //reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
+ void show_helper_ise_selector (int client_id) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::show_helper_ise_selector ()\n";
+ LOGD ("");
+ m_signal_show_helper_ise_selector ();
+ }
+ //ISM_TRANS_CMD_IS_HELPER_ISE_ENABLED
+ //reply
+ void is_helper_ise_enabled (int client_id, String strAppid, _OUT_ uint32& nEnabled) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+ LOGD ("");
+ int _nEnabled = 0;
+ m_signal_is_helper_ise_enabled (strAppid, _nEnabled);
+ nEnabled = (uint32)_nEnabled;
+ }
+ //ISM_TRANS_CMD_GET_ISE_INFORMATION
+ void get_ise_information (int client_id, String strUuid, _OUT_ String& strName, _OUT_ String& strLanguage,
+ _OUT_ int& nType, _OUT_ int& nOption, _OUT_ String& strModuleName) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+ LOGD ("");
+ m_signal_get_ise_information (strUuid, strName, strLanguage, nType, nOption, strModuleName);
+ }
+ /*
+ * useless
+ */
+ void get_language_list (int client_id, _OUT_ std::vector<String>& strlist) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::get_language_list ()\n";
+ m_signal_get_language_list (strlist);
+ }
+
+ void get_all_language (int client_id, _OUT_ std::vector<String>& strlist) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::get_all_language ()\n";
+ m_signal_get_all_language (strlist);
+ }
+ /*
+ * useless
+ */
+ void get_ise_language (int client_id, char* buf, size_t len, _OUT_ std::vector<String>& strlist) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::get_ise_language ()\n";
+ m_signal_get_ise_language (buf, strlist);
+ }
+ //ISM_TRANS_CMD_RESET_ISE_OPTION
+ //reply SCIM_TRANS_CMD_OK
+ bool reset_ise_option (int client_id) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::resect_ise_option ()\n";
+ LOGD ("");
+ int client = -1;
+ uint32 context;
+ lock ();
+ ClientContextUUIDRepository::iterator it = m_client_context_uuids.begin ();
+
+ if (it != m_client_context_uuids.end ()) {
+ get_imengine_client_context (it->first, client, context);
+ }
+
+ if (client >= 0) {
+ m_panel_agent_manager.reset_ise_option (client, context);
+ }
+
+ unlock ();
+ return client >= 0;
+ }
+
+ bool find_active_ise_by_uuid (String uuid) {
+ HelperInfoRepository::iterator iter = m_helper_info_repository.begin ();
+
+ for (; iter != m_helper_info_repository.end (); iter++) {
+ if (!uuid.compare (iter->second.uuid))
+ return true;
+ }
+
+ return false;
+ }
+ //ISM_TRANS_CMD_SET_ACTIVE_ISE_BY_UUID
+ //reply
+ bool set_active_ise_by_uuid (int client_id, char* buf, size_t len) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::set_active_ise_by_uuid ()\n";
+ LOGD ("");
+
+ if (buf == NULL) {
+ return false;
+ }
+
+ String uuid (buf);
+ ISE_INFO info;
+
+ if (!m_signal_get_ise_info_by_uuid (uuid, info)) {
+ return false;
+ }
+
+ if (info.type == TOOLBAR_KEYBOARD_MODE) {
+ m_signal_set_active_ise_by_uuid (uuid, 1);
+ return true;
+ } else if (info.option & ISM_ISE_HIDE_IN_CONTROL_PANEL) {
+ int count = _id_count--;
+
+ if (info.type == TOOLBAR_HELPER_MODE) {
+ m_current_toolbar_mode = TOOLBAR_HELPER_MODE;
+
+ if (uuid != m_current_helper_uuid)
+ m_last_helper_uuid = m_current_helper_uuid;
+
+ start_helper (uuid, count, DEFAULT_CONTEXT_VALUE);
+ IMControlRepository::iterator iter = m_imcontrol_repository.find (client_id);
+
+ if (iter == m_imcontrol_repository.end ()) {
+ struct IMControlStub stub;
+ stub.count.clear ();
+ stub.info.clear ();
+ stub.info.push_back (info);
+ stub.count.push_back (count);
+ m_imcontrol_repository[client_id] = stub;
+ } else {
+ iter->second.info.push_back (info);
+ iter->second.count.push_back (count);
+ }
+ }
+ } else {
+ m_signal_set_active_ise_by_uuid (uuid, 1);
+ }
+
+ sync ();
+
+ if (find_active_ise_by_uuid (uuid)) {
+ return true;
+ } else {
+ m_ise_pending_repository[uuid] = client_id;
+ return false;
+ }
+ }
+ //ISM_TRANS_CMD_SET_INITIAL_ISE_BY_UUID
+ //reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
+ void set_initial_ise_by_uuid (int client_id, char* buf, size_t len) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::set_initial_ise_by_uuid ()\n";
+ LOGD ("");
+
+ if (buf == NULL) {
+ return;
+ }
+
+ String uuid (buf);
+ scim_global_config_write (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String (uuid));
+ scim_global_config_flush ();
+ }
+ //ISM_TRANS_CMD_SET_RETURN_KEY_TYPE
+ void set_ise_return_key_type (int client_id, uint32 type) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+ LOGD ("");
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ set_helper_return_key_type (m_current_helper_uuid, type);
+ }
+ //ISM_TRANS_CMD_GET_RETURN_KEY_TYPE
+ //reply
+ bool get_ise_return_key_type (int client_id, _OUT_ uint32& type) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+ bool ret = false;
+ LOGD ("");
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ ret = get_helper_return_key_type (m_current_helper_uuid, type);
+
+ return ret;
+ }
+ //ISM_TRANS_CMD_SET_RETURN_KEY_DISABLE
+ void set_ise_return_key_disable (int client_id, uint32 disabled) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+ LOGD ("");
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ set_helper_return_key_disable (m_current_helper_uuid, disabled);
+ }
+ //ISM_TRANS_CMD_GET_RETURN_KEY_DISABLE
+ void get_ise_return_key_disable (int client_id, _OUT_ uint32& disabled) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+ LOGD ("");
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ get_helper_return_key_disable (m_current_helper_uuid, disabled);
+ }
+
+ int get_active_ise_list (std::vector<String>& strlist) {
+ LOGD ("");
+ strlist.clear ();
+ m_helper_manager.get_active_ise_list (strlist);
+ return (int) (strlist.size ());
+ }
+
+ int get_helper_manager_id (void) {
+ return m_helper_manager.get_connection_number ();
+ }
+
+ bool has_helper_manager_pending_event (void) {
+ return m_helper_manager.has_pending_event ();
+ }
+
+ bool filter_helper_manager_event (void) {
+ return m_helper_manager.filter_event ();
+ }
+
+ void reset_helper_context (const String& uuid) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.reset_helper_context (it->second.id, ctx, uuid);
+ }
+ }
+ /*
+ * useless
+ */
+ void reset_ise_context (int client_id) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::reset_ise_context ()\n";
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ reset_helper_context (m_current_helper_uuid);
+ }
+ //ISM_TRANS_CMD_SET_CAPS_MODE
+ void set_ise_caps_mode (int client_id, uint32 mode) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::set_ise_caps_mode ()\n";
+ LOGD ("");
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ set_helper_caps_mode (m_current_helper_uuid, mode);
+ }
+
+ int send_display_name (String& name) {
+ LOGD ("");
+ return m_helper_manager.send_display_name (name);
+ }
+ //SCIM_TRANS_CMD_RELOAD_CONFIG
+ void reload_config (void) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::reload_config ()\n";
+ LOGD ("");
+ lock ();
+
+ for (ClientRepository::iterator it = m_client_repository.begin (); it != m_client_repository.end (); ++it) {
+ if (it->second.type == FRONTEND_CLIENT || it->second.type == HELPER_CLIENT) {
+ m_panel_agent_manager.reload_config (it->first);
+ }
+ }
+
+ unlock ();
+ m_signal_reload_config ();
+ }
+
+ bool exit (void) {
+ SCIM_DEBUG_MAIN (1) << "InfoManager::exit ()\n";
+ lock ();
+
+ for (ClientRepository::iterator it = m_client_repository.begin (); it != m_client_repository.end (); ++it) {
+ m_panel_agent_manager.exit (it->first, 0);
+ }
+
+ unlock ();
+ stop ();
+ return true;
+ }
+
+ void update_ise_list (std::vector<String>& strList) {
+ /* send ise list to frontend */
+ String dst_str = scim_combine_string_list (strList);
+ m_helper_manager.send_ise_list (dst_str);
+ /* request PanelClient to update keyboard ise list */
+ update_keyboard_ise_list ();
+ }
+ //ISM_TRANS_CMD_SEND_WILL_SHOW_ACK
+ void will_show_ack (int client_id) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::will_show_ack ()\n";
+ LOGD ("");
+ m_signal_will_show_ack ();
+ }
+ //ISM_TRANS_CMD_SEND_WILL_HIDE_ACK
+ void will_hide_ack (int client_id) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::will_hide_ack ()\n";
+ LOGD ("");
+ m_signal_will_hide_ack ();
+ }
+ //ISM_TRANS_CMD_RESET_DEFAULT_ISE
+ void reset_default_ise (int client_id) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+ LOGD ("");
+ String initial_ise = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String (""));
+
+ if (initial_ise.length () > 0)
+ m_signal_set_active_ise_by_uuid (initial_ise, 1);
+ else
+ std::cerr << "Read SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID is failed!!!\n";
+ }
+ //ISM_TRANS_CMD_SET_HARDWARE_KEYBOARD_MODE
+ void set_keyboard_mode (int client_id, uint32 mode) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "InfoManager::set_keyboard_mode ()\n";
+ m_signal_set_keyboard_mode (mode);
+ }
+ //ISM_TRANS_CMD_SEND_CANDIDATE_WILL_HIDE_ACK
+ void candidate_will_hide_ack (int client_id) {
+ SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "\n";
+ LOGD ("");
+ m_signal_candidate_will_hide_ack ();
+ }
+
+ //ISM_TRANS_CMD_GET_ACTIVE_HELPER_OPTION
+ void get_active_helper_option (int client_id, _OUT_ uint32& option) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+ option = get_current_helper_option ();
+ }
+ //ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW
+ void show_ise_option_window (int client_id) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::show_ise_panel ()\n";
+ LOGD ("");
+ String initial_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String (""));
+ String default_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
+ LOGD ("prepare to show ISE option window %d [%s] [%s]", client_id, initial_uuid.c_str (), default_uuid.c_str ());
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode) {
+ show_helper_option_window (m_current_helper_uuid);
+ }
+ }
+
+ //ISM_TRANS_CMD_EXPAND_CANDIDATE
+ void expand_candidate () {
+ LOGD ("");
+ m_signal_expand_candidate ();
+ }
+
+ //ISM_TRANS_CMD_CONTRACT_CANDIDATE
+ void contract_candidate () {
+ LOGD ("");
+ m_signal_contract_candidate ();
+ }
+ //ISM_TRANS_CMD_GET_RECENT_ISE_GEOMETRY
+ void get_recent_ise_geometry (int client_id, uint32 angle, _OUT_ struct rectinfo& info) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+ LOGD ("");
+ m_signal_get_recent_ise_geometry (angle, info);
+ }
+
+ bool check_privilege_by_sockfd (int client_id, const String& privilege) {
+ return m_signal_check_privilege_by_sockfd (client_id, privilege);
+ }
+
+ Connection signal_connect_reload_config (InfoManagerSlotVoid* slot) {
+ return m_signal_reload_config.connect (slot);
+ }
+
+ Connection signal_connect_turn_on (InfoManagerSlotVoid* slot) {
+ return m_signal_turn_on.connect (slot);
+ }
+
+ Connection signal_connect_turn_off (InfoManagerSlotVoid* slot) {
+ return m_signal_turn_off.connect (slot);
+ }
+
+ Connection signal_connect_show_panel (InfoManagerSlotVoid* slot) {
+ return m_signal_show_panel.connect (slot);
+ }
+
+ Connection signal_connect_hide_panel (InfoManagerSlotVoid* slot) {
+ return m_signal_hide_panel.connect (slot);
+ }
+
+ Connection signal_connect_update_screen (InfoManagerSlotInt* slot) {
+ return m_signal_update_screen.connect (slot);
+ }
+
+ Connection signal_connect_update_spot_location (InfoManagerSlotIntIntInt* slot) {
+ return m_signal_update_spot_location.connect (slot);
+ }
+
+ Connection signal_connect_update_factory_info (InfoManagerSlotFactoryInfo* slot) {
+ return m_signal_update_factory_info.connect (slot);
+ }
+
+ Connection signal_connect_start_default_ise (InfoManagerSlotVoid* slot) {
+ return m_signal_start_default_ise.connect (slot);
+ }
+
+ Connection signal_connect_stop_default_ise (InfoManagerSlotVoid* slot) {
+ return m_signal_stop_default_ise.connect (slot);
+ }
+
+ Connection signal_connect_set_candidate_ui (InfoManagerSlotIntInt* slot) {
+ return m_signal_set_candidate_ui.connect (slot);
+ }
+
+ Connection signal_connect_get_candidate_ui (InfoManagerSlotIntInt2* slot) {
+ return m_signal_get_candidate_ui.connect (slot);
+ }
+
+ Connection signal_connect_set_candidate_position (InfoManagerSlotIntInt* slot) {
+ return m_signal_set_candidate_position.connect (slot);
+ }
+
+ Connection signal_connect_get_candidate_geometry (InfoManagerSlotRect* slot) {
+ return m_signal_get_candidate_geometry.connect (slot);
+ }
+
+ Connection signal_connect_get_input_panel_geometry (InfoManagerSlotRect* slot) {
+ return m_signal_get_input_panel_geometry.connect (slot);
+ }
+
+ Connection signal_connect_set_keyboard_ise (InfoManagerSlotString* slot) {
+ return m_signal_set_keyboard_ise.connect (slot);
+ }
+
+ Connection signal_connect_get_keyboard_ise (InfoManagerSlotString2* slot) {
+ return m_signal_get_keyboard_ise.connect (slot);
+ }
+
+ Connection signal_connect_show_help (InfoManagerSlotString* slot) {
+ return m_signal_show_help.connect (slot);
+ }
+
+ Connection signal_connect_show_factory_menu (InfoManagerSlotFactoryInfoVector* slot) {
+ return m_signal_show_factory_menu.connect (slot);
+ }
+
+ Connection signal_connect_show_preedit_string (InfoManagerSlotVoid* slot) {
+ return m_signal_show_preedit_string.connect (slot);
+ }
+
+ Connection signal_connect_show_aux_string (InfoManagerSlotVoid* slot) {
+ return m_signal_show_aux_string.connect (slot);
+ }
+
+ Connection signal_connect_show_lookup_table (InfoManagerSlotVoid* slot) {
+ return m_signal_show_lookup_table.connect (slot);
+ }
+
+ Connection signal_connect_show_associate_table (InfoManagerSlotVoid* slot) {
+ return m_signal_show_associate_table.connect (slot);
+ }
+
+ Connection signal_connect_hide_preedit_string (InfoManagerSlotVoid* slot) {
+ return m_signal_hide_preedit_string.connect (slot);
+ }
+
+ Connection signal_connect_hide_aux_string (InfoManagerSlotVoid* slot) {
+ return m_signal_hide_aux_string.connect (slot);
+ }
+
+ Connection signal_connect_hide_lookup_table (InfoManagerSlotVoid* slot) {
+ return m_signal_hide_lookup_table.connect (slot);
+ }
+
+ Connection signal_connect_hide_associate_table (InfoManagerSlotVoid* slot) {
+ return m_signal_hide_associate_table.connect (slot);
+ }
+
+ Connection signal_connect_update_preedit_string (InfoManagerSlotAttributeStringInt* slot) {
+ return m_signal_update_preedit_string.connect (slot);
+ }
+
+ Connection signal_connect_update_preedit_caret (InfoManagerSlotInt* slot) {
+ return m_signal_update_preedit_caret.connect (slot);
+ }
+
+ Connection signal_connect_update_aux_string (InfoManagerSlotAttributeString* slot) {
+ return m_signal_update_aux_string.connect (slot);
+ }
+
+ Connection signal_connect_update_lookup_table (InfoManagerSlotLookupTable* slot) {
+ return m_signal_update_lookup_table.connect (slot);
+ }
+
+ Connection signal_connect_update_associate_table (InfoManagerSlotLookupTable* slot) {
+ return m_signal_update_associate_table.connect (slot);
+ }
+
+ Connection signal_connect_register_properties (InfoManagerSlotPropertyList* slot) {
+ return m_signal_register_properties.connect (slot);
+ }
+
+ Connection signal_connect_update_property (InfoManagerSlotProperty* slot) {
+ return m_signal_update_property.connect (slot);
+ }
+
+ Connection signal_connect_register_helper_properties (InfoManagerSlotIntPropertyList* slot) {
+ return m_signal_register_helper_properties.connect (slot);
+ }
+
+ Connection signal_connect_update_helper_property (InfoManagerSlotIntProperty* slot) {
+ return m_signal_update_helper_property.connect (slot);
+ }
+
+ Connection signal_connect_register_helper (InfoManagerSlotIntHelperInfo* slot) {
+ return m_signal_register_helper.connect (slot);
+ }
+
+ Connection signal_connect_remove_helper (InfoManagerSlotInt* slot) {
+ return m_signal_remove_helper.connect (slot);
+ }
+
+ Connection signal_connect_set_active_ise_by_uuid (InfoManagerSlotStringBool* slot) {
+ return m_signal_set_active_ise_by_uuid.connect (slot);
+ }
+
+ Connection signal_connect_focus_in (InfoManagerSlotVoid* slot) {
+ return m_signal_focus_in.connect (slot);
+ }
+
+ Connection signal_connect_focus_out (InfoManagerSlotVoid* slot) {
+ return m_signal_focus_out.connect (slot);
+ }
+
+ Connection signal_connect_expand_candidate (InfoManagerSlotVoid* slot) {
+ return m_signal_expand_candidate.connect (slot);
+ }
+
+ Connection signal_connect_contract_candidate (InfoManagerSlotVoid* slot) {
+ return m_signal_contract_candidate.connect (slot);
+ }
+
+ Connection signal_connect_select_candidate (InfoManagerSlotInt* slot) {
+ return m_signal_select_candidate.connect (slot);
+ }
+
+ Connection signal_connect_get_ise_list (InfoManagerSlotBoolStringVector* slot) {
+ return m_signal_get_ise_list.connect (slot);
+ }
+
+ Connection signal_connect_get_all_helper_ise_info (InfoManagerSlotBoolHelperInfo* slot) {
+ return m_signal_get_all_helper_ise_info.connect (slot);
+ }
+
+ Connection signal_connect_set_has_option_helper_ise_info (InfoManagerSlotStringBool* slot) {
+ return m_signal_set_has_option_helper_ise_info.connect (slot);
+ }
+
+ Connection signal_connect_set_enable_helper_ise_info (InfoManagerSlotStringBool* slot) {
+ return m_signal_set_enable_helper_ise_info.connect (slot);
+ }
+
+ Connection signal_connect_show_helper_ise_list (InfoManagerSlotVoid* slot) {
+ return m_signal_show_helper_ise_list.connect (slot);
+ }
+
+ Connection signal_connect_show_helper_ise_selector (InfoManagerSlotVoid* slot) {
+ return m_signal_show_helper_ise_selector.connect (slot);
+ }
+
+ Connection signal_connect_is_helper_ise_enabled (InfoManagerSlotStringInt* slot) {
+ return m_signal_is_helper_ise_enabled.connect (slot);
+ }
+
+ Connection signal_connect_get_ise_information (InfoManagerSlotBoolString4int2* slot) {
+ return m_signal_get_ise_information.connect (slot);
+ }
+
+ Connection signal_connect_get_keyboard_ise_list (InfoManagerSlotBoolStringVector* slot) {
+ return m_signal_get_keyboard_ise_list.connect (slot);
+ }
+
+ Connection signal_connect_update_ise_geometry (InfoManagerSlotIntIntIntInt* slot) {
+ return m_signal_update_ise_geometry.connect (slot);
+ }
+
+ Connection signal_connect_get_language_list (InfoManagerSlotStringVector* slot) {
+ return m_signal_get_language_list.connect (slot);
+ }
+
+ Connection signal_connect_get_all_language (InfoManagerSlotStringVector* slot) {
+ return m_signal_get_all_language.connect (slot);
+ }
+
+ Connection signal_connect_get_ise_language (InfoManagerSlotStrStringVector* slot) {
+ return m_signal_get_ise_language.connect (slot);
+ }
+
+ Connection signal_connect_get_ise_info_by_uuid (InfoManagerSlotStringISEINFO* slot) {
+ return m_signal_get_ise_info_by_uuid.connect (slot);
+ }
+
+ Connection signal_connect_send_key_event (InfoManagerSlotKeyEvent* slot) {
+ return m_signal_send_key_event.connect (slot);
+ }
+
+ Connection signal_connect_accept_connection (InfoManagerSlotInt* slot) {
+ return m_signal_accept_connection.connect (slot);
+ }
+
+ Connection signal_connect_close_connection (InfoManagerSlotInt* slot) {
+ return m_signal_close_connection.connect (slot);
+ }
+
+ Connection signal_connect_exit (InfoManagerSlotVoid* slot) {
+ return m_signal_exit.connect (slot);
+ }
+
+ Connection signal_connect_transaction_start (InfoManagerSlotVoid* slot) {
+ return m_signal_transaction_start.connect (slot);
+ }
+
+ Connection signal_connect_transaction_end (InfoManagerSlotVoid* slot) {
+ return m_signal_transaction_end.connect (slot);
+ }
+
+ Connection signal_connect_lock (InfoManagerSlotVoid* slot) {
+ return m_signal_lock.connect (slot);
+ }
+
+ Connection signal_connect_unlock (InfoManagerSlotVoid* slot) {
+ return m_signal_unlock.connect (slot);
+ }
+
+ Connection signal_connect_update_input_context (InfoManagerSlotIntInt* slot) {
+ return m_signal_update_input_context.connect (slot);
+ }
+
+ Connection signal_connect_show_ise (InfoManagerSlotVoid* slot) {
+ return m_signal_show_ise.connect (slot);
+ }
+
+ Connection signal_connect_hide_ise (InfoManagerSlotVoid* slot) {
+ return m_signal_hide_ise.connect (slot);
+ }
+
+ Connection signal_connect_will_show_ack (InfoManagerSlotVoid* slot) {
+ return m_signal_will_show_ack.connect (slot);
+ }
+
+ Connection signal_connect_will_hide_ack (InfoManagerSlotVoid* slot) {
+ return m_signal_will_hide_ack.connect (slot);
+ }
+
+ Connection signal_connect_set_keyboard_mode (InfoManagerSlotInt* slot) {
+ return m_signal_set_keyboard_mode.connect (slot);
+ }
+
+ Connection signal_connect_candidate_will_hide_ack (InfoManagerSlotVoid* slot) {
+ return m_signal_candidate_will_hide_ack.connect (slot);
+ }
+
+ Connection signal_connect_get_ise_state (InfoManagerSlotInt2* slot) {
+ return m_signal_get_ise_state.connect (slot);
+ }
+
+ Connection signal_connect_get_recent_ise_geometry (InfoManagerSlotIntRect* slot) {
+ return m_signal_get_recent_ise_geometry.connect (slot);
+ }
+
+ Connection signal_connect_check_privilege_by_sockfd (InfoManagerSlotIntString2* slot)
+ {
+ return m_signal_check_privilege_by_sockfd.connect (slot);
+ }
+
+ //ISM_TRANS_CMD_REGISTER_PANEL_CLIENT
+ void register_panel_client (uint32 client_id, uint32 id) {
+ LOGD ("");
+ m_panel_client_map [client_id] = (int)id;
+ }
+ //SCIM_TRANS_CMD_PANEL_REGISTER_INPUT_CONTEXT
+ void register_input_context (uint32 client_id, uint32 context, String uuid) {
+ LOGD ("");
+ uint32 ctx = get_helper_ic (m_panel_client_map[client_id], context);
+ m_client_context_uuids [ctx] = uuid;
+ }
+ //SCIM_TRANS_CMD_PANEL_REMOVE_INPUT_CONTEXT
+ void remove_input_context (uint32 client_id, uint32 context) {
+ LOGD ("");
+ uint32 ctx = get_helper_ic (m_panel_client_map[client_id], context);
+ m_client_context_uuids.erase (ctx);
+
+ if (ctx == get_helper_ic (m_current_socket_client, m_current_client_context)) {
+ lock ();
+ m_current_socket_client = m_last_socket_client;
+ m_current_client_context = m_last_client_context;
+ m_current_context_uuid = m_last_context_uuid;
+ m_last_socket_client = -1;
+ m_last_client_context = 0;
+ m_last_context_uuid = String ("");
+
+ if (m_current_socket_client == -1) {
+ unlock ();
+ socket_update_control_panel ();
+ } else {
+ unlock ();
+ }
+ } else if (ctx == get_helper_ic (m_last_socket_client, m_last_client_context)) {
+ lock ();
+ m_last_socket_client = -1;
+ m_last_client_context = 0;
+ m_last_context_uuid = String ("");
+ unlock ();
+ }
+
+ if (m_client_context_uuids.size () == 0)
+ m_signal_stop_default_ise ();
+ }
+
+ //SCIM_TRANS_CMD_PANEL_RESET_INPUT_CONTEXT
+ void socket_reset_input_context (int client_id, uint32 context) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_reset_input_context \n";
+ LOGD ("");
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ socket_reset_helper_input_context (m_current_helper_uuid, m_panel_client_map[client_id], context);
+ }
+
+ //SCIM_TRANS_CMD_FOCUS_IN
+ void focus_in (int client_id, uint32 context, String uuid) {
+ LOGD ("");
+ m_signal_focus_in ();
+ focus_in_helper (m_current_helper_uuid, m_panel_client_map[client_id], context);
+ SCIM_DEBUG_MAIN (2) << "PanelAgent::focus_in (" << client_id << "," << context << "," << uuid << ")\n";
+ m_active_client_id = client_id;
+ lock ();
+
+ if (m_current_socket_client >= 0) {
+ m_last_socket_client = m_current_socket_client;
+ m_last_client_context = m_current_client_context;
+ m_last_context_uuid = m_current_context_uuid;
+ }
+
+ m_current_socket_client = m_panel_client_map[client_id];
+ m_current_client_context = context;
+ m_current_context_uuid = uuid;
+ unlock ();
+ }
+
+ //SCIM_TRANS_CMD_FOCUS_OUT
+ void focus_out (int client_id, uint32 context) {
+ LOGD ("");
+ m_signal_focus_out ();
+ lock ();
+ focus_out_helper (m_current_helper_uuid, m_panel_client_map[client_id], context);
+
+ if (m_current_socket_client >= 0) {
+ m_last_socket_client = m_current_socket_client;
+ m_last_client_context = m_current_client_context;
+ m_last_context_uuid = m_current_context_uuid;
+ }
+
+ m_current_socket_client = -1;
+ m_current_client_context = 0;
+ m_current_context_uuid = String ("");
+ unlock ();
+ }
+
+ //ISM_TRANS_CMD_TURN_ON_LOG
+ void socket_turn_on_log (uint32 isOn) {
+ LOGD ("");
+
+ if (isOn) {
+ DebugOutput::enable_debug (SCIM_DEBUG_AllMask);
+ DebugOutput::set_verbose_level (7);
+ SCIM_DEBUG_MAIN (4) << __func__ << " on\n";
+ } else {
+ SCIM_DEBUG_MAIN (4) << __func__ << " off\n";
+ DebugOutput::disable_debug (SCIM_DEBUG_AllMask);
+ DebugOutput::set_verbose_level (0);
+ }
+
+ int focused_client;
+ uint32 focused_context;
+ get_focused_context (focused_client, focused_context);
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ uint32 ctx = get_helper_ic (focused_client, focused_context);
+ //FIXME
+ //m_panel_agent_manager.socket_turn_on_log (it->second.id, ctx, m_current_helper_uuid, isOn);
+ }
+ }
+
+ if (focused_client == -1) {
+ std::cerr << __func__ << " get_focused_context is failed!!!\n";
+ return;
+ }
+
+ ClientInfo client_info = socket_get_client_info (focused_client);
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ //FIXME
+ //m_panel_agent_manager.socket_turn_on_log (focused_client, focused_context, isOn);
+ }
+ }
+
+
+ void add_client (int client_id, uint32 key, ClientType type) {
+ LOGD ("id:%d, key:%d, type:%d", client_id, key, type);
+ ClientInfo info;
+ info.key = key;
+ info.type = type;
+ SCIM_DEBUG_MAIN (4) << "Add client to repository. Type=" << type << " key=" << key << "\n";
+ lock ();
+ m_client_repository [client_id] = info;
+
+ if (info.type == IMCONTROL_ACT_CLIENT) {
+ m_pending_active_imcontrol_id = client_id;
+ } else if (info.type == IMCONTROL_CLIENT) {
+ m_imcontrol_map [m_pending_active_imcontrol_id] = client_id;
+ m_pending_active_imcontrol_id = -1;
+ }
+
+ LOGD ("%d clients connecting", m_client_repository.size());
+
+ unlock ();
+ }
+
+ void del_client (int client_id) {
+ LOGD ("id:%d", client_id);
+ lock ();
+ m_signal_close_connection (client_id);
+ ClientInfo client_info = socket_get_client_info (client_id);
+ m_client_repository.erase (client_id);
+#ifdef PANEL_SERVER_AUTO_EXIT
+ /* Exit panel if there is no connected client anymore. */
+ if (client_info.type != UNKNOWN_CLIENT && m_client_repository.size () == 0 && !m_should_resident) {
+ SCIM_DEBUG_MAIN (4) << "Exit Socket Server Thread.\n";
+ server->shutdown ();
+ m_signal_exit.emit ();
+ }
+#endif
+ unlock ();
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ SCIM_DEBUG_MAIN (4) << "It's a FrontEnd client.\n";
+
+ /* The focused client is closed. */
+ if (m_current_socket_client == client_id) {
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+ hide_helper (m_current_helper_uuid);
+
+ lock ();
+ m_current_socket_client = -1;
+ m_current_client_context = 0;
+ m_current_context_uuid = String ("");
+ unlock ();
+ socket_transaction_start ();
+ socket_turn_off ();
+ socket_transaction_end ();
+ }
+
+ if (m_last_socket_client == client_id) {
+ lock ();
+ m_last_socket_client = -1;
+ m_last_client_context = 0;
+ m_last_context_uuid = String ("");
+ unlock ();
+ }
+
+ /* Erase all associated Client Context UUIDs. */
+ std::vector <uint32> ctx_list;
+ ClientContextUUIDRepository::iterator it = m_client_context_uuids.begin ();
+
+ for (; it != m_client_context_uuids.end (); ++it) {
+ if ((it->first & 0xFFFF) == (client_id & 0xFFFF))
+ ctx_list.push_back (it->first);
+ }
+
+ for (size_t i = 0; i < ctx_list.size (); ++i)
+ m_client_context_uuids.erase (ctx_list [i]);
+
+ /* Erase all helperise info associated with the client */
+ ctx_list.clear ();
+ it = m_client_context_helper.begin ();
+
+ for (; it != m_client_context_helper.end (); ++it) {
+ if ((it->first & 0xFFFF) == (client_id & 0xFFFF)) {
+ ctx_list.push_back (it->first);
+ /* similar to stop_helper except that it will not call get_focused_context() */
+ String uuid = it->second;
+
+ if (m_helper_uuid_count.find (uuid) != m_helper_uuid_count.end ()) {
+ uint32 count = m_helper_uuid_count[uuid];
+
+ if (1 == count) {
+ m_helper_uuid_count.erase (uuid);
+ HelperClientIndex::iterator pise = m_helper_client_index.find (uuid);
+
+ if (pise != m_helper_client_index.end ()) {
+ stop_helper (uuid, pise->second.id, it->first);
+ }
+
+ SCIM_DEBUG_MAIN (1) << "Stop HelperISE " << uuid << " ...\n";
+ } else {
+ m_helper_uuid_count[uuid] = count - 1;
+ focus_out_helper (uuid, (it->first & 0xFFFF), ((it->first >> 16) & 0x7FFF));
+ SCIM_DEBUG_MAIN (1) << "Decrement usage count of HelperISE " << uuid
+ << " to " << m_helper_uuid_count[uuid] << "\n";
+ }
+ }
+ }
+ }
+
+ for (size_t i = 0; i < ctx_list.size (); ++i)
+ m_client_context_helper.erase (ctx_list [i]);
+
+ HelperInfoRepository::iterator iter = m_helper_info_repository.begin ();
+
+ for (; iter != m_helper_info_repository.end (); iter++) {
+ if (!m_current_helper_uuid.compare (iter->second.uuid))
+ if (! (iter->second.option & ISM_ISE_HIDE_IN_CONTROL_PANEL))
+ socket_update_control_panel ();
+ }
+ } else if (client_info.type == FRONTEND_ACT_CLIENT) {
+ SCIM_DEBUG_MAIN (4) << "It's a FRONTEND_ACT_CLIENT client.\n";
+ IntIntRepository::iterator iter2 = m_panel_client_map.find (client_id);
+
+ if (iter2 != m_panel_client_map.end ())
+ m_panel_client_map.erase (iter2);
+ } else if (client_info.type == HELPER_CLIENT) {
+ SCIM_DEBUG_MAIN (4) << "It's a Helper client.\n";
+ lock ();
+ HelperInfoRepository::iterator hiit = m_helper_info_repository.find (client_id);
+
+ if (hiit != m_helper_info_repository.end ()) {
+ bool restart = false;
+ String uuid = hiit->second.uuid;
+ HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
+
+ if ((hiit->second.option & SCIM_HELPER_AUTO_RESTART) &&
+ (it != m_helper_client_index.end () && it->second.ref > 0))
+ restart = true;
+
+ m_helper_manager.stop_helper (hiit->second.name);
+ m_helper_client_index.erase (uuid);
+ m_helper_info_repository.erase (hiit);
+
+ if (restart && !m_ise_exiting) {
+ struct tms tiks_buf;
+ static clock_t start_tiks = times (&tiks_buf);
+ static double clock_tiks = (double)sysconf (_SC_CLK_TCK);
+ clock_t curr_tiks = times (&tiks_buf);
+ double secs = (double) (curr_tiks - start_tiks) / clock_tiks;
+ //LOGE ("time second:%f\n", secs);
+ static String restart_uuid;
+
+ if (restart_uuid != uuid || secs > MIN_REPEAT_TIME) {
+ m_helper_manager.run_helper (uuid, m_config_name, m_display_name);
+ restart_uuid = uuid;
+ LOGE ("Auto restart soft ISE:%s", uuid.c_str ());
+ } else {
+ reset_default_ise (0);
+ ISF_SAVE_LOG ("Auto restart is abnormal, reset default ISE\n");
+ }
+
+ start_tiks = curr_tiks;
+ }
+ }
+
+ m_ise_exiting = false;
+ unlock ();
+ socket_transaction_start ();
+ m_signal_remove_helper (client_id);
+ socket_transaction_end ();
+ } else if (client_info.type == HELPER_ACT_CLIENT) {
+ SCIM_DEBUG_MAIN (4) << "It's a Helper passive client.\n";
+ lock ();
+ HelperInfoRepository::iterator hiit = m_helper_active_info_repository.find (client_id);
+
+ if (hiit != m_helper_active_info_repository.end ())
+ m_helper_active_info_repository.erase (hiit);
+
+ unlock ();
+ } else if (client_info.type == IMCONTROL_ACT_CLIENT) {
+ SCIM_DEBUG_MAIN (4) << "It's a IMCONTROL_ACT_CLIENT client.\n";
+ IMControlRepository::iterator iter = m_imcontrol_repository.find (client_id);
+
+ if (iter != m_imcontrol_repository.end ()) {
+ int size = iter->second.info.size ();
+ int i = 0;
+
+ while (i < size) {
+ stop_helper ((iter->second.info)[i].uuid, (iter->second.count)[i], DEFAULT_CONTEXT_VALUE);
+
+ if ((iter->second.info)[i].option & ISM_ISE_HIDE_IN_CONTROL_PANEL)
+ m_current_helper_uuid = m_last_helper_uuid;
+
+ i++;
+ }
+
+ m_imcontrol_repository.erase (iter);
+ }
+
+ IntIntRepository::iterator iter2 = m_imcontrol_map.find (client_id);
+
+ if (iter2 != m_imcontrol_map.end ())
+ m_imcontrol_map.erase (iter2);
+ }
+ LOGI ("clients: %d, panel clients: %d, imcontrols size: %d, helper infos: %d, \
+helper active infos: %d, helper client indexs: %d, ises pending: %d, \
+imcontrols: %d, start helper ic indexs: %d, client context uuids: %d, \
+client context helpers: %d, helpers uuid count: %d",
+ m_client_repository.size(),
+ m_panel_client_map.size(),
+ m_imcontrol_map.size(),
+ m_helper_info_repository.size(),
+ m_helper_active_info_repository.size(),
+ m_helper_client_index.size(),
+ m_ise_pending_repository.size(),
+ m_imcontrol_repository.size(),
+ m_start_helper_ic_index.size(),
+ m_client_context_uuids.size(),
+ m_client_context_helper.size(),
+ m_helper_uuid_count.size());
+ }
+
+ const ClientInfo& socket_get_client_info (int client) {
+ static ClientInfo null_client = { 0, UNKNOWN_CLIENT };
+ ClientRepository::iterator it = m_client_repository.find (client);
+
+ if (it != m_client_repository.end ())
+ return it->second;
+
+ return null_client;
+ }
+
+ //SCIM_TRANS_CMD_PANEL_TURN_ON
+ void socket_turn_on (void) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_turn_on ()\n";
+ LOGD ("");
+ m_signal_turn_on ();
+ }
+ //SCIM_TRANS_CMD_PANEL_TURN_OFF
+ void socket_turn_off (void) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_turn_off ()\n";
+ LOGD ("");
+ m_signal_turn_off ();
+ }
+ //SCIM_TRANS_CMD_UPDATE_SCREEN
+ void socket_update_screen (int client_id, uint32 num) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_screen ()\n";
+ LOGD ("");
+
+ if (((int) num) != m_current_screen) {
+ SCIM_DEBUG_MAIN (4) << "New Screen number = " << num << "\n";
+ m_signal_update_screen ((int) num);
+ helper_all_update_screen ((int) num);
+ m_current_screen = (num);
+ }
+ }
+ //SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION
+ void socket_update_spot_location (uint32 x, uint32 y, uint32 top_y) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_spot_location ()\n";
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "New Spot location x=" << x << " y=" << y << "\n";
+ m_signal_update_spot_location ((int)x, (int)y, (int)top_y);
+ helper_all_update_spot_location ((int)x, (int)y);
+ }
+ //ISM_TRANS_CMD_UPDATE_CURSOR_POSITION
+ void socket_update_cursor_position (uint32 cursor_pos) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_cursor_position ()\n";
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "New cursor position pos=" << cursor_pos << "\n";
+ helper_all_update_cursor_position ((int)cursor_pos);
+ }
+ //ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT
+ void socket_update_surrounding_text (String text, uint32 cursor) {
+ SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ lock ();
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.socket_update_surrounding_text (it->second.id, ctx, m_current_helper_uuid, text, cursor);
+ unlock ();
+ }
+ }
+ //ISM_TRANS_CMD_UPDATE_SELECTION
+ void socket_update_selection (String text) {
+ SCIM_DEBUG_MAIN (4) << __FUNCTION__ << "...\n";
+ LOGD ("");
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ lock ();
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.socket_update_selection (it->second.id, ctx, m_current_helper_uuid, text);
+ unlock ();
+ }
+ }
+ //SCIM_TRANS_CMD_PANEL_UPDATE_FACTORY_INFO
+ void socket_update_factory_info (PanelFactoryInfo& info) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_factory_info ()\n";
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "New Factory info uuid=" << info.uuid << " name=" << info.name << "\n";
+ info.lang = scim_get_normalized_language (info.lang);
+ m_signal_update_factory_info (info);
+ }
+ //SCIM_TRANS_CMD_PANEL_SHOW_HELP
+ void socket_show_help (String help) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_show_help ()\n";
+ LOGD ("");
+ m_signal_show_help (help);
+ }
+ //SCIM_TRANS_CMD_PANEL_SHOW_FACTORY_MENU
+ void socket_show_factory_menu (std::vector <PanelFactoryInfo>& vec) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_show_factory_menu ()\n";
+ LOGD ("");
+
+ if (vec.size ())
+ m_signal_show_factory_menu (vec);
+ }
+
+
+ //SCIM_TRANS_CMD_SHOW_PREEDIT_STRING
+ void socket_show_preedit_string (void) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_show_preedit_string ()\n";
+ m_signal_show_preedit_string ();
+ }
+ //SCIM_TRANS_CMD_SHOW_AUX_STRING
+ void socket_show_aux_string (void) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_show_aux_string ()\n";
+ m_signal_show_aux_string ();
+ }
+ //SCIM_TRANS_CMD_SHOW_LOOKUP_TABLE
+ void socket_show_lookup_table (void) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_show_lookup_table ()\n";
+ m_signal_show_lookup_table ();
+ }
+ //ISM_TRANS_CMD_SHOW_ASSOCIATE_TABLE
+ void socket_show_associate_table (void) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_show_associate_table ()\n";
+ m_signal_show_associate_table ();
+ }
+ //SCIM_TRANS_CMD_HIDE_PREEDIT_STRING
+ void socket_hide_preedit_string (void) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_hide_preedit_string ()\n";
+ m_signal_hide_preedit_string ();
+ }
+ //SCIM_TRANS_CMD_HIDE_AUX_STRING
+ void socket_hide_aux_string (void) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_hide_aux_string ()\n";
+ m_signal_hide_aux_string ();
+ }
+ //SCIM_TRANS_CMD_HIDE_LOOKUP_TABLE
+ void socket_hide_lookup_table (void) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_hide_lookup_table ()\n";
+ m_signal_hide_lookup_table ();
+ }
+ //ISM_TRANS_CMD_HIDE_ASSOCIATE_TABLE
+ void socket_hide_associate_table (void) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_hide_associate_table ()\n";
+ m_signal_hide_associate_table ();
+ }
+ //SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING
+ void socket_update_preedit_string (String& str, const AttributeList& attrs, uint32 caret) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_preedit_string ()\n";
+ LOGD ("");
+ m_signal_update_preedit_string (str, attrs, (int) caret);
+ }
+ //SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET
+ void socket_update_preedit_caret (uint32 caret) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_preedit_caret ()\n";
+ LOGD ("");
+ m_signal_update_preedit_caret ((int) caret);
+ }
+ //SCIM_TRANS_CMD_UPDATE_AUX_STRING
+ void socket_update_aux_string (String& str, const AttributeList& attrs) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_aux_string ()\n";
+ LOGD ("");
+ m_signal_update_aux_string (str, attrs);
+ m_is_imengine_aux = true;
+ }
+ //SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE
+ void socket_update_lookup_table (const LookupTable& table) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_lookup_table ()\n";
+ LOGD ("");
+ //FIXME:
+ //g_isf_candidate_table = _isf_candidate_table;
+ m_signal_update_lookup_table (table);
+ m_is_imengine_candidate = true;
+ }
+ //ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE
+ void socket_update_associate_table (const LookupTable& table) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_associate_table ()\n";
+ LOGD ("");
+ m_signal_update_associate_table (table);
+ }
+
+ void socket_update_control_panel (void) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_control_panel ()\n";
+ String name, uuid;
+ m_signal_get_keyboard_ise (name, uuid);
+ PanelFactoryInfo info;
+
+ if (name.length () > 0)
+ info = PanelFactoryInfo (uuid, name, String (""), String (""));
+ else
+ info = PanelFactoryInfo (String (""), String (_ ("English Keyboard")), String ("C"), String (SCIM_KEYBOARD_ICON_FILE));
+
+ m_signal_update_factory_info (info);
+ }
+ //SCIM_TRANS_CMD_REGISTER_PROPERTIES
+ void socket_register_properties (const PropertyList& properties) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_register_properties ()\n";
+ LOGD ("");
+ m_signal_register_properties (properties);
+ }
+ //SCIM_TRANS_CMD_UPDATE_PROPERTY
+ void socket_update_property (const Property& property) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_update_property ()\n";
+ LOGD ("");
+ m_signal_update_property (property);
+ }
+ //ISM_TRANS_CMD_GET_KEYBOARD_ISE_LIST
+ void socket_get_keyboard_ise_list (String& uuid) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_get_keyboard_ise_list ()\n";
+ LOGD ("");
+ std::vector<String> list;
+ list.clear ();
+ m_signal_get_keyboard_ise_list (list);
+ HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ get_focused_context (client, context);
+ uint32 ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.socket_get_keyboard_ise_list (it->second.id, ctx, uuid, list);
+ }
+ }
+ //ISM_TRANS_CMD_SET_CANDIDATE_UI
+ void socket_set_candidate_ui (uint32 portrait_line, uint32 mode) {
+ SCIM_DEBUG_MAIN (4) << __func__ << " \n";
+ LOGD ("");
+ m_signal_set_candidate_ui (portrait_line, mode);
+ }
+ //ISM_TRANS_CMD_GET_CANDIDATE_UI
+ void socket_get_candidate_ui (String uuid) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_get_candidate_ui ()\n";
+ int style = 0, mode = 0;
+ m_signal_get_candidate_ui (style, mode);
+ HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ get_focused_context (client, context);
+ uint32 ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.socket_get_candidate_ui (it->second.id, ctx, uuid, style, mode);
+ }
+ }
+ //ISM_TRANS_CMD_SET_CANDIDATE_POSITION
+ void socket_set_candidate_position (uint32 left, uint32 top) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_set_candidate_position ()\n";
+ m_signal_set_candidate_position (left, top);
+ }
+ //ISM_TRANS_CMD_HIDE_CANDIDATE
+ void socket_hide_candidate (void) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_hide_candidate ()\n";
+ LOGD ("");
+ m_signal_hide_preedit_string ();
+ m_signal_hide_aux_string ();
+ m_signal_hide_lookup_table ();
+ m_signal_hide_associate_table ();
+ }
+ //ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY
+ void socket_get_candidate_geometry (String& uuid) {
+ LOGD ("");
+ SCIM_DEBUG_MAIN (4) << __func__ << " \n";
+ HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ struct rectinfo info = {0, 0, 0, 0};
+ m_signal_get_candidate_geometry (info);
+ int client;
+ uint32 context;
+ get_focused_context (client, context);
+ uint32 ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.socket_get_candidate_geometry (it->second.id, ctx, uuid, info);
+ }
+ }
+ //ISM_TRANS_CMD_SET_KEYBOARD_ISE_BY_UUID
+ void socket_set_keyboard_ise (String uuid) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_set_keyboard_ise ()\n";
+ LOGD ("");
+ m_signal_set_keyboard_ise (uuid);
+ }
+ //ISM_TRANS_CMD_SELECT_CANDIDATE
+ void socket_helper_select_candidate (uint32 index) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_set_keyboard_ise ()\n";
+ LOGD ("");
+ m_signal_select_candidate (index);
+ }
+ //ISM_TRANS_CMD_UPDATE_ISE_GEOMETRY
+ void socket_helper_update_ise_geometry (int client, uint32 x, uint32 y, uint32 width, uint32 height) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+ LOGD ("");
+ HelperInfoRepository::iterator it = m_helper_active_info_repository.find (client);
+
+ if (it != m_helper_active_info_repository.end ()) {
+ if (it->second.uuid == m_current_helper_uuid)
+ m_signal_update_ise_geometry (x, y, width, height);
+ }
+ }
+ //ISM_TRANS_CMD_GET_KEYBOARD_ISE
+ void socket_get_keyboard_ise (String uuid) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_get_keyboard_ise ()\n";
+ LOGD ("");
+ String ise_name, ise_uuid;
+ int client = -1;
+ uint32 context = 0;
+ uint32 ctx = 0;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+
+ if (m_client_context_uuids.find (ctx) != m_client_context_uuids.end ())
+ ise_uuid = m_client_context_uuids[ctx];
+
+ m_signal_get_keyboard_ise (ise_name, ise_uuid);
+ HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.socket_get_keyboard_ise (it->second.id, ctx, uuid, ise_name, ise_uuid);
+ }
+ }
+
+ //SCIM_TRANS_CMD_START_HELPER
+ void socket_start_helper (int client_id, uint32 context, String uuid) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_start_helper ()\n";
+ LOGD ("");
+ HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
+ lock ();
+ uint32 ic = get_helper_ic (m_panel_client_map[client_id], context);
+ String ic_uuid;
+ /* Get the context uuid from the client context registration table. */
+ {
+ ClientContextUUIDRepository::iterator it = m_client_context_uuids.find (get_helper_ic (m_panel_client_map[client_id], context));
+
+ if (it != m_client_context_uuids.end ())
+ ic_uuid = it->second;
+ }
+
+ if (m_current_socket_client == m_panel_client_map[client_id] && m_current_client_context == context) {
+ if (!ic_uuid.length ()) ic_uuid = m_current_context_uuid;
+ } else if (m_last_socket_client == m_panel_client_map[client_id] && m_last_client_context == context) {
+ if (!ic_uuid.length ()) ic_uuid = m_last_context_uuid;
+ }
+
+ if (it == m_helper_client_index.end ()) {
+ SCIM_DEBUG_MAIN (5) << "Run this Helper.\n";
+ m_start_helper_ic_index [uuid].push_back (std::make_pair (ic, ic_uuid));
+ m_helper_manager.run_helper (uuid, m_config_name, m_display_name);
+ } else {
+ SCIM_DEBUG_MAIN (5) << "Increase the Reference count.\n";
+ m_panel_agent_manager.socket_start_helper (it->second.id, ic, ic_uuid);
+ ++ it->second.ref;
+ }
+
+ unlock ();
+ }
+ //SCIM_TRANS_CMD_STOP_HELPER
+ void socket_stop_helper (int client_id, uint32 context, String uuid) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_stop_helper ()\n";
+ LOGD ("");
+ HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
+ lock ();
+ uint32 ic = get_helper_ic (m_panel_client_map[client_id], context);
+
+ if (it != m_helper_client_index.end ()) {
+ SCIM_DEBUG_MAIN (5) << "Decrase the Reference count.\n";
+ -- it->second.ref;
+ String ic_uuid;
+ /* Get the context uuid from the client context registration table. */
+ {
+ ClientContextUUIDRepository::iterator it = m_client_context_uuids.find (get_helper_ic (m_panel_client_map[client_id], context));
+
+ if (it != m_client_context_uuids.end ())
+ ic_uuid = it->second;
+ }
+
+ if (m_current_socket_client == m_panel_client_map[client_id] && m_current_client_context == context) {
+ if (!ic_uuid.length ()) ic_uuid = m_current_context_uuid;
+ } else if (m_last_socket_client == m_panel_client_map[client_id] && m_last_client_context == context) {
+ if (!ic_uuid.length ()) ic_uuid = m_last_context_uuid;
+ }
+
+ m_panel_agent_manager.helper_detach_input_context (it->second.id, ic, ic_uuid);
+
+ if (it->second.ref <= 0)
+ m_panel_agent_manager.exit (it->second.id, ic);
+ }
+
+ unlock ();
+ }
+ //SCIM_TRANS_CMD_SEND_HELPER_EVENT
+ void socket_send_helper_event (int client_id, uint32 context, String uuid, const Transaction& _nest_trans) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_send_helper_event ()\n";
+ LOGD ("");
+ HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ String ic_uuid;
+ /* Get the context uuid from the client context registration table. */
+ {
+ ClientContextUUIDRepository::iterator it = m_client_context_uuids.find (get_helper_ic (m_panel_client_map[client_id], context));
+
+ if (it != m_client_context_uuids.end ())
+ ic_uuid = it->second;
+ }
+
+ if (m_current_socket_client == m_panel_client_map[client_id] && m_current_client_context == context) {
+ if (!ic_uuid.length ()) ic_uuid = m_current_context_uuid;
+ } else if (m_last_socket_client == m_panel_client_map[client_id] && m_last_client_context == context) {
+ if (!ic_uuid.length ()) ic_uuid = m_last_context_uuid;
+ }
+
+ 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);
+ }
+ }
+
+ //SCIM_TRANS_CMD_REGISTER_PROPERTIES
+ void socket_helper_register_properties (int client, PropertyList& properties) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_register_properties (" << client << ")\n";
+ LOGD ("");
+ m_signal_register_helper_properties (client, properties);
+
+ /* Check whether application is already focus_in */
+ if (m_current_socket_client != -1) {
+ SCIM_DEBUG_MAIN (2) << "Application is already focus_in!\n";
+ focus_in_helper (m_current_helper_uuid, m_current_socket_client, m_current_client_context);
+ reset_keyboard_ise ();
+ }
+
+ /* Check whether ISE panel is already shown */
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode && m_ise_context_length > 0) {
+ SCIM_DEBUG_MAIN (2) << "Re-show ISE panel!\n";
+ int focused_client;
+ uint32 focused_context;
+ get_focused_context (focused_client, focused_context);
+
+ if (focused_client == -1 && m_active_client_id != -1) {
+ focused_client = m_panel_client_map[m_active_client_id];
+ focused_context = 0;
+ }
+
+ uint32 ctx = get_helper_ic (focused_client, focused_context);
+ bool ret = show_helper (m_current_helper_uuid, m_ise_context_buffer, m_ise_context_length, ctx);
+
+ if (ret)
+ m_signal_show_ise ();
+ }
+ }
+ //SCIM_TRANS_CMD_UPDATE_PROPERTY
+ void socket_helper_update_property (int client, Property& property) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_update_property (" << client << ")\n";
+ LOGD ("");
+ m_signal_update_helper_property (client, property);
+ }
+ //SCIM_TRANS_CMD_PANEL_SEND_IMENGINE_EVENT
+ void socket_helper_send_imengine_event (int client, uint32 target_ic, String target_uuid , Transaction& nest_trans) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_send_imengine_event (" << client << ")\n";
+ LOGD ("");
+ HelperInfoRepository::iterator hiit = m_helper_active_info_repository.find (client);
+
+ if (hiit != m_helper_active_info_repository.end ()) {
+ int target_client;
+ uint32 target_context;
+ get_imengine_client_context (target_ic, target_client, target_context);
+ int focused_client;
+ uint32 focused_context;
+ String focused_uuid;
+ focused_uuid = get_focused_context (focused_client, focused_context);
+
+ if (target_ic == (uint32) (-1)) {
+ target_client = focused_client;
+ target_context = focused_context;
+ }
+
+ if (target_uuid.length () == 0)
+ target_uuid = focused_uuid;
+
+ ClientInfo client_info = socket_get_client_info (target_client);
+ SCIM_DEBUG_MAIN (5) << "Target UUID = " << target_uuid << " Focused UUId = " << focused_uuid << "\nTarget Client = " << target_client << "\n";
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ m_panel_agent_manager.process_helper_event (target_client, target_context, target_uuid, hiit->second.uuid, nest_trans);
+ }
+ }
+ }
+
+ void socket_helper_key_event_op (int client, int cmd, uint32 target_ic, String& target_uuid, KeyEvent& key) {
+ if (!key.empty ()) {
+ int target_client;
+ uint32 target_context;
+ get_imengine_client_context (target_ic, target_client, target_context);
+ int focused_client;
+ uint32 focused_context;
+ String focused_uuid;
+ focused_uuid = get_focused_context (focused_client, focused_context);
+
+ if (target_ic == (uint32) (-1)) {
+ target_client = focused_client;
+ target_context = focused_context;
+ }
+
+ if (target_uuid.length () == 0)
+ target_uuid = focused_uuid;
+
+ if (target_client == -1) {
+ /* FIXUP: monitor 'Invalid Window' error */
+ LOGW ("focused target client is NULL");
+ } else if (target_client == focused_client && target_context == focused_context && target_uuid == focused_uuid) {
+ ClientInfo client_info = socket_get_client_info (target_client);
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ m_panel_agent_manager.socket_helper_key_event (target_client, target_context, cmd, key);
+ }
+ }
+ }
+ }
+ //SCIM_TRANS_CMD_PROCESS_KEY_EVENT
+ //SCIM_TRANS_CMD_PANEL_SEND_KEY_EVENT
+ void socket_helper_send_key_event (int client, uint32 target_ic, String target_uuid, KeyEvent key) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_send_key_event (" << client << ")\n";
+ ISF_PROF_DEBUG ("first message")
+ LOGD ("");
+ socket_helper_key_event_op (client, SCIM_TRANS_CMD_PROCESS_KEY_EVENT, target_ic, target_uuid, key);
+ }
+ //SCIM_TRANS_CMD_FORWARD_KEY_EVENT
+ void socket_helper_forward_key_event (int client, uint32 target_ic, String target_uuid, KeyEvent key) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_forward_key_event (" << client << ")\n";
+ LOGD ("");
+ socket_helper_key_event_op (client, SCIM_TRANS_CMD_FORWARD_KEY_EVENT, target_ic, target_uuid, key);
+ }
+
+ //SCIM_TRANS_CMD_COMMIT_STRING
+ void socket_helper_commit_string (int client, uint32 target_ic, String target_uuid, WideString wstr) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_commit_string (" << client << ")\n";
+ LOGD ("");
+
+ if (wstr.length ()) {
+ int target_client;
+ uint32 target_context;
+ get_imengine_client_context (target_ic, target_client, target_context);
+ int focused_client;
+ uint32 focused_context;
+ String focused_uuid;
+ focused_uuid = get_focused_context (focused_client, focused_context);
+
+ if (target_ic == (uint32) (-1)) {
+ target_client = focused_client;
+ target_context = focused_context;
+ }
+
+ if (target_uuid.length () == 0)
+ target_uuid = focused_uuid;
+
+ if (target_client == focused_client &&
+ target_context == focused_context &&
+ target_uuid == focused_uuid) {
+ ClientInfo client_info = socket_get_client_info (target_client);
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ m_panel_agent_manager.commit_string (target_client, target_context, wstr);
+ } else {
+ std::cerr << "target client is not existed!!!" << "\n";
+ }
+ }
+ }
+ }
+ //SCIM_TRANS_CMD_GET_SURROUNDING_TEXT
+ void socket_helper_get_surrounding_text (int client, String uuid, uint32 maxlen_before, uint32 maxlen_after) {
+ SCIM_DEBUG_MAIN (4) << __FUNCTION__ << " (" << client << ")\n";
+ LOGD ("");
+ int focused_client;
+ uint32 focused_context;
+ String focused_uuid = get_focused_context (focused_client, focused_context);
+ ClientInfo client_info = socket_get_client_info (focused_client);
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ m_panel_agent_manager.socket_helper_get_surrounding_text (focused_client, focused_context, maxlen_before, maxlen_after);
+ }
+ }
+ //SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT
+ void socket_helper_delete_surrounding_text (int client, uint32 offset, uint32 len) {
+ SCIM_DEBUG_MAIN (4) << __FUNCTION__ << " (" << client << ")\n";
+ LOGD ("");
+ int focused_client;
+ uint32 focused_context;
+ String focused_uuid = get_focused_context (focused_client, focused_context);
+ ClientInfo client_info = socket_get_client_info (focused_client);
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ m_panel_agent_manager.socket_helper_delete_surrounding_text (focused_client, focused_context, offset, len);
+ }
+ }
+ //SCIM_TRANS_CMD_GET_SELECTION
+ void socket_helper_get_selection (int client, String uuid) {
+ SCIM_DEBUG_MAIN (4) << __FUNCTION__ << " (" << client << ")\n";
+ LOGD ("");
+ int focused_client;
+ uint32 focused_context;
+ String focused_uuid = get_focused_context (focused_client, focused_context);
+ ClientInfo client_info = socket_get_client_info (focused_client);
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ m_panel_agent_manager.socket_helper_get_selection (focused_client, focused_context);
+ }
+ }
+ //SCIM_TRANS_CMD_SET_SELECTION
+ void socket_helper_set_selection (int client, uint32 start, uint32 end) {
+ SCIM_DEBUG_MAIN (4) << __FUNCTION__ << " (" << client << ")\n";
+ LOGD ("");
+ int focused_client;
+ uint32 focused_context;
+ String focused_uuid = get_focused_context (focused_client, focused_context);
+ ClientInfo client_info = socket_get_client_info (focused_client);
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ m_panel_agent_manager.socket_helper_set_selection (focused_client, focused_context, start, end);
+ }
+ }
+
+ //SCIM_TRANS_CMD_SHOW_PREEDIT_STRING
+ void socket_helper_show_preedit_string (int client, uint32 target_ic, String target_uuid) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_show_preedit_string (" << client << ")\n";
+ LOGD ("");
+ int target_client;
+ uint32 target_context;
+ get_imengine_client_context (target_ic, target_client, target_context);
+ int focused_client;
+ uint32 focused_context;
+ String focused_uuid = get_focused_context (focused_client, focused_context);
+
+ if (target_ic == (uint32) (-1)) {
+ target_client = focused_client;
+ target_context = focused_context;
+ }
+
+ if (target_uuid.length () == 0)
+ target_uuid = focused_uuid;
+
+ if (target_client == focused_client &&
+ target_context == focused_context &&
+ target_uuid == focused_uuid) {
+ ClientInfo client_info = socket_get_client_info (target_client);
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ m_panel_agent_manager.show_preedit_string (target_client, target_context);
+ }
+ }
+ }
+ //SCIM_TRANS_CMD_HIDE_PREEDIT_STRING
+ void socket_helper_hide_preedit_string (int client, uint32 target_ic, String target_uuid) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_hide_preedit_string (" << client << ")\n";
+ LOGD ("");
+ int target_client;
+ uint32 target_context;
+ get_imengine_client_context (target_ic, target_client, target_context);
+ int focused_client;
+ uint32 focused_context;
+ String focused_uuid = get_focused_context (focused_client, focused_context);
+
+ if (target_ic == (uint32) (-1)) {
+ target_client = focused_client;
+ target_context = focused_context;
+ }
+
+ if (target_uuid.length () == 0)
+ target_uuid = focused_uuid;
+
+ if (target_client == focused_client &&
+ target_context == focused_context &&
+ target_uuid == focused_uuid) {
+ ClientInfo client_info = socket_get_client_info (target_client);
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ m_panel_agent_manager.hide_preedit_string (target_client, target_context);
+ }
+ }
+ }
+ //SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING
+ void socket_helper_update_preedit_string (int client, uint32 target_ic, String target_uuid, WideString wstr, AttributeList& attrs, uint32 caret) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_update_preedit_string (" << client << ")\n";
+ LOGD ("");
+ int target_client;
+ uint32 target_context;
+ get_imengine_client_context (target_ic, target_client, target_context);
+ int focused_client;
+ uint32 focused_context;
+ String focused_uuid;
+ focused_uuid = get_focused_context (focused_client, focused_context);
+
+ if (target_ic == (uint32) (-1)) {
+ target_client = focused_client;
+ target_context = focused_context;
+ }
+
+ if (target_uuid.length () == 0)
+ target_uuid = focused_uuid;
+
+ if (target_client == focused_client &&
+ target_context == focused_context &&
+ target_uuid == focused_uuid) {
+ ClientInfo client_info = socket_get_client_info (target_client);
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ m_panel_agent_manager.update_preedit_string (target_client, target_context, wstr, attrs, caret);
+ }
+ }
+ }
+ //SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET
+ void socket_helper_update_preedit_caret (int client, uint32 caret) {
+ SCIM_DEBUG_MAIN (4) << __func__ << " (" << client << ")\n";
+ LOGD ("");
+ int focused_client;
+ uint32 focused_context;
+ String focused_uuid;
+ focused_uuid = get_focused_context (focused_client, focused_context);
+ ClientInfo client_info = socket_get_client_info (focused_client);
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ m_panel_agent_manager.update_preedit_caret (focused_client, focused_context, caret);
+ }
+ }
+
+ //SCIM_TRANS_CMD_PANEL_REGISTER_HELPER
+ void socket_helper_register_helper (int client, HelperInfo& info) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_register_helper (" << client << ")\n";
+ bool result = false;
+ lock ();
+ LOGD ("");
+
+ if (info.uuid.length ()) {
+ SCIM_DEBUG_MAIN (4) << "New Helper uuid=" << info.uuid << " name=" << info.name << "\n";
+ HelperClientIndex::iterator it = m_helper_client_index.find (info.uuid);
+
+ if (it == m_helper_client_index.end ()) {
+ m_helper_info_repository [client] = info;
+ m_helper_client_index [info.uuid] = HelperClientStub (client, 1);
+ StartHelperICIndex::iterator icit = m_start_helper_ic_index.find (info.uuid);
+
+ if (icit != m_start_helper_ic_index.end ()) {
+ m_panel_agent_manager.helper_attach_input_context_and_update_screen (client, icit->second, m_current_screen);
+ m_start_helper_ic_index.erase (icit);
+ }
+
+ result = true;
+ }
+ }
+
+ unlock ();
+
+ if (result)
+ m_signal_register_helper (client, info);
+ }
+
+ //SCIM_TRANS_CMD_PANEL_REGISTER_ACTIVE_HELPER
+ void socket_helper_register_helper_passive (int client, HelperInfo& info) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_register_helper_passive (" << client << ")\n";
+ LOGD ("");
+ lock ();
+
+ if (info.uuid.length ()) {
+ SCIM_DEBUG_MAIN (4) << "New Helper Passive uuid=" << info.uuid << " name=" << info.name << "\n";
+ HelperInfoRepository::iterator it = m_helper_active_info_repository.find (client);
+
+ if (it == m_helper_active_info_repository.end ()) {
+ m_helper_active_info_repository[client] = info;
+ }
+
+ StringIntRepository::iterator iter = m_ise_pending_repository.find (info.uuid);
+
+ if (iter != m_ise_pending_repository.end ()) {
+ m_ise_pending_repository.erase (iter);
+ }
+
+ iter = m_ise_pending_repository.find (info.name);
+
+ if (iter != m_ise_pending_repository.end ()) {
+ m_ise_pending_repository.erase (iter);
+ }
+ }
+
+ unlock ();
+ }
+ //ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT
+ void socket_helper_update_input_context (int client, uint32 type, uint32 value) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_update_input_context (" << client << ")\n";
+ LOGD ("");
+ m_signal_update_input_context ((int)type, (int)value);
+ int focused_client;
+ uint32 focused_context;
+ get_focused_context (focused_client, focused_context);
+ ClientInfo client_info = socket_get_client_info (focused_client);
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ m_panel_agent_manager.update_ise_input_context (focused_client, focused_context, type, value);
+ } else {
+ std::cerr << "focused client is not existed!!!" << "\n";
+ }
+ }
+ //SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND
+ void socket_helper_send_private_command (int client, String command) {
+ SCIM_DEBUG_MAIN (4) << __FUNCTION__ << " (" << client << ")\n";
+ LOGD ("");
+ int focused_client;
+ uint32 focused_context;
+ String focused_uuid = get_focused_context (focused_client, focused_context);
+ ClientInfo client_info = socket_get_client_info (focused_client);
+
+ if (client_info.type == FRONTEND_CLIENT) {
+ m_panel_agent_manager.send_private_command (focused_client, focused_context, command);
+ }
+ }
+ //ISM_TRANS_CMD_UPDATE_ISE_EXIT
+ //void UPDATE_ISE_EXIT (int client) {
+ // LOGD ("");
+ // HelperInfoRepository::iterator hiit = m_helper_active_info_repository.find (client);
+
+ // if (hiit != m_helper_active_info_repository.end ()) {
+ // String l_uuid = hiit->second.uuid;
+ // HelperClientIndex::iterator it = m_helper_client_index.find (l_uuid);
+
+ // if (it != m_helper_client_index.end ()) {
+ // del_client (it->second.id);
+ // }
+ // }
+
+ // del_client (client);
+ //}
+
+ void socket_reset_helper_input_context (const String& uuid, int client, uint32 context) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ uint32 ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.reset_helper_context (it->second.id, ctx, uuid);
+ }
+ }
+
+ bool helper_select_aux (uint32 item) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::helper_select_aux \n";
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.select_aux (it->second.id, ctx, item);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool helper_select_candidate (uint32 item) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::helper_select_candidate \n";
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.select_candidate (it->second.id, ctx, item);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool helper_lookup_table_page_up (void) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::helper_lookup_table_page_up \n";
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.lookup_table_page_up (it->second.id, ctx);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool helper_lookup_table_page_down (void) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::helper_lookup_table_page_down \n";
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.lookup_table_page_down (it->second.id, ctx);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool helper_update_lookup_table_page_size (uint32 size) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::helper_update_lookup_table_page_size \n";
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.update_lookup_table_page_size (it->second.id, ctx, size);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool helper_update_candidate_item_layout (const std::vector<uint32>& row_items) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.update_candidate_item_layout (it->second.id, ctx, row_items);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool helper_select_associate (uint32 item) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::helper_select_associate \n";
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.select_associate (it->second.id, ctx, item);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool helper_associate_table_page_up (void) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::helper_associate_table_page_up \n";
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.associate_table_page_up (it->second.id, ctx);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool helper_associate_table_page_down (void) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::helper_associate_table_page_down \n";
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.associate_table_page_down (it->second.id, ctx);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool helper_update_associate_table_page_size (uint32 size) {
+ SCIM_DEBUG_MAIN (4) << "InfoManager::helper_update_associate_table_page_size \n";
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.update_associate_table_page_size (it->second.id, ctx, size);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool helper_update_displayed_candidate_number (uint32 size) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.update_displayed_candidate_number (it->second.id, ctx, size);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool helper_longpress_candidate (uint32 index) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ int client;
+ uint32 context;
+ uint32 ctx;
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+ m_panel_agent_manager.send_longpress_event (it->second.id, ctx, index);
+ return true;
+ }
+ }
+
+ std::cerr << __func__ << " is failed!!!\n";
+ return false;
+ }
+
+ void helper_all_update_spot_location (int x, int y) {
+ SCIM_DEBUG_MAIN (5) << "InfoManager::helper_all_update_spot_location (" << x << "," << y << ")\n";
+ HelperInfoRepository::iterator hiit = m_helper_info_repository.begin ();
+ int client;
+ uint32 context;
+ String uuid = get_focused_context (client, context);
+
+ for (; hiit != m_helper_info_repository.end (); ++ hiit) {
+ if (hiit->second.option & SCIM_HELPER_NEED_SPOT_LOCATION_INFO) {
+ m_panel_agent_manager.helper_all_update_spot_location (hiit->first, get_helper_ic (client, context), uuid, x, y);
+ }
+ }
+ }
+
+ void helper_all_update_cursor_position (int cursor_pos) {
+ SCIM_DEBUG_MAIN (5) << "InfoManager::helper_all_update_cursor_position (" << cursor_pos << ")\n";
+ HelperInfoRepository::iterator hiit = m_helper_info_repository.begin ();
+ int client;
+ uint32 context;
+ String uuid = get_focused_context (client, context);
+
+ for (; hiit != m_helper_info_repository.end (); ++ hiit) {
+ m_panel_agent_manager.helper_all_update_cursor_position (hiit->first, get_helper_ic (client, context), uuid, cursor_pos);
+ }
+ }
+
+ void helper_all_update_screen (int screen) {
+ SCIM_DEBUG_MAIN (5) << "InfoManager::helper_all_update_screen (" << screen << ")\n";
+ HelperInfoRepository::iterator hiit = m_helper_info_repository.begin ();
+ int client;
+ uint32 context;
+ String uuid;
+ uuid = get_focused_context (client, context);
+
+ for (; hiit != m_helper_info_repository.end (); ++ hiit) {
+ if (hiit->second.option & SCIM_HELPER_NEED_SCREEN_INFO) {
+ m_panel_agent_manager.helper_all_update_screen (hiit->first, get_helper_ic (client, context), uuid, screen);
+ }
+ }
+ }
+
+ const String& get_focused_context (int& client, uint32& context, bool force_last_context = false) const {
+ if (m_current_socket_client >= 0) {
+ client = m_current_socket_client;
+ context = m_current_client_context;
+ return m_current_context_uuid;
+ } else {
+ client = m_last_socket_client;
+ context = m_last_client_context;
+ return m_last_context_uuid;
+ }
+ }
+
+private:
+ void socket_transaction_start (void) {
+ m_signal_transaction_start ();
+ }
+
+ void socket_transaction_end (void) {
+ m_signal_transaction_end ();
+ }
+
+ void lock (void) {
+ m_signal_lock ();
+ }
+ void unlock (void) {
+ m_signal_unlock ();
+ }
+};
+
+InfoManager::InfoManager ()
+ : m_impl (new InfoManagerImpl ())
+{
+}
+
+InfoManager::~InfoManager ()
+{
+ delete m_impl;
+}
+
+bool
+InfoManager::initialize (InfoManager* info_manager, const ConfigPointer& config, const String& display, bool resident)
+{
+ return m_impl->initialize (info_manager, config, display, resident);
+}
+
+bool
+InfoManager::valid (void) const
+{
+ return m_impl->valid ();
+}
+
+void
+InfoManager::stop (void)
+{
+ if (m_impl != NULL)
+ m_impl->stop ();
+}
+
+const ClientInfo&
+InfoManager::socket_get_client_info (int client) const
+{
+ return m_impl->socket_get_client_info (client);
+}
+
+int
+InfoManager::get_helper_list (std::vector <HelperInfo>& helpers) const
+{
+ return m_impl->get_helper_list (helpers);
+}
+
+void InfoManager::hide_helper (const String& uuid)
+{
+ m_impl->hide_helper (uuid);
+}
+TOOLBAR_MODE_T
+InfoManager::get_current_toolbar_mode () const
+{
+ return m_impl->get_current_toolbar_mode ();
+}
+
+void
+InfoManager::get_current_ise_geometry (rectinfo& rect)
+{
+ m_impl->get_current_ise_geometry (rect);
+}
+
+String
+InfoManager::get_current_helper_uuid () const
+{
+ return m_impl->get_current_helper_uuid ();
+}
+
+String
+InfoManager::get_current_helper_name () const
+{
+ return m_impl->get_current_helper_name ();
+}
+
+String
+InfoManager::get_current_ise_name () const
+{
+ return m_impl->get_current_ise_name ();
+}
+
+void
+InfoManager::set_current_toolbar_mode (TOOLBAR_MODE_T mode)
+{
+ m_impl->set_current_toolbar_mode (mode);
+}
+
+void
+InfoManager::set_current_ise_name (String& name)
+{
+ m_impl->set_current_ise_name (name);
+}
+
+void
+InfoManager::set_current_helper_option (uint32 option)
+{
+ m_impl->set_current_helper_option (option);
+}
+
+void
+InfoManager::update_candidate_panel_event (uint32 nType, uint32 nValue)
+{
+ m_impl->update_panel_event (ISM_TRANS_CMD_UPDATE_ISF_CANDIDATE_PANEL, nType, nValue);
+}
+
+void
+InfoManager::update_input_panel_event (uint32 nType, uint32 nValue)
+{
+ m_impl->update_panel_event (ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT, nType, nValue);
+}
+
+bool
+InfoManager::move_preedit_caret (uint32 position)
+{
+ return m_impl->move_preedit_caret (position);
+}
+
+//useless
+#if 0
+bool
+InfoManager::request_help (void)
+{
+ return m_impl->request_help ();
+}
+
+bool
+InfoManager::request_factory_menu (void)
+{
+ return m_impl->request_factory_menu ();
+}
+#endif
+
+bool
+InfoManager::change_factory (const String& uuid)
+{
+ return m_impl->change_factory (uuid);
+}
+
+bool
+InfoManager::helper_candidate_show (void)
+{
+ return m_impl->helper_candidate_show ();
+}
+
+bool
+InfoManager::helper_candidate_hide (void)
+{
+ return m_impl->helper_candidate_hide ();
+}
+
+bool
+InfoManager::candidate_more_window_show (void)
+{
+ return m_impl->candidate_more_window_show ();
+}
+
+bool
+InfoManager::candidate_more_window_hide (void)
+{
+ return m_impl->candidate_more_window_hide ();
+}
+
+bool
+InfoManager::update_helper_lookup_table (const LookupTable& table)
+{
+ return m_impl->update_helper_lookup_table (table);
+}
+
+bool
+InfoManager::select_aux (uint32 item)
+{
+ return m_impl->select_aux (item);
+}
+
+bool
+InfoManager::select_candidate (uint32 item)
+{
+ return m_impl->select_candidate (item);
+}
+
+bool
+InfoManager::lookup_table_page_up (void)
+{
+ return m_impl->lookup_table_page_up ();
+}
+
+bool
+InfoManager::lookup_table_page_down (void)
+{
+ return m_impl->lookup_table_page_down ();
+}
+
+bool
+InfoManager::update_lookup_table_page_size (uint32 size)
+{
+ return m_impl->update_lookup_table_page_size (size);
+}
+
+bool
+InfoManager::update_candidate_item_layout (const std::vector<uint32>& row_items)
+{
+ return m_impl->update_candidate_item_layout (row_items);
+}
+
+bool
+InfoManager::select_associate (uint32 item)
+{
+ return m_impl->select_associate (item);
+}
+
+bool
+InfoManager::associate_table_page_up (void)
+{
+ return m_impl->associate_table_page_up ();
+}
+
+bool
+InfoManager::associate_table_page_down (void)
+{
+ return m_impl->associate_table_page_down ();
+}
+
+bool
+InfoManager::update_associate_table_page_size (uint32 size)
+{
+ return m_impl->update_associate_table_page_size (size);
+}
+
+bool
+InfoManager::update_displayed_candidate_number (uint32 size)
+{
+ return m_impl->update_displayed_candidate_number (size);
+}
+
+void
+InfoManager::send_longpress_event (int type, int index)
+{
+ m_impl->send_longpress_event (type, index);
+}
+
+bool
+InfoManager::trigger_property (const String& property)
+{
+ return m_impl->trigger_property (property);
+}
+
+bool
+InfoManager::start_helper (const String& uuid)
+{
+ return m_impl->start_helper (uuid, -2, 0);
+}
+
+bool
+InfoManager::stop_helper (const String& uuid)
+{
+ return m_impl->stop_helper (uuid, -2, 0);
+}
+
+void
+InfoManager::set_default_ise (const DEFAULT_ISE_T& ise)
+{
+ m_impl->set_default_ise (ise);
+}
+
+void
+InfoManager::set_should_shared_ise (const bool should_shared_ise)
+{
+ m_impl->set_should_shared_ise (should_shared_ise);
+}
+
+int
+InfoManager::get_active_ise_list (std::vector<String>& strlist)
+{
+ return m_impl->get_active_ise_list (strlist);
+}
+
+int
+InfoManager::get_helper_manager_id (void)
+{
+ return m_impl->get_helper_manager_id ();
+}
+
+bool
+InfoManager::has_helper_manager_pending_event (void)
+{
+ return m_impl->has_helper_manager_pending_event ();
+}
+
+bool
+InfoManager::filter_helper_manager_event (void)
+{
+ return m_impl->filter_helper_manager_event ();
+}
+
+int
+InfoManager::send_display_name (String& name)
+{
+ return m_impl->send_display_name (name);
+}
+
+//void
+//InfoManager::reload_config (void)
+//{
+// m_impl->reload_config ();
+//}
+
+bool
+InfoManager::exit (void)
+{
+ return m_impl->exit ();
+}
+void
+InfoManager::update_ise_list (std::vector<String>& strList)
+{
+ m_impl->update_ise_list (strList);
+}
+
+/////////////////////////////////Message function begin/////////////////////////////////////////
+
+//ISM_TRANS_CMD_PANEL_RESET_KEYBOARD_ISE
+bool InfoManager:: reset_keyboard_ise (void)
+{
+ return m_impl->reset_keyboard_ise ();
+}
+
+//ISM_TRANS_CMD_SHOW_ISF_CONTROL
+void InfoManager::show_isf_panel (int client_id)
+{
+ m_impl->show_isf_panel (client_id);
+}
+
+//ISM_TRANS_CMD_HIDE_ISF_CONTROL
+void InfoManager::hide_isf_panel (int client_id)
+{
+ m_impl->hide_isf_panel (client_id);
+}
+
+//ISM_TRANS_CMD_SHOW_ISE_PANEL
+void InfoManager::show_ise_panel (int client_id, uint32 client, uint32 context, char* data, size_t len)
+{
+ m_impl->show_ise_panel (client_id, client, context, data, len);
+}
+
+//ISM_TRANS_CMD_HIDE_ISE_PANEL
+void InfoManager::hide_ise_panel (int client_id, uint32 client, uint32 context)
+{
+ m_impl->hide_ise_panel (client_id, client, context);
+}
+
+//SCIM_TRANS_CMD_PROCESS_KEY_EVENT
+bool InfoManager::process_key_event (KeyEvent& key, _OUT_ uint32& result)
+{
+ return m_impl->process_key_event (key, result);
+}
+
+//ISM_TRANS_CMD_GET_ACTIVE_ISE_GEOMETRY
+void InfoManager::get_input_panel_geometry (int client_id, _OUT_ struct rectinfo& info)
+{
+ m_impl->get_input_panel_geometry (client_id, info);
+}
+
+//ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY
+void InfoManager::get_candidate_window_geometry (int client_id, _OUT_ struct rectinfo& info)
+{
+ m_impl->get_candidate_window_geometry (client_id, info);
+}
+
+
+//ISM_TRANS_CMD_GET_ISE_LANGUAGE_LOCALE
+void InfoManager::get_ise_language_locale (int client_id, _OUT_ char* data, _OUT_ size_t& len)
+{
+ m_impl->get_ise_language_locale (client_id, data, len);
+}
+
+//ISM_TRANS_CMD_SET_LAYOUT
+void InfoManager::set_ise_layout (int client_id, uint32 layout)
+{
+ m_impl->set_ise_layout (client_id, layout);
+}
+
+//ISM_TRANS_CMD_SET_INPUT_MODE
+void InfoManager::set_ise_input_mode (int client_id, uint32 input_mode)
+{
+ m_impl->set_ise_input_mode (client_id, input_mode);
+}
+
+//ISM_TRANS_CMD_SET_INPUT_HINT
+void InfoManager::set_ise_input_hint (int client_id, uint32 input_hint)
+{
+ m_impl->set_ise_input_hint (client_id, input_hint);
+}
+
+//ISM_TRANS_CMD_UPDATE_BIDI_DIRECTION
+void InfoManager::update_ise_bidi_direction (int client_id, uint32 bidi_direction)
+{
+ m_impl->update_ise_bidi_direction (client_id, bidi_direction);
+}
+
+
+//ISM_TRANS_CMD_SET_ISE_LANGUAGE
+void InfoManager::set_ise_language (int client_id, uint32 language)
+{
+ m_impl->set_ise_language (client_id, language);
+}
+
+//ISM_TRANS_CMD_SET_ISE_IMDATA
+void InfoManager::set_ise_imdata (int client_id, const char* imdata, size_t len)
+{
+ m_impl->set_ise_imdata (client_id, imdata, len);
+}
+
+//ISM_TRANS_CMD_GET_ISE_IMDATA
+bool InfoManager:: get_ise_imdata (int client_id, _OUT_ char** imdata, _OUT_ size_t& len)
+{
+ return m_impl->get_ise_imdata (client_id, imdata, len);
+}
+
+//ISM_TRANS_CMD_GET_LAYOUT
+bool InfoManager:: get_ise_layout (int client_id, _OUT_ uint32& layout)
+{
+ return m_impl->get_ise_layout (client_id, layout);
+}
+
+//ISM_TRANS_CMD_GET_ISE_STATE
+void InfoManager::get_ise_state (int client_id, _OUT_ int& state)
+{
+ m_impl->get_ise_state (client_id, state);
+}
+
+//ISM_TRANS_CMD_GET_ACTIVE_ISE
+void InfoManager::get_active_ise (int client_id, _OUT_ String& default_uuid)
+{
+ m_impl->get_active_ise (client_id, default_uuid);
+}
+
+//ISM_TRANS_CMD_GET_ISE_LIST
+void InfoManager::get_ise_list (int client_id, _OUT_ std::vector<String>& strlist)
+{
+ m_impl->get_ise_list (client_id, strlist);
+}
+
+
+//ISM_TRANS_CMD_GET_ALL_HELPER_ISE_INFO
+void InfoManager::get_all_helper_ise_info (int client_id, _OUT_ HELPER_ISE_INFO& info)
+{
+ m_impl->get_all_helper_ise_info (client_id, info);
+}
+
+//ISM_TRANS_CMD_SET_ENABLE_HELPER_ISE_INFO
+//reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
+void InfoManager::set_enable_helper_ise_info (int client_id, String appid, uint32 is_enabled)
+{
+ m_impl->set_enable_helper_ise_info (client_id, appid, is_enabled);
+}
+
+//ISM_TRANS_CMD_SHOW_HELPER_ISE_LIST
+//reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
+void InfoManager::show_helper_ise_list (int client_id)
+{
+ m_impl->show_helper_ise_list (client_id);
+}
+
+
+//ISM_TRANS_CMD_SHOW_HELPER_ISE_SELECTOR
+//reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
+void InfoManager::show_helper_ise_selector (int client_id)
+{
+ m_impl->show_helper_ise_selector (client_id);
+}
+
+//ISM_TRANS_CMD_IS_HELPER_ISE_ENABLED
+//reply
+void InfoManager::is_helper_ise_enabled (int client_id, String strAppid, _OUT_ uint32& nEnabled)
+{
+ m_impl->is_helper_ise_enabled (client_id, strAppid, nEnabled);
+}
+
+//ISM_TRANS_CMD_GET_ISE_INFORMATION
+void InfoManager::get_ise_information (int client_id, String strUuid, _OUT_ String& strName, _OUT_ String& strLanguage,
+ _OUT_ int& nType, _OUT_ int& nOption, _OUT_ String& strModuleName)
+{
+ m_impl->get_ise_information (client_id, strUuid, strName, strLanguage, nType, nOption, strModuleName);
+}
+
+//ISM_TRANS_CMD_RESET_ISE_OPTION
+//reply SCIM_TRANS_CMD_OK
+bool InfoManager:: reset_ise_option (int client_id)
+{
+ return m_impl->reset_ise_option (client_id);
+}
+
+//ISM_TRANS_CMD_SET_ACTIVE_ISE_BY_UUID
+//reply
+bool InfoManager:: set_active_ise_by_uuid (int client_id, char* buf, size_t len)
+{
+ return m_impl->set_active_ise_by_uuid (client_id, buf, len);
+}
+
+//ISM_TRANS_CMD_SET_INITIAL_ISE_BY_UUID
+//reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
+void InfoManager::set_initial_ise_by_uuid (int client_id, char* buf, size_t len)
+{
+ m_impl->set_initial_ise_by_uuid (client_id, buf, len);
+}
+
+//ISM_TRANS_CMD_SET_RETURN_KEY_TYPE
+void InfoManager::set_ise_return_key_type (int client_id, uint32 type)
+{
+ m_impl->set_ise_return_key_type (client_id, type);
+}
+
+//ISM_TRANS_CMD_GET_RETURN_KEY_TYPE
+//reply
+bool InfoManager:: get_ise_return_key_type (int client_id, _OUT_ uint32& type)
+{
+ return m_impl->get_ise_return_key_type (client_id, type);
+}
+
+
+//ISM_TRANS_CMD_SET_RETURN_KEY_DISABLE
+void InfoManager::set_ise_return_key_disable (int client_id, uint32 disabled)
+{
+ m_impl->set_ise_return_key_disable (client_id, disabled);
+}
+
+//ISM_TRANS_CMD_GET_RETURN_KEY_DISABLE
+void InfoManager::get_ise_return_key_disable (int client_id, _OUT_ uint32& disabled)
+{
+ m_impl->get_ise_return_key_disable (client_id, disabled);
+}
+
+//ISM_TRANS_CMD_SET_CAPS_MODE
+void InfoManager::set_ise_caps_mode (int client_id, uint32 mode)
+{
+ m_impl->set_ise_caps_mode (client_id, mode);
+}
+
+//SCIM_TRANS_CMD_RELOAD_CONFIG
+void InfoManager::reload_config (void)
+{
+ m_impl->reload_config ();
+}
+
+//ISM_TRANS_CMD_SEND_WILL_SHOW_ACK
+void InfoManager::will_show_ack (int client_id)
+{
+ m_impl->will_show_ack (client_id);
+}
+
+//ISM_TRANS_CMD_SEND_WILL_HIDE_ACK
+void InfoManager::will_hide_ack (int client_id)
+{
+ m_impl->will_hide_ack (client_id);
+}
+
+//ISM_TRANS_CMD_RESET_DEFAULT_ISE
+void InfoManager::reset_default_ise (int client_id)
+{
+ m_impl->reset_default_ise (client_id);
+}
+
+//ISM_TRANS_CMD_SET_HARDWARE_KEYBOARD_MODE
+void InfoManager::set_keyboard_mode (int client_id, uint32 mode)
+{
+ m_impl->set_keyboard_mode (client_id, mode);
+}
+
+//ISM_TRANS_CMD_SEND_CANDIDATE_WILL_HIDE_ACK
+void InfoManager::candidate_will_hide_ack (int client_id)
+{
+ m_impl->candidate_will_hide_ack (client_id);
+}
+
+//ISM_TRANS_CMD_GET_ACTIVE_HELPER_OPTION
+void InfoManager::get_active_helper_option (int client_id, _OUT_ uint32& option)
+{
+ m_impl->get_active_helper_option (client_id, option);
+}
+
+//ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW
+void InfoManager::show_ise_option_window (int client_id)
+{
+ m_impl->show_ise_option_window (client_id);
+}
+
+//ISM_TRANS_CMD_EXPAND_CANDIDATE
+void InfoManager::expand_candidate ()
+{
+ m_impl->expand_candidate ();
+}
+
+//ISM_TRANS_CMD_CONTRACT_CANDIDATE
+void InfoManager::contract_candidate ()
+{
+ m_impl->contract_candidate ();
+}
+
+//ISM_TRANS_CMD_GET_RECENT_ISE_GEOMETRY
+void InfoManager::get_recent_ise_geometry (int client_id, uint32 angle, _OUT_ struct rectinfo& info)
+{
+ m_impl->get_recent_ise_geometry (client_id, angle, info);
+}
+
+//ISM_TRANS_CMD_REGISTER_PANEL_CLIENT
+void InfoManager::register_panel_client (uint32 client_id, uint32 id)
+{
+ m_impl->register_panel_client (client_id, id);
+}
+
+//SCIM_TRANS_CMD_PANEL_REGISTER_INPUT_CONTEXT
+void InfoManager::register_input_context (uint32 client_id, uint32 context, String uuid)
+{
+ m_impl->register_input_context (client_id, context, uuid);
+}
+
+//SCIM_TRANS_CMD_PANEL_REMOVE_INPUT_CONTEXT
+void InfoManager::remove_input_context (uint32 client_id, uint32 context)
+{
+ m_impl->remove_input_context (client_id, context);
+}
+
+//SCIM_TRANS_CMD_PANEL_RESET_INPUT_CONTEXT
+void InfoManager::socket_reset_input_context (int client_id, uint32 context)
+{
+ m_impl->socket_reset_input_context (client_id, context);
+}
+
+//SCIM_TRANS_CMD_FOCUS_IN
+void InfoManager::focus_in (int client_id, uint32 context, String uuid)
+{
+ m_impl->focus_in (client_id, context, uuid);
+}
+
+//SCIM_TRANS_CMD_FOCUS_OUT
+void InfoManager::focus_out (int client_id, uint32 context)
+{
+ m_impl->focus_out (client_id, context);
+}
+
+//ISM_TRANS_CMD_TURN_ON_LOG
+void InfoManager::socket_turn_on_log (uint32 isOn)
+{
+ m_impl->socket_turn_on_log (isOn);
+}
+
+//SCIM_TRANS_CMD_PANEL_TURN_ON
+void InfoManager::socket_turn_on (void)
+{
+ m_impl->socket_turn_on ();
+}
+
+//SCIM_TRANS_CMD_PANEL_TURN_OFF
+void InfoManager::socket_turn_off (void)
+{
+ m_impl->socket_turn_off ();
+}
+
+//SCIM_TRANS_CMD_UPDATE_SCREEN
+void InfoManager::socket_update_screen (int client_id, uint32 num)
+{
+ m_impl->socket_update_screen (client_id, num);
+}
+
+//SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION
+void InfoManager::socket_update_spot_location (uint32 x, uint32 y, uint32 top_y)
+{
+ m_impl->socket_update_spot_location (x, y, top_y);
+}
+
+//ISM_TRANS_CMD_UPDATE_CURSOR_POSITION
+void InfoManager::socket_update_cursor_position (uint32 cursor_pos)
+{
+ m_impl->socket_update_cursor_position (cursor_pos);
+}
+
+//ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT
+void InfoManager::socket_update_surrounding_text (String text, uint32 cursor)
+{
+ m_impl->socket_update_surrounding_text (text, cursor);
+}
+
+//ISM_TRANS_CMD_UPDATE_SELECTION
+void InfoManager::socket_update_selection (String text)
+{
+ m_impl->socket_update_selection (text);
+}
+
+//SCIM_TRANS_CMD_PANEL_UPDATE_FACTORY_INFO
+void InfoManager::socket_update_factory_info (PanelFactoryInfo& info)
+{
+ m_impl->socket_update_factory_info (info);
+}
+
+//SCIM_TRANS_CMD_PANEL_SHOW_HELP
+void InfoManager::socket_show_help (String help)
+{
+ m_impl->socket_show_help (help);
+}
+
+//SCIM_TRANS_CMD_PANEL_SHOW_FACTORY_MENU
+void InfoManager::socket_show_factory_menu (std::vector <PanelFactoryInfo>& vec)
+{
+ m_impl->socket_show_factory_menu (vec);
+}
+
+//SCIM_TRANS_CMD_SHOW_PREEDIT_STRING
+void InfoManager::socket_show_preedit_string (void)
+{
+ m_impl->socket_show_preedit_string ();
+}
+
+//SCIM_TRANS_CMD_SHOW_AUX_STRING
+void InfoManager::socket_show_aux_string (void)
+{
+ m_impl->socket_show_aux_string ();
+}
+
+//SCIM_TRANS_CMD_SHOW_LOOKUP_TABLE
+void InfoManager::socket_show_lookup_table (void)
+{
+ m_impl->socket_show_lookup_table ();
+}
+
+//ISM_TRANS_CMD_SHOW_ASSOCIATE_TABLE
+void InfoManager::socket_show_associate_table (void)
+{
+ m_impl->socket_show_associate_table ();
+}
+
+//SCIM_TRANS_CMD_HIDE_PREEDIT_STRING
+void InfoManager::socket_hide_preedit_string (void)
+{
+ m_impl->socket_hide_preedit_string ();
+}
+
+//SCIM_TRANS_CMD_HIDE_AUX_STRING
+void InfoManager::socket_hide_aux_string (void)
+{
+ m_impl->socket_hide_aux_string ();
+}
+
+//SCIM_TRANS_CMD_HIDE_LOOKUP_TABLE
+void InfoManager::socket_hide_lookup_table (void)
+{
+ m_impl->socket_hide_lookup_table ();
+}
+
+//ISM_TRANS_CMD_HIDE_ASSOCIATE_TABLE
+void InfoManager::socket_hide_associate_table (void)
+{
+ m_impl->socket_hide_associate_table ();
+}
+
+//SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING
+void InfoManager::socket_update_preedit_string (String& str, const AttributeList& attrs, uint32 caret)
+{
+ m_impl->socket_update_preedit_string (str, attrs, caret);
+}
+
+//SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET
+void InfoManager::socket_update_preedit_caret (uint32 caret)
+{
+ m_impl->socket_update_preedit_caret (caret);
+}
+
+//SCIM_TRANS_CMD_UPDATE_AUX_STRING
+void InfoManager::socket_update_aux_string (String& str, const AttributeList& attrs)
+{
+ m_impl->socket_update_aux_string (str, attrs);
+}
+
+//SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE
+void InfoManager::socket_update_lookup_table (const LookupTable& table)
+{
+ m_impl->socket_update_lookup_table (table);
+}
+
+//ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE
+void InfoManager::socket_update_associate_table (const LookupTable& table)
+{
+ m_impl->socket_update_associate_table (table);
+}
+
+//SCIM_TRANS_CMD_REGISTER_PROPERTIES
+void InfoManager::socket_register_properties (const PropertyList& properties)
+{
+ m_impl->socket_register_properties (properties);
+}
+
+//SCIM_TRANS_CMD_UPDATE_PROPERTY
+void InfoManager::socket_update_property (const Property& property)
+{
+ m_impl->socket_update_property (property);
+}
+
+//ISM_TRANS_CMD_GET_KEYBOARD_ISE_LIST
+void InfoManager::socket_get_keyboard_ise_list (String& uuid)
+{
+ m_impl->socket_get_keyboard_ise_list (uuid);
+}
+
+//ISM_TRANS_CMD_SET_CANDIDATE_UI
+void InfoManager::socket_set_candidate_ui (uint32 portrait_line, uint32 mode)
+{
+ m_impl->socket_set_candidate_ui (portrait_line, mode);
+}
+
+//ISM_TRANS_CMD_GET_CANDIDATE_UI
+void InfoManager::socket_get_candidate_ui (String uuid)
+{
+ m_impl->socket_get_candidate_ui (uuid);
+}
+
+//ISM_TRANS_CMD_SET_CANDIDATE_POSITION
+void InfoManager::socket_set_candidate_position (uint32 left, uint32 top)
+{
+ m_impl->socket_set_candidate_position (left, top);
+}
+
+//ISM_TRANS_CMD_HIDE_CANDIDATE
+void InfoManager::socket_hide_candidate (void)
+{
+ m_impl->socket_hide_candidate ();
+}
+
+//ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY
+void InfoManager::socket_get_candidate_geometry (String& uuid)
+{
+ m_impl->socket_get_candidate_geometry (uuid);
+}
+
+//ISM_TRANS_CMD_SET_KEYBOARD_ISE_BY_UUID
+void InfoManager::socket_set_keyboard_ise (String uuid)
+{
+ m_impl->socket_set_keyboard_ise (uuid);
+}
+
+//ISM_TRANS_CMD_SELECT_CANDIDATE
+void InfoManager::socket_helper_select_candidate (uint32 index)
+{
+ m_impl->socket_helper_select_candidate (index);
+}
+
+//ISM_TRANS_CMD_UPDATE_ISE_GEOMETRY
+void InfoManager::socket_helper_update_ise_geometry (int client, uint32 x, uint32 y, uint32 width, uint32 height)
+{
+ m_impl->socket_helper_update_ise_geometry (client, x, y, width, height);
+}
+
+//ISM_TRANS_CMD_GET_KEYBOARD_ISE
+void InfoManager::socket_get_keyboard_ise (String uuid)
+{
+ m_impl->socket_get_keyboard_ise (uuid);
+}
+
+//SCIM_TRANS_CMD_START_HELPER
+void InfoManager::socket_start_helper (int client_id, uint32 context, String uuid)
+{
+ m_impl->socket_start_helper (client_id, context, uuid);
+}
+
+//SCIM_TRANS_CMD_STOP_HELPER
+void InfoManager::socket_stop_helper (int client_id, uint32 context, String uuid)
+{
+ m_impl->socket_stop_helper (client_id, context, uuid);
+}
+
+//SCIM_TRANS_CMD_SEND_HELPER_EVENT
+void InfoManager::socket_send_helper_event (int client_id, uint32 context, String uuid, const Transaction& _nest_trans)
+{
+ m_impl->socket_send_helper_event (client_id, context, uuid, _nest_trans);
+}
+
+//SCIM_TRANS_CMD_REGISTER_PROPERTIES
+void InfoManager::socket_helper_register_properties (int client, PropertyList& properties)
+{
+ m_impl->socket_helper_register_properties (client, properties);
+}
+
+//SCIM_TRANS_CMD_UPDATE_PROPERTY
+void InfoManager::socket_helper_update_property (int client, Property& property)
+{
+ m_impl->socket_helper_update_property (client, property);
+}
+
+//SCIM_TRANS_CMD_PANEL_SEND_IMENGINE_EVENT
+void InfoManager::socket_helper_send_imengine_event (int client, uint32 target_ic, String target_uuid , Transaction& nest_trans)
+{
+ m_impl->socket_helper_send_imengine_event (client, target_ic, target_uuid, nest_trans);
+}
+
+//SCIM_TRANS_CMD_PROCESS_KEY_EVENT
+//SCIM_TRANS_CMD_PANEL_SEND_KEY_EVENT
+void InfoManager::socket_helper_send_key_event (int client, uint32 target_ic, String target_uuid, KeyEvent key)
+{
+ m_impl->socket_helper_send_key_event (client, target_ic, target_uuid, key);
+}
+
+//SCIM_TRANS_CMD_FORWARD_KEY_EVENT
+void InfoManager::socket_helper_forward_key_event (int client, uint32 target_ic, String target_uuid, KeyEvent key)
+{
+ m_impl->socket_helper_forward_key_event (client, target_ic, target_uuid, key);
+}
+
+//SCIM_TRANS_CMD_COMMIT_STRING
+void InfoManager::socket_helper_commit_string (int client, uint32 target_ic, String target_uuid, WideString wstr)
+{
+ m_impl->socket_helper_commit_string (client, target_ic, target_uuid, wstr);
+}
+
+//SCIM_TRANS_CMD_GET_SURROUNDING_TEXT
+void InfoManager::socket_helper_get_surrounding_text (int client, String uuid, uint32 maxlen_before, uint32 maxlen_after)
+{
+ m_impl->socket_helper_get_surrounding_text (client, uuid, maxlen_before, maxlen_after);
+}
+
+//SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT
+void InfoManager::socket_helper_delete_surrounding_text (int client, uint32 offset, uint32 len)
+{
+ m_impl->socket_helper_delete_surrounding_text (client, offset, len);
+}
+
+//SCIM_TRANS_CMD_GET_SELECTION
+void InfoManager::socket_helper_get_selection (int client, String uuid)
+{
+ m_impl->socket_helper_get_selection (client, uuid);
+}
+
+//SCIM_TRANS_CMD_SET_SELECTION
+void InfoManager::socket_helper_set_selection (int client, uint32 start, uint32 end)
+{
+ m_impl->socket_helper_set_selection (client, start, end);
+}
+
+//SCIM_TRANS_CMD_SHOW_PREEDIT_STRING
+void InfoManager::socket_helper_show_preedit_string (int client, uint32 target_ic, String target_uuid)
+{
+ m_impl->socket_helper_show_preedit_string (client, target_ic, target_uuid);
+}
+
+//SCIM_TRANS_CMD_HIDE_PREEDIT_STRING
+void InfoManager::socket_helper_hide_preedit_string (int client, uint32 target_ic, String target_uuid)
+{
+ m_impl->socket_helper_hide_preedit_string (client, target_ic, target_uuid);
+}
+
+//SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING
+void InfoManager::socket_helper_update_preedit_string (int client, uint32 target_ic, String target_uuid, WideString wstr,
+ AttributeList& attrs, uint32 caret)
+{
+ m_impl->socket_helper_update_preedit_string (client, target_ic, target_uuid, wstr, attrs, caret);
+}
+
+//SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET
+void InfoManager::socket_helper_update_preedit_caret (int client, uint32 caret)
+{
+ m_impl->socket_helper_update_preedit_caret (client, caret);
+}
+
+//SCIM_TRANS_CMD_PANEL_REGISTER_HELPER
+void InfoManager::socket_helper_register_helper (int client, HelperInfo& info)
+{
+ m_impl->socket_helper_register_helper (client, info);
+}
+
+//SCIM_TRANS_CMD_PANEL_REGISTER_ACTIVE_HELPER
+void InfoManager::socket_helper_register_helper_passive (int client, HelperInfo& info)
+{
+ m_impl->socket_helper_register_helper_passive (client, info);
+}
+
+//ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT
+void InfoManager::socket_helper_update_input_context (int client, uint32 type, uint32 value)
+{
+ m_impl->socket_helper_update_input_context (client, type, value);
+}
+
+//SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND
+void InfoManager::socket_helper_send_private_command (int client, String command)
+{
+ m_impl->socket_helper_send_private_command (client, command);
+}
+
+//ISM_TRANS_CMD_UPDATE_ISE_EXIT
+//void InfoManager::UPDATE_ISE_EXIT (int client)
+//{
+// m_impl->UPDATE_ISE_EXIT (client);
+//}
+
+bool InfoManager::check_privilege_by_sockfd (int client_id, const String& privilege) {
+ return m_impl->check_privilege_by_sockfd (client_id, privilege);
+}
+
+void InfoManager::add_client (int client_id, uint32 key, ClientType type)
+{
+ m_impl->add_client (client_id, key, type);
+}
+
+void InfoManager::del_client (int client_id)
+{
+ m_impl->del_client (client_id);
+}
+
+//////////////////////////////////Message function end/////////////////////////////////////////
+Connection
+InfoManager::signal_connect_reload_config (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_reload_config (slot);
+}
+
+Connection
+InfoManager::signal_connect_turn_on (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_turn_on (slot);
+}
+
+Connection
+InfoManager::signal_connect_turn_off (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_turn_off (slot);
+}
+
+Connection
+InfoManager::signal_connect_show_panel (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_show_panel (slot);
+}
+
+Connection
+InfoManager::signal_connect_hide_panel (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_hide_panel (slot);
+}
+
+Connection
+InfoManager::signal_connect_update_screen (InfoManagerSlotInt* slot)
+{
+ return m_impl->signal_connect_update_screen (slot);
+}
+
+Connection
+InfoManager::signal_connect_update_spot_location (InfoManagerSlotIntIntInt* slot)
+{
+ return m_impl->signal_connect_update_spot_location (slot);
+}
+
+Connection
+InfoManager::signal_connect_update_factory_info (InfoManagerSlotFactoryInfo* slot)
+{
+ return m_impl->signal_connect_update_factory_info (slot);
+}
+
+Connection
+InfoManager::signal_connect_start_default_ise (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_start_default_ise (slot);
+}
+
+Connection
+InfoManager::signal_connect_stop_default_ise (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_stop_default_ise (slot);
+}
+
+Connection
+InfoManager::signal_connect_set_candidate_ui (InfoManagerSlotIntInt* slot)
+{
+ return m_impl->signal_connect_set_candidate_ui (slot);
+}
+
+Connection
+InfoManager::signal_connect_get_candidate_ui (InfoManagerSlotIntInt2* slot)
+{
+ return m_impl->signal_connect_get_candidate_ui (slot);
+}
+
+Connection
+InfoManager::signal_connect_set_candidate_position (InfoManagerSlotIntInt* slot)
+{
+ return m_impl->signal_connect_set_candidate_position (slot);
+}
+
+Connection
+InfoManager::signal_connect_get_candidate_geometry (InfoManagerSlotRect* slot)
+{
+ return m_impl->signal_connect_get_candidate_geometry (slot);
+}
+
+Connection
+InfoManager::signal_connect_get_input_panel_geometry (InfoManagerSlotRect* slot)
+{
+ return m_impl->signal_connect_get_input_panel_geometry (slot);
+}
+
+Connection
+InfoManager::signal_connect_set_keyboard_ise (InfoManagerSlotString* slot)
+{
+ return m_impl->signal_connect_set_keyboard_ise (slot);
+}
+
+Connection
+InfoManager::signal_connect_get_keyboard_ise (InfoManagerSlotString2* slot)
+{
+ return m_impl->signal_connect_get_keyboard_ise (slot);
+}
+
+Connection
+InfoManager::signal_connect_show_help (InfoManagerSlotString* slot)
+{
+ return m_impl->signal_connect_show_help (slot);
+}
+
+Connection
+InfoManager::signal_connect_show_factory_menu (InfoManagerSlotFactoryInfoVector* slot)
+{
+ return m_impl->signal_connect_show_factory_menu (slot);
+}
+
+Connection
+InfoManager::signal_connect_show_preedit_string (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_show_preedit_string (slot);
+}
+
+Connection
+InfoManager::signal_connect_show_aux_string (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_show_aux_string (slot);
+}
+
+Connection
+InfoManager::signal_connect_show_lookup_table (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_show_lookup_table (slot);
+}
+
+Connection
+InfoManager::signal_connect_show_associate_table (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_show_associate_table (slot);
+}
+
+Connection
+InfoManager::signal_connect_hide_preedit_string (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_hide_preedit_string (slot);
+}
+
+Connection
+InfoManager::signal_connect_hide_aux_string (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_hide_aux_string (slot);
+}
+
+Connection
+InfoManager::signal_connect_hide_lookup_table (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_hide_lookup_table (slot);
+}
+
+Connection
+InfoManager::signal_connect_hide_associate_table (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_hide_associate_table (slot);
+}
+
+Connection
+InfoManager::signal_connect_update_preedit_string (InfoManagerSlotAttributeStringInt* slot)
+{
+ return m_impl->signal_connect_update_preedit_string (slot);
+}
+
+Connection
+InfoManager::signal_connect_update_preedit_caret (InfoManagerSlotInt* slot)
+{
+ return m_impl->signal_connect_update_preedit_caret (slot);
+}
+
+Connection
+InfoManager::signal_connect_update_aux_string (InfoManagerSlotAttributeString* slot)
+{
+ return m_impl->signal_connect_update_aux_string (slot);
+}
+
+Connection
+InfoManager::signal_connect_update_lookup_table (InfoManagerSlotLookupTable* slot)
+{
+ return m_impl->signal_connect_update_lookup_table (slot);
+}
+
+Connection
+InfoManager::signal_connect_update_associate_table (InfoManagerSlotLookupTable* slot)
+{
+ return m_impl->signal_connect_update_associate_table (slot);
+}
+
+Connection
+InfoManager::signal_connect_register_properties (InfoManagerSlotPropertyList* slot)
+{
+ return m_impl->signal_connect_register_properties (slot);
+}
+
+Connection
+InfoManager::signal_connect_update_property (InfoManagerSlotProperty* slot)
+{
+ return m_impl->signal_connect_update_property (slot);
+}
+
+Connection
+InfoManager::signal_connect_register_helper_properties (InfoManagerSlotIntPropertyList* slot)
+{
+ return m_impl->signal_connect_register_helper_properties (slot);
+}
+
+Connection
+InfoManager::signal_connect_update_helper_property (InfoManagerSlotIntProperty* slot)
+{
+ return m_impl->signal_connect_update_helper_property (slot);
+}
+
+Connection
+InfoManager::signal_connect_register_helper (InfoManagerSlotIntHelperInfo* slot)
+{
+ return m_impl->signal_connect_register_helper (slot);
+}
+
+Connection
+InfoManager::signal_connect_remove_helper (InfoManagerSlotInt* slot)
+{
+ return m_impl->signal_connect_remove_helper (slot);
+}
+
+Connection
+InfoManager::signal_connect_set_active_ise_by_uuid (InfoManagerSlotStringBool* slot)
+{
+ return m_impl->signal_connect_set_active_ise_by_uuid (slot);
+}
+
+Connection
+InfoManager::signal_connect_focus_in (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_focus_in (slot);
+}
+
+Connection
+InfoManager::signal_connect_focus_out (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_focus_out (slot);
+}
+
+Connection
+InfoManager::signal_connect_expand_candidate (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_expand_candidate (slot);
+}
+
+Connection
+InfoManager::signal_connect_contract_candidate (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_contract_candidate (slot);
+}
+
+Connection
+InfoManager::signal_connect_select_candidate (InfoManagerSlotInt* slot)
+{
+ return m_impl->signal_connect_select_candidate (slot);
+}
+
+Connection
+InfoManager::signal_connect_get_ise_list (InfoManagerSlotBoolStringVector* slot)
+{
+ return m_impl->signal_connect_get_ise_list (slot);
+}
+
+Connection
+InfoManager::signal_connect_get_all_helper_ise_info (InfoManagerSlotBoolHelperInfo* slot)
+{
+ return m_impl->signal_connect_get_all_helper_ise_info (slot);
+}
+
+Connection
+InfoManager::signal_connect_set_has_option_helper_ise_info (InfoManagerSlotStringBool* slot)
+{
+ return m_impl->signal_connect_set_has_option_helper_ise_info (slot);
+}
+
+Connection
+InfoManager::signal_connect_set_enable_helper_ise_info (InfoManagerSlotStringBool* slot)
+{
+ return m_impl->signal_connect_set_enable_helper_ise_info (slot);
+}
+
+Connection
+InfoManager::signal_connect_show_helper_ise_list (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_show_helper_ise_list (slot);
+}
+
+Connection
+InfoManager::signal_connect_show_helper_ise_selector (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_show_helper_ise_selector (slot);
+}
+
+Connection
+InfoManager::signal_connect_is_helper_ise_enabled (InfoManagerSlotStringInt* slot)
+{
+ return m_impl->signal_connect_is_helper_ise_enabled (slot);
+}
+
+Connection
+InfoManager::signal_connect_get_ise_information (InfoManagerSlotBoolString4int2* slot)
+{
+ return m_impl->signal_connect_get_ise_information (slot);
+}
+
+Connection
+InfoManager::signal_connect_get_keyboard_ise_list (InfoManagerSlotBoolStringVector* slot)
+{
+ return m_impl->signal_connect_get_keyboard_ise_list (slot);
+}
+
+Connection
+InfoManager::signal_connect_update_ise_geometry (InfoManagerSlotIntIntIntInt* slot)
+{
+ return m_impl->signal_connect_update_ise_geometry (slot);
+}
+
+Connection
+InfoManager::signal_connect_get_language_list (InfoManagerSlotStringVector* slot)
+{
+ return m_impl->signal_connect_get_language_list (slot);
+}
+
+Connection
+InfoManager::signal_connect_get_all_language (InfoManagerSlotStringVector* slot)
+{
+ return m_impl->signal_connect_get_all_language (slot);
+}
+
+Connection
+InfoManager::signal_connect_get_ise_language (InfoManagerSlotStrStringVector* slot)
+{
+ return m_impl->signal_connect_get_ise_language (slot);
+}
+
+Connection
+InfoManager::signal_connect_get_ise_info_by_uuid (InfoManagerSlotStringISEINFO* slot)
+{
+ return m_impl->signal_connect_get_ise_info_by_uuid (slot);
+}
+
+Connection
+InfoManager::signal_connect_send_key_event (InfoManagerSlotKeyEvent* slot)
+{
+ return m_impl->signal_connect_send_key_event (slot);
+}
+
+Connection
+InfoManager::signal_connect_accept_connection (InfoManagerSlotInt* slot)
+{
+ return m_impl->signal_connect_accept_connection (slot);
+}
+
+Connection
+InfoManager::signal_connect_close_connection (InfoManagerSlotInt* slot)
+{
+ return m_impl->signal_connect_close_connection (slot);
+}
+
+Connection
+InfoManager::signal_connect_exit (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_exit (slot);
+}
+
+Connection
+InfoManager::signal_connect_transaction_start (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_transaction_start (slot);
+}
+
+Connection
+InfoManager::signal_connect_transaction_end (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_transaction_end (slot);
+}
+
+Connection
+InfoManager::signal_connect_lock (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_lock (slot);
+}
+
+Connection
+InfoManager::signal_connect_unlock (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_unlock (slot);
+}
+
+Connection
+InfoManager::signal_connect_update_input_context (InfoManagerSlotIntInt* slot)
+{
+ return m_impl->signal_connect_update_input_context (slot);
+}
+
+Connection
+InfoManager::signal_connect_show_ise (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_show_ise (slot);
+}
+
+Connection
+InfoManager::signal_connect_hide_ise (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_hide_ise (slot);
+}
+
+Connection
+InfoManager::signal_connect_will_show_ack (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_will_show_ack (slot);
+}
+
+Connection
+InfoManager::signal_connect_will_hide_ack (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_will_hide_ack (slot);
+}
+
+Connection
+InfoManager::signal_connect_set_keyboard_mode (InfoManagerSlotInt* slot)
+{
+ return m_impl->signal_connect_set_keyboard_mode (slot);
+}
+
+Connection
+InfoManager::signal_connect_candidate_will_hide_ack (InfoManagerSlotVoid* slot)
+{
+ return m_impl->signal_connect_candidate_will_hide_ack (slot);
+}
+
+Connection
+InfoManager::signal_connect_get_ise_state (InfoManagerSlotInt2* slot)
+{
+ return m_impl->signal_connect_get_ise_state (slot);
+}
+
+Connection
+InfoManager::signal_connect_get_recent_ise_geometry (InfoManagerSlotIntRect* slot)
+{
+ return m_impl->signal_connect_get_recent_ise_geometry (slot);
+}
+
+Connection
+InfoManager::signal_connect_check_privilege_by_sockfd (InfoManagerSlotIntString2* slot)
+{
+ return m_impl->signal_connect_check_privilege_by_sockfd (slot);
+}
+
+
+} /* namespace scim */
+
+/*
+vi:ts=4:nowrap:ai:expandtab
+*/
/**
* @file scim_panel_agent.h
- * @brief Defines scim::PanelAgent and their related types.
+ * @brief Defines scim::InfoManager and their related types.
*
- * scim::PanelAgent is a class used to write Panel daemons.
+ * scim::InfoManager is a class used to write Panel daemons.
* It acts like a Socket Server and handles all socket clients
* issues.
*/
* $Id: scim_panel_agent.h,v 1.2 2005/06/11 14:50:31 suzhe Exp $
*/
-#ifndef __SCIM_PANEL_AGENT_H
-#define __SCIM_PANEL_AGENT_H
+#ifndef __ISF_INFO_MANAGER_H
+#define __ISF_INFO_MANAGER_H
#include <scim_panel_common.h>
+#ifndef _OUT_
+#define _OUT_
+#endif
-namespace scim {
+namespace scim
+{
+
+enum ClientType {
+ UNKNOWN_CLIENT,
+ FRONTEND_CLIENT,
+ FRONTEND_ACT_CLIENT,
+ HELPER_CLIENT,
+ HELPER_ACT_CLIENT,
+ IMCONTROL_ACT_CLIENT,
+ IMCONTROL_CLIENT
+};
+
+struct ClientInfo {
+ uint32 key;
+ ClientType type;
+};
/**
* @addtogroup Panel
* @{
*/
-typedef struct _ISE_INFO
-{
- String uuid;
- String name;
- String lang;
- String icon;
- uint32 option;
- TOOLBAR_MODE_T type;
-} ISE_INFO;
-
-typedef struct _HELPER_ISE_INFO {
- std::vector<String> appid;
- std::vector<String> label;
- std::vector<uint32> is_enabled;
- std::vector<uint32> is_preinstalled;
- std::vector<uint32> has_option;
-} HELPER_ISE_INFO;
-
typedef Slot0<void>
- PanelAgentSlotVoid;
+InfoManagerSlotVoid;
typedef Slot1<void, int>
- PanelAgentSlotInt;
+InfoManagerSlotInt;
-typedef Slot1<void, int &>
- PanelAgentSlotInt2;
+typedef Slot1<void, int&>
+InfoManagerSlotInt2;
-typedef Slot1<void, const String &>
- PanelAgentSlotString;
+typedef Slot1<void, const String&>
+InfoManagerSlotString;
-typedef Slot2<void, String &, String &>
- PanelAgentSlotString2;
+typedef Slot2<void, String&, String&>
+InfoManagerSlotString2;
-typedef Slot2<void, int, const String &>
- PanelAgentSlotIntString;
+typedef Slot2<void, int, const String&>
+InfoManagerSlotIntString;
-typedef Slot1<void, const PanelFactoryInfo &>
- PanelAgentSlotFactoryInfo;
+typedef Slot1<void, const PanelFactoryInfo&>
+InfoManagerSlotFactoryInfo;
typedef Slot1<void, const std::vector <PanelFactoryInfo> &>
- PanelAgentSlotFactoryInfoVector;
+InfoManagerSlotFactoryInfoVector;
-typedef Slot1<void, const LookupTable &>
- PanelAgentSlotLookupTable;
+typedef Slot1<void, const LookupTable&>
+InfoManagerSlotLookupTable;
-typedef Slot1<void, const Property &>
- PanelAgentSlotProperty;
+typedef Slot1<void, const Property&>
+InfoManagerSlotProperty;
-typedef Slot1<void, const PropertyList &>
- PanelAgentSlotPropertyList;
+typedef Slot1<void, const PropertyList&>
+InfoManagerSlotPropertyList;
typedef Slot2<void, int, int>
- PanelAgentSlotIntInt;
+InfoManagerSlotIntInt;
-typedef Slot2<void, int &, int &>
- PanelAgentSlotIntInt2;
+typedef Slot2<void, int&, int&>
+InfoManagerSlotIntInt2;
typedef Slot3<void, int, int, int>
- PanelAgentSlotIntIntInt;
+InfoManagerSlotIntIntInt;
typedef Slot4<void, int, int, int, int>
- PanelAgentSlotIntIntIntInt;
+InfoManagerSlotIntIntIntInt;
-typedef Slot2<void, int, const Property &>
- PanelAgentSlotIntProperty;
+typedef Slot2<void, int, const Property&>
+InfoManagerSlotIntProperty;
-typedef Slot2<void, int, const PropertyList &>
- PanelAgentSlotIntPropertyList;
+typedef Slot2<void, int, const PropertyList&>
+InfoManagerSlotIntPropertyList;
-typedef Slot2<void, int, const HelperInfo &>
- PanelAgentSlotIntHelperInfo;
+typedef Slot2<void, int, const HelperInfo&>
+InfoManagerSlotIntHelperInfo;
-typedef Slot2<void, const String &, const AttributeList &>
- PanelAgentSlotAttributeString;
+typedef Slot2<void, const String&, const AttributeList&>
+InfoManagerSlotAttributeString;
-typedef Slot3<void, const String &, const AttributeList &, int>
- PanelAgentSlotAttributeStringInt;
+typedef Slot3<void, const String&, const AttributeList&, int>
+InfoManagerSlotAttributeStringInt;
typedef Slot1<void, std::vector<String> &>
- PanelAgentSlotStringVector;
+InfoManagerSlotStringVector;
-typedef Slot1<bool, HELPER_ISE_INFO &>
- PanelAgentSlotBoolHelperInfo;
+typedef Slot1<bool, HELPER_ISE_INFO&>
+InfoManagerSlotBoolHelperInfo;
typedef Slot1<bool, std::vector<String> &>
- PanelAgentSlotBoolStringVector;
+InfoManagerSlotBoolStringVector;
-typedef Slot2<void, char *, std::vector<String> &>
- PanelAgentSlotStrStringVector;
+typedef Slot2<void, char*, std::vector<String> &>
+InfoManagerSlotStrStringVector;
-typedef Slot2<bool, const String &, ISE_INFO &>
- PanelAgentSlotStringISEINFO;
+typedef Slot2<bool, const String&, ISE_INFO&>
+InfoManagerSlotStringISEINFO;
-typedef Slot2<bool, String, int &>
- PanelAgentSlotStringInt;
+typedef Slot2<bool, String, int&>
+InfoManagerSlotStringInt;
-typedef Slot1<void, const KeyEvent &>
- PanelAgentSlotKeyEvent;
+typedef Slot1<void, const KeyEvent&>
+InfoManagerSlotKeyEvent;
-typedef Slot1<void, struct rectinfo &>
- PanelAgentSlotRect;
+typedef Slot1<void, struct rectinfo&>
+InfoManagerSlotRect;
-typedef Slot2<void, const String &, bool>
- PanelAgentSlotStringBool;
+typedef Slot2<void, const String&, bool>
+InfoManagerSlotStringBool;
-typedef Slot6<bool, String, String &, String &, int &, int &, String &>
- PanelAgentSlotBoolString4int2;
+typedef Slot6<bool, String, String&, String&, int&, int&, String&>
+InfoManagerSlotBoolString4int2;
-typedef Slot2<void, int, struct rectinfo &>
- PanelAgentSlotIntRect;
+typedef Slot2<void, int, struct rectinfo&>
+InfoManagerSlotIntRect;
typedef Slot2<bool, int, String>
- PanelAgentSlotIntString2;
-
-typedef struct DefaultIse
-{
- TOOLBAR_MODE_T type;
- String uuid;
- String name;
- DefaultIse () : type (TOOLBAR_KEYBOARD_MODE), uuid (""), name ("") { }
-} DEFAULT_ISE_T;
+InfoManagerSlotIntString2;
/**
* @brief The class to implement all socket protocol in Panel.
* corresponding signals.
*
* Note that, there are two special signals: lock(void) and unlock(void). These
- * two signals are used to provide a thread lock to PanelAgent, so that PanelAgent
+ * two signals are used to provide a thread lock to InfoManager, so that InfoManager
* can run correctly within a multi-threading Panel program.
*/
-class EXAPI PanelAgent
+class EXAPI InfoManager
{
- class PanelAgentImpl;
- PanelAgentImpl *m_impl;
+ class InfoManagerImpl;
+ InfoManagerImpl* m_impl;
- PanelAgent (const HelperAgent &);
- const PanelAgent & operator = (const HelperAgent &);
+ InfoManager (const HelperAgent&);
+ const InfoManager& operator = (const HelperAgent&);
public:
- PanelAgent ();
- ~PanelAgent ();
+ InfoManager ();
+ ~InfoManager ();
/**
- * @brief Initialize this PanelAgent.
+ * @brief Initialize this InfoManager.
*
* @param config The name of the config module to be used by Helpers.
* @param display The name of display, on which the Panel should run.
- * @param resident If this is true then this PanelAgent will keep running
+ * @param resident If this is true then this InfoManager will keep running
* even if there is no more client connected.
*
- * @return true if the PanelAgent is initialized correctly and ready to run.
+ * @return true if the InfoManager is initialized correctly and ready to run.
*/
- bool initialize (const String &config, const String &display, bool resident = false);
+ bool initialize (InfoManager* info_manager, const ConfigPointer& config, const String& display, bool resident = false);
/**
- * @brief Check if this PanelAgent is initialized correctly and ready to run.
+ * @brief Check if this InfoManager is initialized correctly and ready to run.
*
- * @return true if this PanelAgent is ready to run.
+ * @return true if this InfoManager is ready to run.
*/
bool valid (void) const;
/**
- * @brief Run this PanelAgent.
- *
- * This method has its own dedicated main loop,
- * so it should be run in a separated thread.
- *
- * @return false if the Panel SocketServer encountered an error when running.
- * Otherwise, it won't return until the server exits.
- */
- bool run (void);
-
- /**
- * @brief Stop this PanelAgent.
+ * @brief Stop this InfoManager.
*/
void stop (void);
public:
+ const ClientInfo& socket_get_client_info (int client) const;
+
/**
* @brief Get the list of all helpers.
*
* all stand alone but not auto start Helpers, so that users can activate
* the Helpers by clicking in the menu.
*
- * All auto start Helpers should be started by Panel after running PanelAgent
- * by calling PanelAgent::start_helper().
+ * All auto start Helpers should be started by Panel after running InfoManager
+ * by calling InfoManager::start_helper().
*
* @param helpers A list contains information of all Helpers.
*/
- int get_helper_list (std::vector <HelperInfo> & helpers) const;
+ int get_helper_list (std::vector <HelperInfo>& helpers) const;
/**
* @brief Get the list of active ISEs.
*
* @return the list size.
*/
- int get_active_ise_list (std::vector<String> &strlist);
+ int get_active_ise_list (std::vector<String>& strlist);
/**
* @brief Get the helper manager connection id.
*
* @return zero if this operation is successful, otherwise return -1.
*/
- int send_display_name (String &name);
+ int send_display_name (String& name);
/**
*
* @return the current helper ISE uuid.
*/
- String get_current_helper_uuid (void) const;
+ String get_current_helper_uuid (void) const;
/**
* @brief Get current helper ISE name.
*
* @param name The current ISE name.
*/
- void set_current_ise_name (String &name);
+ void set_current_ise_name (String& name);
/**
* @brief Set current ISE type.
*
* @param rect It contains ISE size and position.
*/
- void get_current_ise_geometry (rectinfo &rect);
+ void get_current_ise_geometry (rectinfo& rect);
/**
* @brief Send candidate panel event to IM Control.
*
* @param uuid The helper ISE uuid.
*/
- void focus_out_helper (const String &uuid);
+ void focus_out_helper (const String& uuid);
/**
* @brief Notice helper ISE to focus in.
*
* @param uuid The helper ISE uuid.
*/
- void focus_in_helper (const String &uuid);
+ void focus_in_helper (const String& uuid);
/**
* @brief Notice helper ISE to show window.
*
* @param uuid The helper ISE uuid.
*/
- bool show_helper (const String &uuid);
+ bool show_helper (const String& uuid);
/**
* @brief Notice helper ISE to hide window.
*
* @param uuid The helper ISE uuid.
*/
- void hide_helper (const String &uuid);
+ void hide_helper (const String& uuid);
/**
*
* @param ise The variable contains the information of default ISE.
*/
- void set_default_ise (const DEFAULT_ISE_T &ise);
+ void set_default_ise (const DEFAULT_ISE_T& ise);
/**
* @brief Set whether shared ISE is for all applications.
*/
void set_should_shared_ise (const bool should_shared_ise);
- /**
- * @brief Reset keyboard ISE.
- *
- * @return true if this operation is successful, otherwise return false.
- */
- bool reset_keyboard_ise (void) const;
+
public:
/**
* @param position The new preedit caret position.
* @return true if the command was sent correctly.
*/
- bool move_preedit_caret (uint32 position);
+ bool move_preedit_caret (uint32 position);
+#if 0
/**
* @brief Request help information from the focused IMEngineInstance object.
* @return true if the command was sent correctly.
*/
- bool request_help (void);
+ bool request_help (void);
/**
* @brief Request factory menu from the focused FrontEnd.
* @return true if the command was sent correctly.
*/
- bool request_factory_menu (void);
+ bool request_factory_menu (void);
+#endif
/**
* @brief Change the factory used by the focused IMEngineInstance object.
* @param uuid The uuid of the new factory.
* @return true if the command was sent correctly.
*/
- bool change_factory (const String &uuid);
+ bool change_factory (const String& uuid);
/**
* @brief Notice Helper ISE that candidate more window is showed.
* @return true if the command was sent correctly.
*/
- bool candidate_more_window_show (void);
+ bool candidate_more_window_show (void);
/**
* @brief Notice Helper ISE that candidate more window is hidden.
* @return true if the command was sent correctly.
*/
- bool candidate_more_window_hide (void);
+ bool candidate_more_window_hide (void);
/**
* @brief Notice Helper ISE that show candidate.
* @return true if the command was sent correctly.
*/
- bool helper_candidate_show (void);
+ bool helper_candidate_show (void);
/**
* @brief Notice Helper ISE that hide candidate.
* @return true if the command was sent correctly.
*/
- bool helper_candidate_hide (void);
+ bool helper_candidate_hide (void);
/**
* @brief Update helper lookup table.
* @return true if the command was sent correctly.
*/
- bool update_helper_lookup_table (const LookupTable &table);
+ bool update_helper_lookup_table (const LookupTable& table);
/**
* @brief Let the focused IMEngineInstance object
* @param item The index of the selected aux.
* @return true if the command was sent correctly.
*/
- bool select_aux (uint32 item);
+ bool select_aux (uint32 item);
/**
* @brief Let the focused IMEngineInstance object
* @param item The index of the selected candidate.
* @return true if the command was sent correctly.
*/
- bool select_candidate (uint32 item);
+ bool select_candidate (uint32 item);
/**
* @brief Let the focused IMEngineInstance object
* flip the LookupTable to previous page.
* @return true if the command was sent correctly.
*/
- bool lookup_table_page_up (void);
+ bool lookup_table_page_up (void);
/**
* @brief Let the focused IMEngineInstance object
* flip the LookupTable to next page.
* @return true if the command was sent correctly.
*/
- bool lookup_table_page_down (void);
+ bool lookup_table_page_down (void);
/**
* @brief Let the focused IMEngineInstance object
* @param size The new page size.
* @return true if the command was sent correctly.
*/
- bool update_lookup_table_page_size (uint32 size);
+ bool update_lookup_table_page_size (uint32 size);
/**
* @brief Let the focused IMEngineInstance object
* @param row_items The items of each row.
* @return true if the command was sent correctly.
*/
- bool update_candidate_item_layout (const std::vector<uint32> &row_items);
+ bool update_candidate_item_layout (const std::vector<uint32>& row_items);
/**
* @brief Let the focused IMEngineInstance object
* @param item The index of the selected associate.
* @return true if the command was sent correctly.
*/
- bool select_associate (uint32 item);
+ bool select_associate (uint32 item);
/**
* @brief Let the focused IMEngineInstance object
* flip the AssociateTable to previous page.
* @return true if the command was sent correctly.
*/
- bool associate_table_page_up (void);
+ bool associate_table_page_up (void);
/**
* @brief Let the focused IMEngineInstance object
* flip the AssociateTable to next page.
* @return true if the command was sent correctly.
*/
- bool associate_table_page_down (void);
+ bool associate_table_page_down (void);
/**
* @brief Let the focused IMEngineInstance object
* @param property The property key to be triggered.
* @return true if the command was sent correctly.
*/
- bool trigger_property (const String &property);
-
- /**
- * @brief Trigger a property of a Helper object.
- *
- * @param client The client id of the Helper object.
- * @param property The property key to be triggered.
- * @return true if the command was sent correctly.
- */
- bool trigger_helper_property (int client,
- const String &property);
+ bool trigger_property (const String& property);
/**
* @brief Start a stand alone helper.
* @param uuid The uuid of the Helper object to be started.
* @return true if the command was sent correctly.
*/
- bool start_helper (const String &uuid);
+ bool start_helper (const String& uuid);
/**
* @brief Stop a stand alone helper.
* @param uuid The uuid of the Helper object to be stopped.
* @return true if the command was sent correctly.
*/
- bool stop_helper (const String &uuid);
+ bool stop_helper (const String& uuid);
/**
* @brief Let all FrontEnds and Helpers reload configuration.
* @return true if the command was sent correctly.
*/
- bool reload_config (void);
+ //void reload_config (void);
/**
* @brief Let all FrontEnds, Helpers and this Panel exit.
* @return true if the command was sent correctly.
*/
- bool exit (void);
+ bool exit (void);
- /**
- * @brief Filter the events received from panel client.
- *
- * Corresponding signal will be emitted in this method.
- *
- * @param fd The file description for connection.
- *
- * @return true if the command was sent correctly, otherwise return false.
- */
- bool filter_event (int fd);
-
- /**
- * @brief Filter the exception events received from panel client.
- *
- * Corresponding signal will be emitted in this method.
- *
- * @param fd The file description for connection.
- *
- * @return true if the command was sent correctly, otherwise return false.
- */
- bool filter_exception_event (int fd);
-
- /**
- * @brief Get PanelAgent server fd.
- *
- * @return the PanelAgent server fd.
- */
- int get_server_id (void);
/**
* @brief Send candidate longpress event to ISE.
*
* @return none.
*/
- void send_longpress_event (int type, int index);
+ void send_longpress_event (int type, int index);
+
+
+
/**
* @brief Request to update ISE list.
*
* @return none.
*/
- void update_ise_list (std::vector<String> &strList);
+ void update_ise_list (std::vector<String>& strList);
+/////////////////////////////////Message function begin/////////////////////////////////////////
+
+//ISM_TRANS_CMD_PANEL_RESET_KEYBOARD_ISE
+ /**
+ * @brief Reset keyboard ISE.
+ *
+ * @return true if this operation is successful, otherwise return false.
+ */
+ bool reset_keyboard_ise (void);
+
+ //ISM_TRANS_CMD_SHOW_ISF_CONTROL
+ void show_isf_panel (int client_id);
+
+ //ISM_TRANS_CMD_HIDE_ISF_CONTROL
+ void hide_isf_panel (int client_id);
+
+ //ISM_TRANS_CMD_SHOW_ISE_PANEL
+ void show_ise_panel (int client_id, uint32 client, uint32 context, char* data, size_t len);
+
+ //ISM_TRANS_CMD_HIDE_ISE_PANEL
+ void hide_ise_panel (int client_id, uint32 client, uint32 context);
+
+ //SCIM_TRANS_CMD_PROCESS_KEY_EVENT
+ bool process_key_event (KeyEvent& key, _OUT_ uint32& result);
+
+ //ISM_TRANS_CMD_GET_ACTIVE_ISE_GEOMETRY
+ void get_input_panel_geometry (int client_id, _OUT_ struct rectinfo& info);
+
+ //ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY
+ void get_candidate_window_geometry (int client_id, _OUT_ struct rectinfo& info);
+
+
+ //ISM_TRANS_CMD_GET_ISE_LANGUAGE_LOCALE
+ void get_ise_language_locale (int client_id, _OUT_ char* data, _OUT_ size_t& len);
+
+ //ISM_TRANS_CMD_SET_LAYOUT
+ void set_ise_layout (int client_id, uint32 layout);
+
+ //ISM_TRANS_CMD_SET_INPUT_MODE
+ void set_ise_input_mode (int client_id, uint32 input_mode);
+
+ //ISM_TRANS_CMD_SET_INPUT_HINT
+ void set_ise_input_hint (int client_id, uint32 input_hint);
+
+ //ISM_TRANS_CMD_UPDATE_BIDI_DIRECTION
+ void update_ise_bidi_direction (int client_id, uint32 bidi_direction);
+
+
+ //ISM_TRANS_CMD_SET_ISE_LANGUAGE
+ void set_ise_language (int client_id, uint32 language);
+
+ //ISM_TRANS_CMD_SET_ISE_IMDATA
+ void set_ise_imdata (int client_id, const char* imdata, size_t len);
+
+ //ISM_TRANS_CMD_GET_ISE_IMDATA
+ bool get_ise_imdata (int client_id, _OUT_ char** imdata, _OUT_ size_t& len);
+
+ //ISM_TRANS_CMD_GET_LAYOUT
+ bool get_ise_layout (int client_id, _OUT_ uint32& layout);
+
+ //ISM_TRANS_CMD_GET_ISE_STATE
+ void get_ise_state (int client_id, _OUT_ int& state);
+
+ //ISM_TRANS_CMD_GET_ACTIVE_ISE
+ void get_active_ise (int client_id, _OUT_ String& default_uuid);
+
+ //ISM_TRANS_CMD_GET_ISE_LIST
+ void get_ise_list (int client_id, _OUT_ std::vector<String>& strlist);
+
+
+ //ISM_TRANS_CMD_GET_ALL_HELPER_ISE_INFO
+ void get_all_helper_ise_info (int client_id, _OUT_ HELPER_ISE_INFO& info);
+
+ //ISM_TRANS_CMD_SET_ENABLE_HELPER_ISE_INFO
+ //reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
+ void set_enable_helper_ise_info (int client_id, String appid, uint32 is_enabled);
+
+ //ISM_TRANS_CMD_SHOW_HELPER_ISE_LIST
+ //reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
+ void show_helper_ise_list (int client_id);
+
+
+ //ISM_TRANS_CMD_SHOW_HELPER_ISE_SELECTOR
+ //reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
+ void show_helper_ise_selector (int client_id);
+
+ //ISM_TRANS_CMD_IS_HELPER_ISE_ENABLED
+ //reply
+ void is_helper_ise_enabled (int client_id, String strAppid, _OUT_ uint32& nEnabled);
+
+ //ISM_TRANS_CMD_GET_ISE_INFORMATION
+ void get_ise_information (int client_id, String strUuid, _OUT_ String& strName, _OUT_ String& strLanguage,
+ _OUT_ int& nType, _OUT_ int& nOption, _OUT_ String& strModuleName);
+
+ //ISM_TRANS_CMD_RESET_ISE_OPTION
+ //reply SCIM_TRANS_CMD_OK
+ bool reset_ise_option (int client_id);
+
+ //ISM_TRANS_CMD_SET_ACTIVE_ISE_BY_UUID
+ //reply
+ bool set_active_ise_by_uuid (int client_id, char* buf, size_t len);
+
+ //ISM_TRANS_CMD_SET_INITIAL_ISE_BY_UUID
+ //reply SCIM_TRANS_CMD_FAIL or SCIM_TRANS_CMD_OK
+ void set_initial_ise_by_uuid (int client_id, char* buf, size_t len);
+
+ //ISM_TRANS_CMD_SET_RETURN_KEY_TYPE
+ void set_ise_return_key_type (int client_id, uint32 type);
+
+
+ //ISM_TRANS_CMD_GET_RETURN_KEY_TYPE
+ //reply
+ bool get_ise_return_key_type (int client_id, _OUT_ uint32& type);
+
+
+ //ISM_TRANS_CMD_SET_RETURN_KEY_DISABLE
+ void set_ise_return_key_disable (int client_id, uint32 disabled);
+
+
+ //ISM_TRANS_CMD_GET_RETURN_KEY_DISABLE
+ void get_ise_return_key_disable (int client_id, _OUT_ uint32& disabled);
+
+
+ //ISM_TRANS_CMD_SET_CAPS_MODE
+ void set_ise_caps_mode (int client_id, uint32 mode);
+
+
+ //SCIM_TRANS_CMD_RELOAD_CONFIG
+ void reload_config (void);
+
+
+ //ISM_TRANS_CMD_SEND_WILL_SHOW_ACK
+ void will_show_ack (int client_id);
+
+
+ //ISM_TRANS_CMD_SEND_WILL_HIDE_ACK
+ void will_hide_ack (int client_id);
+
+
+ //ISM_TRANS_CMD_RESET_DEFAULT_ISE
+ void reset_default_ise (int client_id);
+
+ //ISM_TRANS_CMD_SET_HARDWARE_KEYBOARD_MODE
+ void set_keyboard_mode (int client_id, uint32 mode);
+
+ //ISM_TRANS_CMD_SEND_CANDIDATE_WILL_HIDE_ACK
+ void candidate_will_hide_ack (int client_id);
+
+ //ISM_TRANS_CMD_GET_ACTIVE_HELPER_OPTION
+ void get_active_helper_option (int client_id, _OUT_ uint32& option);
+
+ //ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW
+ void show_ise_option_window (int client_id);
+
+ //ISM_TRANS_CMD_EXPAND_CANDIDATE
+ void expand_candidate ();
+
+ //ISM_TRANS_CMD_CONTRACT_CANDIDATE
+ void contract_candidate ();
+
+ //ISM_TRANS_CMD_GET_RECENT_ISE_GEOMETRY
+ void get_recent_ise_geometry (int client_id, uint32 angle, _OUT_ struct rectinfo& info);
+
+ //ISM_TRANS_CMD_REGISTER_PANEL_CLIENT
+ void register_panel_client (uint32 client_id, uint32 id);
+
+ //SCIM_TRANS_CMD_PANEL_REGISTER_INPUT_CONTEXT
+ void register_input_context (uint32 client_id, uint32 context, String uuid);
+
+ //SCIM_TRANS_CMD_PANEL_REMOVE_INPUT_CONTEXT
+ void remove_input_context (uint32 client_id, uint32 context);
+
+ //SCIM_TRANS_CMD_PANEL_RESET_INPUT_CONTEXT
+ void socket_reset_input_context (int client_id, uint32 context);
+
+ //SCIM_TRANS_CMD_FOCUS_IN
+ void focus_in (int client_id, uint32 context, String uuid);
+
+ //SCIM_TRANS_CMD_FOCUS_OUT
+ void focus_out (int client_id, uint32 context);
+
+ //ISM_TRANS_CMD_TURN_ON_LOG
+ void socket_turn_on_log (uint32 isOn);
+
+
+ //SCIM_TRANS_CMD_PANEL_TURN_ON
+ void socket_turn_on (void);
+
+
+ //SCIM_TRANS_CMD_PANEL_TURN_OFF
+ void socket_turn_off (void);
+
+ //SCIM_TRANS_CMD_UPDATE_SCREEN
+ void socket_update_screen (int client_id, uint32 num);
+
+
+ //SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION
+ void socket_update_spot_location (uint32 x, uint32 y, uint32 top_y);
+
+ //ISM_TRANS_CMD_UPDATE_CURSOR_POSITION
+ void socket_update_cursor_position (uint32 cursor_pos);
+
+ //ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT
+ void socket_update_surrounding_text (String text, uint32 cursor);
+
+ //ISM_TRANS_CMD_UPDATE_SELECTION
+ void socket_update_selection (String text);
+
+ //SCIM_TRANS_CMD_PANEL_UPDATE_FACTORY_INFO
+ void socket_update_factory_info (PanelFactoryInfo& info);
+
+ //SCIM_TRANS_CMD_PANEL_SHOW_HELP
+ void socket_show_help (String help);
+
+ //SCIM_TRANS_CMD_PANEL_SHOW_FACTORY_MENU
+ void socket_show_factory_menu (std::vector <PanelFactoryInfo>& vec);
+
+ //SCIM_TRANS_CMD_SHOW_PREEDIT_STRING
+ void socket_show_preedit_string (void);
+
+ //SCIM_TRANS_CMD_SHOW_AUX_STRING
+ void socket_show_aux_string (void);
+
+ //SCIM_TRANS_CMD_SHOW_LOOKUP_TABLE
+ void socket_show_lookup_table (void);
+
+ //ISM_TRANS_CMD_SHOW_ASSOCIATE_TABLE
+ void socket_show_associate_table (void);
+
+ //SCIM_TRANS_CMD_HIDE_PREEDIT_STRING
+ void socket_hide_preedit_string (void);
+
+ //SCIM_TRANS_CMD_HIDE_AUX_STRING
+ void socket_hide_aux_string (void);
+
+ //SCIM_TRANS_CMD_HIDE_LOOKUP_TABLE
+ void socket_hide_lookup_table (void);
+
+ //ISM_TRANS_CMD_HIDE_ASSOCIATE_TABLE
+ void socket_hide_associate_table (void);
+
+ //SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING
+ void socket_update_preedit_string (String& str, const AttributeList& attrs, uint32 caret);
+
+
+ //SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET
+ void socket_update_preedit_caret (uint32 caret);
+
+ //SCIM_TRANS_CMD_UPDATE_AUX_STRING
+ void socket_update_aux_string (String& str, const AttributeList& attrs);
+
+ //SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE
+ void socket_update_lookup_table (const LookupTable& table);
+
+ //ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE
+ void socket_update_associate_table (const LookupTable& table);
+
+ //SCIM_TRANS_CMD_REGISTER_PROPERTIES
+ void socket_register_properties (const PropertyList& properties);
+
+ //SCIM_TRANS_CMD_UPDATE_PROPERTY
+ void socket_update_property (const Property& property);
+
+ //ISM_TRANS_CMD_GET_KEYBOARD_ISE_LIST
+ void socket_get_keyboard_ise_list (String& uuid);
+
+ //ISM_TRANS_CMD_SET_CANDIDATE_UI
+ void socket_set_candidate_ui (uint32 portrait_line, uint32 mode);
+
+ //ISM_TRANS_CMD_GET_CANDIDATE_UI
+ void socket_get_candidate_ui (String uuid);
+
+ //ISM_TRANS_CMD_SET_CANDIDATE_POSITION
+ void socket_set_candidate_position (uint32 left, uint32 top);
+
+ //ISM_TRANS_CMD_HIDE_CANDIDATE
+ void socket_hide_candidate (void);
+
+ //ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY
+ void socket_get_candidate_geometry (String& uuid);
+
+ //ISM_TRANS_CMD_SET_KEYBOARD_ISE_BY_UUID
+ void socket_set_keyboard_ise (String uuid);
+
+ //ISM_TRANS_CMD_SELECT_CANDIDATE
+ void socket_helper_select_candidate (uint32 index);
+
+ //ISM_TRANS_CMD_UPDATE_ISE_GEOMETRY
+ void socket_helper_update_ise_geometry (int client, uint32 x, uint32 y, uint32 width, uint32 height);
+
+ //ISM_TRANS_CMD_GET_KEYBOARD_ISE
+ void socket_get_keyboard_ise (String uuid);
+
+ //SCIM_TRANS_CMD_START_HELPER
+ void socket_start_helper (int client_id, uint32 context, String uuid);
+
+
+ //SCIM_TRANS_CMD_STOP_HELPER
+ void socket_stop_helper (int client_id, uint32 context, String uuid);
+
+ //SCIM_TRANS_CMD_SEND_HELPER_EVENT
+ void socket_send_helper_event (int client_id, uint32 context, String uuid, const Transaction& _nest_trans);
+
+
+ //SCIM_TRANS_CMD_REGISTER_PROPERTIES
+ void socket_helper_register_properties (int client, PropertyList& properties);
+
+ //SCIM_TRANS_CMD_UPDATE_PROPERTY
+ void socket_helper_update_property (int client, Property& property);
+
+ //SCIM_TRANS_CMD_PANEL_SEND_IMENGINE_EVENT
+ void socket_helper_send_imengine_event (int client, uint32 target_ic, String target_uuid , Transaction& nest_trans);
+
+ //SCIM_TRANS_CMD_PROCESS_KEY_EVENT
+ //SCIM_TRANS_CMD_PANEL_SEND_KEY_EVENT
+ void socket_helper_send_key_event (int client, uint32 target_ic, String target_uuid, KeyEvent key);
+
+ //SCIM_TRANS_CMD_FORWARD_KEY_EVENT
+ void socket_helper_forward_key_event (int client, uint32 target_ic, String target_uuid, KeyEvent key);
+
+ //SCIM_TRANS_CMD_COMMIT_STRING
+ void socket_helper_commit_string (int client, uint32 target_ic, String target_uuid, WideString wstr);
+
+ //SCIM_TRANS_CMD_GET_SURROUNDING_TEXT
+ void socket_helper_get_surrounding_text (int client, String uuid, uint32 maxlen_before, uint32 maxlen_after);
+
+ //SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT
+ void socket_helper_delete_surrounding_text (int client, uint32 offset, uint32 len);
+
+ //SCIM_TRANS_CMD_GET_SELECTION
+ void socket_helper_get_selection (int client, String uuid);
+
+ //SCIM_TRANS_CMD_SET_SELECTION
+ void socket_helper_set_selection (int client, uint32 start, uint32 end);
+
+
+ //SCIM_TRANS_CMD_SHOW_PREEDIT_STRING
+ void socket_helper_show_preedit_string (int client, uint32 target_ic, String target_uuid);
+
+ //SCIM_TRANS_CMD_HIDE_PREEDIT_STRING
+ void socket_helper_hide_preedit_string (int client, uint32 target_ic, String target_uuid);
+
+ //SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING
+ void socket_helper_update_preedit_string (int client, uint32 target_ic, String target_uuid, WideString wstr, AttributeList& attrs, uint32 caret);
+
+ //SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET
+ void socket_helper_update_preedit_caret (int client, uint32 caret);
+
+ //SCIM_TRANS_CMD_PANEL_REGISTER_HELPER
+ void socket_helper_register_helper (int client, HelperInfo& info);
+
+ //SCIM_TRANS_CMD_PANEL_REGISTER_ACTIVE_HELPER
+ void socket_helper_register_helper_passive (int client, HelperInfo& info);
+
+ //ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT
+ void socket_helper_update_input_context (int client, uint32 type, uint32 value);
+
+ //SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND
+ void socket_helper_send_private_command (int client, String command);
+
+ //ISM_TRANS_CMD_UPDATE_ISE_EXIT
+ //void UPDATE_ISE_EXIT (int client);
+ bool check_privilege_by_sockfd (int client_id, const String& privilege);
+
+ void add_client (int client_id, uint32 key, ClientType type);
+
+
+ void del_client (int client_id);
+
+//////////////////////////////////Message function end/////////////////////////////////////////
+
public:
/**
* When a Helper object send a RELOAD_CONFIG event to this Panel,
* this signal will be emitted. Panel should reload all configuration here.
*/
- Connection signal_connect_reload_config (PanelAgentSlotVoid *slot);
+ Connection signal_connect_reload_config (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Turn on.
*
* slot prototype: void turn_on (void);
*/
- Connection signal_connect_turn_on (PanelAgentSlotVoid *slot);
+ Connection signal_connect_turn_on (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Turn off.
*
* slot prototype: void turn_off (void);
*/
- Connection signal_connect_turn_off (PanelAgentSlotVoid *slot);
+ Connection signal_connect_turn_off (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Show panel.
*
* slot prototype: void show_panel (void);
*/
- Connection signal_connect_show_panel (PanelAgentSlotVoid *slot);
+ Connection signal_connect_show_panel (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Hide panel.
*
* slot prototype: void hide_panel (void);
*/
- Connection signal_connect_hide_panel (PanelAgentSlotVoid *slot);
+ Connection signal_connect_hide_panel (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Update screen.
*
* slot prototype: void update_screen (int screen);
*/
- Connection signal_connect_update_screen (PanelAgentSlotInt *slot);
+ Connection signal_connect_update_screen (InfoManagerSlotInt* slot);
/**
* @brief Signal: Update spot location.
*
* slot prototype: void update_spot_location (int x, int y, int top_y);
*/
- Connection signal_connect_update_spot_location (PanelAgentSlotIntIntInt *slot);
+ Connection signal_connect_update_spot_location (InfoManagerSlotIntIntInt* slot);
/**
* @brief Signal: Update factory information.
*
* slot prototype: void update_factory_info (const PanelFactoryInfo &info);
*/
- Connection signal_connect_update_factory_info (PanelAgentSlotFactoryInfo *slot);
+ Connection signal_connect_update_factory_info (InfoManagerSlotFactoryInfo* slot);
/**
* @brief Signal: start default ise.
*
* slot prototype: void start_default_ise (void);
*/
- Connection signal_connect_start_default_ise (PanelAgentSlotVoid *slot);
+ Connection signal_connect_start_default_ise (InfoManagerSlotVoid* slot);
/**
* @brief Signal: stop default ise.
*
* slot prototype: void stop_default_ise (void);
*/
- Connection signal_connect_stop_default_ise (PanelAgentSlotVoid *slot);
+ Connection signal_connect_stop_default_ise (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Get the list of keyboard ise name.
*
* slot prototype: bool get_keyboard_ise_list (std::vector<String> &);
*/
- Connection signal_connect_get_keyboard_ise_list (PanelAgentSlotBoolStringVector *slot);
+ Connection signal_connect_get_keyboard_ise_list (InfoManagerSlotBoolStringVector* slot);
/**
* @brief Signal: Set candidate ui.
*
* slot prototype: void set_candidate_ui (int style, int mode);
*/
- Connection signal_connect_set_candidate_ui (PanelAgentSlotIntInt *slot);
+ Connection signal_connect_set_candidate_ui (InfoManagerSlotIntInt* slot);
/**
* @brief Signal: Get candidate ui.
*
* slot prototype: void get_candidate_ui (int &style, int &mode);
*/
- Connection signal_connect_get_candidate_ui (PanelAgentSlotIntInt2 *slot);
+ Connection signal_connect_get_candidate_ui (InfoManagerSlotIntInt2* slot);
/**
* @brief Signal: Get candidate window geometry information.
*
* slot prototype: void get_candidate_geometry (rectinfo &info);
*/
- Connection signal_connect_get_candidate_geometry (PanelAgentSlotRect *slot);
+ Connection signal_connect_get_candidate_geometry (InfoManagerSlotRect* slot);
/**
* @brief Signal: Get input panel geometry information.
*
* slot prototype: void get_input_panel_geometry (rectinfo &info);
*/
- Connection signal_connect_get_input_panel_geometry (PanelAgentSlotRect *slot);
+ Connection signal_connect_get_input_panel_geometry (InfoManagerSlotRect* slot);
/**
* @brief Signal: Set candidate position.
*
* slot prototype: void set_candidate_position (int left, int top);
*/
- Connection signal_connect_set_candidate_position (PanelAgentSlotIntInt *slot);
+ Connection signal_connect_set_candidate_position (InfoManagerSlotIntInt* slot);
/**
* @brief Signal: Set keyboard ise.
*
* slot prototype: void set_keyboard_ise (const String &uuid);
*/
- Connection signal_connect_set_keyboard_ise (PanelAgentSlotString *slot);
+ Connection signal_connect_set_keyboard_ise (InfoManagerSlotString* slot);
/**
* @brief Signal: Get keyboard ise.
*
* slot prototype: void get_keyboard_ise (String &ise_name);
*/
- Connection signal_connect_get_keyboard_ise (PanelAgentSlotString2 *slot);
+ Connection signal_connect_get_keyboard_ise (InfoManagerSlotString2* slot);
/**
* @brief Signal: Update ise geometry.
*
* slot prototype: void update_ise_geometry (int x, int y, int width, int height);
*/
- Connection signal_connect_update_ise_geometry (PanelAgentSlotIntIntIntInt *slot);
+ Connection signal_connect_update_ise_geometry (InfoManagerSlotIntIntIntInt* slot);
/**
* @brief Signal: Show help.
*
* slot prototype: void show_help (const String &help);
*/
- Connection signal_connect_show_help (PanelAgentSlotString *slot);
+ Connection signal_connect_show_help (InfoManagerSlotString* slot);
/**
* @brief Signal: Show factory menu.
*
* slot prototype: void show_factory_menu (const std::vector <PanelFactoryInfo> &menu);
*/
- Connection signal_connect_show_factory_menu (PanelAgentSlotFactoryInfoVector *slot);
+ Connection signal_connect_show_factory_menu (InfoManagerSlotFactoryInfoVector* slot);
/**
* @brief Signal: Show preedit string.
*
* slot prototype: void show_preedit_string (void):
*/
- Connection signal_connect_show_preedit_string (PanelAgentSlotVoid *slot);
+ Connection signal_connect_show_preedit_string (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Show aux string.
*
* slot prototype: void show_aux_string (void):
*/
- Connection signal_connect_show_aux_string (PanelAgentSlotVoid *slot);
+ Connection signal_connect_show_aux_string (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Show lookup table.
*
* slot prototype: void show_lookup_table (void):
*/
- Connection signal_connect_show_lookup_table (PanelAgentSlotVoid *slot);
+ Connection signal_connect_show_lookup_table (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Show associate table.
*
* slot prototype: void show_associate_table (void):
*/
- Connection signal_connect_show_associate_table (PanelAgentSlotVoid *slot);
+ Connection signal_connect_show_associate_table (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Hide preedit string.
*
* slot prototype: void hide_preedit_string (void);
*/
- Connection signal_connect_hide_preedit_string (PanelAgentSlotVoid *slot);
+ Connection signal_connect_hide_preedit_string (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Hide aux string.
*
* slot prototype: void hide_aux_string (void);
*/
- Connection signal_connect_hide_aux_string (PanelAgentSlotVoid *slot);
+ Connection signal_connect_hide_aux_string (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Hide lookup table.
*
* slot prototype: void hide_lookup_table (void);
*/
- Connection signal_connect_hide_lookup_table (PanelAgentSlotVoid *slot);
+ Connection signal_connect_hide_lookup_table (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Hide associate table.
*
* slot prototype: void hide_associate_table (void);
*/
- Connection signal_connect_hide_associate_table (PanelAgentSlotVoid *slot);
+ Connection signal_connect_hide_associate_table (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Update preedit string.
* - str -- The UTF-8 encoded string to be displayed in preedit area.
* - attrs -- The attributes of the string.
*/
- Connection signal_connect_update_preedit_string (PanelAgentSlotAttributeStringInt *slot);
+ Connection signal_connect_update_preedit_string (InfoManagerSlotAttributeStringInt* slot);
/**
* @brief Signal: Update preedit caret.
*
* slot prototype: void update_preedit_caret (int caret);
*/
- Connection signal_connect_update_preedit_caret (PanelAgentSlotInt *slot);
+ Connection signal_connect_update_preedit_caret (InfoManagerSlotInt* slot);
/**
* @brief Signal: Update aux string.
* - str -- The UTF-8 encoded string to be displayed in aux area.
* - attrs -- The attributes of the string.
*/
- Connection signal_connect_update_aux_string (PanelAgentSlotAttributeString *slot);
+ Connection signal_connect_update_aux_string (InfoManagerSlotAttributeString* slot);
/**
* @brief Signal: Update lookup table.
* slot prototype: void update_lookup_table (const LookupTable &table);
* - table -- The new LookupTable object.
*/
- Connection signal_connect_update_lookup_table (PanelAgentSlotLookupTable *slot);
+ Connection signal_connect_update_lookup_table (InfoManagerSlotLookupTable* slot);
/**
* @brief Signal: Update associate table.
* slot prototype: void update_associate_table (const LookupTable &table);
* - table -- The new LookupTable object.
*/
- Connection signal_connect_update_associate_table (PanelAgentSlotLookupTable *slot);
+ Connection signal_connect_update_associate_table (InfoManagerSlotLookupTable* slot);
/**
* @brief Signal: Register properties.
* slot prototype: void register_properties (const PropertyList &props);
* - props -- The properties to be registered.
*/
- Connection signal_connect_register_properties (PanelAgentSlotPropertyList *slot);
+ Connection signal_connect_register_properties (InfoManagerSlotPropertyList* slot);
/**
* @brief Signal: Update property.
* slot prototype: void update_property (const Property &prop);
* - prop -- The property to be updated.
*/
- Connection signal_connect_update_property (PanelAgentSlotProperty *slot);
+ Connection signal_connect_update_property (InfoManagerSlotProperty* slot);
/**
* @brief Signal: Register properties of a helper.
* - id -- The client id of the helper object.
* - props -- The properties to be registered.
*/
- Connection signal_connect_register_helper_properties (PanelAgentSlotIntPropertyList *slot);
+ Connection signal_connect_register_helper_properties (InfoManagerSlotIntPropertyList* slot);
/**
* @brief Signal: Update helper property.
* - id -- The client id of the helper object.
* - prop -- The property to be updated.
*/
- Connection signal_connect_update_helper_property (PanelAgentSlotIntProperty *slot);
+ Connection signal_connect_update_helper_property (InfoManagerSlotIntProperty* slot);
/**
* @brief Signal: Register a helper object.
* - id -- The client id of the helper object.
* - helper -- The information of the helper object.
*/
- Connection signal_connect_register_helper (PanelAgentSlotIntHelperInfo *slot);
+ Connection signal_connect_register_helper (InfoManagerSlotIntHelperInfo* slot);
/**
* @brief Signal: Remove a helper object.
* slot prototype: void remove_helper (int id);
* - id -- The client id of the helper object to be removed.
*/
- Connection signal_connect_remove_helper (PanelAgentSlotInt *slot);
+ Connection signal_connect_remove_helper (InfoManagerSlotInt* slot);
/**
* @brief Signal: Start an ise with the speficied uuid
* slot prototype: void set_active_ise_by_uuid (const String& uuid);
* - uuid -- the uuid of the ise object
*/
- Connection signal_connect_set_active_ise_by_uuid (PanelAgentSlotStringBool *slot);
+ Connection signal_connect_set_active_ise_by_uuid (InfoManagerSlotStringBool* slot);
/**
* @brief Signal: Focus in panel.
*
* slot prototype: void focus_in (void);
*/
- Connection signal_connect_focus_in (PanelAgentSlotVoid *slot);
+ Connection signal_connect_focus_in (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Focus out panel.
*
* slot prototype: void focus_out (void);
*/
- Connection signal_connect_focus_out (PanelAgentSlotVoid *slot);
+ Connection signal_connect_focus_out (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Expand candidate panel.
*
* slot prototype: void expand_candidate (void);
*/
- Connection signal_connect_expand_candidate (PanelAgentSlotVoid *slot);
+ Connection signal_connect_expand_candidate (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Contract candidate panel.
*
* slot prototype: void contract_candidate (void);
*/
- Connection signal_connect_contract_candidate (PanelAgentSlotVoid *slot);
+ Connection signal_connect_contract_candidate (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Select candidate string index.
*
* slot prototype: void select_candidate (int index);
*/
- Connection signal_connect_select_candidate (PanelAgentSlotInt *slot);
+ Connection signal_connect_select_candidate (InfoManagerSlotInt* slot);
/**
* @brief Signal: Get the list of ise name.
*
* slot prototype: bool get_ise_list (std::vector<String> &);
*/
- Connection signal_connect_get_ise_list (PanelAgentSlotBoolStringVector *slot);
+ Connection signal_connect_get_ise_list (InfoManagerSlotBoolStringVector* slot);
/**
* @brief Signal: Get the info of all helper ise.
*
* slot prototype: bool get_all_helper_ise_info (HELPER_ISE_INFO &);
*/
- Connection signal_connect_get_all_helper_ise_info (PanelAgentSlotBoolHelperInfo *slot);
+ Connection signal_connect_get_all_helper_ise_info (InfoManagerSlotBoolHelperInfo* slot);
/**
* @brief Signal: Update "has_option" column of ime_info DB by Application ID
*
* slot prototype: void set_enable_helper_ise_info (const String &, bool );
*/
- Connection signal_connect_set_has_option_helper_ise_info (PanelAgentSlotStringBool *slot);
+ Connection signal_connect_set_has_option_helper_ise_info (InfoManagerSlotStringBool* slot);
/**
* @brief Signal: Update "is_enable" column of ime_info DB by Application ID
*
* slot prototype: void set_enable_helper_ise_info (const String &, bool );
*/
- Connection signal_connect_set_enable_helper_ise_info (PanelAgentSlotStringBool *slot);
+ Connection signal_connect_set_enable_helper_ise_info (InfoManagerSlotStringBool* slot);
/**
* @brief Signal: Launch inputmethod-setting-list application
*
* slot prototype: void show_helper_ise_list (void);
*/
- Connection signal_connect_show_helper_ise_list (PanelAgentSlotVoid *slot);
+ Connection signal_connect_show_helper_ise_list (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Launch inputmethod-setting-selector application
*
* slot prototype: void show_helper_ise_selector (void);
*/
- Connection signal_connect_show_helper_ise_selector (PanelAgentSlotVoid *slot);
+ Connection signal_connect_show_helper_ise_selector (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Checks if the specific IME is enabled or disabled in the system keyboard setting
*
* slot prototype: bool is_helper_ise_enabled (const String, int &);
*/
- Connection signal_connect_is_helper_ise_enabled (PanelAgentSlotStringInt *slot);
+ Connection signal_connect_is_helper_ise_enabled (InfoManagerSlotStringInt* slot);
/**
* @brief Signal: Get the ISE information according to UUID.
*
* slot prototype: bool get_ise_information (String, String &, String &, int &, int &);
*/
- Connection signal_connect_get_ise_information (PanelAgentSlotBoolString4int2 *slot);
+ Connection signal_connect_get_ise_information (InfoManagerSlotBoolString4int2* slot);
/**
* @brief Signal: Get the list of selected language name.
*
* slot prototype: void get_language_list (std::vector<String> &);
*/
- Connection signal_connect_get_language_list (PanelAgentSlotStringVector *slot);
+ Connection signal_connect_get_language_list (InfoManagerSlotStringVector* slot);
/**
* @brief Signal: Get the all languages name.
*
* slot prototype: void get_all_language (std::vector<String> &);
*/
- Connection signal_connect_get_all_language (PanelAgentSlotStringVector *slot);
+ Connection signal_connect_get_all_language (InfoManagerSlotStringVector* slot);
/**
* @brief Signal: Get the language list of a specified ise.
*
* slot prototype: void get_ise_language (char *, std::vector<String> &);
*/
- Connection signal_connect_get_ise_language (PanelAgentSlotStrStringVector *slot);
+ Connection signal_connect_get_ise_language (InfoManagerSlotStrStringVector* slot);
/**
* @brief Signal: Get the ise information by uuid.
*
* slot prototype: bool get_ise_info_by_uuid (const String &, ISE_INFO &);
*/
- Connection signal_connect_get_ise_info_by_uuid (PanelAgentSlotStringISEINFO *slot);
+ Connection signal_connect_get_ise_info_by_uuid (InfoManagerSlotStringISEINFO* slot);
/**
* @brief Signal: send key event in panel.
*
* slot prototype: void send_key_event (const KeyEvent &);
*/
- Connection signal_connect_send_key_event (PanelAgentSlotKeyEvent *slot);
+ Connection signal_connect_send_key_event (InfoManagerSlotKeyEvent* slot);
/**
* @brief Signal: A transaction is started.
*
* slot prototype: void signal_connect_transaction_start (void);
*/
- Connection signal_connect_transaction_start (PanelAgentSlotVoid *slot);
+ Connection signal_connect_transaction_start (InfoManagerSlotVoid* slot);
/**
- * @brief Signal: Accept connection for this PanelAgent.
+ * @brief Signal: Accept connection for this InfoManager.
*
* slot prototype: void accept_connection (int fd);
* - fd -- the file description for connection
*/
- Connection signal_connect_accept_connection (PanelAgentSlotInt *slot);
+ Connection signal_connect_accept_connection (InfoManagerSlotInt* slot);
/**
- * @brief Signal: Close connection for this PanelAgent.
+ * @brief Signal: Close connection for this InfoManager.
*
* slot prototype: void close_connection (int fd);
* - fd -- the file description for connection
*/
- Connection signal_connect_close_connection (PanelAgentSlotInt *slot);
+ Connection signal_connect_close_connection (InfoManagerSlotInt* slot);
/**
- * @brief Signal: Exit application for this PanelAgent.
+ * @brief Signal: Exit application for this InfoManager.
*
* slot prototype: void app_exit (void);
*/
- Connection signal_connect_exit (PanelAgentSlotVoid *slot);
+ Connection signal_connect_exit (InfoManagerSlotVoid* slot);
/**
* @brief Signal: A transaction is finished.
*
* slot prototype: void signal_connect_transaction_end (void);
*/
- Connection signal_connect_transaction_end (PanelAgentSlotVoid *slot);
+ Connection signal_connect_transaction_end (InfoManagerSlotVoid* slot);
/**
- * @brief Signal: Lock the exclusive lock for this PanelAgent.
+ * @brief Signal: Lock the exclusive lock for this InfoManager.
*
* The panel program should provide a thread lock and hook a slot into this signal to lock it.
- * PanelAgent will use this lock to ensure the data integrity.
+ * InfoManager will use this lock to ensure the data integrity.
*
* slot prototype: void lock (void);
*/
- Connection signal_connect_lock (PanelAgentSlotVoid *slot);
+ Connection signal_connect_lock (InfoManagerSlotVoid* slot);
/**
- * @brief Signal: Unlock the exclusive lock for this PanelAgent.
+ * @brief Signal: Unlock the exclusive lock for this InfoManager.
*
* slot prototype: void unlock (void);
*/
- Connection signal_connect_unlock (PanelAgentSlotVoid *slot);
+ Connection signal_connect_unlock (InfoManagerSlotVoid* slot);
/**
* @brief Signal: The input context of ISE is changed.
*
* slot prototype: void update_input_context (int type, int value);
*/
- Connection signal_connect_update_input_context (PanelAgentSlotIntInt *slot);
+ Connection signal_connect_update_input_context (InfoManagerSlotIntInt* slot);
/**
* @brief Signal: Show ISE.
*
* slot prototype: void show_ise (void);
*/
- Connection signal_connect_show_ise (PanelAgentSlotVoid *slot);
+ Connection signal_connect_show_ise (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Hide ISE.
*
* slot prototype: void hide_ise (void);
*/
- Connection signal_connect_hide_ise (PanelAgentSlotVoid *slot);
+ Connection signal_connect_hide_ise (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Notifies the client finished handling WILL_SHOW event
*
* slot prototype: void will_show_ack (void);
*/
- Connection signal_connect_will_show_ack (PanelAgentSlotVoid *slot);
+ Connection signal_connect_will_show_ack (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Notifies the client finished handling WILL_HIDE event
*
* slot prototype: void will_hide_ack (void);
*/
- Connection signal_connect_will_hide_ack (PanelAgentSlotVoid *slot);
+ Connection signal_connect_will_hide_ack (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Set hardware mode
*
* slot prototype: void set_keyboard_mode (void);
*/
- Connection signal_connect_set_keyboard_mode (PanelAgentSlotInt *slot);
+ Connection signal_connect_set_keyboard_mode (InfoManagerSlotInt* slot);
/**
* @brief Signal: Notifies the client finished handling WILL_HIDE event for candidate
*
* slot prototype: void candidate_will_hide_ack (void);
*/
- Connection signal_connect_candidate_will_hide_ack (PanelAgentSlotVoid *slot);
+ Connection signal_connect_candidate_will_hide_ack (InfoManagerSlotVoid* slot);
/**
* @brief Signal: Get ISE state.
*
* slot prototype: void get_ise_state (int &state);
*/
- Connection signal_connect_get_ise_state (PanelAgentSlotInt2 *slot);
+ Connection signal_connect_get_ise_state (InfoManagerSlotInt2* slot);
/**
* @brief Signal: Get the recent input panel geometry information.
*
* slot prototype: void get_recent_ise_geometry (int angle, rectinfo &info);
*/
- Connection signal_connect_get_recent_ise_geometry (PanelAgentSlotIntRect *slot);
+ Connection signal_connect_get_recent_ise_geometry (InfoManagerSlotIntRect* slot);
- Connection signal_connect_check_privilege_by_sockfd (PanelAgentSlotIntString2 *slot);
+ Connection signal_connect_check_privilege_by_sockfd (InfoManagerSlotIntString2* slot);
};
/** @} */
/*
vi:ts=4:nowrap:ai:expandtab
*/
-
--- /dev/null
+/** @file scim_panel.cpp
+ * @brief Implementation of class PanelAgent.
+ */
+
+/* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
+
+/*
+ * Smart Common Input Method
+ *
+ * Copyright (c) 2005 James Su <suzhe@tsinghua.org.cn>
+ * Copyright (c) 2012-2015 Samsung Electronics Co., Ltd.
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307 USA
+ *
+ * Modifications by Samsung Electronics Co., Ltd.
+ * 1. Add new signals
+ * a. m_signal_set_keyboard_ise and m_signal_get_keyboard_ise
+ * b. m_signal_focus_in and m_signal_focus_out
+ * c. m_signal_expand_candidate, m_signal_contract_candidate and m_signal_set_candidate_ui
+ * d. m_signal_get_ise_list, m_signal_get_keyboard_ise_list, m_signal_update_ise_geometry and m_signal_get_ise_information
+ * e. m_signal_set_active_ise_by_uuid and m_signal_get_ise_info_by_uuid
+ * f. m_signal_accept_connection, m_signal_close_connection and m_signal_exit
+ * 2. Add new interface APIs in PanelClient class
+ * a. get_helper_manager_id (), has_helper_manager_pending_event () and filter_helper_manager_event ()
+ * b. update_candidate_panel_event (), update_input_panel_event () and select_aux ()
+ * c. candidate_more_window_show () and candidate_more_window_hide ()
+ * d. update_displayed_candidate_number () and update_candidate_item_layout ()
+ * e. stop_helper (), send_longpress_event () and update_ise_list ()
+ * f. filter_event (), filter_exception_event () and get_server_id ()
+ * 3. Donot use thread to receive message
+ * 4. Monitor socket frontend for self-recovery function
+ *
+ * $Id: scim_panel_agent.cpp,v 1.8.2.1 2006/01/09 14:32:18 suzhe Exp $
+ *
+ */
+
+#define Uses_SCIM_TRANSACTION
+#define Uses_SCIM_TRANS_COMMANDS
+#define Uses_SCIM_PANEL_AGENT
+#define Uses_SCIM_HELPER
+#define Uses_SCIM_SOCKET
+#define Uses_SCIM_EVENT
+#define Uses_SCIM_CONFIG
+#define Uses_SCIM_CONFIG_MODULE
+#define Uses_SCIM_CONFIG_PATH
+#define Uses_SCIM_UTILITY
+
+#include <string.h>
+#include <sys/types.h>
+#include <sys/times.h>
+#include <dlog.h>
+#include <unistd.h>
+#include "scim_private.h"
+#include "scim.h"
+#include "scim_stl_map.h"
+#include "privilege_checker.h"
+
+#ifdef LOG_TAG
+# undef LOG_TAG
+#endif
+#define LOG_TAG "ISF_PANEL_AGENT_BASE"
+
+
+namespace scim
+{
+
+
+PanelAgentBase::PanelAgentBase (const String& name)
+ :m_name (name)
+{
+}
+
+PanelAgentBase::~PanelAgentBase ()
+{
+}
+
+bool PanelAgentBase::initialize (InfoManager* info_manager, const String& display, bool resident)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+ return false;
+}
+
+bool PanelAgentBase::valid (void) const
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+ return false;
+}
+
+void PanelAgentBase::stop (void)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+
+void PanelAgentBase::update_panel_event (int client, uint32 context, int cmd, uint32 nType, uint32 nValue)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::reset_keyboard_ise (int client, uint32 context)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::update_keyboard_ise_list (int client, uint32 context)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::change_factory (int client, uint32 context, const String& uuid)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::helper_candidate_show (int client, uint32 context, const String& uuid)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::helper_candidate_hide (int client, uint32 context, const String& uuid)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+/* if the uuid is empty, it must send to panelclient otherwise HelperAgent
+ */
+void PanelAgentBase::candidate_more_window_show (int client, uint32 context)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+/* if the uuid is empty, it must send to panelclient otherwise HelperAgent
+ */
+void PanelAgentBase::candidate_more_window_hide (int client, uint32 context)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::update_helper_lookup_table (int client, uint32 context, const String& uuid, const LookupTable& table)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+//select_aux
+//helper_select_aux
+//SCIM_TRANS_CMD_SELECT_AUX
+//this function called by two places, will send message to help(with uuid) or app
+void PanelAgentBase::select_aux (int client, uint32 context, uint32 item)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+//SCIM_TRANS_CMD_SELECT_CANDIDATE
+//this function called by two places, will send message to help(with uuid) or app
+void PanelAgentBase::select_candidate (int client, uint32 context, uint32 item)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::lookup_table_page_up (int client, uint32 context)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::lookup_table_page_down (int client, uint32 context)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::update_lookup_table_page_size (int client, uint32 context, uint32 size)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::update_candidate_item_layout (int client, uint32 context, const std::vector<uint32>& row_items)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::select_associate (int client, uint32 context, uint32 item)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::associate_table_page_up (int client, uint32 context)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::associate_table_page_down (int client, uint32 context)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::update_associate_table_page_size (int client, uint32 context, uint32 size)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::update_displayed_candidate_number (int client, uint32 context, uint32 size)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::send_longpress_event (int client, uint32 context, uint32 index)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::trigger_property (int client, uint32 context, const String& property)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::socket_start_helper (int client, uint32 context, const String& ic_uuid)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+
+void PanelAgentBase::exit (int client, uint32 context)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::focus_out_helper (int client, uint32 context, const String& uuid)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::focus_in_helper (int client, uint32 context, const String& uuid)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::show_helper (int client, uint32 context, const String& uuid, char* data, size_t& len)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::hide_helper (int client, uint32 context, const String& uuid)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::set_helper_mode (int client, uint32 context, const String& uuid, uint32& mode)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::set_helper_language (int client, uint32 context, const String& uuid, uint32& language)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::set_helper_imdata (int client, uint32 context, const String& uuid, const char* imdata, size_t& len)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::set_helper_return_key_type (int client, uint32 context, const String& uuid, uint32 type)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::get_helper_return_key_type (int client, uint32 context, const String& uuid, _OUT_ uint32& type)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::set_helper_return_key_disable (int client, uint32 context, const String& uuid, uint32 disabled)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::get_helper_return_key_disable (int client, uint32 context, const String& uuid, _OUT_ uint32& disabled)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::set_helper_layout (int client, uint32 context, const String& uuid, uint32& layout)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::set_helper_input_mode (int client, uint32 context, const String& uuid, uint32& mode)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::set_helper_input_hint (int client, uint32 context, const String& uuid, uint32& hint)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::set_helper_bidi_direction (int client, uint32 context, const String& uuid, uint32& direction)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::set_helper_caps_mode (int client, uint32 context, const String& uuid, uint32& mode)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::show_helper_option_window (int client, uint32 context, const String& uuid)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+bool PanelAgentBase::process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, _OUT_ uint32& result)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+ return false;
+}
+
+bool PanelAgentBase::get_helper_geometry (int client, uint32 context, String& uuid, _OUT_ struct rectinfo& info)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+ return false;
+}
+
+void PanelAgentBase::get_helper_imdata (int client, uint32 context, String& uuid, _OUT_ char** imdata, _OUT_ size_t& len)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::get_helper_layout (int client, uint32 context, String& uuid, uint32& layout)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+
+void PanelAgentBase::get_ise_language_locale (int client, uint32 context, String& uuid, _OUT_ char* data, _OUT_ size_t& len)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::check_option_window (int client, uint32 context, String& uuid, _OUT_ uint32& avail)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::reset_ise_option (int client, uint32 context)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::reset_helper_context (int client, uint32 context, const String& uuid)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::reload_config (int client)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::socket_update_surrounding_text (int client, uint32 context, String& uuid, String text, uint32 cursor)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::socket_update_selection (int client, uint32 context, String& uuid, String text)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::socket_get_keyboard_ise_list (int client, uint32 context, const String& uuid, std::vector<String>& list)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::socket_get_candidate_ui (int client, uint32 context, const String& uuid, int style, int mode)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::socket_get_candidate_geometry (int client, uint32 context, const String& uuid, struct rectinfo& info)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+void PanelAgentBase::socket_get_keyboard_ise (int client, uint32 context, const String& uuid, String& ise_name, String& ise_uuid)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::helper_detach_input_context (int client, uint32 context, const String& ic_uuid)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::helper_process_imengine_event (int client, uint32 context, const String& ic_uuid, const Transaction& nest_transaction)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::process_helper_event (int client, uint32 context, String target_uuid, String active_uuid, Transaction& nest_trans)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+void PanelAgentBase::socket_helper_key_event (int client, uint32 context, int cmd , KeyEvent& key)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+//SCIM_TRANS_CMD_GET_SURROUNDING_TEXT
+//socket_helper_get_surrounding_text
+void PanelAgentBase::socket_helper_get_surrounding_text (int client, uint32 context, uint32 maxlen_before, uint32 maxlen_after)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+//SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT
+//socket_helper_delete_surrounding_text
+void PanelAgentBase::socket_helper_delete_surrounding_text (int client, uint32 context, uint32 offset, uint32 len)
+{
+ LOGD ("not implemented ");
+}
+//SCIM_TRANS_CMD_GET_SELECTION
+void PanelAgentBase::socket_helper_get_selection (int client, uint32 context)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+//SCIM_TRANS_CMD_SET_SELECTION
+void PanelAgentBase::socket_helper_set_selection (int client, uint32 context, uint32 start, uint32 end)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+//socket_helper_update_input_context
+//ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT
+void PanelAgentBase::update_ise_input_context (int client, uint32 context, uint32 type, uint32 value)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+//socket_helper_send_private_command
+//SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND
+void PanelAgentBase::send_private_command (int client, uint32 context, String command)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+//SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION
+void PanelAgentBase::helper_all_update_spot_location (int client, uint32 context, String uuid, int x, int y)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+//ISM_TRANS_CMD_UPDATE_CURSOR_POSITION
+void PanelAgentBase::helper_all_update_cursor_position (int client, uint32 context, String uuid, int cursor_pos)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+//SCIM_TRANS_CMD_UPDATE_SCREEN
+void PanelAgentBase::helper_all_update_screen (int client, uint32 context, String uuid, int screen)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+//socket_helper_commit_string
+//SCIM_TRANS_CMD_COMMIT_STRING
+void PanelAgentBase::commit_string (int client, uint32 context,const WideString& wstr)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+//socket_helper_show_preedit_string
+//SCIM_TRANS_CMD_SHOW_PREEDIT_STRING
+void PanelAgentBase::show_preedit_string (int client, uint32 context)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+//socket_helper_hide_preedit_string
+//SCIM_TRANS_CMD_HIDE_PREEDIT_STRING
+void PanelAgentBase::hide_preedit_string (int client, uint32 context)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+//socket_helper_update_preedit_string
+//SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING
+void PanelAgentBase::update_preedit_string (int client, uint32 context, WideString wstr, AttributeList& attrs, uint32 caret)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+//socket_helper_update_preedit_caret
+//SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET
+void PanelAgentBase::update_preedit_caret (int client, uint32 context, uint32 caret)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+//socket_helper_register_helper
+//SCIM_TRANS_CMD_HELPER_ATTACH_INPUT_CONTEXT
+//SCIM_TRANS_CMD_UPDATE_SCREEN
+void PanelAgentBase::helper_attach_input_context_and_update_screen (int client, std::vector < std::pair <uint32, String> >& helper_ic_index,
+ uint32 current_screen)
+{
+ LOGW ("not implemented for %s", m_name.c_str ());
+}
+
+
+} /* namespace scim */
+
+/*
+vi:ts=4:nowrap:ai:expandtab
+*/
--- /dev/null
+/**
+ * @file scim_panel_agent.h
+ * @brief Defines scim::PanelAgent and their related types.
+ *
+ * scim::PanelAgent is a class used to write Panel daemons.
+ * It acts like a Socket Server and handles all socket clients
+ * issues.
+ */
+
+/* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
+
+/*
+ * Smart Common Input Method
+ *
+ * Copyright (c) 2004-2005 James Su <suzhe@tsinghua.org.cn>
+ * Copyright (c) 2012-2015 Samsung Electronics Co., Ltd.
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307 USA
+ *
+ * Modifications by Samsung Electronics Co., Ltd.
+ * 1. Add new signals
+ * a. m_signal_set_keyboard_ise and m_signal_get_keyboard_ise
+ * b. m_signal_focus_in and m_signal_focus_out
+ * c. m_signal_expand_candidate, m_signal_contract_candidate and m_signal_set_candidate_ui
+ * d. m_signal_get_ise_list, m_signal_get_keyboard_ise_list, m_signal_update_ise_geometry and m_signal_get_ise_information
+ * e. m_signal_set_active_ise_by_uuid and m_signal_get_ise_info_by_uuid
+ * f. m_signal_accept_connection, m_signal_close_connection and m_signal_exit
+ * 2. Add new interface APIs in PanelClient class
+ * a. get_helper_manager_id (), has_helper_manager_pending_event () and filter_helper_manager_event ()
+ * b. update_candidate_panel_event (), update_input_panel_event () and select_aux ()
+ * c. candidate_more_window_show () and candidate_more_window_hide ()
+ * d. update_displayed_candidate_number () and update_candidate_item_layout ()
+ * e. stop_helper (), send_longpress_event () and update_ise_list ()
+ * f. filter_event (), filter_exception_event () and get_server_id ()
+ * 3. Donot use thread to receive message
+ * 4. Monitor socket frontend for self-recovery function
+ *
+ * $Id: scim_panel_agent.h,v 1.2 2005/06/11 14:50:31 suzhe Exp $
+ */
+
+#ifndef __ISF_PANEL_AGENT_BASE_H
+#define __ISF_PANEL_AGENT_BASE_H
+
+#include <scim_panel_common.h>
+
+#ifndef _OUT_
+#define _OUT_
+#endif
+
+namespace scim
+{
+
+/**
+ * @addtogroup Panel
+ * @ingroup InputServiceFramework
+ * The accessory classes to help develop Panel daemons and FrontEnds
+ * which need to communicate with Panel daemons.
+ * @{
+ */
+
+typedef struct _ISE_INFO {
+ String uuid;
+ String name;
+ String lang;
+ String icon;
+ uint32 option;
+ TOOLBAR_MODE_T type;
+} ISE_INFO;
+
+typedef struct _HELPER_ISE_INFO {
+ std::vector<String> appid;
+ std::vector<String> label;
+ std::vector<uint32> is_enabled;
+ std::vector<uint32> is_preinstalled;
+ std::vector<uint32> has_option;
+} HELPER_ISE_INFO;
+
+
+typedef struct DefaultIse {
+ TOOLBAR_MODE_T type;
+ String uuid;
+ String name;
+ DefaultIse () : type (TOOLBAR_KEYBOARD_MODE), uuid (""), name ("") { }
+} DEFAULT_ISE_T;
+
+
+class PanelAgentBase;
+class InfoManager;
+/**
+ * @typedef typedef Pointer <PanelAgentBase> PanelAgentPointer;
+ *
+ * A smart pointer for scim::PanelAgentBase and its derived classes.
+ */
+typedef Pointer <PanelAgentBase> PanelAgentPointer;
+
+/**
+ * @brief The class to implement all socket protocol in Panel.
+ *
+ * This class acts like a stand alone SocketServer.
+ * It has its own dedicated main loop, and will be blocked when run () is called.
+ * So run () must be called within a separated thread, in order to not block
+ * the main loop of the Panel program itself.
+ *
+ * Before calling run (), the panel must hook the callback functions to the
+ * corresponding signals.
+ *
+ * Note that, there are two special signals: lock(void) and unlock(void). These
+ * two signals are used to provide a thread lock to PanelAgent, so that PanelAgent
+ * can run correctly within a multi-threading Panel program.
+ */
+class EXAPI PanelAgentBase : public ReferencedObject
+{
+ class PanelAgentBaseImpl;
+ PanelAgentBaseImpl* m_impl;
+
+ PanelAgentBase (const PanelAgentBase&);
+ const PanelAgentBase& operator = (const PanelAgentBase&);
+ String m_name;
+public:
+ PanelAgentBase (const String& name);
+ virtual ~PanelAgentBase ();
+
+ /**
+ * @brief Initialize this PanelAgent.
+ *
+ * @param config The name of the config module to be used by Helpers.
+ * @param display The name of display, on which the Panel should run.
+ * @param resident If this is true then this PanelAgent will keep running
+ * even if there is no more client connected.
+ *
+ * @return true if the PanelAgent is initialized correctly and ready to run.
+ */
+ virtual bool initialize (InfoManager* info_manager, const String& display, bool resident = false);
+
+ /**
+ * @brief Check if this PanelAgent is initialized correctly and ready to run.
+ *
+ * @return true if this PanelAgent is ready to run.
+ */
+ virtual bool valid (void) const;
+
+ /**
+ * @brief Stop this PanelAgent.
+ */
+ virtual void stop (void);
+
+public:
+
+ /**
+ * @brief Notice helper ISE to focus out.
+ *
+ * @param uuid The helper ISE uuid.
+ */
+ virtual void focus_out_helper (int client, uint32 context, const String& uuid);
+
+ /**
+ * @brief Notice helper ISE to focus in.
+ *
+ * @param uuid The helper ISE uuid.
+ */
+ virtual void focus_in_helper (int client, uint32 context, const String& uuid);
+
+ /**
+ * @brief Notice helper ISE to show window.
+ *
+ * @param uuid The helper ISE uuid.
+ */
+ virtual void show_helper (int client, uint32 context, const String& uuid, char* data, size_t& len);
+
+ /**
+ * @brief Notice helper ISE to hide window.
+ *
+ * @param uuid The helper ISE uuid.
+ */
+ virtual void hide_helper (int client, uint32 context, const String& uuid);
+
+ /**
+ * @brief Reset keyboard ISE.
+ *
+ * @return true if this operation is successful, otherwise return false.
+ */
+ virtual void reset_keyboard_ise (int client, uint32 context);
+
+ /**
+ * @brief Change the factory used by the focused IMEngineInstance object.
+ *
+ * @param uuid The uuid of the new factory.
+ * @return true if the command was sent correctly.
+ */
+ virtual void change_factory (int client, uint32 context, const String& uuid);
+
+ /**
+ * @brief Notice Helper ISE that candidate more window is showed.
+ * @return true if the command was sent correctly.
+ */
+ virtual void candidate_more_window_show (int client, uint32 context);
+
+ /**
+ * @brief Notice Helper ISE that candidate more window is hidden.
+ * @return true if the command was sent correctly.
+ */
+ virtual void candidate_more_window_hide (int client, uint32 context);
+
+ /**
+ * @brief Notice Helper ISE that show candidate.
+ * @return true if the command was sent correctly.
+ */
+ virtual void helper_candidate_show (int client, uint32 context, const String& uuid);
+
+ /**
+ * @brief Notice Helper ISE that hide candidate.
+ * @return true if the command was sent correctly.
+ */
+ virtual void helper_candidate_hide (int client, uint32 context, const String& uuid);
+
+ /**
+ * @brief Update helper lookup table.
+ * @return true if the command was sent correctly.
+ */
+ virtual void update_helper_lookup_table (int client, uint32 context, const String& uuid, const LookupTable& table);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * select a aux in current aux string.
+ *
+ * @param item The index of the selected aux.
+ * @return true if the command was sent correctly.
+ */
+ virtual void select_aux (int client, uint32 context, uint32 item);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * select a candidate in current lookup table.
+ *
+ * @param item The index of the selected candidate.
+ * @return true if the command was sent correctly.
+ */
+ virtual void select_candidate (int client, uint32 context, uint32 item);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * flip the LookupTable to previous page.
+ * @return true if the command was sent correctly.
+ */
+ virtual void lookup_table_page_up (int client, uint32 context);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * flip the LookupTable to next page.
+ * @return true if the command was sent correctly.
+ */
+ virtual void lookup_table_page_down (int client, uint32 context);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * update the page size of the LookupTable.
+ *
+ * @param size The new page size.
+ * @return true if the command was sent correctly.
+ */
+ virtual void update_lookup_table_page_size (int client, uint32 context, uint32 size);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * update candidate items layout.
+ *
+ * @param row_items The items of each row.
+ * @return true if the command was sent correctly.
+ */
+ virtual void update_candidate_item_layout (int client, uint32 context, const std::vector<uint32>& row_items);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * select a associate in current associate table.
+ *
+ * @param item The index of the selected associate.
+ * @return true if the command was sent correctly.
+ */
+ virtual void select_associate (int client, uint32 context, uint32 item);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * flip the AssociateTable to previous page.
+ * @return true if the command was sent correctly.
+ */
+ virtual void associate_table_page_up (int client, uint32 context);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * flip the AssociateTable to next page.
+ * @return true if the command was sent correctly.
+ */
+ virtual void associate_table_page_down (int client, uint32 context);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * update the page size of the AssociateTable.
+ *
+ * @param size The new page size.
+ * @return true if the command was sent correctly.
+ */
+ virtual void update_associate_table_page_size (int client, uint32 context, uint32 size);
+
+ /**
+ * @brief Inform helper ISE to update displayed candidate number.
+ *
+ * @param size The displayed candidate number.
+ * @return true if the command was sent correctly.
+ */
+ virtual void update_displayed_candidate_number (int client, uint32 context, uint32 size);
+
+ /**
+ * @brief Trigger a property of the focused IMEngineInstance object.
+ *
+ * @param property The property key to be triggered.
+ * @return true if the command was sent correctly.
+ */
+ virtual void trigger_property (int client, uint32 context, const String& property);
+
+ /**
+ * @brief Let all FrontEnds and Helpers reload configuration.
+ * @return true if the command was sent correctly.
+ */
+ virtual void reload_config (int client);
+
+ /**
+ * @brief Let all FrontEnds, Helpers and this Panel exit.
+ * @return true if the command was sent correctly.
+ */
+ virtual void exit (int client, uint32 context);
+
+ /**
+ * @brief Send candidate longpress event to ISE.
+ *
+ * @param index The candidate object index.
+ *
+ * @return none.
+ */
+ virtual void send_longpress_event (int client, uint32 context, uint32 index);
+
+ /**
+ * @brief update_panel_event.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void update_panel_event (int client, uint32 context, int cmd, uint32 nType, uint32 nValue);
+
+ /**
+ * @brief update_keyboard_ise_list.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void update_keyboard_ise_list (int client, uint32 context);
+
+ /**
+ * @brief set_helper_mode.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void set_helper_mode (int client, uint32 context, const String& uuid, uint32& mode);
+
+ /**
+ * @brief set_helper_language.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void set_helper_language (int client, uint32 context, const String& uuid, uint32& language);
+
+ /**
+ * @brief set_helper_imdata.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void set_helper_imdata (int client, uint32 context, const String& uuid, const char* imdata, size_t& len);
+
+ /**
+ * @brief set_helper_return_key_type.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void set_helper_return_key_type (int client, uint32 context, const String& uuid, uint32 type);
+
+ /**
+ * @brief get_helper_return_key_type.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void get_helper_return_key_type (int client, uint32 context, const String& uuid, _OUT_ uint32& type);
+
+ /**
+ * @brief set_helper_return_key_disable.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void set_helper_return_key_disable (int client, uint32 context, const String& uuid, uint32 disabled);
+
+ /**
+ * @brief get_helper_return_key_disable.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void get_helper_return_key_disable (int client, uint32 context, const String& uuid, _OUT_ uint32& disabled);
+
+ /**
+ * @brief set_helper_layout.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void set_helper_layout (int client, uint32 context, const String& uuid, uint32& layout);
+
+ /**
+ * @brief set_helper_input_mode.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void set_helper_input_mode (int client, uint32 context, const String& uuid, uint32& mode);
+
+ /**
+ * @brief set_helper_input_hint.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void set_helper_input_hint (int client, uint32 context, const String& uuid, uint32& hint);
+
+ /**
+ * @brief set_helper_bidi_direction.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void set_helper_bidi_direction (int client, uint32 context, const String& uuid, uint32& direction);
+
+ /**
+ * @brief set_helper_caps_mode.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void set_helper_caps_mode (int client, uint32 context, const String& uuid, uint32& mode);
+
+ /**
+ * @brief show_helper_option_window.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void show_helper_option_window (int client, uint32 context, const String& uuid);
+
+ /**
+ * @brief process_key_event.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual bool process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, _OUT_ uint32& result);
+
+ /**
+ * @brief get_helper_geometry.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual bool get_helper_geometry (int client, uint32 context, String& uuid, _OUT_ struct rectinfo& info);
+
+ /**
+ * @brief get_helper_imdata.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void get_helper_imdata (int client, uint32 context, String& uuid, _OUT_ char** imdata, _OUT_ size_t& len);
+
+ /**
+ * @brief get_helper_layout.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void get_helper_layout (int client, uint32 context, String& uuid, uint32& layout);
+
+ /**
+ * @brief get_ise_language_locale.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void get_ise_language_locale (int client, uint32 context, String& uuid, _OUT_ char* data, _OUT_ size_t& len);
+
+ /**
+ * @brief check_option_window.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void check_option_window (int client, uint32 context, String& uuid, _OUT_ uint32& avail);
+
+ /**
+ * @brief reset_ise_option.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void reset_ise_option (int client, uint32 context);
+
+ /**
+ * @brief reset_helper_context.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void reset_helper_context (int client, uint32 context, const String& uuid);
+
+ /**
+ * @brief socket_update_surrounding_text.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void socket_update_surrounding_text (int client, uint32 context, String& uuid, String text, uint32 cursor);
+
+ /**
+ * @brief socket_update_selection.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void socket_update_selection (int client, uint32 context, String& uuid, String text);
+
+ /**
+ * @brief socket_get_keyboard_ise_list.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void socket_get_keyboard_ise_list (int client, uint32 context, const String& uuid, std::vector<String>& list);
+
+ /**
+ * @brief socket_get_candidate_ui.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void socket_get_candidate_ui (int client, uint32 context, const String& uuid, int style, int mode);
+
+ /**
+ * @brief socket_get_candidate_geometry.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void socket_get_candidate_geometry (int client, uint32 context, const String& uuid, struct rectinfo& info);
+
+ /**
+ * @brief socket_get_keyboard_ise.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void socket_get_keyboard_ise (int client, uint32 context, const String& uuid, String& ise_name, String& ise_uuid);
+
+ /**
+ * @brief socket_start_helper.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void socket_start_helper (int client, uint32 context, const String& ic_uuid);
+
+ /**
+ * @brief helper_detach_input_context.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void helper_detach_input_context (int client, uint32 context, const String& ic_uuid);
+
+ /**
+ * @brief helper_process_imengine_event.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void helper_process_imengine_event (int client, uint32 context, const String& ic_uuid, const Transaction& nest_transaction);
+
+ /**
+ * @brief process_helper_event.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void process_helper_event (int client, uint32 context, String target_uuid, String active_uuid, Transaction& nest_trans);
+
+ /**
+ * @brief socket_helper_key_event.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void socket_helper_key_event (int client, uint32 context, int cmd , KeyEvent& key);
+
+ /**
+ * @brief socket_helper_get_surrounding_text.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void socket_helper_get_surrounding_text (int client, uint32 context, uint32 maxlen_before, uint32 maxlen_after);
+
+ /**
+ * @brief socket_helper_delete_surrounding_text.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void socket_helper_delete_surrounding_text (int client, uint32 context, uint32 offset, uint32 len);
+
+ /**
+ * @brief socket_helper_get_selection.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void socket_helper_get_selection (int client, uint32 context);
+
+ /**
+ * @brief socket_helper_set_selection.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void socket_helper_set_selection (int client, uint32 context, uint32 start, uint32 end);
+
+ /**
+ * @brief update_ise_input_context.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void update_ise_input_context (int client, uint32 context, uint32 type, uint32 value);
+
+ /**
+ * @brief send_private_command.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void send_private_command (int client, uint32 context, String command);
+
+ /**
+ * @brief helper_all_update_spot_location.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void helper_all_update_spot_location (int client, uint32 context, String uuid, int x, int y);
+
+ /**
+ * @brief helper_all_update_cursor_position.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void helper_all_update_cursor_position (int client, uint32 context, String uuid, int cursor_pos);
+
+ /**
+ * @brief helper_all_update_screen.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void helper_all_update_screen (int client, uint32 context, String uuid, int screen);
+
+ /**
+ * @brief commit_string.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void commit_string (int client, uint32 context,const WideString& wstr);
+
+ /**
+ * @brief show_preedit_string.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void show_preedit_string (int client, uint32 context);
+
+ /**
+ * @brief hide_preedit_string.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void hide_preedit_string (int client, uint32 context);
+
+ /**
+ * @brief update_preedit_string.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void update_preedit_string (int client, uint32 context, WideString wstr, AttributeList& attrs, uint32 caret);
+
+ /**
+ * @brief update_preedit_caret.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void update_preedit_caret (int client, uint32 context, uint32 caret);
+
+ /**
+ * @brief attach_input_context and update_screen.
+ *
+ * @param
+ *
+ * @return none.
+ */
+ virtual void helper_attach_input_context_and_update_screen (int client, std::vector < std::pair <uint32, String> >& helper_ic_index, uint32 current_screen);
+
+};
+
+/** @} */
+
+} /* namespace scim */
+
+#endif /* __SCIM_PANEL_AGENT_H */
+
+/*
+vi:ts=4:nowrap:ai:expandtab
+*/
--- /dev/null
+/** @file scim_panel.cpp
+ * @brief Implementation of class PanelAgent.
+ */
+
+/* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
+
+/*
+ * Smart Common Input Method
+ *
+ * Copyright (c) 2005 James Su <suzhe@tsinghua.org.cn>
+ * Copyright (c) 2012-2015 Samsung Electronics Co., Ltd.
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307 USA
+ *
+ * Modifications by Samsung Electronics Co., Ltd.
+ * 1. Add new signals
+ * a. m_signal_set_keyboard_ise and m_signal_get_keyboard_ise
+ * b. m_signal_focus_in and m_signal_focus_out
+ * c. m_signal_expand_candidate, m_signal_contract_candidate and m_signal_set_candidate_ui
+ * d. m_signal_get_ise_list, m_signal_get_keyboard_ise_list, m_signal_update_ise_geometry and m_signal_get_ise_information
+ * e. m_signal_set_active_ise_by_uuid and m_signal_get_ise_info_by_uuid
+ * f. m_signal_accept_connection, m_signal_close_connection and m_signal_exit
+ * 2. Add new interface APIs in PanelClient class
+ * a. get_helper_manager_id (), has_helper_manager_pending_event () and filter_helper_manager_event ()
+ * b. update_candidate_panel_event (), update_input_panel_event () and select_aux ()
+ * c. candidate_more_window_show () and candidate_more_window_hide ()
+ * d. update_displayed_candidate_number () and update_candidate_item_layout ()
+ * e. stop_helper (), send_longpress_event () and update_ise_list ()
+ * f. filter_event (), filter_exception_event () and get_server_id ()
+ * 3. Donot use thread to receive message
+ * 4. Monitor socket frontend for self-recovery function
+ *
+ * $Id: scim_panel_agent.cpp,v 1.8.2.1 2006/01/09 14:32:18 suzhe Exp $
+ *
+ */
+
+#define Uses_SCIM_TRANSACTION
+#define Uses_SCIM_TRANS_COMMANDS
+#define Uses_SCIM_PANEL_AGENT
+#define Uses_SCIM_HELPER
+#define Uses_SCIM_SOCKET
+#define Uses_SCIM_EVENT
+#define Uses_SCIM_CONFIG
+#define Uses_SCIM_CONFIG_MODULE
+#define Uses_SCIM_CONFIG_PATH
+#define Uses_SCIM_UTILITY
+#define Uses_SCIM_PANEL_AGENT_MODULE
+
+#include <string.h>
+#include <sys/types.h>
+#include <sys/times.h>
+#include <dlog.h>
+#include <unistd.h>
+#include "scim_private.h"
+#include "scim.h"
+#include "scim_stl_map.h"
+#include "privilege_checker.h"
+
+#ifdef LOG_TAG
+# undef LOG_TAG
+#endif
+#define LOG_TAG "ISF_PANEL_AGENT_MANAGER"
+
+//FIXME
+//remove this
+#define WAYLAND_MODULE_CLIENT_ID (0)
+
+
+namespace scim
+{
+
+
+//==================================== PanelAgent ===========================
+class PanelAgentManager::PanelAgentManagerImpl
+{
+public:
+ std::vector<PanelAgentModule*> m_panel_agent_modules;
+ std::map <int, PanelAgentPointer> m_client_repository;
+
+ PanelAgentPointer m_socket;
+ PanelAgentPointer m_wayland;
+public:
+ PanelAgentManagerImpl () {
+ }
+
+ ~PanelAgentManagerImpl () {
+ std::vector<PanelAgentModule*>::iterator iter = m_panel_agent_modules.begin ();
+
+ for (; iter != m_panel_agent_modules.end (); iter++) {
+ delete *iter;
+ }
+
+ m_panel_agent_modules.clear ();
+ }
+
+ PanelAgentPointer get_panel_agent_by_id (int id) {
+ if (id == WAYLAND_MODULE_CLIENT_ID)
+ return m_wayland;
+ else
+ return m_socket;
+ }
+};
+
+PanelAgentManager::PanelAgentManager ()
+ :m_impl (new PanelAgentManagerImpl ())
+{
+}
+
+PanelAgentManager::~PanelAgentManager ()
+{
+ delete m_impl;
+}
+
+bool PanelAgentManager::initialize (InfoManager* info_manager, const ConfigPointer& config, const String& display, bool resident)
+{
+ std::vector <String> mod_list;
+ scim_get_panel_agent_module_list (mod_list);
+
+ for (std::vector<String>::iterator it = mod_list.begin (); it != mod_list.end (); ++it) {
+ LOGD ("Trying to load panelagent module %s", it->c_str ());
+ PanelAgentModule* _panel_agent_module = new PanelAgentModule;
+
+ if (!_panel_agent_module) {
+ LOGD ("");
+ continue;
+ }
+
+ _panel_agent_module->load (*it, config);
+
+ if (!_panel_agent_module->valid ()) {
+ LOGD ("");
+ delete _panel_agent_module;
+ continue;
+ }
+
+ PanelAgentPointer _panelagent = _panel_agent_module->get_instance ();
+
+ if (_panelagent.null ()) {
+ LOGD ("");
+ delete _panel_agent_module;
+ continue;
+ }
+
+ _panelagent->initialize (info_manager, display, resident);
+ LOGD ("PanelAgent Module %s loaded", _panel_agent_module->get_module_name ().c_str ());
+ m_impl->m_panel_agent_modules.push_back (_panel_agent_module);
+
+ if (_panel_agent_module->get_module_name () == "wayland")
+ m_impl->m_wayland = _panelagent;
+ else
+ m_impl->m_socket = _panelagent;
+ }
+
+ return true;
+}
+
+bool PanelAgentManager::valid (void) const
+{
+ return true;
+}
+
+void PanelAgentManager::stop (void)
+{
+ SCIM_DEBUG_MAIN (1) << "PanelAgent::stop ()\n";
+}
+
+void PanelAgentManager::update_panel_event (int id, uint32 context_id, int cmd, uint32 nType, uint32 nValue)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->update_panel_event (id, context_id, cmd, nType, nValue);
+}
+
+void PanelAgentManager::reset_keyboard_ise (int id, uint32 context_id)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->reset_keyboard_ise (id, context_id);
+}
+
+void PanelAgentManager::update_keyboard_ise_list (int id, uint32 context_id)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->update_keyboard_ise_list (id, context_id);
+}
+
+void PanelAgentManager::change_factory (int id, uint32 context_id, const String& uuid)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->change_factory (id, context_id, uuid);
+}
+
+void PanelAgentManager::helper_candidate_show (int id, uint32 context_id, const String& uuid)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->helper_candidate_show (id, context_id, uuid);
+}
+
+void PanelAgentManager::helper_candidate_hide (int id, uint32 context_id, const String& uuid)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->helper_candidate_hide (id, context_id, uuid);
+}
+
+void PanelAgentManager::candidate_more_window_show (int id, uint32 context_id)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->candidate_more_window_show (id, context_id);
+}
+
+void PanelAgentManager::candidate_more_window_hide (int id, uint32 context_id)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->candidate_more_window_hide (id, context_id);
+}
+
+void PanelAgentManager::update_helper_lookup_table (int id, uint32 context_id, const String& uuid, const LookupTable& table)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->update_helper_lookup_table (id, context_id, uuid, table);
+}
+
+void PanelAgentManager::select_aux (int id, uint32 context_id, uint32 item)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->select_aux (id, context_id, item);
+}
+
+void PanelAgentManager::select_candidate (int id, uint32 context_id, uint32 item)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->select_candidate (id, context_id, item);
+}
+
+void PanelAgentManager::lookup_table_page_up (int id, uint32 context_id)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->lookup_table_page_up (id, context_id);
+}
+
+void PanelAgentManager::lookup_table_page_down (int id, uint32 context_id)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->lookup_table_page_down (id, context_id);
+}
+
+void PanelAgentManager::update_lookup_table_page_size (int id, uint32 context_id, uint32 size)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->update_lookup_table_page_size (id, context_id, size);
+}
+
+void PanelAgentManager::update_candidate_item_layout (int id, uint32 context_id, const std::vector<uint32>& row_items)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->update_candidate_item_layout (id, context_id, row_items);
+}
+
+void PanelAgentManager::select_associate (int id, uint32 context_id, uint32 item)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->select_associate (id, context_id, item);
+}
+
+void PanelAgentManager::associate_table_page_up (int id, uint32 context_id)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->associate_table_page_up (id, context_id);
+}
+
+void PanelAgentManager::associate_table_page_down (int id, uint32 context_id)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->associate_table_page_down (id, context_id);
+}
+
+void PanelAgentManager::update_associate_table_page_size (int id, uint32 context_id, uint32 size)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->update_associate_table_page_size (id, context_id, size);
+}
+
+void PanelAgentManager::update_displayed_candidate_number (int id, uint32 context_id, uint32 size)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->update_displayed_candidate_number (id, context_id, size);
+}
+
+void PanelAgentManager::send_longpress_event (int id, uint32 context_id, uint32 index)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->send_longpress_event (id, context_id, index);
+}
+
+void PanelAgentManager::trigger_property (int id, uint32 context_id, const String& property)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->trigger_property (id, context_id, property);
+}
+
+void PanelAgentManager::socket_start_helper (int id, uint32 context_id, const String& ic_uuid)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->socket_start_helper (id, context_id, ic_uuid);
+}
+
+
+void PanelAgentManager::exit (int id, uint32 context_id)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->exit (id, context_id);
+}
+
+void PanelAgentManager::focus_out_helper (int id, uint32 context_id, const String& uuid)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->focus_out_helper (id, context_id, uuid);
+}
+
+void PanelAgentManager::focus_in_helper (int id, uint32 context_id, const String& uuid)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->focus_in_helper (id, context_id, uuid);
+}
+
+void PanelAgentManager::show_helper (int id, uint32 context_id, const String& uuid, char* data, size_t& len)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->show_helper (id, context_id, uuid, data, len);
+}
+
+void PanelAgentManager::hide_helper (int id, uint32 context_id, const String& uuid)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->hide_helper (id, context_id, uuid);
+}
+
+void PanelAgentManager::set_helper_mode (int id, uint32 context_id, const String& uuid, uint32& mode)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->set_helper_mode (id, context_id, uuid, mode);
+}
+
+void PanelAgentManager::set_helper_language (int id, uint32 context_id, const String& uuid, uint32& language)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->set_helper_language (id, context_id, uuid, language);
+}
+
+void PanelAgentManager::set_helper_imdata (int id, uint32 context_id, const String& uuid, const char* imdata, size_t& len)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->set_helper_imdata (id, context_id, uuid, imdata, len);
+}
+
+void PanelAgentManager::set_helper_return_key_type (int id, uint32 context_id, const String& uuid, uint32 type)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->set_helper_return_key_type (id, context_id, uuid, type);
+}
+
+void PanelAgentManager::get_helper_return_key_type (int id, uint32 context_id, const String& uuid, _OUT_ uint32& type)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->get_helper_return_key_type (id, context_id, uuid, type);
+}
+
+void PanelAgentManager::set_helper_return_key_disable (int id, uint32 context_id, const String& uuid, uint32 disabled)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->set_helper_return_key_disable (id, context_id, uuid, disabled);
+}
+
+void PanelAgentManager::get_helper_return_key_disable (int id, uint32 context_id, const String& uuid, _OUT_ uint32& disabled)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->get_helper_return_key_disable (id, context_id, uuid, disabled);
+}
+
+void PanelAgentManager::set_helper_layout (int id, uint32 context_id, const String& uuid, uint32& layout)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->set_helper_layout (id, context_id, uuid, layout);
+}
+
+void PanelAgentManager::set_helper_input_mode (int id, uint32 context_id, const String& uuid, uint32& mode)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->set_helper_input_mode (id, context_id, uuid, mode);
+}
+
+void PanelAgentManager::set_helper_input_hint (int id, uint32 context_id, const String& uuid, uint32& hint)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->set_helper_input_hint (id, context_id, uuid, hint);
+}
+
+void PanelAgentManager::set_helper_bidi_direction (int id, uint32 context_id, const String& uuid, uint32& direction)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->set_helper_bidi_direction (id, context_id, uuid, direction);
+}
+
+void PanelAgentManager::set_helper_caps_mode (int id, uint32 context_id, const String& uuid, uint32& mode)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->set_helper_caps_mode (id, context_id, uuid, mode);
+}
+
+void PanelAgentManager::show_helper_option_window (int id, uint32 context_id, const String& uuid)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->show_helper_option_window (id, context_id, uuid);
+}
+
+bool PanelAgentManager::process_key_event (int id, uint32 context_id, const String& uuid, KeyEvent& key, _OUT_ uint32& result)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ return _p->process_key_event (id, context_id, uuid, key, result);
+ return false;
+}
+
+bool PanelAgentManager::get_helper_geometry (int id, uint32 context_id, String& uuid, _OUT_ struct rectinfo& info)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ return _p->get_helper_geometry (id, context_id, uuid, info);
+ return false;
+}
+
+void PanelAgentManager::get_helper_imdata (int id, uint32 context_id, String& uuid, _OUT_ char** imdata, _OUT_ size_t& len)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->get_helper_imdata (id, context_id, uuid, imdata, len);
+}
+
+void PanelAgentManager::get_helper_layout (int id, uint32 context_id, String& uuid, uint32& layout)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->get_helper_layout (id, context_id, uuid, layout);
+}
+
+void PanelAgentManager::get_ise_language_locale (int id, uint32 context_id, String& uuid, _OUT_ char* data, _OUT_ size_t& len)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->get_ise_language_locale (id, context_id, uuid, data, len);
+}
+
+void PanelAgentManager::check_option_window (int id, uint32 context_id, String& uuid, _OUT_ uint32& avail)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->check_option_window (id, context_id, uuid, avail);
+}
+
+void PanelAgentManager::reset_ise_option (int id, uint32 context_id)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->reset_ise_option (id, context_id);
+}
+
+void PanelAgentManager::reset_helper_context (int id, uint32 context_id, const String& uuid)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->reset_helper_context (id, context_id, uuid);
+}
+
+void PanelAgentManager::reload_config (int id)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->reload_config (id);
+}
+
+void PanelAgentManager::socket_update_surrounding_text (int id, uint32 context_id, String& uuid, String text, uint32 cursor)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->socket_update_surrounding_text (id, context_id, uuid, text, cursor);
+}
+
+void PanelAgentManager::socket_update_selection (int id, uint32 context_id, String& uuid, String text)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->socket_update_selection (id, context_id, uuid, text);
+}
+
+void PanelAgentManager::socket_get_keyboard_ise_list (int id, uint32 context_id, const String& uuid, std::vector<String>& list)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->socket_get_keyboard_ise_list (id, context_id, uuid, list);
+}
+
+void PanelAgentManager::socket_get_candidate_ui (int id, uint32 context_id, const String& uuid, int style, int mode)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->socket_get_candidate_ui (id, context_id, uuid, style, mode);
+}
+
+void PanelAgentManager::socket_get_candidate_geometry (int id, uint32 context_id, const String& uuid, struct rectinfo& info)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->socket_get_candidate_geometry (id, context_id, uuid, info);
+}
+
+void PanelAgentManager::socket_get_keyboard_ise (int id, uint32 context_id, const String& uuid, String& ise_name, String& ise_uuid)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->socket_get_keyboard_ise (id, context_id, uuid, ise_name, ise_uuid);
+}
+
+void PanelAgentManager::helper_detach_input_context (int id, uint32 context_id, const String& uuid)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->helper_detach_input_context (id, context_id, uuid);
+}
+
+void PanelAgentManager::helper_process_imengine_event (int id, uint32 context_id, const String& uuid, const Transaction& nest_transaction)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->helper_process_imengine_event (id, context_id, uuid, nest_transaction);
+}
+
+void PanelAgentManager::process_helper_event (int id, uint32 context_id, String target_uuid, String active_uuid, Transaction& nest_trans)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->process_helper_event (id, context_id, target_uuid, active_uuid, nest_trans);
+}
+
+void PanelAgentManager::socket_helper_key_event (int id, uint32 context_id, int cmd , KeyEvent& key)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->socket_helper_key_event (id, context_id, cmd, key);
+}
+
+void PanelAgentManager::socket_helper_get_surrounding_text (int id, uint32 context_id, uint32 maxlen_before, uint32 maxlen_after)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->socket_helper_get_surrounding_text (id, context_id, maxlen_before, maxlen_after);
+}
+
+void PanelAgentManager::socket_helper_delete_surrounding_text (int id, uint32 context_id, uint32 offset, uint32 len)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->socket_helper_delete_surrounding_text (id, context_id, offset, len);
+}
+
+void PanelAgentManager::socket_helper_get_selection (int id, uint32 context_id)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->socket_helper_get_selection (id, context_id);
+}
+
+void PanelAgentManager::socket_helper_set_selection (int id, uint32 context_id, uint32 start, uint32 end)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->socket_helper_set_selection (id, context_id, start, end);
+}
+
+void PanelAgentManager::update_ise_input_context (int id, uint32 context_id, uint32 type, uint32 value)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->update_ise_input_context (id, context_id, type, value);
+}
+
+void PanelAgentManager::send_private_command (int id, uint32 context_id, String command)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->send_private_command (id, context_id, command);
+}
+
+void PanelAgentManager::helper_all_update_spot_location (int id, uint32 context_id, String uuid, int x, int y)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->helper_all_update_spot_location (id, context_id, uuid, x, y);
+}
+
+void PanelAgentManager::helper_all_update_cursor_position (int id, uint32 context_id, String uuid, int cursor_pos)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->helper_all_update_cursor_position (id, context_id, uuid, cursor_pos);
+}
+
+void PanelAgentManager::helper_all_update_screen (int id, uint32 context_id, String uuid, int screen)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->helper_all_update_screen (id, context_id, uuid, screen);
+}
+
+void PanelAgentManager::commit_string (int id, uint32 context_id, const WideString& wstr)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->commit_string (id, context_id, wstr);
+}
+
+void PanelAgentManager::show_preedit_string (int id, uint32 context_id)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->show_preedit_string (id, context_id);
+}
+
+void PanelAgentManager::hide_preedit_string (int id, uint32 context_id)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->hide_preedit_string (id, context_id);
+}
+
+void PanelAgentManager::update_preedit_string (int id, uint32 context_id, WideString wstr, AttributeList& attrs, uint32 caret)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->update_preedit_string (id, context_id, wstr, attrs, caret);
+}
+
+void PanelAgentManager::update_preedit_caret (int id, uint32 context_id, uint32 caret)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->update_preedit_caret (id, context_id, caret);
+}
+
+void PanelAgentManager::helper_attach_input_context_and_update_screen (int id, std::vector < std::pair <uint32, String> >& helper_ic_index,
+ uint32 current_screen)
+{
+ PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+ if (!_p.null ())
+ _p->helper_attach_input_context_and_update_screen (id, helper_ic_index, current_screen);
+}
+
+
+} /* namespace scim */
+
+/*
+vi:ts=4:nowrap:ai:expandtab
+*/
--- /dev/null
+/**
+ * @file scim_panel_agent.h
+ * @brief Defines scim::PanelAgent and their related types.
+ *
+ * scim::PanelAgent is a class used to write Panel daemons.
+ * It acts like a Socket Server and handles all socket clients
+ * issues.
+ */
+
+/* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
+
+/*
+ * Smart Common Input Method
+ *
+ * Copyright (c) 2004-2005 James Su <suzhe@tsinghua.org.cn>
+ * Copyright (c) 2012-2015 Samsung Electronics Co., Ltd.
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307 USA
+ *
+ * Modifications by Samsung Electronics Co., Ltd.
+ * 1. Add new signals
+ * a. m_signal_set_keyboard_ise and m_signal_get_keyboard_ise
+ * b. m_signal_focus_in and m_signal_focus_out
+ * c. m_signal_expand_candidate, m_signal_contract_candidate and m_signal_set_candidate_ui
+ * d. m_signal_get_ise_list, m_signal_get_keyboard_ise_list, m_signal_update_ise_geometry and m_signal_get_ise_information
+ * e. m_signal_set_active_ise_by_uuid and m_signal_get_ise_info_by_uuid
+ * f. m_signal_accept_connection, m_signal_close_connection and m_signal_exit
+ * 2. Add new interface APIs in PanelClient class
+ * a. get_helper_manager_id (), has_helper_manager_pending_event () and filter_helper_manager_event ()
+ * b. update_candidate_panel_event (), update_input_panel_event () and select_aux ()
+ * c. candidate_more_window_show () and candidate_more_window_hide ()
+ * d. update_displayed_candidate_number () and update_candidate_item_layout ()
+ * e. stop_helper (), send_longpress_event () and update_ise_list ()
+ * f. filter_event (), filter_exception_event () and get_server_id ()
+ * 3. Donot use thread to receive message
+ * 4. Monitor socket frontend for self-recovery function
+ *
+ * $Id: scim_panel_agent.h,v 1.2 2005/06/11 14:50:31 suzhe Exp $
+ */
+
+#ifndef __ISF_PANEL_AGENT_MANAGER_H
+#define __ISF_PANEL_AGENT_MANAGER_H
+
+#include <scim_panel_common.h>
+
+#ifndef _OUT_
+#define _OUT_
+#endif
+
+namespace scim
+{
+
+
+/**
+ * @brief The class to implement all socket protocol in Panel.
+ *
+ * This class acts like a stand alone SocketServer.
+ * It has its own dedicated main loop, and will be blocked when run () is called.
+ * So run () must be called within a separated thread, in order to not block
+ * the main loop of the Panel program itself.
+ *
+ * Before calling run (), the panel must hook the callback functions to the
+ * corresponding signals.
+ *
+ * Note that, there are two special signals: lock(void) and unlock(void). These
+ * two signals are used to provide a thread lock to PanelAgent, so that PanelAgent
+ * can run correctly within a multi-threading Panel program.
+ */
+class EXAPI PanelAgentManager
+{
+ class PanelAgentManagerImpl;
+ PanelAgentManagerImpl* m_impl;
+
+ PanelAgentManager (const PanelAgentManager&);
+ const PanelAgentManager& operator = (const PanelAgentManager&);
+
+public:
+ PanelAgentManager ();
+ ~PanelAgentManager ();
+
+ /**
+ * @brief Initialize this PanelAgent.
+ *
+ * @param config The name of the config module to be used by Helpers.
+ * @param display The name of display, on which the Panel should run.
+ * @param resident If this is true then this PanelAgent will keep running
+ * even if there is no more client connected.
+ *
+ * @return true if the PanelAgent is initialized correctly and ready to run.
+ */
+ bool initialize (InfoManager* info_manager,const ConfigPointer& config ,const String& display, bool resident = false);
+
+ /**
+ * @brief Check if this PanelAgent is initialized correctly and ready to run.
+ *
+ * @return true if this PanelAgent is ready to run.
+ */
+ bool valid (void) const;
+
+ /**
+ * @brief Stop this PanelAgent.
+ */
+ void stop (void);
+
+public:
+
+ /**
+ * @brief Notice helper ISE to focus out.
+ *
+ * @param uuid The helper ISE uuid.
+ */
+ void focus_out_helper (int client, uint32 context, const String& uuid);
+
+ /**
+ * @brief Notice helper ISE to focus in.
+ *
+ * @param uuid The helper ISE uuid.
+ */
+ void focus_in_helper (int client, uint32 context, const String& uuid);
+
+ /**
+ * @brief Notice helper ISE to show window.
+ *
+ * @param uuid The helper ISE uuid.
+ */
+ void show_helper (int client, uint32 context, const String& uuid, char* data, size_t& len);
+
+ /**
+ * @brief Notice helper ISE to hide window.
+ *
+ * @param uuid The helper ISE uuid.
+ */
+ void hide_helper (int client, uint32 context, const String& uuid);
+
+ /**
+ * @brief Reset keyboard ISE.
+ *
+ * @return true if this operation is successful, otherwise return false.
+ */
+ void reset_keyboard_ise (int client, uint32 context);
+
+ /**
+ * @brief Change the factory used by the focused IMEngineInstance object.
+ *
+ * @param uuid The uuid of the new factory.
+ * @return true if the command was sent correctly.
+ */
+ void change_factory (int client, uint32 context, const String& uuid);
+
+ /**
+ * @brief Notice Helper ISE that candidate more window is showed.
+ * @return true if the command was sent correctly.
+ */
+ void candidate_more_window_show (int client, uint32 context);
+
+ /**
+ * @brief Notice Helper ISE that candidate more window is hidden.
+ * @return true if the command was sent correctly.
+ */
+ void candidate_more_window_hide (int client, uint32 context);
+
+ /**
+ * @brief Notice Helper ISE that show candidate.
+ * @return true if the command was sent correctly.
+ */
+ void helper_candidate_show (int client, uint32 context, const String& uuid);
+
+ /**
+ * @brief Notice Helper ISE that hide candidate.
+ * @return true if the command was sent correctly.
+ */
+ void helper_candidate_hide (int client, uint32 context, const String& uuid);
+
+ /**
+ * @brief Update helper lookup table.
+ * @return true if the command was sent correctly.
+ */
+ void update_helper_lookup_table (int client, uint32 context, const String& uuid, const LookupTable& table);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * select a aux in current aux string.
+ *
+ * @param item The index of the selected aux.
+ * @return true if the command was sent correctly.
+ */
+ void select_aux (int client, uint32 context, uint32 item);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * select a candidate in current lookup table.
+ *
+ * @param item The index of the selected candidate.
+ * @return true if the command was sent correctly.
+ */
+ void select_candidate (int client, uint32 context, uint32 item);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * flip the LookupTable to previous page.
+ * @return true if the command was sent correctly.
+ */
+ void lookup_table_page_up (int client, uint32 context);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * flip the LookupTable to next page.
+ * @return true if the command was sent correctly.
+ */
+ void lookup_table_page_down (int client, uint32 context);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * update the page size of the LookupTable.
+ *
+ * @param size The new page size.
+ * @return true if the command was sent correctly.
+ */
+ void update_lookup_table_page_size (int client, uint32 context, uint32 size);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * update candidate items layout.
+ *
+ * @param row_items The items of each row.
+ * @return true if the command was sent correctly.
+ */
+ void update_candidate_item_layout (int client, uint32 context, const std::vector<uint32>& row_items);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * select a associate in current associate table.
+ *
+ * @param item The index of the selected associate.
+ * @return true if the command was sent correctly.
+ */
+ void select_associate (int client, uint32 context, uint32 item);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * flip the AssociateTable to previous page.
+ * @return true if the command was sent correctly.
+ */
+ void associate_table_page_up (int client, uint32 context);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * flip the AssociateTable to next page.
+ * @return true if the command was sent correctly.
+ */
+ void associate_table_page_down (int client, uint32 context);
+
+ /**
+ * @brief Let the focused IMEngineInstance object
+ * update the page size of the AssociateTable.
+ *
+ * @param size The new page size.
+ * @return true if the command was sent correctly.
+ */
+ void update_associate_table_page_size (int client, uint32 context, uint32 size);
+
+ /**
+ * @brief Inform helper ISE to update displayed candidate number.
+ *
+ * @param size The displayed candidate number.
+ * @return true if the command was sent correctly.
+ */
+ void update_displayed_candidate_number (int client, uint32 context, uint32 size);
+
+ /**
+ * @brief Trigger a property of the focused IMEngineInstance object.
+ *
+ * @param property The property key to be triggered.
+ * @return true if the command was sent correctly.
+ */
+ void trigger_property (int client, uint32 context, const String& property);
+
+
+
+ /**
+ * @brief Let all FrontEnds and Helpers reload configuration.
+ * @return true if the command was sent correctly.
+ */
+ void reload_config (int client);
+
+ /**
+ * @brief Let all FrontEnds, Helpers and this Panel exit.
+ * @return true if the command was sent correctly.
+ */
+ void exit (int client, uint32 context);
+
+ /**
+ * @brief Send candidate longpress event to ISE.
+ *
+ * @param type The candidate object type.
+ * @param index The candidate object index.
+ *
+ * @return none.
+ */
+ void send_longpress_event (int client, uint32 context, uint32 index);
+ void update_panel_event (int id, uint32 contextid, int cmd, uint32 nType, uint32 nValue);
+ void update_keyboard_ise_list (int id, uint32 contextid);
+ void set_helper_mode (int client, uint32 context, const String& uuid, uint32& mode);
+ void set_helper_language (int client, uint32 context, const String& uuid, uint32& language);
+ void set_helper_imdata (int client, uint32 context, const String& uuid, const char* imdata, size_t& len);
+ void set_helper_return_key_type (int client, uint32 context, const String& uuid, uint32 type);
+ void get_helper_return_key_type (int client, uint32 context, const String& uuid, _OUT_ uint32& type);
+ void set_helper_return_key_disable (int client, uint32 context, const String& uuid, uint32 disabled);
+ void get_helper_return_key_disable (int client, uint32 context, const String& uuid, _OUT_ uint32& disabled);
+ void set_helper_layout (int client, uint32 context, const String& uuid, uint32& layout);
+ void set_helper_input_mode (int client, uint32 context, const String& uuid, uint32& mode);
+ void set_helper_input_hint (int client, uint32 context, const String& uuid, uint32& hint);
+ void set_helper_bidi_direction (int client, uint32 context, const String& uuid, uint32& direction);
+ void set_helper_caps_mode (int client, uint32 context, const String& uuid, uint32& mode);
+ void show_helper_option_window (int client, uint32 context, const String& uuid);
+ bool process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, _OUT_ uint32& result);
+ bool get_helper_geometry (int client, uint32 context, String& uuid, _OUT_ struct rectinfo& info);
+ void get_helper_imdata (int client, uint32 context, String& uuid, _OUT_ char** imdata, _OUT_ size_t& len);
+ void get_helper_layout (int client, uint32 context, String& uuid, uint32& layout);
+ void get_ise_language_locale (int client, uint32 context, String& uuid, _OUT_ char* data, _OUT_ size_t& len);
+ void check_option_window (int client, uint32 context, String& uuid, _OUT_ uint32& avail);
+ void reset_ise_option (int client_id, uint32 context);
+ void reset_helper_context (int client_id, uint32 context, const String& uuid);
+ void socket_update_surrounding_text (int client, uint32 context, String& uuid, String text, uint32 cursor);
+ void socket_update_selection (int client, uint32 context, String& uuid, String text);
+ void socket_get_keyboard_ise_list (int client, uint32 context, const String& uuid, std::vector<String>& list);
+ void socket_get_candidate_ui (int client, uint32 context, const String& uuid, int style, int mode);
+ void socket_get_candidate_geometry (int client, uint32 context, const String& uuid, struct rectinfo& info);
+ void socket_get_keyboard_ise (int client, uint32 context, const String& uuid, String& ise_name, String& ise_uuid);
+ void socket_start_helper (int client, uint32 context, const String& ic_uuid);
+ void helper_detach_input_context (int client, uint32 context, const String& ic_uuid);
+ void helper_process_imengine_event (int client, uint32 context, const String& ic_uuid, const Transaction& nest_transaction);
+ void process_helper_event (int client, uint32 context, String target_uuid, String active_uuid, Transaction& nest_trans);
+ void socket_helper_key_event (int client, uint32 context, int cmd , KeyEvent& key);
+ void socket_helper_get_surrounding_text (int client, uint32 context_id, uint32 maxlen_before, uint32 maxlen_after);
+ void socket_helper_delete_surrounding_text (int client, uint32 context_id, uint32 offset, uint32 len);
+ void socket_helper_get_selection (int client, uint32 context_id);
+ void socket_helper_set_selection (int client, uint32 context_id, uint32 start, uint32 end);
+ void update_ise_input_context (int focused_client, uint32 focused_context, uint32 type, uint32 value);
+ void send_private_command (int focused_client, uint32 focused_context, String command);
+ void helper_all_update_spot_location (int client_id, uint32 context_id, String uuid, int x, int y);
+ void helper_all_update_cursor_position (int client_id, uint32 context_id, String uuid, int cursor_pos);
+ void helper_all_update_screen (int client_id, uint32 context_id, String uuid, int screen);
+ void commit_string (int target_client, uint32 target_context,const WideString& wstr);
+ void show_preedit_string (int target_client, uint32 target_context);
+ void hide_preedit_string (int target_client, uint32 target_context);
+ void update_preedit_string (int target_client, uint32 target_context, WideString wstr, AttributeList& attrs, uint32 caret);
+ void update_preedit_caret (int focused_client, uint32 focused_context, uint32 caret);
+ void helper_attach_input_context_and_update_screen (int client, std::vector < std::pair <uint32, String> >& helper_ic_index, uint32 current_screen);
+};
+
+/** @} */
+
+} /* namespace scim */
+
+#endif /* __ISF_PANEL_AGENT_MANAGER_H */
+
+/*
+vi:ts=4:nowrap:ai:expandtab
+*/
--- /dev/null
+/*
+ * Smart Common Input Method
+ *
+ * Copyright (c) 2002-2005 James Su <suzhe@tsinghua.org.cn>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307 USA
+ *
+ * $Id: scim_panel_client_module.h,v 0.01 2016/01/26 15:38:00 lizhang $
+ *
+ */
+
+#define Uses_SCIM_PANEL_AGENT_MODULE
+#define Uses_SCIM_MODULE
+#include "scim_private.h"
+#include "scim.h"
+#include <dlog.h>
+
+#ifdef LOG_TAG
+# undef LOG_TAG
+#endif
+#define LOG_TAG "ISF_PANEL_AGENT_MODULE"
+
+
+namespace scim
+{
+
+PanelAgentModule::PanelAgentModule ()
+ : m_panel_agent_init (0),
+ m_panel_agent_get_instance (0)
+{
+}
+
+PanelAgentModule::PanelAgentModule (const String& name, const ConfigPointer& config)
+ : m_panel_agent_init (0),
+ m_panel_agent_get_instance (0)
+{
+ load (name, config);
+}
+
+bool
+PanelAgentModule::load (const String& name, const ConfigPointer& config)
+{
+ m_module_name = name;
+
+ try {
+ if (!m_module.load (name, "PanelAgent"))
+ return false;
+
+ m_panel_agent_init = (PanelAgentModuleInitFunc) m_module.symbol ("scim_panel_agent_module_init");
+ m_panel_agent_get_instance = (PanelAgentModuleGetInstanceFunc) m_module.symbol ("scim_panel_agent_module_get_instance");
+
+ if (!m_panel_agent_init || !m_panel_agent_get_instance) {
+ m_module.unload ();
+ m_panel_agent_init = 0;
+ m_panel_agent_get_instance = 0;
+ return false;
+ }
+
+ m_panel_agent_init (config);
+ } catch (...) {
+ m_module.unload ();
+ m_panel_agent_init = 0;
+ m_panel_agent_get_instance = 0;
+ return false;
+ }
+
+ return true;
+}
+
+bool
+PanelAgentModule::valid () const
+{
+ return (m_module.valid () && m_panel_agent_init && m_panel_agent_get_instance);
+}
+
+String
+PanelAgentModule::get_module_name () const
+{
+ return m_module_name;
+}
+
+
+PanelAgentPointer
+PanelAgentModule::get_instance () const
+{
+ if (valid ())
+ return m_panel_agent_get_instance ();
+
+ return PanelAgentPointer (0);
+}
+
+
+EXAPI int scim_get_panel_agent_module_list (std::vector <String>& mod_list)
+{
+ return scim_get_module_list (mod_list, "PanelAgent");
+}
+
+
+} // namespace scim
+
+/*
+vi:ts=4:nowrap:ai:expandtab
+*/
--- /dev/null
+/** @file scim_config_module.h
+ * @brief Define scim::ConfigModule class for manipulating the config modules.
+ *
+ * Class scim::ConfigModule is a wrapper of class scim::Module,
+ * which is for manipulating the configuration modules.
+ */
+
+/* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
+
+/*
+ * Smart Common Input Method
+ *
+ * Copyright (c) 2002-2005 Li Zhang <li2012.zhang@samsung.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307 USA
+ *
+ * $Id: scim_panel_client_module.h,v 0.01 2016/01/26 15:38:00 lizhang $
+ */
+
+#ifndef __ISF_PANEL_AGENT_MODULE_H
+#define __ISF_PANEL_AGENT_MODULE_H
+
+namespace scim
+{
+/**
+ * @addtogroup Config
+ * @ingroup InputServiceFramework
+ * @{
+ */
+
+/**
+ * @brief The prototype of initialization function in config modules.
+ *
+ * There must be a function called "scim_config_module_init"
+ * which complies with this prototype.
+ * This function name can have a prefix like simple_LTX_,
+ * in which "simple" is the module's name.
+ */
+typedef void (*PanelAgentModuleInitFunc) (const ConfigPointer& config);
+
+/**
+ * @brief Create a factory instance for an engine,
+ *
+ * There must be a function called "scim_imengine_module_create_factory"
+ * which complies with this prototype.
+ * This function name can have a prefix like table_LTX_,
+ * in which "table" is the module's name.
+ *
+ * @param engine - the index of the engine for which a factory object will be created.
+ * @return the pointer of the factory object.
+ */
+typedef PanelAgentPointer (*PanelAgentModuleGetInstanceFunc) ();
+
+
+/**
+ * @brief The class to manipulate the PanelClient modules.
+ *
+ * This is a wrapper of scim::Module class, which is specially
+ * for manipulating the PanelClient modules.
+ */
+class EXAPI PanelAgentModule
+{
+ Module m_module;
+ String m_module_name;
+
+ PanelAgentModuleInitFunc m_panel_agent_init;
+ PanelAgentModuleGetInstanceFunc m_panel_agent_get_instance;
+
+ PanelAgentModule (const PanelAgentModule&);
+ PanelAgentModule& operator= (const PanelAgentModule&);
+
+public:
+ /**
+ * @brief Default constructor.
+ */
+ PanelAgentModule ();
+
+ /**
+ * @brief Constructor.
+ * @param name - the module's name, eg. "simple".
+ */
+ PanelAgentModule (const String& name, const ConfigPointer& config);
+
+ /**
+ * @brief Load a module by its name.
+ *
+ * Load a module into memory.
+ * If another module has been loaded into this object,
+ * then the old module will be unloaded first.
+ * If the old module is resident, false will be returned,
+ * and the old module will be untouched.
+ *
+ * @param name - the module's name, eg. "simple".
+ * @return true if success.
+ */
+ bool load (const String& name, const ConfigPointer& config);
+
+ /**
+ * @brief Check if a module is loaded and initialized successfully.
+ * @return true if a module is already loaded and initialized successfully.
+ */
+ bool valid () const;
+ /**
+ * @brief Get a name of currently IMEngine modules.
+ */
+ String get_module_name () const;
+
+
+ /**
+ * @brief Create an object for an IMEngine factory.
+ *
+ * @param engine - the index of this IMEngine factory,
+ * must be less than the result of number_of_factories method
+ * and greater than or equal to zero.
+ * @return A smart pointer to the factory object, NULL if failed.
+ */
+ PanelAgentPointer get_instance () const;
+
+};
+
+/**
+ * @brief Get a name list of currently available configuration modules.
+ * @param mod_list - the result list will be stored here.
+ * @return the number of the modules, equal to mod_list.size ().
+ */
+EXAPI int scim_get_panel_agent_module_list (std::vector <String>& mod_list);
+
+/** @} */
+
+} // namespace scim
+
+#endif //__SCIM_CONFIG_MODULE_H
+
+/*
+vi:ts=4:ai:nowrap:expandtab
+*/
#define Uses_SCIM_FRONTEND_MODULE
#define Uses_SCIM_IMENGINE_MODULE
#define Uses_SCIM_HELPER_MODULE
-#define Uses_SCIM_BACKEND
#define Uses_SCIM_CONFIG_PATH
#define Uses_SCIM_TRANSACTION
#define Uses_C_LOCALE
struct tms tiks_buf;
clock_t clock_start = times (&tiks_buf);
- BackEndPointer backend;
-
std::vector<String> frontend_list;
std::vector<String> config_list;
std::vector<String> engine_list;
#define Uses_SCIM_PANEL_CLIENT
#endif
+#ifdef Uses_SCIM_PANEL_AGENT_MODULE
+ #define Uses_SCIM_MODULE
+ #define Uses_SCIM_PANEL_AGENT
+#endif
+
#ifdef Uses_SCIM_PANEL_AGENT
+ #define Uses_SCIM_CONFIG_BASE
#define Uses_SCIM_HELPER_MANAGER
#define Uses_SCIM_TRANSACTION
#endif
#endif
#ifdef Uses_SCIM_PANEL_AGENT
- #include <scim_panel_agent.h>
+ #include <isf_panel_agent_base.h>
+ #include <isf_panel_agent_manager.h>
+ #include <isf_info_manager.h>
+#endif
+
+#ifdef Uses_SCIM_PANEL_AGENT_MODULE
+ #include <isf_panel_agent_module.h>
#endif
#ifdef Uses_SCIM_PANEL_CLIENT
if (address.valid ()) {
if (!m_socket_client.connect (address)) {
int i = 0;
- bool bConnected = false;
std::cerr << " Connecting to ISF(scim) server.";
/* Make sure we are not waiting for more than 10 second */
for (i = 0; i < 100; ++i) {
if (m_socket_client.connect (address)) {
- bConnected = true;
break;
}
scim_usleep (100000);
std::cerr << ".";
}
std::cerr << " Connected :" << i << "\n";
-
- /* Do not launch SocketFrontEnd process here, let the immodule to create SocketFrontEnd process */
- if (false && !bConnected) {
- /* Get modules list */
- std::vector<String> engine_list;
- std::vector<String> helper_list;
- std::vector<String> load_engine_list;
- scim_get_imengine_module_list (engine_list);
- scim_get_helper_module_list (helper_list);
-
- std::vector<String>::iterator it;
- for (it = engine_list.begin (); it != engine_list.end (); it++) {
- if (*it != "socket")
- load_engine_list.push_back (*it);
- }
- for (it = helper_list.begin (); it != helper_list.end (); it++)
- load_engine_list.push_back (*it);
-
- std::cerr << "Launching a ISF daemon with Socket FrontEnd...\n";
- const char *new_argv [] = { "--stay", 0 };
- scim_launch (true,
- "simple",
- (load_engine_list.size () ? scim_combine_string_list (load_engine_list, ',') : "none"),
- "socket",
- const_cast<char**>(new_argv));
-
- std::cerr << " Reconnecting to ISF(scim) server.";
- for (i = 0; i < 100; ++i) {
- if (m_socket_client.connect (address))
- break;
- scim_usleep (100000);
- std::cerr << ".";
- }
- std::cerr << " Reconnected :" << i << "\n";
- }
}
}
+++ /dev/null
-/** @file scim_panel.cpp
- * @brief Implementation of class PanelAgent.
- */
-
-/* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
-
-/*
- * Smart Common Input Method
- *
- * Copyright (c) 2005 James Su <suzhe@tsinghua.org.cn>
- * Copyright (c) 2012-2015 Samsung Electronics Co., Ltd.
- *
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307 USA
- *
- * Modifications by Samsung Electronics Co., Ltd.
- * 1. Add new signals
- * a. m_signal_set_keyboard_ise and m_signal_get_keyboard_ise
- * b. m_signal_focus_in and m_signal_focus_out
- * c. m_signal_expand_candidate, m_signal_contract_candidate and m_signal_set_candidate_ui
- * d. m_signal_get_ise_list, m_signal_get_keyboard_ise_list, m_signal_update_ise_geometry and m_signal_get_ise_information
- * e. m_signal_set_active_ise_by_uuid and m_signal_get_ise_info_by_uuid
- * f. m_signal_accept_connection, m_signal_close_connection and m_signal_exit
- * 2. Add new interface APIs in PanelClient class
- * a. get_helper_manager_id (), has_helper_manager_pending_event () and filter_helper_manager_event ()
- * b. update_candidate_panel_event (), update_input_panel_event () and select_aux ()
- * c. candidate_more_window_show () and candidate_more_window_hide ()
- * d. update_displayed_candidate_number () and update_candidate_item_layout ()
- * e. stop_helper (), send_longpress_event () and update_ise_list ()
- * f. filter_event (), filter_exception_event () and get_server_id ()
- * 3. Donot use thread to receive message
- * 4. Monitor socket frontend for self-recovery function
- *
- * $Id: scim_panel_agent.cpp,v 1.8.2.1 2006/01/09 14:32:18 suzhe Exp $
- *
- */
-
-#define Uses_SCIM_TRANSACTION
-#define Uses_SCIM_TRANS_COMMANDS
-#define Uses_SCIM_PANEL_AGENT
-#define Uses_SCIM_HELPER
-#define Uses_SCIM_SOCKET
-#define Uses_SCIM_EVENT
-#define Uses_SCIM_CONFIG
-#define Uses_SCIM_CONFIG_MODULE
-#define Uses_SCIM_CONFIG_PATH
-#define Uses_SCIM_UTILITY
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/times.h>
-#include <dlog.h>
-#include <unistd.h>
-#include "scim_private.h"
-#include "scim.h"
-#include "scim_stl_map.h"
-
-#ifdef LOG_TAG
-# undef LOG_TAG
-#endif
-#define LOG_TAG "ISF_PANEL_EFL"
-
-#define MIN_REPEAT_TIME 2.0
-
-#define IMEMANAGER_PRIVILEGE "http://tizen.org/privilege/imemanager"
-
-EXAPI scim::CommonLookupTable g_isf_candidate_table;
-
-
-namespace scim {
-
-typedef Signal0<void>
- PanelAgentSignalVoid;
-
-typedef Signal1<void, int>
- PanelAgentSignalInt;
-
-typedef Signal1<void, int &>
- PanelAgentSignalInt2;
-
-typedef Signal1<void, const String &>
- PanelAgentSignalString;
-
-typedef Signal2<void, const String &, bool>
- PanelAgentSignalStringBool;
-
-typedef Signal2<void, String &, String &>
- PanelAgentSignalString2;
-
-typedef Signal2<void, int, const String &>
- PanelAgentSignalIntString;
-
-typedef Signal1<void, const PanelFactoryInfo &>
- PanelAgentSignalFactoryInfo;
-
-typedef Signal1<void, const std::vector <PanelFactoryInfo> &>
- PanelAgentSignalFactoryInfoVector;
-
-typedef Signal1<void, const LookupTable &>
- PanelAgentSignalLookupTable;
-
-typedef Signal1<void, const Property &>
- PanelAgentSignalProperty;
-
-typedef Signal1<void, const PropertyList &>
- PanelAgentSignalPropertyList;
-
-typedef Signal2<void, int, int>
- PanelAgentSignalIntInt;
-
-typedef Signal2<void, int &, int &>
- PanelAgentSignalIntInt2;
-
-typedef Signal3<void, int, int, int>
- PanelAgentSignalIntIntInt;
-
-typedef Signal4<void, int, int, int, int>
- PanelAgentSignalIntIntIntInt;
-
-typedef Signal2<void, int, const Property &>
- PanelAgentSignalIntProperty;
-
-typedef Signal2<void, int, const PropertyList &>
- PanelAgentSignalIntPropertyList;
-
-typedef Signal2<void, int, const HelperInfo &>
- PanelAgentSignalIntHelperInfo;
-
-typedef Signal3<void, const String &, const AttributeList &, int>
- PanelAgentSignalAttributeStringInt;
-
-typedef Signal2<void, const String &, const AttributeList &>
- PanelAgentSignalAttributeString;
-
-typedef Signal1<void, std::vector <String> &>
- PanelAgentSignalStringVector;
-
-typedef Signal1<bool, HELPER_ISE_INFO &>
- PanelAgentSignalBoolHelperInfo;
-
-typedef Signal1<bool, std::vector <String> &>
- PanelAgentSignalBoolStringVector;
-
-typedef Signal2<void, char *, std::vector <String> &>
- PanelAgentSignalStrStringVector;
-
-typedef Signal2<bool, const String &, ISE_INFO &>
- PanelAgentSignalStringISEINFO;
-
-typedef Signal2<bool, String, int &>
- PanelAgentSignalStringInt;
-
-typedef Signal1<void, const KeyEvent &>
- PanelAgentSignalKeyEvent;
-
-typedef Signal1<void, struct rectinfo &>
- PanelAgentSignalRect;
-
-typedef Signal6<bool, String, String &, String &, int &, int &, String &>
- PanelAgentSignalBoolString4int2;
-
-typedef Signal2<void, int, struct rectinfo &>
- PanelAgentSignalIntRect;
-
-typedef Signal2<bool, int, String>
- PanelAgentSignalIntString2;
-
-enum ClientType {
- UNKNOWN_CLIENT,
- FRONTEND_CLIENT,
- FRONTEND_ACT_CLIENT,
- HELPER_CLIENT,
- HELPER_ACT_CLIENT,
- IMCONTROL_ACT_CLIENT,
- IMCONTROL_CLIENT
-};
-
-struct ClientInfo {
- uint32 key;
- ClientType type;
-};
-
-struct HelperClientStub {
- int id;
- int ref;
-
- HelperClientStub (int i = 0, int r = 0) : id (i), ref (r) { }
-};
-
-struct IMControlStub {
- std::vector<ISE_INFO> info;
- std::vector<int> count;
-};
-
-static int _id_count = -4;
-
-#define DEFAULT_CONTEXT_VALUE 0xfff
-
-#if SCIM_USE_STL_EXT_HASH_MAP
-typedef __gnu_cxx::hash_map <int, ClientInfo, __gnu_cxx::hash <int> > ClientRepository;
-typedef __gnu_cxx::hash_map <int, HelperInfo, __gnu_cxx::hash <int> > HelperInfoRepository;
-typedef __gnu_cxx::hash_map <uint32, String, __gnu_cxx::hash <unsigned int> > ClientContextUUIDRepository;
-typedef __gnu_cxx::hash_map <String, HelperClientStub, scim_hash_string> HelperClientIndex;
-typedef __gnu_cxx::hash_map <String, std::vector < std::pair <uint32, String> >, scim_hash_string> StartHelperICIndex;
-#elif SCIM_USE_STL_HASH_MAP
-typedef std::hash_map <int, ClientInfo, std::hash <int> > ClientRepository;
-typedef std::hash_map <int, HelperInfo, std::hash <int> > HelperInfoRepository;
-typedef std::hash_map <uint32, String, std::hash <unsigned int> > ClientContextUUIDRepository;
-typedef std::hash_map <String, HelperClientStub, scim_hash_string> HelperClientIndex;
-typedef std::hash_map <String, std::vector < std::pair <uint32, String> >, scim_hash_string> StartHelperICIndex;
-#else
-typedef std::map <int, ClientInfo> ClientRepository;
-typedef std::map <int, HelperInfo> HelperInfoRepository;
-typedef std::map <uint32, String> ClientContextUUIDRepository;
-typedef std::map <String, HelperClientStub> HelperClientIndex;
-typedef std::map <String, std::vector < std::pair <uint32, String> > > StartHelperICIndex;
-#endif
-
-typedef std::map <String, uint32> UUIDCountRepository;
-typedef std::map <String, enum HelperState> UUIDStateRepository;
-typedef std::map <String, int> StringIntRepository;
-typedef std::map <int, struct IMControlStub> IMControlRepository;
-typedef std::map <int, int> IntIntRepository;
-
-static uint32
-get_helper_ic (int client, uint32 context)
-{
- return (uint32) (client & 0xFFFF) | ((context & 0x7FFF) << 16);
-}
-
-static void
-get_imengine_client_context (uint32 helper_ic, int &client, uint32 &context)
-{
- client = (int) (helper_ic & 0xFFFF);
- context = ((helper_ic >> 16) & 0x7FFF);
-}
-
-//==================================== PanelAgent ===========================
-class PanelAgent::PanelAgentImpl
-{
- bool m_should_exit;
- bool m_should_resident;
-
- int m_current_screen;
-
- String m_config_name;
- String m_display_name;
-
- int m_socket_timeout;
- String m_socket_address;
- SocketServer m_socket_server;
-
- Transaction m_send_trans;
- Transaction m_recv_trans;
- Transaction m_nest_trans;
-
- int m_current_socket_client;
- uint32 m_current_client_context;
- String m_current_context_uuid;
- TOOLBAR_MODE_T m_current_toolbar_mode;
- uint32 m_current_helper_option;
- String m_current_helper_uuid;
- String m_last_helper_uuid;
- String m_current_ise_name;
- int m_pending_active_imcontrol_id;
- int m_show_request_client_id;
- int m_active_client_id;
- IntIntRepository m_panel_client_map;
- IntIntRepository m_imcontrol_map;
- bool m_should_shared_ise;
- bool m_ise_exiting;
- bool m_is_imengine_aux;
- bool m_is_imengine_candidate;
-
- int m_last_socket_client;
- uint32 m_last_client_context;
- String m_last_context_uuid;
-
- char *m_ise_context_buffer;
- size_t m_ise_context_length;
-
- ClientRepository m_client_repository;
- /*
- * Each Helper ISE has two socket connect between PanelAgent and HelperAgent.
- * m_helper_info_repository records the active connection.
- * m_helper_active_info_repository records the passive connection.
- */
- HelperInfoRepository m_helper_info_repository;
- HelperInfoRepository m_helper_active_info_repository;
- HelperClientIndex m_helper_client_index;
-
- /* when helper register, notify imcontrol client */
- StringIntRepository m_ise_pending_repository;
- IMControlRepository m_imcontrol_repository;
-
- StartHelperICIndex m_start_helper_ic_index;
-
- /* Keyboard ISE */
- ClientContextUUIDRepository m_client_context_uuids;
-
- /* Helper ISE */
- ClientContextUUIDRepository m_client_context_helper;
- UUIDCountRepository m_helper_uuid_count;
-
- HelperManager m_helper_manager;
-
- PanelAgentSignalVoid m_signal_reload_config;
- PanelAgentSignalVoid m_signal_turn_on;
- PanelAgentSignalVoid m_signal_turn_off;
- PanelAgentSignalVoid m_signal_show_panel;
- PanelAgentSignalVoid m_signal_hide_panel;
- PanelAgentSignalInt m_signal_update_screen;
- PanelAgentSignalIntIntInt m_signal_update_spot_location;
- PanelAgentSignalFactoryInfo m_signal_update_factory_info;
- PanelAgentSignalVoid m_signal_start_default_ise;
- PanelAgentSignalVoid m_signal_stop_default_ise;
- PanelAgentSignalIntInt m_signal_update_input_context;
- PanelAgentSignalIntInt m_signal_set_candidate_ui;
- PanelAgentSignalIntInt2 m_signal_get_candidate_ui;
- PanelAgentSignalIntInt m_signal_set_candidate_position;
- PanelAgentSignalRect m_signal_get_candidate_geometry;
- PanelAgentSignalRect m_signal_get_input_panel_geometry;
- PanelAgentSignalString m_signal_set_keyboard_ise;
- PanelAgentSignalString2 m_signal_get_keyboard_ise;
- PanelAgentSignalString m_signal_show_help;
- PanelAgentSignalFactoryInfoVector m_signal_show_factory_menu;
- PanelAgentSignalVoid m_signal_show_preedit_string;
- PanelAgentSignalVoid m_signal_show_aux_string;
- PanelAgentSignalVoid m_signal_show_lookup_table;
- PanelAgentSignalVoid m_signal_show_associate_table;
- PanelAgentSignalVoid m_signal_hide_preedit_string;
- PanelAgentSignalVoid m_signal_hide_aux_string;
- PanelAgentSignalVoid m_signal_hide_lookup_table;
- PanelAgentSignalVoid m_signal_hide_associate_table;
- PanelAgentSignalAttributeStringInt m_signal_update_preedit_string;
- PanelAgentSignalInt m_signal_update_preedit_caret;
- PanelAgentSignalAttributeString m_signal_update_aux_string;
- PanelAgentSignalLookupTable m_signal_update_lookup_table;
- PanelAgentSignalLookupTable m_signal_update_associate_table;
- PanelAgentSignalPropertyList m_signal_register_properties;
- PanelAgentSignalProperty m_signal_update_property;
- PanelAgentSignalIntPropertyList m_signal_register_helper_properties;
- PanelAgentSignalIntProperty m_signal_update_helper_property;
- PanelAgentSignalIntHelperInfo m_signal_register_helper;
- PanelAgentSignalInt m_signal_remove_helper;
- PanelAgentSignalStringBool m_signal_set_active_ise_by_uuid;
- PanelAgentSignalVoid m_signal_focus_in;
- PanelAgentSignalVoid m_signal_focus_out;
- PanelAgentSignalVoid m_signal_expand_candidate;
- PanelAgentSignalVoid m_signal_contract_candidate;
- PanelAgentSignalInt m_signal_select_candidate;
- PanelAgentSignalBoolStringVector m_signal_get_ise_list;
- PanelAgentSignalBoolHelperInfo m_signal_get_all_helper_ise_info;
- PanelAgentSignalStringBool m_signal_set_has_option_helper_ise_info;
- PanelAgentSignalStringBool m_signal_set_enable_helper_ise_info;
- PanelAgentSignalVoid m_signal_show_helper_ise_list;
- PanelAgentSignalVoid m_signal_show_helper_ise_selector;
- PanelAgentSignalStringInt m_signal_is_helper_ise_enabled;
- PanelAgentSignalBoolString4int2 m_signal_get_ise_information;
- PanelAgentSignalBoolStringVector m_signal_get_keyboard_ise_list;
- PanelAgentSignalIntIntIntInt m_signal_update_ise_geometry;
- PanelAgentSignalStringVector m_signal_get_language_list;
- PanelAgentSignalStringVector m_signal_get_all_language;
- PanelAgentSignalStrStringVector m_signal_get_ise_language;
- PanelAgentSignalStringISEINFO m_signal_get_ise_info_by_uuid;
- PanelAgentSignalKeyEvent m_signal_send_key_event;
-
- PanelAgentSignalInt m_signal_accept_connection;
- PanelAgentSignalInt m_signal_close_connection;
- PanelAgentSignalVoid m_signal_exit;
-
- PanelAgentSignalVoid m_signal_transaction_start;
- PanelAgentSignalVoid m_signal_transaction_end;
-
- PanelAgentSignalVoid m_signal_lock;
- PanelAgentSignalVoid m_signal_unlock;
-
- PanelAgentSignalVoid m_signal_show_ise;
- PanelAgentSignalVoid m_signal_hide_ise;
-
- PanelAgentSignalVoid m_signal_will_show_ack;
- PanelAgentSignalVoid m_signal_will_hide_ack;
-
- PanelAgentSignalInt m_signal_set_keyboard_mode;
-
- PanelAgentSignalVoid m_signal_candidate_will_hide_ack;
- PanelAgentSignalInt2 m_signal_get_ise_state;
-
- PanelAgentSignalIntRect m_signal_get_recent_ise_geometry;
-
- PanelAgentSignalIntString2 m_signal_check_privilege_by_sockfd;
-public:
- PanelAgentImpl ()
- : m_should_exit (false),
- m_should_resident (false),
- m_current_screen (0),
- m_socket_timeout (scim_get_default_socket_timeout ()),
- m_current_socket_client (-1), m_current_client_context (0),
- m_current_toolbar_mode (TOOLBAR_KEYBOARD_MODE),
- m_current_helper_option (0),
- m_pending_active_imcontrol_id (-1),
- m_show_request_client_id (-1),
- m_active_client_id (-1),
- m_should_shared_ise (false),
- m_ise_exiting (false), m_is_imengine_aux (false), m_is_imengine_candidate (false),
- m_last_socket_client (-1), m_last_client_context (0),
- m_ise_context_buffer (NULL), m_ise_context_length (0)
- {
- m_current_ise_name = String (_("English Keyboard"));
- m_imcontrol_repository.clear ();
- m_imcontrol_map.clear ();
- m_panel_client_map.clear ();
- m_socket_server.signal_connect_accept (slot (this, &PanelAgentImpl::socket_accept_callback));
- m_socket_server.signal_connect_receive (slot (this, &PanelAgentImpl::socket_receive_callback));
- m_socket_server.signal_connect_exception (slot (this, &PanelAgentImpl::socket_exception_callback));
- }
-
- ~PanelAgentImpl ()
- {
- delete_ise_context_buffer ();
- }
-
- void delete_ise_context_buffer (void)
- {
- if (m_ise_context_buffer != NULL) {
- delete[] m_ise_context_buffer;
- m_ise_context_buffer = NULL;
- m_ise_context_length = 0;
- }
- }
-
- bool initialize (const String &config, const String &display, bool resident)
- {
- m_config_name = config;
- m_display_name = display;
- m_should_resident = resident;
-
- m_socket_address = scim_get_default_panel_socket_address (display);
-
- m_socket_server.shutdown ();
-
- /* If our helper manager could not connect to the HelperManager process,
- this panel agent's initialization has failed - since we are assuming
- the helper manager process should be launched beforehand */
- if (m_helper_manager.get_connection_number() == -1) {
- ISF_SAVE_LOG ("Fail to get connection with HelperManager!\n");
- return false;
- }
-
- return m_socket_server.create (SocketAddress (m_socket_address));
- }
-
- bool valid (void) const
- {
- return m_socket_server.valid ();
- }
-
-public:
- bool run (void)
- {
- SCIM_DEBUG_MAIN (1) << "PanelAgent::run ()\n";
-
- return m_socket_server.run ();
- }
-
- void stop (void)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::stop ()\n";
-
- lock ();
- m_should_exit = true;
- unlock ();
-
- SocketClient client;
-
- if (client.connect (SocketAddress (m_socket_address))) {
- client.close ();
- }
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- String helper_uuid = get_current_helper_uuid ();
- hide_helper (helper_uuid);
- stop_helper (helper_uuid, -2, 0);
- }
- }
-
- int get_helper_list (std::vector <HelperInfo> & helpers) const
- {
- SCIM_DEBUG_MAIN (1) << "PanelAgent::get_helper_list ()\n";
-
- helpers.clear ();
-
- m_helper_manager.get_helper_list ();
- unsigned int num = m_helper_manager.number_of_helpers ();
- HelperInfo info;
-
- SCIM_DEBUG_MAIN (2) << "Found " << num << " Helper objects\n";
-
- for (unsigned int i = 0; i < num; ++i) {
- if (m_helper_manager.get_helper_info (i, info) && info.uuid.length ()
- && (info.option & SCIM_HELPER_STAND_ALONE))
- helpers.push_back (info);
-
- SCIM_DEBUG_MAIN (3) << "Helper " << i << " : " << info.uuid << " : " << info.name << " : "
- << ((info.option & SCIM_HELPER_STAND_ALONE) ? "SA " : "")
- << ((info.option & SCIM_HELPER_AUTO_START) ? "AS " : "")
- << ((info.option & SCIM_HELPER_AUTO_RESTART) ? "AR " : "") << "\n";
- }
-
- return (int)(helpers.size ());
- }
-
- TOOLBAR_MODE_T get_current_toolbar_mode () const
- {
- return m_current_toolbar_mode;
- }
-
- String get_current_ise_name () const
- {
- return m_current_ise_name;
- }
-
- String get_current_helper_uuid () const
- {
- return m_current_helper_uuid;
- }
-
- String get_current_helper_name () const
- {
- std::vector<HelperInfo> helpers;
-
- get_helper_list (helpers);
-
- std::vector<HelperInfo>::iterator iter;
-
- for (iter = helpers.begin (); iter != helpers.end (); iter++) {
- if (iter->uuid == m_current_helper_uuid)
- return iter->name;
- }
-
- return String ("");
- }
-
- uint32 get_current_helper_option () const
- {
- return m_current_helper_option;
- }
-
- void set_current_ise_name (String &name)
- {
- m_current_ise_name = name;
- }
-
- void set_current_toolbar_mode (TOOLBAR_MODE_T mode)
- {
- m_current_toolbar_mode = mode;
- }
-
- void set_current_helper_option (uint32 option)
- {
- m_current_helper_option = option;
- }
-
- void update_panel_event (int cmd, uint32 nType, uint32 nValue)
- {
- int focused_client;
- uint32 focused_context;
- get_focused_context (focused_client, focused_context);
- if (focused_client == -1 && m_active_client_id != -1) {
- focused_client = m_panel_client_map[m_active_client_id];
- focused_context = 0;
- }
-
- SCIM_DEBUG_MAIN(1) << __func__ << " (" << nType << ", " << nValue << "), client=" << focused_client << "\n";
-
- ClientInfo client_info = socket_get_client_info (focused_client);
- if (client_info.type == FRONTEND_CLIENT) {
- Socket client_socket (focused_client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (focused_context);
- m_send_trans.put_command (cmd);
- m_send_trans.put_data (nType);
- m_send_trans.put_data (nValue);
- m_send_trans.write_to_socket (client_socket);
- } else {
- std::cerr << __func__ << " focused client is not existed!!!" << "\n";
- }
-
- if (m_panel_client_map[m_show_request_client_id] != focused_client) {
- client_info = socket_get_client_info (m_panel_client_map[m_show_request_client_id]);
- if (client_info.type == FRONTEND_CLIENT) {
- Socket client_socket (m_panel_client_map[m_show_request_client_id]);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (0);
- m_send_trans.put_command (cmd);
- m_send_trans.put_data (nType);
- m_send_trans.put_data (nValue);
- m_send_trans.write_to_socket (client_socket);
- std::cerr << __func__ << " show request client=" << m_panel_client_map[m_show_request_client_id] << "\n";
- } else {
- std::cerr << __func__ << " show request client is not existed!!!" << "\n";
- }
- }
- }
-
- bool move_preedit_caret (uint32 position)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::move_preedit_caret (" << position << ")\n";
-
- int client;
- uint32 context;
-
- lock ();
-
- get_focused_context (client, context);
-
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (SCIM_TRANS_CMD_MOVE_PREEDIT_CARET);
- m_send_trans.put_data ((uint32) position);
- m_send_trans.write_to_socket (client_socket);
- }
-
- unlock ();
-
- return client >= 0;
- }
-
- bool request_help (void)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::request_help ()\n";
-
- int client;
- uint32 context;
-
- lock ();
-
- get_focused_context (client, context);
-
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (SCIM_TRANS_CMD_PANEL_REQUEST_HELP);
- m_send_trans.write_to_socket (client_socket);
- }
-
- unlock ();
-
- return client >= 0;
- }
-
- bool request_factory_menu (void)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::request_factory_menu ()\n";
-
- int client;
- uint32 context;
-
- lock ();
-
- get_focused_context (client, context);
-
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (SCIM_TRANS_CMD_PANEL_REQUEST_FACTORY_MENU);
- m_send_trans.write_to_socket (client_socket);
- }
-
- unlock ();
-
- return client >= 0;
- }
-
- bool reset_keyboard_ise (void)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::reset_keyboard_ise ()\n";
- int client = -1;
- uint32 context = 0;
-
- lock ();
-
- get_focused_context (client, context);
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (ISM_TRANS_CMD_PANEL_RESET_KEYBOARD_ISE);
- m_send_trans.write_to_socket (client_socket);
- }
-
- unlock ();
-
- return client >= 0;
- }
-
- bool update_keyboard_ise_list (void)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::update_keyboard_ise_list ()\n";
- int client = -1;
- uint32 context = 0;
-
- lock ();
-
- get_focused_context (client, context);
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (ISM_TRANS_CMD_PANEL_UPDATE_KEYBOARD_ISE);
- m_send_trans.write_to_socket (client_socket);
- }
-
- unlock ();
-
- return client >= 0;
- }
-
- bool change_factory (const String &uuid)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::change_factory (" << uuid << ")\n";
-
- int client;
- uint32 context;
- if (scim_global_config_read (SCIM_GLOBAL_CONFIG_PRELOAD_KEYBOARD_ISE, false))
- m_helper_manager.preload_keyboard_ise (uuid);
- lock ();
-
- get_focused_context (client, context);
-
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (SCIM_TRANS_CMD_PANEL_CHANGE_FACTORY);
- m_send_trans.put_data (uuid);
- m_send_trans.write_to_socket (client_socket);
- }
-
- unlock ();
-
- return client >= 0;
- }
-
- bool helper_candidate_show (void)
- {
- SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n";
-
- int client;
- uint32 context;
-
- get_focused_context (client, context);
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- Socket client_socket (it->second.id);
- uint32 ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_CANDIDATE_SHOW);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
- }
-
- return false;
- }
-
- bool helper_candidate_hide (void)
- {
- SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n";
-
- int client;
- uint32 context;
-
- get_focused_context (client, context);
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- Socket client_socket (it->second.id);
- uint32 ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_CANDIDATE_HIDE);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
- }
-
- return false;
- }
-
- bool candidate_more_window_show (void)
- {
- SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n";
-
- int client;
- uint32 context;
-
- get_focused_context (client, context);
- if (m_is_imengine_candidate) {
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_SHOW);
- m_send_trans.write_to_socket (client_socket);
- return true;
- }
- } else {
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- Socket client_socket (it->second.id);
- uint32 ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_SHOW);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
- }
- }
-
- return false;
- }
-
- bool candidate_more_window_hide (void)
- {
- SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n";
-
- int client;
- uint32 context;
-
- get_focused_context (client, context);
- if (m_is_imengine_candidate) {
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_HIDE);
- m_send_trans.write_to_socket (client_socket);
- return true;
- }
- } else {
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- Socket client_socket (it->second.id);
- uint32 ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_HIDE);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
- }
- }
-
- return false;
- }
-
- bool update_helper_lookup_table (const LookupTable &table)
- {
- SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n";
-
- int client;
- uint32 context;
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_LOOKUP_TABLE);
- m_send_trans.put_data (table);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
- }
-
- return false;
- }
-
- bool select_aux (uint32 item)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::select_aux (" << item << ")\n";
-
- int client;
- uint32 context;
-
- lock ();
-
- get_focused_context (client, context);
-
- if (m_is_imengine_aux) {
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (ISM_TRANS_CMD_SELECT_AUX);
- m_send_trans.put_data ((uint32)item);
- m_send_trans.write_to_socket (client_socket);
- }
- } else {
- helper_select_aux (item);
- }
-
- unlock ();
-
- return client >= 0;
- }
-
- bool select_candidate (uint32 item)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::select_candidate (" << item << ")\n";
-
- int client;
- uint32 context;
-
- lock ();
-
- get_focused_context (client, context);
-
- if (m_is_imengine_candidate) {
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (SCIM_TRANS_CMD_SELECT_CANDIDATE);
- m_send_trans.put_data ((uint32)item);
- m_send_trans.write_to_socket (client_socket);
- }
- } else {
- helper_select_candidate (item);
- }
-
- unlock ();
-
- return client >= 0;
- }
-
- bool lookup_table_page_up (void)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::lookup_table_page_up ()\n";
-
- int client;
- uint32 context;
-
- lock ();
-
- get_focused_context (client, context);
-
- if (m_is_imengine_candidate) {
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_UP);
- m_send_trans.write_to_socket (client_socket);
- }
- } else {
- helper_lookup_table_page_up ();
- }
-
- unlock ();
-
- return client >= 0;
- }
-
- bool lookup_table_page_down (void)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::lookup_table_page_down ()\n";
-
- int client;
- uint32 context;
-
- lock ();
-
- get_focused_context (client, context);
-
- if (m_is_imengine_candidate) {
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_DOWN);
- m_send_trans.write_to_socket (client_socket);
- }
- } else {
- helper_lookup_table_page_down ();
- }
-
- unlock ();
-
- return client >= 0;
- }
-
- bool update_lookup_table_page_size (uint32 size)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::update_lookup_table_page_size (" << size << ")\n";
-
- int client;
- uint32 context;
-
- lock ();
-
- get_focused_context (client, context);
-
- if (m_is_imengine_candidate) {
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE_PAGE_SIZE);
- m_send_trans.put_data (size);
- m_send_trans.write_to_socket (client_socket);
- }
- } else {
- helper_update_lookup_table_page_size (size);
- }
-
- unlock ();
-
- return client >= 0;
- }
-
- bool update_candidate_item_layout (const std::vector<uint32> &row_items)
- {
- SCIM_DEBUG_MAIN(1) << __func__ << " (" << row_items.size () << ")\n";
-
- int client;
- uint32 context;
-
- lock ();
-
- get_focused_context (client, context);
-
- if (m_is_imengine_candidate) {
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_CANDIDATE_ITEM_LAYOUT);
- m_send_trans.put_data (row_items);
- m_send_trans.write_to_socket (client_socket);
- }
- } else {
- helper_update_candidate_item_layout (row_items);
- }
-
- unlock ();
-
- return client >= 0;
- }
-
- bool select_associate (uint32 item)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::select_associate (" << item << ")\n";
-
- int client;
- uint32 context;
-
- lock ();
-
- get_focused_context (client, context);
-
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (ISM_TRANS_CMD_SELECT_ASSOCIATE);
- m_send_trans.put_data ((uint32)item);
- m_send_trans.write_to_socket (client_socket);
- }
-
- unlock ();
-
- helper_select_associate (item);
-
- return client >= 0;
- }
-
- bool associate_table_page_up (void)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::associate_table_page_up ()\n";
-
- int client;
- uint32 context;
-
- lock ();
-
- get_focused_context (client, context);
-
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (ISM_TRANS_CMD_ASSOCIATE_TABLE_PAGE_UP);
- m_send_trans.write_to_socket (client_socket);
- }
-
- unlock ();
-
- helper_associate_table_page_up ();
-
- return client >= 0;
- }
-
- bool associate_table_page_down (void)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::associate_table_page_down ()\n";
-
- int client;
- uint32 context;
-
- lock ();
-
- get_focused_context (client, context);
-
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (ISM_TRANS_CMD_ASSOCIATE_TABLE_PAGE_DOWN);
- m_send_trans.write_to_socket (client_socket);
- }
-
- unlock ();
-
- helper_associate_table_page_down ();
-
- return client >= 0;
- }
-
- bool update_associate_table_page_size (uint32 size)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::update_associate_table_page_size (" << size << ")\n";
-
- int client;
- uint32 context;
-
- lock ();
-
- get_focused_context (client, context);
-
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE_PAGE_SIZE);
- m_send_trans.put_data (size);
- m_send_trans.write_to_socket (client_socket);
- }
-
- unlock ();
-
- helper_update_associate_table_page_size (size);
-
- return client >= 0;
- }
-
- bool update_displayed_candidate_number (uint32 size)
- {
- SCIM_DEBUG_MAIN(1) << __func__ << " (" << size << ")\n";
-
- int client;
- uint32 context;
-
- lock ();
- get_focused_context (client, context);
-
- if (m_is_imengine_candidate) {
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_DISPLAYED_CANDIDATE);
- m_send_trans.put_data (size);
- m_send_trans.write_to_socket (client_socket);
- }
- } else {
- helper_update_displayed_candidate_number (size);
- }
- unlock ();
-
- return client >= 0;
- }
-
- void send_longpress_event (int type, int index)
- {
- SCIM_DEBUG_MAIN(1) << __func__ << " (" << type << ", " << index << ")\n";
-
- int client;
- uint32 context;
-
- get_focused_context (client, context);
- if (m_is_imengine_candidate) {
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (ISM_TRANS_CMD_LONGPRESS_CANDIDATE);
- m_send_trans.put_data (index);
- m_send_trans.write_to_socket (client_socket);
- }
- } else {
- helper_longpress_candidate (index);
- }
- }
-
- bool trigger_property (const String &property)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::trigger_property (" << property << ")\n";
-
- int client;
- uint32 context;
-
- lock ();
-
- get_focused_context (client, context);
-
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (SCIM_TRANS_CMD_TRIGGER_PROPERTY);
- m_send_trans.put_data (property);
- m_send_trans.write_to_socket (client_socket);
- }
-
- unlock ();
-
- return client >= 0;
- }
-
- bool trigger_helper_property (int client,
- const String &property)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::trigger_helper_property (" << client << "," << property << ")\n";
-
- lock ();
-
- ClientInfo info = socket_get_client_info (client);
-
- if (client >= 0 && info.type == HELPER_CLIENT) {
- int fe_client;
- uint32 fe_context;
- String fe_uuid;
-
- fe_uuid = get_focused_context (fe_client, fe_context);
-
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
-
- /* FIXME: We presume that client and context are both less than 65536.
- * Hopefully, it should be true in any UNIXs.
- * So it's ok to combine client and context into one uint32.*/
- m_send_trans.put_data (get_helper_ic (fe_client, fe_context));
- m_send_trans.put_data (fe_uuid);
- m_send_trans.put_command (SCIM_TRANS_CMD_TRIGGER_PROPERTY);
- m_send_trans.put_data (property);
- m_send_trans.write_to_socket (client_socket);
- }
-
- unlock ();
-
- return client >= 0 && info.type == HELPER_CLIENT;
- }
-
- bool start_helper (const String &uuid, int client, uint32 context)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::start_helper (" << uuid << ")\n";
- LOGD ("start ISE(%s)", uuid.c_str ());
-
- if (uuid.length () <= 0)
- return false;
-
- lock ();
-
- /*if (m_current_toolbar_mode != TOOLBAR_HELPER_MODE || m_current_helper_uuid.compare (uuid) != 0)*/ {
- SCIM_DEBUG_MAIN(1) << "Run_helper\n";
- m_helper_manager.run_helper (uuid, m_config_name, m_display_name);
- }
- m_current_helper_uuid = uuid;
-
- unlock ();
-
- return true;
- }
-
- bool stop_helper (const String &uuid, int client, uint32 context)
- {
- char buf[256] = {0};
- snprintf (buf, sizeof (buf), "time:%ld pid:%d %s %s prepare to stop ISE(%s)\n",
- time (0), getpid (), __FILE__, __func__, uuid.c_str ());
- LOGD ("prepare to stop ISE(%s)", uuid.c_str ());
-
- SCIM_DEBUG_MAIN(1) << "PanelAgent::stop_helper (" << uuid << ")\n";
- if (uuid.length () <= 0)
- return false;
-
- lock ();
-
- uint32 ctx = get_helper_ic (client, context);
- HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
- if (it != m_helper_client_index.end ())
- {
- Socket client_socket (it->second.id);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
-
- m_ise_exiting = true;
- m_current_helper_uuid = String ("");
- m_send_trans.put_command (SCIM_TRANS_CMD_EXIT);
- m_send_trans.write_to_socket (client_socket);
- SCIM_DEBUG_MAIN(1) << "Stop helper\n";
- ISF_SAVE_LOG ("send SCIM_TRANS_CMD_EXIT message to %s\n", uuid.c_str ());
- }
-
- unlock ();
-
- return true;
- }
-
- void focus_out_helper (const String &uuid, int client, uint32 context)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- Socket client_socket (it->second.id);
- uint32 ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (SCIM_TRANS_CMD_FOCUS_OUT);
- m_send_trans.write_to_socket (client_socket);
- }
- }
-
- void focus_in_helper (const String &uuid, int client, uint32 context)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- Socket client_socket (it->second.id);
- uint32 ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (SCIM_TRANS_CMD_FOCUS_IN);
- m_send_trans.write_to_socket (client_socket);
- }
- }
-
- bool show_helper (const String &uuid, char *data, size_t &len, uint32 ctx)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- Socket client_socket (it->second.id);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_SHOW_ISE_PANEL);
- m_send_trans.put_data (data, len);
- m_send_trans.write_to_socket (client_socket);
-
- LOGD ("Send ISM_TRANS_CMD_SHOW_ISE_PANEL message");
-
- return true;
- }
-
- LOGW ("Can't find %s", m_current_helper_uuid.c_str ());
- return false;
- }
-
- void hide_helper (const String &uuid, uint32 ctx = 0)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
-
- if (ctx == 0) {
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
- }
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_HIDE_ISE_PANEL);
- m_send_trans.write_to_socket (client_socket);
-
- LOGD ("Send ISM_TRANS_CMD_HIDE_ISE_PANEL message");
- }
- }
-
- bool set_helper_mode (const String &uuid, uint32 &mode)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_SET_ISE_MODE);
- m_send_trans.put_data (mode);
- m_send_trans.write_to_socket (client_socket);
- return true;
- }
-
- return false;
- }
-
- bool set_helper_language (const String &uuid, uint32 &language)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client = -1;
- uint32 context = 0;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_SET_ISE_LANGUAGE);
- m_send_trans.put_data (language);
- m_send_trans.write_to_socket (client_socket);
- return true;
- }
- return false;
- }
-
- bool set_helper_imdata (const String &uuid, char *imdata, size_t &len)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client = -1;
- uint32 context = 0;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_SET_ISE_IMDATA);
- m_send_trans.put_data (imdata, len);
- m_send_trans.write_to_socket (client_socket);
- return true;
- }
- return false;
- }
-
- bool set_helper_return_key_type (const String &uuid, int type)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client = -1;
- uint32 context = 0;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_SET_RETURN_KEY_TYPE);
- m_send_trans.put_data (type);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
-
- return false;
- }
-
- bool get_helper_return_key_type (const String &uuid, uint32 &type)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
-
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
- Transaction trans;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_data (ctx);
- trans.put_data (uuid);
- trans.put_command (ISM_TRANS_CMD_GET_RETURN_KEY_TYPE);
-
- int cmd;
- if (trans.write_to_socket (client_socket)
- && trans.read_from_socket (client_socket)
- && trans.get_command(cmd) && cmd == SCIM_TRANS_CMD_REPLY
- && trans.get_data (type)) {
- SCIM_DEBUG_MAIN (1) << __func__ << " success\n";
- return true;
- } else {
- std::cerr << __func__ << " failed\n";
- }
- }
- return false;
- }
-
- bool set_helper_return_key_disable (const String &uuid, bool disabled)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client = -1;
- uint32 context = 0;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_SET_RETURN_KEY_DISABLE);
- m_send_trans.put_data (disabled);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
-
- return false;
- }
-
- bool get_helper_return_key_disable (const String &uuid, uint32 &disabled)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
- Transaction trans;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_data (ctx);
- trans.put_data (uuid);
- trans.put_command (ISM_TRANS_CMD_GET_RETURN_KEY_DISABLE);
-
- int cmd;
- if (trans.write_to_socket (client_socket)
- && trans.read_from_socket (client_socket)
- && trans.get_command(cmd) && cmd == SCIM_TRANS_CMD_REPLY
- && trans.get_data (disabled)) {
- SCIM_DEBUG_MAIN (1) << __func__ << " success\n";
- return true;
- } else {
- std::cerr << __func__ << " failed\n";
- }
- }
- return false;
- }
-
- bool set_helper_layout (const String &uuid, uint32 &layout)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_SET_LAYOUT);
- m_send_trans.put_data (layout);
- m_send_trans.write_to_socket (client_socket);
- return true;
- }
-
- return false;
- }
-
- bool set_helper_input_mode (const String &uuid, uint32 &mode)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_SET_INPUT_MODE);
- m_send_trans.put_data (mode);
- m_send_trans.write_to_socket (client_socket);
- return true;
- }
-
- return false;
- }
-
- bool set_helper_input_hint (const String &uuid, uint32 &hint)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_SET_INPUT_HINT);
- m_send_trans.put_data (hint);
- m_send_trans.write_to_socket (client_socket);
- return true;
- }
-
- return false;
- }
-
- bool set_helper_bidi_direction (const String &uuid, uint32 &direction)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_BIDI_DIRECTION);
- m_send_trans.put_data (direction);
- m_send_trans.write_to_socket (client_socket);
- return true;
- }
-
- return false;
- }
-
- bool set_helper_caps_mode (const String &uuid, uint32 &mode)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_SET_CAPS_MODE);
- m_send_trans.put_data (mode);
- m_send_trans.write_to_socket (client_socket);
- return true;
- }
-
- return false;
- }
-
- bool show_helper_option_window (const String &uuid)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW);
- m_send_trans.write_to_socket (client_socket);
-
- LOGD ("Send ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW message");
-
- return true;
- }
- return false;
- }
-
- void show_isf_panel (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::show_isf_panel ()\n";
- m_signal_show_panel ();
- }
-
- void hide_isf_panel (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::hide_isf_panel ()\n";
- m_signal_hide_panel ();
- }
-
- void show_ise_panel (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::show_ise_panel ()\n";
-
- String initial_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String (""));
- String default_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
-
- LOGD ("prepare to show ISE %d [%s] [%s]", client_id, initial_uuid.c_str(), default_uuid.c_str());
-
- char *data = NULL;
- size_t len;
- bool ret = false;
- Transaction trans;
- Socket client_socket (client_id);
- m_show_request_client_id = client_id;
- m_active_client_id = client_id;
-
- uint32 client;
- uint32 context;
- if (m_recv_trans.get_data (client) && m_recv_trans.get_data (context) && m_recv_trans.get_data (&data, len)) {
- SCIM_DEBUG_MAIN(4) << __func__ << " (client:" << client << " context:" << context << ")\n";
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode) {
- uint32 ctx = get_helper_ic (client, context);
- ret = show_helper (m_current_helper_uuid, data, len, ctx);
- }
- /* Save ISE context for ISE panel re-showing */
- if (data && len > 0) {
- delete_ise_context_buffer ();
- m_ise_context_buffer = new char [len];
- if (m_ise_context_buffer) {
- m_ise_context_length = len;
- memcpy (m_ise_context_buffer, data, m_ise_context_length);
- }
- }
- }
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.put_data (ret);
- trans.write_to_socket (client_socket);
- if (data != NULL)
- delete[] data;
-
- if (ret) {
- m_signal_show_ise ();
- } else {
- m_signal_start_default_ise ();
- }
- }
-
- void hide_ise_panel (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::hide_ise_panel ()\n";
- LOGD ("prepare to hide ISE, %d %d", client_id, m_show_request_client_id);
-
- uint32 client;
- uint32 context;
- if (m_recv_trans.get_data (client) && m_recv_trans.get_data (context)) {
- SCIM_DEBUG_MAIN(4) << __func__ << " (client:" << client << " context:" << context << ")\n";
- if (m_panel_client_map[client_id] == m_current_socket_client || client_id == m_show_request_client_id) {
-// && (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)) {
- int focused_client;
- uint32 focused_context;
- get_focused_context (focused_client, focused_context);
- if (focused_client == -1 && m_active_client_id != -1) {
- focused_client = m_panel_client_map[m_active_client_id];
- focused_context = 0;
- }
-
- m_signal_hide_ise ();
- }
- /* Release ISE context buffer */
- delete_ise_context_buffer ();
- }
- }
-
- void set_default_ise (const DEFAULT_ISE_T &ise)
- {
- scim_global_config_write (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), ise.uuid);
- scim_global_config_flush ();
- }
-
- void set_should_shared_ise (const bool should_shared_ise)
- {
- m_should_shared_ise = should_shared_ise;
- }
-
- bool process_key_event (const String &uuid, KeyEvent& key, uint32 &result)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
- Transaction trans;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_data (ctx);
- trans.put_data (uuid);
- trans.put_command (SCIM_TRANS_CMD_PROCESS_KEY_EVENT);
- trans.put_data (key);
- int cmd;
- if (trans.write_to_socket (client_socket)
- && trans.read_from_socket (client_socket)
- && trans.get_command (cmd) && cmd == SCIM_TRANS_CMD_REPLY
- && trans.get_data (result)) {
- SCIM_DEBUG_MAIN (1) << __func__ << " success\n";
- return true;
- } else {
- std::cerr << __func__ << " failed\n";
- }
- }
- return false;
- }
-
- bool get_helper_geometry (String &uuid, struct rectinfo &info)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
- Transaction trans;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_data (ctx);
- trans.put_data (uuid);
- trans.put_command (ISM_TRANS_CMD_GET_ACTIVE_ISE_GEOMETRY);
-
- if (trans.write_to_socket (client_socket)) {
- int cmd;
-
- trans.clear ();
- if (trans.read_from_socket (client_socket)
- && trans.get_command(cmd) && cmd == SCIM_TRANS_CMD_REPLY
- && trans.get_data (info.pos_x)
- && trans.get_data (info.pos_y)
- && trans.get_data (info.width)
- && trans.get_data (info.height)) {
- SCIM_DEBUG_MAIN (1) << __func__ << " is successful\n";
- return true;
- } else {
- std::cerr << __func__ << " is failed!!!\n";
- return false;
- }
- }
- }
- return false;
- }
-
- bool get_helper_imdata (String &uuid, char **imdata, size_t &len)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
- Transaction trans;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_data (ctx);
- trans.put_data (uuid);
- trans.put_command (ISM_TRANS_CMD_GET_ISE_IMDATA);
-
- int cmd;
- if (trans.write_to_socket (client_socket)
- && trans.read_from_socket (client_socket)
- && trans.get_command(cmd) && cmd == SCIM_TRANS_CMD_REPLY
- && trans.get_data (imdata, len)) {
- SCIM_DEBUG_MAIN (1) << "get_helper_imdata success\n";
- return true;
- } else {
- std::cerr << "get_helper_imdata failed\n";
- }
- }
- return false;
- }
-
- bool get_helper_layout (String &uuid, uint32 &layout)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
- Transaction trans;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_data (ctx);
- trans.put_data (uuid);
- trans.put_command (ISM_TRANS_CMD_GET_LAYOUT);
-
- int cmd;
- if (trans.write_to_socket (client_socket)
- && trans.read_from_socket (client_socket)
- && trans.get_command(cmd) && cmd == SCIM_TRANS_CMD_REPLY
- && trans.get_data (layout)) {
- SCIM_DEBUG_MAIN (1) << "get_helper_layout success\n";
- return true;
- } else {
- std::cerr << "get_helper_layout failed\n";
- }
- }
- return false;
- }
-
- void get_input_panel_geometry (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
-
- struct rectinfo info = {0, 0, 0, 0};
- m_signal_get_input_panel_geometry (info);
-
- Transaction trans;
- Socket client_socket (client_id);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.put_data (info.pos_x);
- trans.put_data (info.pos_y);
- trans.put_data (info.width);
- trans.put_data (info.height);
- trans.write_to_socket (client_socket);
- }
-
- void get_candidate_window_geometry (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
-
- struct rectinfo info = {0, 0, 0, 0};
- m_signal_get_candidate_geometry (info);
-
- Transaction trans;
- Socket client_socket (client_id);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.put_data (info.pos_x);
- trans.put_data (info.pos_y);
- trans.put_data (info.width);
- trans.put_data (info.height);
- trans.write_to_socket (client_socket);
- }
-
- void get_ise_language_locale (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
-
- size_t len;
- char *data = NULL;
- Transaction trans;
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- get_focused_context (client, context);
-
- uint32 ctx = get_helper_ic (client, context);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_data (ctx);
- trans.put_data (m_current_helper_uuid);
- trans.put_command (ISM_TRANS_CMD_GET_ISE_LANGUAGE_LOCALE);
-
- int cmd;
- Socket client_socket (it->second.id);
- if (trans.write_to_socket (client_socket)
- && trans.read_from_socket (client_socket)
- && trans.get_command (cmd) && cmd == SCIM_TRANS_CMD_REPLY
- && trans.get_data (&data, len)) {
- } else {
- std::cerr << "Get ISE language locale is failed!!!\n";
- }
- }
- }
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- if (data != NULL && len > 0) {
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.put_data (data, len);
- } else {
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- }
-
- Socket client_socket (client_id);
- trans.write_to_socket (client_socket);
-
- if (NULL != data)
- delete [] data;
- }
-
- void get_current_ise_geometry (rectinfo &rect)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << " \n";
- bool ret = false;
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- ret = get_helper_geometry (m_current_helper_uuid, rect);
-
- if (!ret) {
- rect.pos_x = 0;
- rect.pos_y = 0;
- rect.width = 0;
- rect.height = 0;
- }
- }
-
- void set_ise_mode (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::set_ise_mode ()\n";
- uint32 mode;
-
- if (m_recv_trans.get_data (mode)) {
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- set_helper_mode (m_current_helper_uuid, mode);
- }
- }
-
- void set_ise_layout (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::set_ise_layout ()\n";
- uint32 layout;
-
- if (m_recv_trans.get_data (layout)) {
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- set_helper_layout (m_current_helper_uuid, layout);
- }
- }
-
- void set_ise_input_mode (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::set_ise_input_mode ()\n";
- uint32 input_mode;
-
- if (m_recv_trans.get_data (input_mode)) {
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- set_helper_input_mode (m_current_helper_uuid, input_mode);
- }
- }
-
- void set_ise_input_hint (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::set_ise_input_hint ()\n";
- uint32 input_hint;
-
- if (m_recv_trans.get_data (input_hint)) {
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- set_helper_input_hint (m_current_helper_uuid, input_hint);
- }
- }
-
- void update_ise_bidi_direction (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::update_ise_bidi_direction ()\n";
- uint32 bidi_direction;
-
- if (m_recv_trans.get_data (bidi_direction)) {
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- set_helper_bidi_direction (m_current_helper_uuid, bidi_direction);
- }
- }
-
- void set_ise_language (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::set_ise_language ()\n";
- uint32 language;
-
- if (m_recv_trans.get_data (language)) {
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- set_helper_language (m_current_helper_uuid, language);
- }
- }
-
- void set_ise_imdata (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::set_ise_imdata ()\n";
- char *imdata = NULL;
- size_t len;
-
- if (m_recv_trans.get_data (&imdata, len)) {
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- set_helper_imdata (m_current_helper_uuid, imdata, len);
- }
-
- if (NULL != imdata)
- delete [] imdata;
- }
-
- void get_ise_imdata (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::get_ise_imdata ()\n";
- char *imdata = NULL;
- size_t len;
- bool ret = false;
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- ret = get_helper_imdata (m_current_helper_uuid, &imdata, len);
-
- Transaction trans;
- Socket client_socket (client_id);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- if (ret) {
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.put_data (imdata, len);
- } else {
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- }
-
- trans.write_to_socket (client_socket);
-
- if (NULL != imdata)
- delete [] imdata;
- }
-
- void get_ise_layout (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::get_ise_layout ()\n";
- uint32 layout;
- bool ret = false;
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- ret = get_helper_layout (m_current_helper_uuid, layout);
-
- Transaction trans;
- Socket client_socket (client_id);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- if (ret) {
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.put_data (layout);
- } else {
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- }
-
- trans.write_to_socket (client_socket);
- }
-
- void get_ise_state (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
- int state = 0;
- m_signal_get_ise_state (state);
-
- Transaction trans;
- Socket client_socket (client_id);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.put_data (state);
- trans.write_to_socket (client_socket);
- }
-
- void get_active_ise (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
- Transaction trans;
- Socket client_socket (client_id);
- String default_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.put_data (default_uuid);
- trans.write_to_socket (client_socket);
- }
-
- void get_ise_list (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::get_ise_list ()\n";
- std::vector<String> strlist;
- m_signal_get_ise_list (strlist);
-
- Transaction trans;
- Socket client_socket (client_id);
- char *buf = NULL;
- size_t len;
- uint32 num;
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
-
- num = strlist.size ();
- trans.put_data (num);
- for (unsigned int i = 0; i < num; i++) {
- buf = const_cast<char *>(strlist[i].c_str ());
- len = strlen (buf) + 1;
- trans.put_data (buf, len);
- }
-
- trans.write_to_socket (client_socket);
- }
-
- void get_all_helper_ise_info (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::get_all_helper_ise_info ()\n";
- HELPER_ISE_INFO info;
- m_signal_get_all_helper_ise_info (info);
-
- //1 Check if the current IME's option (setting) is available or not.
- for (uint32 i = 0; i < info.appid.size (); i++) {
- if (m_current_helper_uuid.compare (info.appid [i]) == 0) { // Find the current IME
- // If the current IME's "has_option" is unknown (-1), get it through ISM_TRANS_CMD_CHECK_OPTION_WINDOW command.
- // And it's saved to ime_info DB. Then next time this will be skipped.
- if (info.has_option [i] >= 2) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
- if (it != m_helper_client_index.end ()) {
- int cmd;
- Socket client_socket (it->second.id);
- int client;
- uint32 context;
- get_focused_context (client, context);
- uint32 ctx = get_helper_ic (client, context);
- Transaction trans;
- uint32 avail = static_cast<uint32>(-1);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_data (ctx);
- trans.put_data (m_current_helper_uuid);
- trans.put_command (ISM_TRANS_CMD_CHECK_OPTION_WINDOW);
- trans.write_to_socket (client_socket);
- if (!trans.read_from_socket (client_socket, m_socket_timeout) ||
- !trans.get_command (cmd) || cmd != SCIM_TRANS_CMD_REPLY ||
- !trans.get_data (avail)) {
- LOGW("ISM_TRANS_CMD_CHECK_OPTION_WINDOW failed");
- }
- if (avail < 2) {
- info.has_option [i] = avail;
- // Update "has_option" column of ime_info DB and global variable.
- m_signal_set_has_option_helper_ise_info(info.appid [i], static_cast<bool>(avail));
- }
- }
- }
- }
- }
-
- do {
- Transaction trans;
- Socket client_socket (client_id);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
-
- if (info.appid.size() > 0) {
- trans.put_data (info.appid);
- trans.put_data (info.label);
- trans.put_data (info.is_enabled);
- trans.put_data (info.is_preinstalled);
- trans.put_data (info.has_option);
- }
-
- trans.write_to_socket (client_socket);
- } while(0);
- }
-
- void set_enable_helper_ise_info (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::set_enable_helper_ise_info ()\n";
- String appid;
- uint32 is_enabled;
- Transaction trans;
- Socket client_socket (client_id);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
-
- if (!(m_recv_trans.get_data (appid))) {
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- trans.write_to_socket (client_socket);
- return;
- }
- if (appid.length () == 0) {
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- trans.write_to_socket (client_socket);
- return;
- }
- if (!(m_recv_trans.get_data (is_enabled))) {
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- trans.write_to_socket (client_socket);
- return;
- }
-
- m_signal_set_enable_helper_ise_info (appid, static_cast<bool>(is_enabled));
-
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.write_to_socket (client_socket);
- }
-
- void show_helper_ise_list (int client_id)
- {
- Transaction trans;
- Socket client_socket (client_id);
- SCIM_DEBUG_MAIN(4) << "PanelAgent::show_helper_ise_list ()\n";
-
- m_signal_show_helper_ise_list ();
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.write_to_socket (client_socket);
- }
-
- void show_helper_ise_selector (int client_id)
- {
- Transaction trans;
- Socket client_socket (client_id);
- SCIM_DEBUG_MAIN(4) << "PanelAgent::show_helper_ise_selector ()\n";
-
- m_signal_show_helper_ise_selector ();
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.write_to_socket (client_socket);
- }
-
- void is_helper_ise_enabled (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
-
- String strAppid;
- int nEnabled = 0;
- bool ret = false;
-
- if (m_recv_trans.get_data (strAppid)) {
- ret = m_signal_is_helper_ise_enabled (strAppid, nEnabled);
- }
-
- Transaction trans;
- Socket client_socket (client_id);
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- if (ret) {
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.put_data (static_cast<uint32>(nEnabled));
- }
- else {
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- }
- trans.write_to_socket (client_socket);
- }
-
- void get_ise_information (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
-
- String strUuid, strName, strLanguage, strModuleName;
- int nType = 0;
- int nOption = 0;
- if (m_recv_trans.get_data (strUuid)) {
- m_signal_get_ise_information (strUuid, strName, strLanguage, nType, nOption, strModuleName);
- }
-
- Transaction trans;
- Socket client_socket (client_id);
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.put_data (strName);
- trans.put_data (strLanguage);
- trans.put_data (nType);
- trans.put_data (nOption);
- trans.put_data (strModuleName);
- trans.write_to_socket (client_socket);
- }
-
- void get_language_list (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::get_language_list ()\n";
- std::vector<String> strlist;
-
- m_signal_get_language_list (strlist);
-
- Transaction trans;
- Socket client_socket (client_id);
- char *buf = NULL;
- size_t len;
- uint32 num;
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
-
- num = strlist.size ();
- trans.put_data (num);
- for (unsigned int i = 0; i < num; i++) {
- buf = const_cast<char *>(strlist[i].c_str ());
- len = strlen (buf) + 1;
- trans.put_data (buf, len);
- }
-
- trans.write_to_socket (client_socket);
- }
-
- void get_all_language (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::get_all_language ()\n";
- std::vector<String> strlist;
-
- m_signal_get_all_language (strlist);
-
- Transaction trans;
- Socket client_socket (client_id);
- char *buf = NULL;
- size_t len;
- uint32 num;
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
-
- num = strlist.size ();
- trans.put_data (num);
- for (unsigned int i = 0; i < num; i++) {
- buf = const_cast<char *>(strlist[i].c_str ());
- len = strlen (buf) + 1;
- trans.put_data (buf, len);
- }
-
- trans.write_to_socket (client_socket);
- }
-
- void get_ise_language (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::get_ise_language ()\n";
- std::vector<String> strlist;
- char *buf = NULL;
- size_t len;
- Transaction trans;
- Socket client_socket (client_id);
-
- if (!(m_recv_trans.get_data (&buf, len))) {
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- trans.write_to_socket (client_socket);
- if (NULL != buf)
- delete[] buf;
- return;
- }
-
- m_signal_get_ise_language (buf, strlist);
-
- if (buf) {
- delete [] buf;
- buf = NULL;
- }
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
-
- uint32 num = strlist.size ();
- trans.put_data (num);
- for (unsigned int i = 0; i < num; i++) {
- buf = const_cast<char *>(strlist[i].c_str ());
- len = strlen (buf) + 1;
- trans.put_data (buf, len);
- }
-
- trans.write_to_socket (client_socket);
- }
-
- bool reset_ise_option (int client_id)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::resect_ise_option ()\n";
-
- int client = -1;
- uint32 context;
-
- lock ();
-
- ClientContextUUIDRepository::iterator it = m_client_context_uuids.begin ();
- if (it != m_client_context_uuids.end ()) {
- get_imengine_client_context (it->first, client, context);
- }
-
- if (client >= 0) {
- Socket client_socket (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data ((uint32) context);
- m_send_trans.put_command (ISM_TRANS_CMD_RESET_ISE_OPTION);
- m_send_trans.write_to_socket (client_socket);
- }
-
- unlock ();
-
- Transaction trans;
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
- Socket client_socket (client_id);
- trans.write_to_socket (client_socket);
-
- return client >= 0;
- }
-
- bool find_active_ise_by_uuid (String uuid)
- {
- HelperInfoRepository::iterator iter = m_helper_info_repository.begin ();
- for (; iter != m_helper_info_repository.end (); iter++) {
- if (!uuid.compare (iter->second.uuid))
- return true;
- }
-
- return false;
- }
-
- void set_active_ise_by_uuid (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::set_active_ise_by_uuid ()\n";
- char *buf = NULL;
- size_t len;
- Transaction trans;
- Socket client_socket (client_id);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- if (!(m_recv_trans.get_data (&buf, len))) {
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- trans.write_to_socket (client_socket);
- if (NULL != buf)
- delete[] buf;
- return;
- }
-
- if (buf == NULL) {
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- trans.write_to_socket (client_socket);
- return;
- }
-
- String uuid (buf);
- ISE_INFO info;
-
- if (!m_signal_get_ise_info_by_uuid (uuid, info)) {
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- trans.write_to_socket (client_socket);
- if (NULL != buf)
- delete[] buf;
- return;
- }
-
- if (info.type == TOOLBAR_KEYBOARD_MODE) {
- m_signal_set_active_ise_by_uuid (uuid, 1);
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.write_to_socket (client_socket);
- if (NULL != buf)
- delete[] buf;
- return;
- } else if (info.option & ISM_ISE_HIDE_IN_CONTROL_PANEL) {
- int count = _id_count--;
- if (info.type == TOOLBAR_HELPER_MODE) {
- m_current_toolbar_mode = TOOLBAR_HELPER_MODE;
- if (uuid != m_current_helper_uuid)
- m_last_helper_uuid = m_current_helper_uuid;
- start_helper (uuid, count, DEFAULT_CONTEXT_VALUE);
- IMControlRepository::iterator iter = m_imcontrol_repository.find (client_id);
- if (iter == m_imcontrol_repository.end ()) {
- struct IMControlStub stub;
- stub.count.clear ();
- stub.info.clear ();
- stub.info.push_back (info);
- stub.count.push_back (count);
- m_imcontrol_repository[client_id] = stub;
- } else {
- iter->second.info.push_back (info);
- iter->second.count.push_back (count);
- }
- }
- } else {
- m_signal_set_active_ise_by_uuid (uuid, 1);
- }
-
- sync();
-
- if (find_active_ise_by_uuid (uuid)) {
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.write_to_socket (client_socket);
- } else {
- m_ise_pending_repository[uuid] = client_id;
- }
-
- if (NULL != buf)
- delete[] buf;
- }
-
- void set_initial_ise_by_uuid (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::set_initial_ise_by_uuid ()\n";
- char *buf = NULL;
- size_t len;
- Transaction trans;
- Socket client_socket (client_id);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- if (!(m_recv_trans.get_data (&buf, len))) {
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- trans.write_to_socket (client_socket);
- if (NULL != buf)
- delete[] buf;
- return;
- }
-
- if (buf == NULL) {
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- trans.write_to_socket (client_socket);
- return;
- }
-
- String uuid (buf);
-
- scim_global_config_write (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String (uuid));
- scim_global_config_flush ();
-
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.write_to_socket (client_socket);
-
- if (NULL != buf)
- delete[] buf;
- }
-
- void set_ise_return_key_type (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
- uint32 type;
-
- if (m_recv_trans.get_data (type)) {
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- set_helper_return_key_type (m_current_helper_uuid, type);
- }
- }
-
- void get_ise_return_key_type (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
- uint32 type = 0;
- bool ret = false;
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- ret = get_helper_return_key_type (m_current_helper_uuid, type);
-
- Transaction trans;
- Socket client_socket (client_id);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- if (ret) {
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.put_data (type);
- } else {
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- }
-
- trans.write_to_socket (client_socket);
- }
-
- void set_ise_return_key_disable (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
- uint32 disabled;
-
- if (m_recv_trans.get_data (disabled)) {
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- set_helper_return_key_disable (m_current_helper_uuid, disabled);
- }
- }
-
- void get_ise_return_key_disable (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
- uint32 disabled = 0;
- bool ret = false;
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- ret = get_helper_return_key_disable (m_current_helper_uuid, disabled);
-
- Transaction trans;
- Socket client_socket (client_id);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- if (ret) {
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.put_data (disabled);
- } else {
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- }
-
- trans.write_to_socket (client_socket);
- }
-
- int get_active_ise_list (std::vector<String> &strlist)
- {
- strlist.clear ();
- m_helper_manager.get_active_ise_list (strlist);
- return (int)(strlist.size ());
- }
-
- int get_helper_manager_id (void)
- {
- return m_helper_manager.get_connection_number ();
- }
-
- bool has_helper_manager_pending_event (void)
- {
- return m_helper_manager.has_pending_event ();
- }
-
- bool filter_helper_manager_event (void)
- {
- return m_helper_manager.filter_event ();
- }
-
- void reset_helper_context (const String &uuid)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_RESET_ISE_CONTEXT);
- m_send_trans.write_to_socket (client_socket);
- }
- }
-
- void reset_ise_context (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::reset_ise_context ()\n";
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- reset_helper_context (m_current_helper_uuid);
- }
-
- void set_ise_caps_mode (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::set_ise_caps_mode ()\n";
- uint32 mode;
- if (m_recv_trans.get_data (mode)) {
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- set_helper_caps_mode (m_current_helper_uuid, mode);
- }
- }
-
- int send_display_name (String &name)
- {
- return m_helper_manager.send_display_name (name);
- }
-
- bool reload_config (void)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::reload_config ()\n";
-
- lock ();
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_command (SCIM_TRANS_CMD_RELOAD_CONFIG);
-
- for (ClientRepository::iterator it = m_client_repository.begin (); it != m_client_repository.end (); ++it) {
- if (it->second.type == FRONTEND_CLIENT || it->second.type == HELPER_CLIENT) {
- Socket client_socket (it->first);
- m_send_trans.write_to_socket (client_socket);
- }
- }
-
- unlock ();
- return true;
- }
-
- bool exit (void)
- {
- SCIM_DEBUG_MAIN(1) << "PanelAgent::exit ()\n";
-
- lock ();
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_command (SCIM_TRANS_CMD_EXIT);
-
- for (ClientRepository::iterator it = m_client_repository.begin (); it != m_client_repository.end (); ++it) {
- Socket client_socket (it->first);
- m_send_trans.write_to_socket (client_socket);
- }
-
- unlock ();
-
- stop ();
-
- return true;
- }
-
- bool filter_event (int fd)
- {
- SCIM_DEBUG_MAIN (1) << "PanelAgent::filter_event ()\n";
-
- return m_socket_server.filter_event (fd);
- }
-
- bool filter_exception_event (int fd)
- {
- SCIM_DEBUG_MAIN (1) << "PanelAgent::filter_exception_event ()\n";
-
- return m_socket_server.filter_exception_event (fd);
- }
-
- int get_server_id ()
- {
- SCIM_DEBUG_MAIN (1) << "PanelAgent::get_server_id ()\n";
-
- return m_socket_server.get_id ();
- }
-
- void update_ise_list (std::vector<String> &strList)
- {
- /* send ise list to frontend */
- String dst_str = scim_combine_string_list (strList);
- m_helper_manager.send_ise_list (dst_str);
-
- /* request PanelClient to update keyboard ise list */
- update_keyboard_ise_list ();
- }
-
- void will_show_ack (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::will_show_ack ()\n";
-
- m_signal_will_show_ack ();
- }
-
- void will_hide_ack (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::will_hide_ack ()\n";
-
- m_signal_will_hide_ack ();
- }
-
- void reset_default_ise (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
-
- String initial_ise = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String (""));
- if (initial_ise.length () > 0)
- m_signal_set_active_ise_by_uuid (initial_ise, 1);
- else
- std::cerr << "Read SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID is failed!!!\n";
- }
-
- void set_keyboard_mode (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::set_keyboard_mode ()\n";
- uint32 mode;
- if (m_recv_trans.get_data (mode)) {
- m_signal_set_keyboard_mode (mode);
- }
- }
-
- void candidate_will_hide_ack (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "\n";
-
- m_signal_candidate_will_hide_ack ();
- }
-
- void process_key_event (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
- uint32 result = 0;
- bool ret = false;
-
- KeyEvent key;
- if (m_recv_trans.get_data (key)) {
- ret = process_key_event (m_current_helper_uuid, key, result);
- }
-
- Transaction trans;
- Socket client_socket (client_id);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- if (ret) {
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.put_data (result);
- } else {
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- }
-
- trans.write_to_socket (client_socket);
- }
-
- void get_active_helper_option (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
- uint32 option = get_current_helper_option ();
-
- Transaction trans;
- Socket client_socket (client_id);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.put_data (option);
- SCIM_DEBUG_MAIN(4) << __func__ << " option " << option << "\n";
- trans.write_to_socket (client_socket);
- }
-
- void show_ise_option_window (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::show_ise_panel ()\n";
-
- String initial_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String (""));
- String default_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
-
- LOGD ("prepare to show ISE option window %d [%s] [%s]", client_id, initial_uuid.c_str(), default_uuid.c_str());
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode) {
- show_helper_option_window (m_current_helper_uuid);
- }
- }
-
- void get_recent_ise_geometry (int client_id)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
-
- uint32 angle;
-
- Transaction trans;
- Socket client_socket (client_id);
-
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
-
- if (m_recv_trans.get_data (angle)) {
- struct rectinfo info = {0, 0, 0, 0};
- m_signal_get_recent_ise_geometry (angle, info);
-
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.put_data (info.pos_x);
- trans.put_data (info.pos_y);
- trans.put_data (info.width);
- trans.put_data (info.height);
- }
- else {
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- }
-
- trans.write_to_socket (client_socket);
- }
-
- Connection signal_connect_reload_config (PanelAgentSlotVoid *slot)
- {
- return m_signal_reload_config.connect (slot);
- }
-
- Connection signal_connect_turn_on (PanelAgentSlotVoid *slot)
- {
- return m_signal_turn_on.connect (slot);
- }
-
- Connection signal_connect_turn_off (PanelAgentSlotVoid *slot)
- {
- return m_signal_turn_off.connect (slot);
- }
-
- Connection signal_connect_show_panel (PanelAgentSlotVoid *slot)
- {
- return m_signal_show_panel.connect (slot);
- }
-
- Connection signal_connect_hide_panel (PanelAgentSlotVoid *slot)
- {
- return m_signal_hide_panel.connect (slot);
- }
-
- Connection signal_connect_update_screen (PanelAgentSlotInt *slot)
- {
- return m_signal_update_screen.connect (slot);
- }
-
- Connection signal_connect_update_spot_location (PanelAgentSlotIntIntInt *slot)
- {
- return m_signal_update_spot_location.connect (slot);
- }
-
- Connection signal_connect_update_factory_info (PanelAgentSlotFactoryInfo *slot)
- {
- return m_signal_update_factory_info.connect (slot);
- }
-
- Connection signal_connect_start_default_ise (PanelAgentSlotVoid *slot)
- {
- return m_signal_start_default_ise.connect (slot);
- }
-
- Connection signal_connect_stop_default_ise (PanelAgentSlotVoid *slot)
- {
- return m_signal_stop_default_ise.connect (slot);
- }
-
- Connection signal_connect_set_candidate_ui (PanelAgentSlotIntInt *slot)
- {
- return m_signal_set_candidate_ui.connect (slot);
- }
-
- Connection signal_connect_get_candidate_ui (PanelAgentSlotIntInt2 *slot)
- {
- return m_signal_get_candidate_ui.connect (slot);
- }
-
- Connection signal_connect_set_candidate_position (PanelAgentSlotIntInt *slot)
- {
- return m_signal_set_candidate_position.connect (slot);
- }
-
- Connection signal_connect_get_candidate_geometry (PanelAgentSlotRect *slot)
- {
- return m_signal_get_candidate_geometry.connect (slot);
- }
-
- Connection signal_connect_get_input_panel_geometry (PanelAgentSlotRect *slot)
- {
- return m_signal_get_input_panel_geometry.connect (slot);
- }
-
- Connection signal_connect_set_keyboard_ise (PanelAgentSlotString *slot)
- {
- return m_signal_set_keyboard_ise.connect (slot);
- }
-
- Connection signal_connect_get_keyboard_ise (PanelAgentSlotString2 *slot)
- {
- return m_signal_get_keyboard_ise.connect (slot);
- }
-
- Connection signal_connect_show_help (PanelAgentSlotString *slot)
- {
- return m_signal_show_help.connect (slot);
- }
-
- Connection signal_connect_show_factory_menu (PanelAgentSlotFactoryInfoVector *slot)
- {
- return m_signal_show_factory_menu.connect (slot);
- }
-
- Connection signal_connect_show_preedit_string (PanelAgentSlotVoid *slot)
- {
- return m_signal_show_preedit_string.connect (slot);
- }
-
- Connection signal_connect_show_aux_string (PanelAgentSlotVoid *slot)
- {
- return m_signal_show_aux_string.connect (slot);
- }
-
- Connection signal_connect_show_lookup_table (PanelAgentSlotVoid *slot)
- {
- return m_signal_show_lookup_table.connect (slot);
- }
-
- Connection signal_connect_show_associate_table (PanelAgentSlotVoid *slot)
- {
- return m_signal_show_associate_table.connect (slot);
- }
-
- Connection signal_connect_hide_preedit_string (PanelAgentSlotVoid *slot)
- {
- return m_signal_hide_preedit_string.connect (slot);
- }
-
- Connection signal_connect_hide_aux_string (PanelAgentSlotVoid *slot)
- {
- return m_signal_hide_aux_string.connect (slot);
- }
-
- Connection signal_connect_hide_lookup_table (PanelAgentSlotVoid *slot)
- {
- return m_signal_hide_lookup_table.connect (slot);
- }
-
- Connection signal_connect_hide_associate_table (PanelAgentSlotVoid *slot)
- {
- return m_signal_hide_associate_table.connect (slot);
- }
-
- Connection signal_connect_update_preedit_string (PanelAgentSlotAttributeStringInt *slot)
- {
- return m_signal_update_preedit_string.connect (slot);
- }
-
- Connection signal_connect_update_preedit_caret (PanelAgentSlotInt *slot)
- {
- return m_signal_update_preedit_caret.connect (slot);
- }
-
- Connection signal_connect_update_aux_string (PanelAgentSlotAttributeString *slot)
- {
- return m_signal_update_aux_string.connect (slot);
- }
-
- Connection signal_connect_update_lookup_table (PanelAgentSlotLookupTable *slot)
- {
- return m_signal_update_lookup_table.connect (slot);
- }
-
- Connection signal_connect_update_associate_table (PanelAgentSlotLookupTable *slot)
- {
- return m_signal_update_associate_table.connect (slot);
- }
-
- Connection signal_connect_register_properties (PanelAgentSlotPropertyList *slot)
- {
- return m_signal_register_properties.connect (slot);
- }
-
- Connection signal_connect_update_property (PanelAgentSlotProperty *slot)
- {
- return m_signal_update_property.connect (slot);
- }
-
- Connection signal_connect_register_helper_properties (PanelAgentSlotIntPropertyList *slot)
- {
- return m_signal_register_helper_properties.connect (slot);
- }
-
- Connection signal_connect_update_helper_property (PanelAgentSlotIntProperty *slot)
- {
- return m_signal_update_helper_property.connect (slot);
- }
-
- Connection signal_connect_register_helper (PanelAgentSlotIntHelperInfo *slot)
- {
- return m_signal_register_helper.connect (slot);
- }
-
- Connection signal_connect_remove_helper (PanelAgentSlotInt *slot)
- {
- return m_signal_remove_helper.connect (slot);
- }
-
- Connection signal_connect_set_active_ise_by_uuid (PanelAgentSlotStringBool *slot)
- {
- return m_signal_set_active_ise_by_uuid.connect (slot);
- }
-
- Connection signal_connect_focus_in (PanelAgentSlotVoid *slot)
- {
- return m_signal_focus_in.connect (slot);
- }
-
- Connection signal_connect_focus_out (PanelAgentSlotVoid *slot)
- {
- return m_signal_focus_out.connect (slot);
- }
-
- Connection signal_connect_expand_candidate (PanelAgentSlotVoid *slot)
- {
- return m_signal_expand_candidate.connect (slot);
- }
-
- Connection signal_connect_contract_candidate (PanelAgentSlotVoid *slot)
- {
- return m_signal_contract_candidate.connect (slot);
- }
-
- Connection signal_connect_select_candidate (PanelAgentSlotInt *slot)
- {
- return m_signal_select_candidate.connect (slot);
- }
-
- Connection signal_connect_get_ise_list (PanelAgentSlotBoolStringVector *slot)
- {
- return m_signal_get_ise_list.connect (slot);
- }
-
- Connection signal_connect_get_all_helper_ise_info (PanelAgentSlotBoolHelperInfo *slot)
- {
- return m_signal_get_all_helper_ise_info.connect (slot);
- }
-
- Connection signal_connect_set_has_option_helper_ise_info (PanelAgentSlotStringBool *slot)
- {
- return m_signal_set_has_option_helper_ise_info.connect (slot);
- }
-
- Connection signal_connect_set_enable_helper_ise_info (PanelAgentSlotStringBool *slot)
- {
- return m_signal_set_enable_helper_ise_info.connect (slot);
- }
-
- Connection signal_connect_show_helper_ise_list (PanelAgentSlotVoid *slot)
- {
- return m_signal_show_helper_ise_list.connect (slot);
- }
-
- Connection signal_connect_show_helper_ise_selector (PanelAgentSlotVoid *slot)
- {
- return m_signal_show_helper_ise_selector.connect (slot);
- }
-
- Connection signal_connect_is_helper_ise_enabled (PanelAgentSlotStringInt *slot)
- {
- return m_signal_is_helper_ise_enabled.connect (slot);
- }
-
- Connection signal_connect_get_ise_information (PanelAgentSlotBoolString4int2 *slot)
- {
- return m_signal_get_ise_information.connect (slot);
- }
-
- Connection signal_connect_get_keyboard_ise_list (PanelAgentSlotBoolStringVector *slot)
- {
- return m_signal_get_keyboard_ise_list.connect (slot);
- }
-
- Connection signal_connect_update_ise_geometry (PanelAgentSlotIntIntIntInt *slot)
- {
- return m_signal_update_ise_geometry.connect (slot);
- }
-
- Connection signal_connect_get_language_list (PanelAgentSlotStringVector *slot)
- {
- return m_signal_get_language_list.connect (slot);
- }
-
- Connection signal_connect_get_all_language (PanelAgentSlotStringVector *slot)
- {
- return m_signal_get_all_language.connect (slot);
- }
-
- Connection signal_connect_get_ise_language (PanelAgentSlotStrStringVector *slot)
- {
- return m_signal_get_ise_language.connect (slot);
- }
-
- Connection signal_connect_get_ise_info_by_uuid (PanelAgentSlotStringISEINFO *slot)
- {
- return m_signal_get_ise_info_by_uuid.connect (slot);
- }
-
- Connection signal_connect_send_key_event (PanelAgentSlotKeyEvent *slot)
- {
- return m_signal_send_key_event.connect (slot);
- }
-
- Connection signal_connect_accept_connection (PanelAgentSlotInt *slot)
- {
- return m_signal_accept_connection.connect (slot);
- }
-
- Connection signal_connect_close_connection (PanelAgentSlotInt *slot)
- {
- return m_signal_close_connection.connect (slot);
- }
-
- Connection signal_connect_exit (PanelAgentSlotVoid *slot)
- {
- return m_signal_exit.connect (slot);
- }
-
- Connection signal_connect_transaction_start (PanelAgentSlotVoid *slot)
- {
- return m_signal_transaction_start.connect (slot);
- }
-
- Connection signal_connect_transaction_end (PanelAgentSlotVoid *slot)
- {
- return m_signal_transaction_end.connect (slot);
- }
-
- Connection signal_connect_lock (PanelAgentSlotVoid *slot)
- {
- return m_signal_lock.connect (slot);
- }
-
- Connection signal_connect_unlock (PanelAgentSlotVoid *slot)
- {
- return m_signal_unlock.connect (slot);
- }
-
- Connection signal_connect_update_input_context (PanelAgentSlotIntInt *slot)
- {
- return m_signal_update_input_context.connect (slot);
- }
-
- Connection signal_connect_show_ise (PanelAgentSlotVoid *slot)
- {
- return m_signal_show_ise.connect (slot);
- }
-
- Connection signal_connect_hide_ise (PanelAgentSlotVoid *slot)
- {
- return m_signal_hide_ise.connect (slot);
- }
-
- Connection signal_connect_will_show_ack (PanelAgentSlotVoid *slot)
- {
- return m_signal_will_show_ack.connect (slot);
- }
-
- Connection signal_connect_will_hide_ack (PanelAgentSlotVoid *slot)
- {
- return m_signal_will_hide_ack.connect (slot);
- }
-
- Connection signal_connect_set_keyboard_mode (PanelAgentSlotInt *slot)
- {
- return m_signal_set_keyboard_mode.connect (slot);
- }
-
- Connection signal_connect_candidate_will_hide_ack (PanelAgentSlotVoid *slot)
- {
- return m_signal_candidate_will_hide_ack.connect (slot);
- }
-
- Connection signal_connect_get_ise_state (PanelAgentSlotInt2 *slot)
- {
- return m_signal_get_ise_state.connect (slot);
- }
-
- Connection signal_connect_get_recent_ise_geometry (PanelAgentSlotIntRect *slot)
- {
- return m_signal_get_recent_ise_geometry.connect (slot);
- }
-
- Connection signal_connect_check_privilege_by_sockfd (PanelAgentSlotIntString2 *slot)
- {
- return m_signal_check_privilege_by_sockfd.connect (slot);
- }
-
-private:
- bool socket_check_client_connection (const Socket &client)
- {
- SCIM_DEBUG_MAIN (3) << "PanelAgent::socket_check_client_connection (" << client.get_id () << ")\n";
-
- unsigned char buf [sizeof(uint32)];
-
- int nbytes = client.read_with_timeout (buf, sizeof(uint32), m_socket_timeout);
-
- if (nbytes == sizeof (uint32))
- return true;
-
- if (nbytes < 0) {
- SCIM_DEBUG_MAIN (4) << "Error occurred when reading socket: " << client.get_error_message () << ".\n";
- } else {
- SCIM_DEBUG_MAIN (4) << "Timeout when reading socket.\n";
- }
-
- return false;
- }
-
- void socket_accept_callback (SocketServer *server,
- const Socket &client)
- {
- SCIM_DEBUG_MAIN (2) << "PanelAgent::socket_accept_callback (" << client.get_id () << ")\n";
-
- lock ();
- if (m_should_exit) {
- SCIM_DEBUG_MAIN (3) << "Exit Socket Server Thread.\n";
- server->shutdown ();
- } else {
- m_signal_accept_connection (client.get_id ());
- }
- unlock ();
- }
-
- static void send_fail_reply (int client_id)
- {
- Socket client_socket (client_id);
- Transaction trans;
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_FAIL);
- trans.write_to_socket (client_socket);
- }
-
- void socket_receive_callback (SocketServer *server,
- const Socket &client)
- {
- int client_id = client.get_id ();
- int cmd = 0;
- uint32 key = 0;
- uint32 context = 0;
- String uuid;
- bool current = false;
- bool last = false;
-
- ClientInfo client_info;
-
- SCIM_DEBUG_MAIN (1) << "PanelAgent::socket_receive_callback (" << client_id << ")\n";
-
- /* If the connection is closed then close this client. */
- if (!socket_check_client_connection (client)) {
- socket_close_connection (server, client);
- return;
- }
-
- client_info = socket_get_client_info (client_id);
-
- /* If it's a new client, then request to open the connection first. */
- if (client_info.type == UNKNOWN_CLIENT) {
- socket_open_connection (server, client);
- return;
- }
-
- /* If can not read the transaction,
- * or the transaction is not started with SCIM_TRANS_CMD_REQUEST,
- * or the key is mismatch,
- * just return. */
- if (!m_recv_trans.read_from_socket (client, m_socket_timeout) ||
- !m_recv_trans.get_command (cmd) || cmd != SCIM_TRANS_CMD_REQUEST ||
- !m_recv_trans.get_data (key) || key != (uint32) client_info.key)
- return;
-
- if (client_info.type == FRONTEND_ACT_CLIENT) {
- if (m_recv_trans.get_data (context)) {
- SCIM_DEBUG_MAIN (1) << "PanelAgent::FrontEnd Client, context = " << context << "\n";
- socket_transaction_start();
- while (m_recv_trans.get_command (cmd)) {
- SCIM_DEBUG_MAIN (3) << "PanelAgent::cmd = " << cmd << "\n";
-
- if (cmd == ISM_TRANS_CMD_REGISTER_PANEL_CLIENT) {
- uint32 id = 0;
- if (m_recv_trans.get_data (id)) {
- SCIM_DEBUG_MAIN(4) << " ISM_TRANS_CMD_REGISTER_PANEL_CLIENT (" << client_id << "," << context << "," << id << ")\n";
- m_panel_client_map [client_id] = (int)id;
- }
- continue;
- }
-
- if (cmd == SCIM_TRANS_CMD_PANEL_REGISTER_INPUT_CONTEXT) {
- if (m_recv_trans.get_data (uuid)) {
- SCIM_DEBUG_MAIN (2) << "PanelAgent::register_input_context (" << client_id << "," << context << "," << uuid << ")\n";
- uint32 ctx = get_helper_ic (m_panel_client_map[client_id], context);
- m_client_context_uuids [ctx] = uuid;
- }
- continue;
- }
-
- if (cmd == SCIM_TRANS_CMD_PANEL_REMOVE_INPUT_CONTEXT) {
- SCIM_DEBUG_MAIN(4) << " SCIM_TRANS_CMD_PANEL_REMOVE_INPUT_CONTEXT (" << "client:" << client_id << " context:" << context << ")\n";
- uint32 ctx = get_helper_ic (m_panel_client_map[client_id], context);
- m_client_context_uuids.erase (ctx);
- if (ctx == get_helper_ic (m_current_socket_client, m_current_client_context)) {
- lock ();
- m_current_socket_client = m_last_socket_client;
- m_current_client_context = m_last_client_context;
- m_current_context_uuid = m_last_context_uuid;
- m_last_socket_client = -1;
- m_last_client_context = 0;
- m_last_context_uuid = String ("");
- if (m_current_socket_client == -1) {
- unlock ();
- socket_update_control_panel ();
- } else {
- unlock ();
- }
- } else if (ctx == get_helper_ic (m_last_socket_client, m_last_client_context)) {
- lock ();
- m_last_socket_client = -1;
- m_last_client_context = 0;
- m_last_context_uuid = String ("");
- unlock ();
- }
- if (m_client_context_uuids.size () == 0)
- m_signal_stop_default_ise ();
- continue;
- }
-
- if (cmd == SCIM_TRANS_CMD_PANEL_RESET_INPUT_CONTEXT) {
- socket_reset_input_context (m_panel_client_map[client_id], context);
- continue;
- }
-
- if (cmd == SCIM_TRANS_CMD_FOCUS_IN) {
- SCIM_DEBUG_MAIN(4) << " SCIM_TRANS_CMD_FOCUS_IN (" << "client:" << client_id << " context:" << context << ")\n";
- m_signal_focus_in ();
- focus_in_helper (m_current_helper_uuid, m_panel_client_map[client_id], context);
- if (m_recv_trans.get_data (uuid)) {
- SCIM_DEBUG_MAIN (2) << "PanelAgent::focus_in (" << client_id << "," << context << "," << uuid << ")\n";
- m_active_client_id = client_id;
- lock ();
- if (m_current_socket_client >= 0) {
- m_last_socket_client = m_current_socket_client;
- m_last_client_context = m_current_client_context;
- m_last_context_uuid = m_current_context_uuid;
- }
- m_current_socket_client = m_panel_client_map[client_id];
- m_current_client_context = context;
- m_current_context_uuid = uuid;
- unlock ();
- }
- continue;
- }
-
- if (cmd == ISM_TRANS_CMD_TURN_ON_LOG) {
- socket_turn_on_log ();
- continue;
- }
-
- if (cmd == ISM_TRANS_CMD_SHOW_ISF_CONTROL) {
- show_isf_panel (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_HIDE_ISF_CONTROL) {
- hide_isf_panel (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_SHOW_ISE_PANEL) {
- show_ise_panel (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_HIDE_ISE_PANEL) {
- hide_ise_panel (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_GET_ACTIVE_ISE_GEOMETRY) {
- get_input_panel_geometry (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY) {
- get_candidate_window_geometry (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_GET_ISE_LANGUAGE_LOCALE) {
- get_ise_language_locale (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_SET_ISE_LANGUAGE) {
- set_ise_language (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_SET_ISE_IMDATA) {
- set_ise_imdata (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_GET_ISE_IMDATA) {
- get_ise_imdata (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_SET_RETURN_KEY_TYPE) {
- set_ise_return_key_type (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_GET_RETURN_KEY_TYPE) {
- get_ise_return_key_type (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_SET_RETURN_KEY_DISABLE) {
- set_ise_return_key_disable (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_GET_RETURN_KEY_DISABLE) {
- get_ise_return_key_disable (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_GET_LAYOUT) {
- get_ise_layout (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_SET_LAYOUT) {
- set_ise_layout (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_SET_CAPS_MODE) {
- set_ise_caps_mode (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_SEND_WILL_SHOW_ACK) {
- will_show_ack (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_SEND_WILL_HIDE_ACK) {
- will_hide_ack (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_SET_HARDWARE_KEYBOARD_MODE) {
- set_keyboard_mode (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_SEND_CANDIDATE_WILL_HIDE_ACK) {
- candidate_will_hide_ack (client_id);
- continue;
- } else if (cmd == SCIM_TRANS_CMD_PROCESS_KEY_EVENT) {
- process_key_event (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_GET_ACTIVE_HELPER_OPTION) {
- get_active_helper_option (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_GET_ISE_STATE) {
- get_ise_state (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_SET_INPUT_MODE) {
- set_ise_input_mode (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_SET_INPUT_HINT) {
- set_ise_input_hint (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_UPDATE_BIDI_DIRECTION) {
- update_ise_bidi_direction (client_id);
- continue;
- } else if (cmd == ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW) {
- show_ise_option_window (client_id);
- continue;
- }
-
- current = last = false;
- uuid.clear ();
-
- /* Get the context uuid from the client context registration table. */
- {
- ClientContextUUIDRepository::iterator it = m_client_context_uuids.find (get_helper_ic (m_panel_client_map[client_id], context));
- if (it != m_client_context_uuids.end ())
- uuid = it->second;
- }
-
- if (m_current_socket_client == m_panel_client_map[client_id] && m_current_client_context == context) {
- current = true;
- if (!uuid.length ()) uuid = m_current_context_uuid;
- } else if (m_last_socket_client == m_panel_client_map[client_id] && m_last_client_context == context) {
- last = true;
- if (!uuid.length ()) uuid = m_last_context_uuid;
- }
-
- /* Skip to the next command and continue, if it's not current or last focused. */
- if (!uuid.length ()) {
- SCIM_DEBUG_MAIN (3) << "PanelAgent:: Couldn't find context uuid.\n";
- while (m_recv_trans.get_data_type () != SCIM_TRANS_DATA_COMMAND && m_recv_trans.get_data_type () != SCIM_TRANS_DATA_UNKNOWN)
- m_recv_trans.skip_data ();
- continue;
- }
-
- if (cmd == SCIM_TRANS_CMD_START_HELPER) {
- socket_start_helper (m_panel_client_map[client_id], context, uuid);
- continue;
- } else if (cmd == SCIM_TRANS_CMD_SEND_HELPER_EVENT) {
- socket_send_helper_event (m_panel_client_map[client_id], context, uuid);
- continue;
- } else if (cmd == SCIM_TRANS_CMD_STOP_HELPER) {
- socket_stop_helper (m_panel_client_map[client_id], context, uuid);
- continue;
- }
-
- /* If it's not focused, just continue. */
- if ((!current && !last) || (last && m_current_socket_client >= 0)) {
- SCIM_DEBUG_MAIN (3) << "PanelAgent::Not current focused.\n";
- while (m_recv_trans.get_data_type () != SCIM_TRANS_DATA_COMMAND && m_recv_trans.get_data_type () != SCIM_TRANS_DATA_UNKNOWN)
- m_recv_trans.skip_data ();
- continue;
- }
-
- /* Client must focus in before do any other things. */
- if (cmd == SCIM_TRANS_CMD_PANEL_TURN_ON)
- socket_turn_on ();
- else if (cmd == SCIM_TRANS_CMD_PANEL_TURN_OFF)
- socket_turn_off ();
- else if (cmd == SCIM_TRANS_CMD_UPDATE_SCREEN)
- socket_update_screen ();
- else if (cmd == SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION)
- socket_update_spot_location ();
- else if (cmd == ISM_TRANS_CMD_UPDATE_CURSOR_POSITION)
- socket_update_cursor_position ();
- else if (cmd == ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT)
- socket_update_surrounding_text ();
- else if (cmd == ISM_TRANS_CMD_UPDATE_SELECTION)
- socket_update_selection ();
- else if (cmd == ISM_TRANS_CMD_EXPAND_CANDIDATE)
- m_signal_expand_candidate ();
- else if (cmd == ISM_TRANS_CMD_CONTRACT_CANDIDATE)
- m_signal_contract_candidate ();
- else if (cmd == ISM_TRANS_CMD_SET_CANDIDATE_UI)
- socket_set_candidate_ui ();
- else if (cmd == SCIM_TRANS_CMD_PANEL_UPDATE_FACTORY_INFO)
- socket_update_factory_info ();
- else if (cmd == SCIM_TRANS_CMD_SHOW_PREEDIT_STRING)
- socket_show_preedit_string ();
- else if (cmd == SCIM_TRANS_CMD_SHOW_AUX_STRING)
- socket_show_aux_string ();
- else if (cmd == SCIM_TRANS_CMD_SHOW_LOOKUP_TABLE)
- socket_show_lookup_table ();
- else if (cmd == ISM_TRANS_CMD_SHOW_ASSOCIATE_TABLE)
- socket_show_associate_table ();
- else if (cmd == SCIM_TRANS_CMD_HIDE_PREEDIT_STRING)
- socket_hide_preedit_string ();
- else if (cmd == SCIM_TRANS_CMD_HIDE_AUX_STRING)
- socket_hide_aux_string ();
- else if (cmd == SCIM_TRANS_CMD_HIDE_LOOKUP_TABLE)
- socket_hide_lookup_table ();
- else if (cmd == ISM_TRANS_CMD_HIDE_ASSOCIATE_TABLE)
- socket_hide_associate_table ();
- else if (cmd == SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING)
- socket_update_preedit_string ();
- else if (cmd == SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET)
- socket_update_preedit_caret ();
- else if (cmd == SCIM_TRANS_CMD_UPDATE_AUX_STRING) {
- socket_update_aux_string ();
- m_is_imengine_aux = true;
- } else if (cmd == SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE) {
- socket_update_lookup_table ();
- m_is_imengine_candidate = true;
- } else if (cmd == ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE)
- socket_update_associate_table ();
- else if (cmd == SCIM_TRANS_CMD_REGISTER_PROPERTIES)
- socket_register_properties ();
- else if (cmd == SCIM_TRANS_CMD_UPDATE_PROPERTY)
- socket_update_property ();
- else if (cmd == SCIM_TRANS_CMD_PANEL_SHOW_HELP)
- socket_show_help ();
- else if (cmd == SCIM_TRANS_CMD_PANEL_SHOW_FACTORY_MENU)
- socket_show_factory_menu ();
- else if (cmd == SCIM_TRANS_CMD_FOCUS_OUT) {
- m_signal_focus_out ();
- lock ();
- focus_out_helper (m_current_helper_uuid, m_panel_client_map[client_id], context);
- if (m_current_socket_client >= 0) {
- m_last_socket_client = m_current_socket_client;
- m_last_client_context = m_current_client_context;
- m_last_context_uuid = m_current_context_uuid;
- }
- m_current_socket_client = -1;
- m_current_client_context = 0;
- m_current_context_uuid = String ("");
- unlock ();
- }
- }
- socket_transaction_end ();
- }
- } else if (client_info.type == FRONTEND_CLIENT) {
- if (m_recv_trans.get_data (context)) {
- SCIM_DEBUG_MAIN (1) << "client_info.type == FRONTEND_CLIENT\n";
- socket_transaction_start();
- while (m_recv_trans.get_command (cmd)) {
- SCIM_DEBUG_MAIN (3) << "PanelAgent::cmd = " << cmd << "\n";
-
- if (cmd == ISM_TRANS_CMD_GET_PANEL_CLIENT_ID) {
- Socket client_socket (client_id);
-
- Transaction trans;
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.put_data (client_id);
- trans.write_to_socket (client_socket);
- continue;
- }
- }
- socket_transaction_end ();
- }
- } else if (client_info.type == HELPER_CLIENT) {
- socket_transaction_start ();
- while (m_recv_trans.get_command (cmd)) {
- if (cmd == SCIM_TRANS_CMD_PANEL_REGISTER_HELPER) {
- socket_helper_register_helper (client_id);
- }
- }
- socket_transaction_end ();
- } else if (client_info.type == HELPER_ACT_CLIENT) {
- socket_transaction_start ();
- while (m_recv_trans.get_command (cmd)) {
- if (cmd == SCIM_TRANS_CMD_PANEL_REGISTER_ACTIVE_HELPER) {
- socket_helper_register_helper_passive (client_id);
- } else if (cmd == SCIM_TRANS_CMD_COMMIT_STRING) {
- socket_helper_commit_string (client_id);
- } else if (cmd == SCIM_TRANS_CMD_SHOW_PREEDIT_STRING) {
- socket_helper_show_preedit_string (client_id);
- } else if (cmd == SCIM_TRANS_CMD_SHOW_AUX_STRING) {
- socket_show_aux_string ();
- } else if (cmd == SCIM_TRANS_CMD_SHOW_LOOKUP_TABLE) {
- socket_show_lookup_table ();
- } else if (cmd == ISM_TRANS_CMD_SHOW_ASSOCIATE_TABLE) {
- socket_show_associate_table ();
- } else if (cmd == SCIM_TRANS_CMD_HIDE_PREEDIT_STRING) {
- socket_helper_hide_preedit_string (client_id);
- } else if (cmd == SCIM_TRANS_CMD_HIDE_AUX_STRING) {
- socket_hide_aux_string ();
- } else if (cmd == SCIM_TRANS_CMD_HIDE_LOOKUP_TABLE) {
- socket_hide_lookup_table ();
- } else if (cmd == ISM_TRANS_CMD_HIDE_ASSOCIATE_TABLE) {
- socket_hide_associate_table ();
- } else if (cmd == SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING) {
- socket_helper_update_preedit_string (client_id);
- } else if (cmd == SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET) {
- socket_helper_update_preedit_caret (client_id);
- } else if (cmd == SCIM_TRANS_CMD_UPDATE_AUX_STRING) {
- socket_update_aux_string ();
- m_is_imengine_aux = false;
- } else if (cmd == SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE) {
- socket_update_lookup_table ();
- m_is_imengine_candidate = false;
- } else if (cmd == ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE) {
- socket_update_associate_table ();
- } else if (cmd == SCIM_TRANS_CMD_PROCESS_KEY_EVENT ||
- cmd == SCIM_TRANS_CMD_PANEL_SEND_KEY_EVENT) {
- socket_helper_send_key_event (client_id);
- } else if (cmd == SCIM_TRANS_CMD_FORWARD_KEY_EVENT) {
- socket_helper_forward_key_event (client_id);
- } else if (cmd == SCIM_TRANS_CMD_PANEL_SEND_IMENGINE_EVENT) {
- socket_helper_send_imengine_event (client_id);
- } else if (cmd == SCIM_TRANS_CMD_REGISTER_PROPERTIES) {
- socket_helper_register_properties (client_id);
-
- /* Check whether application is already focus_in */
- if (m_current_socket_client != -1) {
- SCIM_DEBUG_MAIN (2) << "Application is already focus_in!\n";
- focus_in_helper (m_current_helper_uuid, m_current_socket_client, m_current_client_context);
- reset_keyboard_ise ();
- }
- /* Check whether ISE panel is already shown */
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode && m_ise_context_length > 0) {
- SCIM_DEBUG_MAIN (2) << "Re-show ISE panel!\n";
- int focused_client;
- uint32 focused_context;
- get_focused_context (focused_client, focused_context);
- if (focused_client == -1 && m_active_client_id != -1) {
- focused_client = m_panel_client_map[m_active_client_id];
- focused_context = 0;
- }
-
- uint32 ctx = get_helper_ic (focused_client, focused_context);
- bool ret = show_helper (m_current_helper_uuid, m_ise_context_buffer, m_ise_context_length, ctx);
- if (ret)
- m_signal_show_ise ();
- }
- } else if (cmd == SCIM_TRANS_CMD_UPDATE_PROPERTY) {
- socket_helper_update_property (client_id);
- } else if (cmd == SCIM_TRANS_CMD_RELOAD_CONFIG) {
- reload_config ();
- m_signal_reload_config ();
- } else if (cmd == ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT) {
- socket_helper_update_input_context (client_id);
- } else if (cmd == ISM_TRANS_CMD_GET_KEYBOARD_ISE_LIST) {
- socket_get_keyboard_ise_list ();
- } else if (cmd == ISM_TRANS_CMD_SET_CANDIDATE_UI) {
- socket_set_candidate_ui ();
- } else if (cmd == ISM_TRANS_CMD_GET_CANDIDATE_UI) {
- socket_get_candidate_ui ();
- } else if (cmd == ISM_TRANS_CMD_SET_CANDIDATE_POSITION) {
- socket_set_candidate_position ();
- } else if (cmd == ISM_TRANS_CMD_HIDE_CANDIDATE) {
- socket_hide_candidate ();
- } else if (cmd == ISM_TRANS_CMD_GET_CANDIDATE_GEOMETRY) {
- socket_get_candidate_geometry ();
- } else if (cmd == ISM_TRANS_CMD_PANEL_RESET_KEYBOARD_ISE) {
- reset_keyboard_ise ();
- } else if (cmd == ISM_TRANS_CMD_SET_KEYBOARD_ISE_BY_UUID) {
- socket_set_keyboard_ise ();
- } else if (cmd == ISM_TRANS_CMD_GET_KEYBOARD_ISE) {
- socket_get_keyboard_ise ();
- } else if (cmd == ISM_TRANS_CMD_UPDATE_ISE_GEOMETRY) {
- socket_helper_update_ise_geometry (client_id);
- } else if (cmd == ISM_TRANS_CMD_EXPAND_CANDIDATE) {
- socket_helper_expand_candidate (client_id);
- } else if (cmd == ISM_TRANS_CMD_CONTRACT_CANDIDATE) {
- socket_helper_contract_candidate (client_id);
- } else if (cmd == ISM_TRANS_CMD_SELECT_CANDIDATE) {
- socket_helper_select_candidate ();
- } else if (cmd == SCIM_TRANS_CMD_GET_SURROUNDING_TEXT) {
- socket_helper_get_surrounding_text (client_id);
- } else if (cmd == SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT) {
- socket_helper_delete_surrounding_text (client_id);
- } else if (cmd == SCIM_TRANS_CMD_GET_SELECTION) {
- socket_helper_get_selection (client_id);
- } else if (cmd == SCIM_TRANS_CMD_SET_SELECTION) {
- socket_helper_set_selection (client_id);
- } else if (cmd == SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND) {
- socket_helper_send_private_command (client_id);
- } else if (cmd == ISM_TRANS_CMD_UPDATE_ISE_EXIT) {
- HelperInfoRepository::iterator hiit = m_helper_active_info_repository.find (client.get_id ());
- if (hiit != m_helper_active_info_repository.end ()) {
- String l_uuid = hiit->second.uuid;
- HelperClientIndex::iterator it = m_helper_client_index.find (l_uuid);
- if (it != m_helper_client_index.end ()) {
- Socket client_socket (it->second.id);
- socket_close_connection (server, client_socket);
- }
- }
- socket_close_connection (server, client);
- }
- }
- socket_transaction_end ();
- } else if (client_info.type == IMCONTROL_ACT_CLIENT) {
- socket_transaction_start ();
-
- while (m_recv_trans.get_command (cmd)) {
- if (cmd == ISM_TRANS_CMD_GET_ACTIVE_ISE) {
- if (m_signal_check_privilege_by_sockfd (client_id, IMEMANAGER_PRIVILEGE)) {
- get_active_ise (client_id);
- }
- else {
- LOGW ("Access denied to get active ise");
- send_fail_reply (client_id);
- }
- }
- else if (cmd == ISM_TRANS_CMD_SET_ACTIVE_ISE_BY_UUID) {
- if (m_signal_check_privilege_by_sockfd (client_id, IMEMANAGER_PRIVILEGE)) {
- set_active_ise_by_uuid (client_id);
- }
- else {
- LOGW ("Access denied to set active ise");
- send_fail_reply (client_id);
- }
- }
- else if (cmd == ISM_TRANS_CMD_SET_INITIAL_ISE_BY_UUID) {
- if (m_signal_check_privilege_by_sockfd (client_id, IMEMANAGER_PRIVILEGE)) {
- set_initial_ise_by_uuid (client_id);
- }
- else {
- LOGW ("Access denied to set initial ise");
- send_fail_reply (client_id);
- }
- }
- else if (cmd == ISM_TRANS_CMD_GET_ISE_LIST) {
- if (m_signal_check_privilege_by_sockfd (client_id, IMEMANAGER_PRIVILEGE)) {
- get_ise_list (client_id);
- }
- else {
- LOGW ("Access denied to get ise list");
- send_fail_reply (client_id);
- }
- }
- else if (cmd == ISM_TRANS_CMD_GET_ALL_HELPER_ISE_INFO) {
- if (m_signal_check_privilege_by_sockfd (client_id, IMEMANAGER_PRIVILEGE)) {
- get_all_helper_ise_info (client_id);
- }
- else {
- LOGW ("Access denied to get all helper ise info");
- send_fail_reply (client_id);
- }
- }
- else if (cmd == ISM_TRANS_CMD_SET_ENABLE_HELPER_ISE_INFO) {
- if (m_signal_check_privilege_by_sockfd (client_id, IMEMANAGER_PRIVILEGE)) {
- set_enable_helper_ise_info (client_id);
- }
- else {
- LOGW ("Access denied to set enable helper ise info");
- send_fail_reply (client_id);
- }
- }
- else if (cmd == ISM_TRANS_CMD_GET_ISE_INFORMATION) {
- if (m_signal_check_privilege_by_sockfd (client_id, IMEMANAGER_PRIVILEGE)) {
- get_ise_information (client_id);
- }
- else {
- LOGW ("Access denied to get ise information");
- send_fail_reply (client_id);
- }
- }
- else if (cmd == ISM_TRANS_CMD_RESET_ISE_OPTION) {
- if (m_signal_check_privilege_by_sockfd (client_id, IMEMANAGER_PRIVILEGE)) {
- reset_ise_option (client_id);
- }
- else {
- LOGW ("Access denied to reset ise option");
- send_fail_reply (client_id);
- }
- }
- else if (cmd == ISM_TRANS_CMD_RESET_DEFAULT_ISE) {
- if (m_signal_check_privilege_by_sockfd (client_id, IMEMANAGER_PRIVILEGE)) {
- reset_default_ise (client_id);
- }
- else {
- LOGW ("Access denied to reset default ise");
- send_fail_reply (client_id);
- }
- }
- else if (cmd == ISM_TRANS_CMD_SHOW_ISF_CONTROL) {
- if (m_signal_check_privilege_by_sockfd (client_id, IMEMANAGER_PRIVILEGE)) {
- show_isf_panel (client_id);
- }
- else {
- LOGW ("Access denied to show isf control");
- send_fail_reply (client_id);
- }
- }
- else if (cmd == ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW) {
- if (m_signal_check_privilege_by_sockfd (client_id, IMEMANAGER_PRIVILEGE)) {
- show_ise_option_window (client_id);
- }
- else {
- LOGW ("Access denied to show ise option window");
- send_fail_reply (client_id);
- }
- }
- else if (cmd == ISM_TRANS_CMD_SHOW_HELPER_ISE_LIST) {
- if (m_signal_check_privilege_by_sockfd (client_id, IMEMANAGER_PRIVILEGE)) {
- show_helper_ise_list (client_id);
- }
- else {
- LOGW ("Access denied to show helper ise list");
- send_fail_reply (client_id);
- }
- }
- else if (cmd == ISM_TRANS_CMD_SHOW_HELPER_ISE_SELECTOR) {
- if (m_signal_check_privilege_by_sockfd (client_id, IMEMANAGER_PRIVILEGE)) {
- show_helper_ise_selector (client_id);
- }
- else {
- LOGW ("Access denied to show helper ise selector");
- send_fail_reply (client_id);
- }
- }
- else if (cmd == ISM_TRANS_CMD_IS_HELPER_ISE_ENABLED) {
- if (m_signal_check_privilege_by_sockfd (client_id, IMEMANAGER_PRIVILEGE)) {
- is_helper_ise_enabled (client_id);
- }
- else {
- LOGW ("Access denied to check helper ise enabled");
- send_fail_reply (client_id);
- }
- }
- else if (cmd == ISM_TRANS_CMD_GET_RECENT_ISE_GEOMETRY)
- get_recent_ise_geometry (client_id);
- }
-
- socket_transaction_end ();
- }
- }
-
- void socket_exception_callback (SocketServer *server,
- const Socket &client)
- {
- SCIM_DEBUG_MAIN (2) << "PanelAgent::socket_exception_callback (" << client.get_id () << ")\n";
-
- socket_close_connection (server, client);
- }
-
- bool socket_open_connection (SocketServer *server,
- const Socket &client)
- {
- SCIM_DEBUG_MAIN (3) << "PanelAgent::socket_open_connection (" << client.get_id () << ")\n";
-
- uint32 key;
- String type = scim_socket_accept_connection (key,
- String ("Panel"),
- String ("FrontEnd,FrontEnd_Active,Helper,Helper_Active,IMControl_Active,IMControl_Passive"),
- client,
- m_socket_timeout);
-
- if (type.length ()) {
- ClientInfo info;
- info.key = key;
- info.type = ((type == "FrontEnd") ? FRONTEND_CLIENT :
- ((type == "FrontEnd_Active") ? FRONTEND_ACT_CLIENT :
- ((type == "IMControl_Active") ? IMCONTROL_ACT_CLIENT :
- ((type == "Helper_Active") ? HELPER_ACT_CLIENT :
- ((type == "IMControl_Passive") ? IMCONTROL_CLIENT : HELPER_CLIENT)))));
-
- SCIM_DEBUG_MAIN (4) << "Add client to repository. Type=" << type << " key=" << key << "\n";
- lock ();
- m_client_repository [client.get_id ()] = info;
-
- if (info.type == IMCONTROL_ACT_CLIENT) {
- m_pending_active_imcontrol_id = client.get_id ();
- } else if (info.type == IMCONTROL_CLIENT) {
- m_imcontrol_map [m_pending_active_imcontrol_id] = client.get_id ();
- m_pending_active_imcontrol_id = -1;
- }
-
- unlock ();
- return true;
- }
-
- SCIM_DEBUG_MAIN (4) << "Close client connection " << client.get_id () << "\n";
- server->close_connection (client);
- return false;
- }
-
- void socket_close_connection (SocketServer *server,
- const Socket &client)
- {
- SCIM_DEBUG_MAIN (3) << "PanelAgent::socket_close_connection (" << client.get_id () << ")\n";
-
- lock ();
-
- m_signal_close_connection (client.get_id ());
-
- ClientInfo client_info = socket_get_client_info (client.get_id ());
-
- m_client_repository.erase (client.get_id ());
-
- server->close_connection (client);
-
- /* Exit panel if there is no connected client anymore. */
- if (client_info.type != UNKNOWN_CLIENT && m_client_repository.size () == 0 && !m_should_resident) {
- SCIM_DEBUG_MAIN (4) << "Exit Socket Server Thread.\n";
- server->shutdown ();
- m_signal_exit.emit ();
- }
-
- unlock ();
-
- if (client_info.type == FRONTEND_CLIENT) {
- SCIM_DEBUG_MAIN(4) << "It's a FrontEnd client.\n";
- /* The focused client is closed. */
- if (m_current_socket_client == client.get_id ()) {
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- hide_helper (m_current_helper_uuid);
-
- lock ();
- m_current_socket_client = -1;
- m_current_client_context = 0;
- m_current_context_uuid = String ("");
- unlock ();
-
- socket_transaction_start ();
- socket_turn_off ();
- socket_transaction_end ();
- }
-
- if (m_last_socket_client == client.get_id ()) {
- lock ();
- m_last_socket_client = -1;
- m_last_client_context = 0;
- m_last_context_uuid = String ("");
- unlock ();
- }
-
- /* Erase all associated Client Context UUIDs. */
- std::vector <uint32> ctx_list;
- ClientContextUUIDRepository::iterator it = m_client_context_uuids.begin ();
- for (; it != m_client_context_uuids.end (); ++it) {
- if ((it->first & 0xFFFF) == (client.get_id () & 0xFFFF))
- ctx_list.push_back (it->first);
- }
-
- for (size_t i = 0; i < ctx_list.size (); ++i)
- m_client_context_uuids.erase (ctx_list [i]);
-
- int client_id = client.get_id ();
-
- /* Erase all helperise info associated with the client */
- ctx_list.clear ();
- it = m_client_context_helper.begin ();
- for (; it != m_client_context_helper.end (); ++it) {
- if ((it->first & 0xFFFF) == (client_id & 0xFFFF)) {
- ctx_list.push_back (it->first);
-
- /* similar to stop_helper except that it will not call get_focused_context() */
- String uuid = it->second;
- if (m_helper_uuid_count.find (uuid) != m_helper_uuid_count.end ()) {
- uint32 count = m_helper_uuid_count[uuid];
- if (1 == count) {
- m_helper_uuid_count.erase (uuid);
-
- HelperClientIndex::iterator pise = m_helper_client_index.find (uuid);
- if (pise != m_helper_client_index.end ()) {
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (it->first);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (SCIM_TRANS_CMD_EXIT);
- m_send_trans.write_to_socket (pise->second.id);
- }
- SCIM_DEBUG_MAIN(1) << "Stop HelperISE " << uuid << " ...\n";
- } else {
- m_helper_uuid_count[uuid] = count - 1;
- focus_out_helper (uuid, (it->first & 0xFFFF), ((it->first >> 16) & 0x7FFF));
- SCIM_DEBUG_MAIN(1) << "Decrement usage count of HelperISE " << uuid
- << " to " << m_helper_uuid_count[uuid] << "\n";
- }
- }
- }
- }
-
- for (size_t i = 0; i < ctx_list.size (); ++i)
- m_client_context_helper.erase (ctx_list [i]);
-
- HelperInfoRepository::iterator iter = m_helper_info_repository.begin ();
- for (; iter != m_helper_info_repository.end (); iter++) {
- if (!m_current_helper_uuid.compare (iter->second.uuid))
- if (!(iter->second.option & ISM_ISE_HIDE_IN_CONTROL_PANEL))
- socket_update_control_panel ();
- }
- } else if (client_info.type == FRONTEND_ACT_CLIENT) {
- SCIM_DEBUG_MAIN(4) << "It's a FRONTEND_ACT_CLIENT client.\n";
- IntIntRepository::iterator iter2 = m_panel_client_map.find (client.get_id ());
- if (iter2 != m_panel_client_map.end ())
- m_panel_client_map.erase (iter2);
- } else if (client_info.type == HELPER_CLIENT) {
- SCIM_DEBUG_MAIN(4) << "It's a Helper client.\n";
-
- lock ();
-
- HelperInfoRepository::iterator hiit = m_helper_info_repository.find (client.get_id ());
-
- if (hiit != m_helper_info_repository.end ()) {
- bool restart = false;
- String uuid = hiit->second.uuid;
-
- HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
- if ((hiit->second.option & SCIM_HELPER_AUTO_RESTART) &&
- (it != m_helper_client_index.end () && it->second.ref > 0))
- restart = true;
-
- m_helper_manager.stop_helper (hiit->second.name);
-
- m_helper_client_index.erase (uuid);
- m_helper_info_repository.erase (hiit);
-
- if (restart && !m_ise_exiting) {
- struct tms tiks_buf;
- static clock_t start_tiks = times (&tiks_buf);
- static double clock_tiks = (double)sysconf (_SC_CLK_TCK);
- clock_t curr_tiks = times (&tiks_buf);
- double secs = (double)(curr_tiks - start_tiks) / clock_tiks;
- //LOGE ("time second:%f\n", secs);
-
- static String restart_uuid;
- if (restart_uuid != uuid || secs > MIN_REPEAT_TIME) {
- m_helper_manager.run_helper (uuid, m_config_name, m_display_name);
- restart_uuid = uuid;
- LOGE ("Auto restart soft ISE:%s", uuid.c_str ());
- } else {
- reset_default_ise (0);
- ISF_SAVE_LOG ("Auto restart is abnormal, reset default ISE\n");
- }
- start_tiks = curr_tiks;
- }
- }
-
- m_ise_exiting = false;
- unlock ();
-
- socket_transaction_start ();
- m_signal_remove_helper (client.get_id ());
- socket_transaction_end ();
- } else if (client_info.type == HELPER_ACT_CLIENT) {
- SCIM_DEBUG_MAIN(4) << "It's a Helper passive client.\n";
-
- lock ();
-
- HelperInfoRepository::iterator hiit = m_helper_active_info_repository.find (client.get_id ());
- if (hiit != m_helper_active_info_repository.end ())
- m_helper_active_info_repository.erase (hiit);
-
- unlock ();
- } else if (client_info.type == IMCONTROL_ACT_CLIENT) {
- SCIM_DEBUG_MAIN(4) << "It's a IMCONTROL_ACT_CLIENT client.\n";
- int client_id = client.get_id ();
-
- IMControlRepository::iterator iter = m_imcontrol_repository.find (client_id);
- if (iter != m_imcontrol_repository.end ()) {
- int size = iter->second.info.size ();
- int i = 0;
- while (i < size) {
- stop_helper ((iter->second.info)[i].uuid, (iter->second.count)[i], DEFAULT_CONTEXT_VALUE);
- if ((iter->second.info)[i].option & ISM_ISE_HIDE_IN_CONTROL_PANEL)
- m_current_helper_uuid = m_last_helper_uuid;
- i++;
- }
- m_imcontrol_repository.erase (iter);
- }
-
- IntIntRepository::iterator iter2 = m_imcontrol_map.find (client_id);
- if (iter2 != m_imcontrol_map.end ())
- m_imcontrol_map.erase (iter2);
- }
- }
-
- const ClientInfo & socket_get_client_info (int client)
- {
- static ClientInfo null_client = { 0, UNKNOWN_CLIENT };
-
- ClientRepository::iterator it = m_client_repository.find (client);
-
- if (it != m_client_repository.end ())
- return it->second;
-
- return null_client;
- }
-
-private:
- void socket_turn_on (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_turn_on ()\n";
-
- m_signal_turn_on ();
- }
-
- void socket_turn_off (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_turn_off ()\n";
-
- m_signal_turn_off ();
- }
-
- void socket_update_screen (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_update_screen ()\n";
-
- uint32 num;
- if (m_recv_trans.get_data (num) && ((int) num) != m_current_screen) {
- SCIM_DEBUG_MAIN(4) << "New Screen number = " << num << "\n";
- m_signal_update_screen ((int) num);
- helper_all_update_screen ((int) num);
- m_current_screen = (num);
- }
- }
-
- void socket_update_spot_location (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_update_spot_location ()\n";
-
- uint32 x, y, top_y;
- if (m_recv_trans.get_data (x) && m_recv_trans.get_data (y) && m_recv_trans.get_data (top_y)) {
- SCIM_DEBUG_MAIN(4) << "New Spot location x=" << x << " y=" << y << "\n";
- m_signal_update_spot_location ((int)x, (int)y, (int)top_y);
- helper_all_update_spot_location ((int)x, (int)y);
- }
- }
-
- void socket_update_cursor_position (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_update_cursor_position ()\n";
-
- uint32 cursor_pos;
- if (m_recv_trans.get_data (cursor_pos)) {
- SCIM_DEBUG_MAIN(4) << "New cursor position pos=" << cursor_pos << "\n";
- helper_all_update_cursor_position ((int)cursor_pos);
- }
- }
-
- void socket_update_surrounding_text (void)
- {
- SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n";
-
- String text;
- uint32 cursor;
- if (m_recv_trans.get_data (text) && m_recv_trans.get_data (cursor)) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- lock ();
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT);
- m_send_trans.put_data (text);
- m_send_trans.put_data (cursor);
- m_send_trans.write_to_socket (client_socket);
-
- unlock ();
- }
- }
- }
-
- void socket_update_selection (void)
- {
- SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n";
-
- String text;
- if (m_recv_trans.get_data (text)) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- lock ();
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_SELECTION);
- m_send_trans.put_data (text);
- m_send_trans.write_to_socket (client_socket);
-
- unlock ();
- }
- }
- }
-
- void socket_update_factory_info (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_update_factory_info ()\n";
-
- PanelFactoryInfo info;
- if (m_recv_trans.get_data (info.uuid) && m_recv_trans.get_data (info.name) &&
- m_recv_trans.get_data (info.lang) && m_recv_trans.get_data (info.icon)) {
- SCIM_DEBUG_MAIN(4) << "New Factory info uuid=" << info.uuid << " name=" << info.name << "\n";
- info.lang = scim_get_normalized_language (info.lang);
- m_signal_update_factory_info (info);
- }
- }
-
- void socket_show_help (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_show_help ()\n";
-
- String help;
- if (m_recv_trans.get_data (help))
- m_signal_show_help (help);
- }
-
- void socket_show_factory_menu (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_show_factory_menu ()\n";
-
- PanelFactoryInfo info;
- std::vector <PanelFactoryInfo> vec;
-
- while (m_recv_trans.get_data (info.uuid) && m_recv_trans.get_data (info.name) &&
- m_recv_trans.get_data (info.lang) && m_recv_trans.get_data (info.icon)) {
- info.lang = scim_get_normalized_language (info.lang);
- vec.push_back (info);
- }
-
- if (vec.size ())
- m_signal_show_factory_menu (vec);
- }
-
- void socket_turn_on_log (void)
- {
- uint32 isOn;
- if (m_recv_trans.get_data (isOn)) {
- if (isOn) {
- DebugOutput::enable_debug (SCIM_DEBUG_AllMask);
- DebugOutput::set_verbose_level (7);
- SCIM_DEBUG_MAIN(4) << __func__ << " on\n";
- } else {
- SCIM_DEBUG_MAIN(4) << __func__ << " off\n";
- DebugOutput::disable_debug (SCIM_DEBUG_AllMask);
- DebugOutput::set_verbose_level (0);
- }
-
- int focused_client;
- uint32 focused_context;
-
- get_focused_context (focused_client, focused_context);
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- ctx = get_helper_ic (focused_client, focused_context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_TURN_ON_LOG);
- m_send_trans.put_data (isOn);
- m_send_trans.write_to_socket (client_socket);
- }
- }
-
- if (focused_client == -1) {
- std::cerr << __func__ << " get_focused_context is failed!!!\n";
- return;
- }
-
- ClientInfo client_info = socket_get_client_info (focused_client);
- if (client_info.type == FRONTEND_CLIENT) {
- Socket socket_client (focused_client);
- lock ();
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (focused_context);
- m_send_trans.put_command (ISM_TRANS_CMD_TURN_ON_LOG);
- m_send_trans.put_data (isOn);
- m_send_trans.write_to_socket (socket_client);
- unlock ();
- }
- }
- }
-
- void socket_show_preedit_string (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_show_preedit_string ()\n";
- m_signal_show_preedit_string ();
- }
-
- void socket_show_aux_string (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_show_aux_string ()\n";
- m_signal_show_aux_string ();
- }
-
- void socket_show_lookup_table (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_show_lookup_table ()\n";
- m_signal_show_lookup_table ();
- }
-
- void socket_show_associate_table (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_show_associate_table ()\n";
- m_signal_show_associate_table ();
- }
-
- void socket_hide_preedit_string (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_hide_preedit_string ()\n";
- m_signal_hide_preedit_string ();
- }
-
- void socket_hide_aux_string (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_hide_aux_string ()\n";
- m_signal_hide_aux_string ();
- }
-
- void socket_hide_lookup_table (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_hide_lookup_table ()\n";
- m_signal_hide_lookup_table ();
- }
-
- void socket_hide_associate_table (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_hide_associate_table ()\n";
- m_signal_hide_associate_table ();
- }
-
- void socket_update_preedit_string (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_update_preedit_string ()\n";
-
- String str;
- AttributeList attrs;
- uint32 caret;
- if (m_recv_trans.get_data (str) && m_recv_trans.get_data (attrs) && m_recv_trans.get_data (caret))
- m_signal_update_preedit_string (str, attrs, (int) caret);
- }
-
- void socket_update_preedit_caret (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_update_preedit_caret ()\n";
-
- uint32 caret;
- if (m_recv_trans.get_data (caret))
- m_signal_update_preedit_caret ((int) caret);
- }
-
- void socket_update_aux_string (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_update_aux_string ()\n";
-
- String str;
- AttributeList attrs;
- if (m_recv_trans.get_data (str) && m_recv_trans.get_data (attrs))
- m_signal_update_aux_string (str, attrs);
- }
-
- void socket_update_lookup_table (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_update_lookup_table ()\n";
-
- lock ();
- if (m_recv_trans.get_data (g_isf_candidate_table)) {
- unlock ();
- m_signal_update_lookup_table (g_isf_candidate_table);
- } else {
- unlock ();
- }
- }
-
- void socket_update_associate_table (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_update_associate_table ()\n";
-
- CommonLookupTable table;
- if (m_recv_trans.get_data (table))
- m_signal_update_associate_table (table);
- }
-
- void socket_update_control_panel (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_update_control_panel ()\n";
-
- String name, uuid;
- m_signal_get_keyboard_ise (name, uuid);
-
- PanelFactoryInfo info;
- if (name.length () > 0)
- info = PanelFactoryInfo (uuid, name, String (""), String (""));
- else
- info = PanelFactoryInfo (String (""), String (_("English Keyboard")), String ("C"), String (SCIM_KEYBOARD_ICON_FILE));
- m_signal_update_factory_info (info);
- }
-
- void socket_register_properties (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_register_properties ()\n";
-
- PropertyList properties;
-
- if (m_recv_trans.get_data (properties))
- m_signal_register_properties (properties);
- }
-
- void socket_update_property (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_update_property ()\n";
-
- Property property;
- if (m_recv_trans.get_data (property))
- m_signal_update_property (property);
- }
-
- void socket_get_keyboard_ise_list (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_get_keyboard_ise_list ()\n";
-
- std::vector<String> list;
- list.clear ();
- m_signal_get_keyboard_ise_list (list);
-
- String uuid;
- if (m_recv_trans.get_data (uuid)) {
- HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- get_focused_context (client, context);
- uint32 ctx = get_helper_ic (client, context);
- Socket socket_client (it->second.id);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_KEYBOARD_ISE_LIST);
- m_send_trans.put_data (list.size ());
- for (unsigned int i = 0; i < list.size (); i++)
- m_send_trans.put_data (list[i]);
- m_send_trans.write_to_socket (socket_client);
- }
- }
- }
-
- void socket_set_candidate_ui (void)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << " \n";
-
- uint32 portrait_line, mode;
- if (m_recv_trans.get_data (portrait_line) && m_recv_trans.get_data (mode))
- m_signal_set_candidate_ui (portrait_line, mode);
- }
-
- void socket_get_candidate_ui (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_get_candidate_ui ()\n";
-
- int style = 0, mode = 0;
- m_signal_get_candidate_ui (style, mode);
-
- String uuid;
- if (m_recv_trans.get_data (uuid)) {
- HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- get_focused_context (client, context);
- uint32 ctx = get_helper_ic (client, context);
- Socket socket_client (it->second.id);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_CANDIDATE_UI);
- m_send_trans.put_data (style);
- m_send_trans.put_data (mode);
- m_send_trans.write_to_socket (socket_client);
- }
- }
- }
-
- void socket_set_candidate_position (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_set_candidate_position ()\n";
-
- uint32 left, top;
- if (m_recv_trans.get_data (left) && m_recv_trans.get_data (top))
- m_signal_set_candidate_position (left, top);
- }
-
- void socket_hide_candidate (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_hide_candidate ()\n";
-
- m_signal_hide_preedit_string ();
- m_signal_hide_aux_string ();
- m_signal_hide_lookup_table ();
- m_signal_hide_associate_table ();
- }
-
- void socket_get_candidate_geometry (void)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << " \n";
-
- String uuid;
- if (m_recv_trans.get_data (uuid)) {
- HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
- if (it != m_helper_client_index.end ()) {
- struct rectinfo info = {0, 0, 0, 0};
- m_signal_get_candidate_geometry (info);
-
- int client;
- uint32 context;
- get_focused_context (client, context);
- uint32 ctx = get_helper_ic (client, context);
- Socket socket_client (it->second.id);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_CANDIDATE_GEOMETRY);
- m_send_trans.put_data (info.pos_x);
- m_send_trans.put_data (info.pos_y);
- m_send_trans.put_data (info.width);
- m_send_trans.put_data (info.height);
- m_send_trans.write_to_socket (socket_client);
- }
- }
- }
-
- void socket_set_keyboard_ise (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_set_keyboard_ise ()\n";
-
- String uuid;
- if (m_recv_trans.get_data (uuid))
- m_signal_set_keyboard_ise (uuid);
- }
-
- void socket_helper_select_candidate (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_set_keyboard_ise ()\n";
-
- uint32 index;
- if (m_recv_trans.get_data (index))
- m_signal_select_candidate (index);
- }
-
- void socket_helper_update_ise_geometry (int client)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
-
- uint32 x, y, width, height;
- if (m_recv_trans.get_data (x) && m_recv_trans.get_data (y) &&
- m_recv_trans.get_data (width) && m_recv_trans.get_data (height)) {
- HelperInfoRepository::iterator it = m_helper_active_info_repository.find (client);
- if (it != m_helper_active_info_repository.end ()) {
- if (it->second.uuid == m_current_helper_uuid)
- m_signal_update_ise_geometry (x, y, width, height);
- }
- }
- }
-
- void socket_helper_expand_candidate (int client)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
-
- HelperInfoRepository::iterator it = m_helper_active_info_repository.find (client);
- if (it != m_helper_active_info_repository.end ()) {
- if (it->second.uuid == m_current_helper_uuid)
- m_signal_expand_candidate ();
- }
- }
-
- void socket_helper_contract_candidate (int client)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
-
- HelperInfoRepository::iterator it = m_helper_active_info_repository.find (client);
- if (it != m_helper_active_info_repository.end ()) {
- if (it->second.uuid == m_current_helper_uuid)
- m_signal_contract_candidate ();
- }
- }
-
- void socket_get_keyboard_ise (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_get_keyboard_ise ()\n";
-
- String ise_name, ise_uuid;
- int client = -1;
- uint32 context = 0;
- uint32 ctx = 0;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- if (m_client_context_uuids.find (ctx) != m_client_context_uuids.end ())
- ise_uuid = m_client_context_uuids[ctx];
- m_signal_get_keyboard_ise (ise_name, ise_uuid);
-
- String uuid;
- if (m_recv_trans.get_data (uuid)) {
- HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
- if (it != m_helper_client_index.end ()) {
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
- Socket socket_client (it->second.id);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_KEYBOARD_ISE);
- m_send_trans.put_data (ise_name);
- m_send_trans.put_data (ise_uuid);
- m_send_trans.write_to_socket (socket_client);
- }
- }
- }
-
- void socket_start_helper (int client, uint32 context, const String &ic_uuid)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_start_helper ()\n";
-
- String uuid;
- if (m_recv_trans.get_data (uuid) && uuid.length ()) {
- HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
-
- lock ();
-
- uint32 ic = get_helper_ic (client, context);
-
- SCIM_DEBUG_MAIN(5) << "Helper UUID =" << uuid << " IC UUID =" << ic_uuid <<"\n";
-
- if (it == m_helper_client_index.end ()) {
- SCIM_DEBUG_MAIN(5) << "Run this Helper.\n";
- m_start_helper_ic_index [uuid].push_back (std::make_pair (ic, ic_uuid));
- m_helper_manager.run_helper (uuid, m_config_name, m_display_name);
- } else {
- SCIM_DEBUG_MAIN(5) << "Increase the Reference count.\n";
- Socket client_socket (it->second.id);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ic);
- m_send_trans.put_data (ic_uuid);
- m_send_trans.put_command (SCIM_TRANS_CMD_HELPER_ATTACH_INPUT_CONTEXT);
- m_send_trans.write_to_socket (client_socket);
- ++ it->second.ref;
- }
-
- unlock ();
- }
- }
-
- void socket_stop_helper (int client, uint32 context, const String &ic_uuid)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_stop_helper ()\n";
-
- String uuid;
- if (m_recv_trans.get_data (uuid) && uuid.length ()) {
- HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
-
- lock ();
-
- uint32 ic = get_helper_ic (client, context);
-
- SCIM_DEBUG_MAIN(5) << "Helper UUID =" << uuid << " IC UUID =" << ic_uuid <<"\n";
-
- if (it != m_helper_client_index.end ()) {
- SCIM_DEBUG_MAIN(5) << "Decrase the Reference count.\n";
- -- it->second.ref;
- Socket client_socket (it->second.id);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ic);
- m_send_trans.put_data (ic_uuid);
- m_send_trans.put_command (SCIM_TRANS_CMD_HELPER_DETACH_INPUT_CONTEXT);
- if (it->second.ref <= 0)
- m_send_trans.put_command (SCIM_TRANS_CMD_EXIT);
- m_send_trans.write_to_socket (client_socket);
- }
-
- unlock ();
- }
- }
-
- void socket_send_helper_event (int client, uint32 context, const String &ic_uuid)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_send_helper_event ()\n";
-
- String uuid;
- if (m_recv_trans.get_data (uuid) && m_recv_trans.get_data (m_nest_trans) &&
- uuid.length () && m_nest_trans.valid ()) {
- HelperClientIndex::iterator it = m_helper_client_index.find (uuid);
- if (it != m_helper_client_index.end ()) {
- Socket client_socket (it->second.id);
-
- lock ();
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
-
- /* FIXME: We presume that client and context are both less than 65536.
- * Hopefully, it should be true in any UNIXs.
- * So it's ok to combine client and context into one uint32. */
- m_send_trans.put_data (get_helper_ic (client, context));
- m_send_trans.put_data (ic_uuid);
- m_send_trans.put_command (SCIM_TRANS_CMD_HELPER_PROCESS_IMENGINE_EVENT);
- m_send_trans.put_data (m_nest_trans);
- m_send_trans.write_to_socket (client_socket);
-
- unlock ();
- }
- }
- }
-
- void socket_helper_register_properties (int client)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_helper_register_properties (" << client << ")\n";
-
- PropertyList properties;
- if (m_recv_trans.get_data (properties))
- m_signal_register_helper_properties (client, properties);
- }
-
- void socket_helper_update_property (int client)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_helper_update_property (" << client << ")\n";
-
- Property property;
- if (m_recv_trans.get_data (property))
- m_signal_update_helper_property (client, property);
- }
-
- void socket_helper_send_imengine_event (int client)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_helper_send_imengine_event (" << client << ")\n";
-
- uint32 target_ic;
- String target_uuid;
-
- HelperInfoRepository::iterator hiit = m_helper_active_info_repository.find (client);
-
- if (m_recv_trans.get_data (target_ic) &&
- m_recv_trans.get_data (target_uuid) &&
- m_recv_trans.get_data (m_nest_trans) &&
- m_nest_trans.valid () &&
- hiit != m_helper_active_info_repository.end ()) {
-
- int target_client;
- uint32 target_context;
-
- get_imengine_client_context (target_ic, target_client, target_context);
-
- int focused_client;
- uint32 focused_context;
- String focused_uuid;
-
- focused_uuid = get_focused_context (focused_client, focused_context);
-
- if (target_ic == (uint32) (-1)) {
- target_client = focused_client;
- target_context = focused_context;
- }
-
- if (target_uuid.length () == 0)
- target_uuid = focused_uuid;
-
- ClientInfo client_info = socket_get_client_info (target_client);
-
- SCIM_DEBUG_MAIN(5) << "Target UUID = " << target_uuid << " Focused UUId = " << focused_uuid << "\nTarget Client = " << target_client << "\n";
-
- if (client_info.type == FRONTEND_CLIENT) {
- Socket socket_client (target_client);
- lock ();
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (target_context);
- m_send_trans.put_command (SCIM_TRANS_CMD_PROCESS_HELPER_EVENT);
- m_send_trans.put_data (target_uuid);
- m_send_trans.put_data (hiit->second.uuid);
- m_send_trans.put_data (m_nest_trans);
- m_send_trans.write_to_socket (socket_client);
- unlock ();
- }
- }
- }
-
- void socket_helper_key_event_op (int client, int cmd)
- {
- uint32 target_ic;
- String target_uuid;
- KeyEvent key;
-
- if (m_recv_trans.get_data (target_ic) &&
- m_recv_trans.get_data (target_uuid) &&
- m_recv_trans.get_data (key) &&
- !key.empty ()) {
-
- int target_client;
- uint32 target_context;
-
- get_imengine_client_context (target_ic, target_client, target_context);
-
- int focused_client;
- uint32 focused_context;
- String focused_uuid;
-
- focused_uuid = get_focused_context (focused_client, focused_context);
-
- if (target_ic == (uint32) (-1)) {
- target_client = focused_client;
- target_context = focused_context;
- }
-
- if (target_uuid.length () == 0)
- target_uuid = focused_uuid;
-
- if (target_client == -1) {
- /* FIXUP: monitor 'Invalid Window' error */
- std::cerr << "focused target client is NULL" << "\n";
- } else if (target_client == focused_client && target_context == focused_context && target_uuid == focused_uuid) {
- ClientInfo client_info = socket_get_client_info (target_client);
- if (client_info.type == FRONTEND_CLIENT) {
- Socket socket_client (target_client);
- lock ();
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (target_context);
- m_send_trans.put_command (cmd);
- m_send_trans.put_data (key);
- m_send_trans.write_to_socket (socket_client);
- unlock ();
- }
- }
- }
- }
-
- void socket_helper_send_key_event (int client)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_helper_send_key_event (" << client << ")\n";
- ISF_PROF_DEBUG("first message")
-
- socket_helper_key_event_op (client, SCIM_TRANS_CMD_PROCESS_KEY_EVENT);
- }
-
- void socket_helper_forward_key_event (int client)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_helper_forward_key_event (" << client << ")\n";
-
- socket_helper_key_event_op (client, SCIM_TRANS_CMD_FORWARD_KEY_EVENT);
- }
-
- void socket_helper_commit_string (int client)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_helper_commit_string (" << client << ")\n";
-
- uint32 target_ic;
- String target_uuid;
- WideString wstr;
-
- if (m_recv_trans.get_data (target_ic) &&
- m_recv_trans.get_data (target_uuid) &&
- m_recv_trans.get_data (wstr) &&
- wstr.length ()) {
-
- int target_client;
- uint32 target_context;
-
- get_imengine_client_context (target_ic, target_client, target_context);
-
- int focused_client;
- uint32 focused_context;
- String focused_uuid;
-
- focused_uuid = get_focused_context (focused_client, focused_context);
-
- if (target_ic == (uint32) (-1)) {
- target_client = focused_client;
- target_context = focused_context;
- }
-
- if (target_uuid.length () == 0)
- target_uuid = focused_uuid;
-
- if (target_client == focused_client &&
- target_context == focused_context &&
- target_uuid == focused_uuid) {
- ClientInfo client_info = socket_get_client_info (target_client);
- if (client_info.type == FRONTEND_CLIENT) {
- Socket socket_client (target_client);
- lock ();
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (target_context);
- m_send_trans.put_command (SCIM_TRANS_CMD_COMMIT_STRING);
- m_send_trans.put_data (wstr);
- m_send_trans.write_to_socket (socket_client);
- unlock ();
- } else {
- std::cerr << "target client is not existed!!!" << "\n";
- }
- }
- }
- }
-
- void socket_helper_get_surrounding_text (int client)
- {
- SCIM_DEBUG_MAIN(4) << __FUNCTION__ << " (" << client << ")\n";
-
- String uuid;
- uint32 maxlen_before;
- uint32 maxlen_after;
-
- if (m_recv_trans.get_data (uuid) &&
- m_recv_trans.get_data (maxlen_before) &&
- m_recv_trans.get_data (maxlen_after)) {
-
- int focused_client;
- uint32 focused_context;
- String focused_uuid = get_focused_context (focused_client, focused_context);
-
- ClientInfo client_info = socket_get_client_info (focused_client);
- if (client_info.type == FRONTEND_CLIENT) {
- Socket socket_client (focused_client);
- lock ();
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (focused_context);
- m_send_trans.put_command (SCIM_TRANS_CMD_GET_SURROUNDING_TEXT);
- m_send_trans.put_data (maxlen_before);
- m_send_trans.put_data (maxlen_after);
- m_send_trans.write_to_socket (socket_client);
- unlock ();
- }
- }
- }
-
- void socket_helper_delete_surrounding_text (int client)
- {
- SCIM_DEBUG_MAIN(4) << __FUNCTION__ << " (" << client << ")\n";
-
- uint32 offset;
- uint32 len;
-
- if (m_recv_trans.get_data (offset) && m_recv_trans.get_data (len)) {
-
- int focused_client;
- uint32 focused_context;
- String focused_uuid = get_focused_context (focused_client, focused_context);
-
- ClientInfo client_info = socket_get_client_info (focused_client);
- if (client_info.type == FRONTEND_CLIENT) {
- Socket socket_client (focused_client);
- lock ();
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (focused_context);
- m_send_trans.put_command (SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT);
- m_send_trans.put_data (offset);
- m_send_trans.put_data (len);
- m_send_trans.write_to_socket (socket_client);
- unlock ();
- }
- }
- }
-
- void socket_helper_get_selection (int client)
- {
- SCIM_DEBUG_MAIN(4) << __FUNCTION__ << " (" << client << ")\n";
-
- String uuid;
-
- if (m_recv_trans.get_data (uuid)) {
-
- int focused_client;
- uint32 focused_context;
- String focused_uuid = get_focused_context (focused_client, focused_context);
-
- ClientInfo client_info = socket_get_client_info (focused_client);
- if (client_info.type == FRONTEND_CLIENT) {
- Socket socket_client (focused_client);
- lock ();
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (focused_context);
- m_send_trans.put_command (SCIM_TRANS_CMD_GET_SELECTION);
- m_send_trans.write_to_socket (socket_client);
- unlock ();
- }
- }
- }
-
- void socket_helper_set_selection (int client)
- {
- SCIM_DEBUG_MAIN(4) << __FUNCTION__ << " (" << client << ")\n";
-
- uint32 start;
- uint32 end;
-
- if (m_recv_trans.get_data (start) && m_recv_trans.get_data (end)) {
-
- int focused_client;
- uint32 focused_context;
- String focused_uuid = get_focused_context (focused_client, focused_context);
-
- ClientInfo client_info = socket_get_client_info (focused_client);
- if (client_info.type == FRONTEND_CLIENT) {
- Socket socket_client (focused_client);
- lock ();
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (focused_context);
- m_send_trans.put_command (SCIM_TRANS_CMD_SET_SELECTION);
- m_send_trans.put_data (start);
- m_send_trans.put_data (end);
- m_send_trans.write_to_socket (socket_client);
- unlock ();
- }
- }
- }
-
- void socket_helper_show_preedit_string (int client)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_helper_show_preedit_string (" << client << ")\n";
-
- uint32 target_ic;
- String target_uuid;
-
- if (m_recv_trans.get_data (target_ic) && m_recv_trans.get_data (target_uuid)) {
- int target_client;
- uint32 target_context;
-
- get_imengine_client_context (target_ic, target_client, target_context);
-
- int focused_client;
- uint32 focused_context;
- String focused_uuid = get_focused_context (focused_client, focused_context);
-
- if (target_ic == (uint32) (-1)) {
- target_client = focused_client;
- target_context = focused_context;
- }
-
- if (target_uuid.length () == 0)
- target_uuid = focused_uuid;
-
- if (target_client == focused_client &&
- target_context == focused_context &&
- target_uuid == focused_uuid) {
- ClientInfo client_info = socket_get_client_info (target_client);
- if (client_info.type == FRONTEND_CLIENT) {
- Socket socket_client (target_client);
- lock ();
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (target_context);
- m_send_trans.put_command (SCIM_TRANS_CMD_SHOW_PREEDIT_STRING);
- m_send_trans.write_to_socket (socket_client);
- unlock ();
- }
- }
- }
- }
-
- void socket_helper_hide_preedit_string (int client)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_helper_hide_preedit_string (" << client << ")\n";
-
- uint32 target_ic;
- String target_uuid;
-
- if (m_recv_trans.get_data (target_ic) && m_recv_trans.get_data (target_uuid)) {
- int target_client;
- uint32 target_context;
-
- get_imengine_client_context (target_ic, target_client, target_context);
-
- int focused_client;
- uint32 focused_context;
- String focused_uuid = get_focused_context (focused_client, focused_context);
-
- if (target_ic == (uint32) (-1)) {
- target_client = focused_client;
- target_context = focused_context;
- }
-
- if (target_uuid.length () == 0)
- target_uuid = focused_uuid;
-
- if (target_client == focused_client &&
- target_context == focused_context &&
- target_uuid == focused_uuid) {
- ClientInfo client_info = socket_get_client_info (target_client);
- if (client_info.type == FRONTEND_CLIENT) {
- Socket socket_client (target_client);
- lock ();
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (target_context);
- m_send_trans.put_command (SCIM_TRANS_CMD_HIDE_PREEDIT_STRING);
- m_send_trans.write_to_socket (socket_client);
- unlock ();
- }
- }
- }
- }
-
- void socket_helper_update_preedit_string (int client)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_helper_update_preedit_string (" << client << ")\n";
-
- uint32 target_ic;
- String target_uuid;
- WideString wstr;
- AttributeList attrs;
- uint32 caret;
-
- if (m_recv_trans.get_data (target_ic) &&
- m_recv_trans.get_data (target_uuid) &&
- m_recv_trans.get_data (wstr) &&
- m_recv_trans.get_data (attrs) &&
- m_recv_trans.get_data (caret)) {
-
- int target_client;
- uint32 target_context;
-
- get_imengine_client_context (target_ic, target_client, target_context);
-
- int focused_client;
- uint32 focused_context;
- String focused_uuid;
-
- focused_uuid = get_focused_context (focused_client, focused_context);
-
- if (target_ic == (uint32) (-1)) {
- target_client = focused_client;
- target_context = focused_context;
- }
-
- if (target_uuid.length () == 0)
- target_uuid = focused_uuid;
-
- if (target_client == focused_client &&
- target_context == focused_context &&
- target_uuid == focused_uuid) {
- ClientInfo client_info = socket_get_client_info (target_client);
- if (client_info.type == FRONTEND_CLIENT) {
- Socket socket_client (target_client);
- lock ();
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (target_context);
- m_send_trans.put_command (SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING);
- m_send_trans.put_data (wstr);
- m_send_trans.put_data (attrs);
- m_send_trans.put_data (caret);
- m_send_trans.write_to_socket (socket_client);
- unlock ();
- }
- }
- }
- }
-
- void socket_helper_update_preedit_caret (int client)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << " (" << client << ")\n";
-
- uint32 caret;
-
- if (m_recv_trans.get_data (caret)) {
- int focused_client;
- uint32 focused_context;
- String focused_uuid;
- focused_uuid = get_focused_context (focused_client, focused_context);
-
- ClientInfo client_info = socket_get_client_info (focused_client);
- if (client_info.type == FRONTEND_CLIENT) {
- Socket socket_client (focused_client);
- lock ();
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (focused_context);
- m_send_trans.put_command (SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET);
- m_send_trans.put_data (caret);
- m_send_trans.write_to_socket (socket_client);
- unlock ();
- }
- }
- }
-
- void socket_helper_register_helper (int client)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_helper_register_helper (" << client << ")\n";
-
- HelperInfo info;
-
- bool result = false;
-
- lock ();
-
- Socket socket_client (client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
-
- if (m_recv_trans.get_data (info.uuid) &&
- m_recv_trans.get_data (info.name) &&
- m_recv_trans.get_data (info.icon) &&
- m_recv_trans.get_data (info.description) &&
- m_recv_trans.get_data (info.option) &&
- info.uuid.length ()) {
-
- SCIM_DEBUG_MAIN(4) << "New Helper uuid=" << info.uuid << " name=" << info.name << "\n";
-
- HelperClientIndex::iterator it = m_helper_client_index.find (info.uuid);
-
- if (it == m_helper_client_index.end ()) {
- m_helper_info_repository [client] = info;
- m_helper_client_index [info.uuid] = HelperClientStub (client, 1);
- m_send_trans.put_command (SCIM_TRANS_CMD_OK);
-
- StartHelperICIndex::iterator icit = m_start_helper_ic_index.find (info.uuid);
-
- if (icit != m_start_helper_ic_index.end ()) {
- m_send_trans.put_command (SCIM_TRANS_CMD_HELPER_ATTACH_INPUT_CONTEXT);
- for (size_t i = 0; i < icit->second.size (); ++i) {
- m_send_trans.put_data (icit->second [i].first);
- m_send_trans.put_data (icit->second [i].second);
- }
- m_start_helper_ic_index.erase (icit);
- }
-
- m_send_trans.put_command (SCIM_TRANS_CMD_UPDATE_SCREEN);
- m_send_trans.put_data ((uint32)m_current_screen);
-
- result = true;
- } else {
- m_send_trans.put_command (SCIM_TRANS_CMD_FAIL);
- }
- }
-
- m_send_trans.write_to_socket (socket_client);
-
- unlock ();
-
- if (result)
- m_signal_register_helper (client, info);
- }
-
- void socket_helper_register_helper_passive (int client)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_helper_register_helper_passive (" << client << ")\n";
-
- HelperInfo info;
-
- lock ();
-
- if (m_recv_trans.get_data (info.uuid) &&
- m_recv_trans.get_data (info.name) &&
- m_recv_trans.get_data (info.icon) &&
- m_recv_trans.get_data (info.description) &&
- m_recv_trans.get_data (info.option) &&
- info.uuid.length ()) {
-
- SCIM_DEBUG_MAIN(4) << "New Helper Passive uuid=" << info.uuid << " name=" << info.name << "\n";
-
- HelperInfoRepository::iterator it = m_helper_active_info_repository.find (client);
- if (it == m_helper_active_info_repository.end ()) {
- m_helper_active_info_repository[client] = info;
- }
-
- StringIntRepository::iterator iter = m_ise_pending_repository.find (info.uuid);
- if (iter != m_ise_pending_repository.end ()) {
- Transaction trans;
- Socket client_socket (iter->second);
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.write_to_socket (client_socket);
- m_ise_pending_repository.erase (iter);
- }
-
- iter = m_ise_pending_repository.find (info.name);
- if (iter != m_ise_pending_repository.end ()) {
- Transaction trans;
- Socket client_socket (iter->second);
- trans.clear ();
- trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.write_to_socket (client_socket);
- m_ise_pending_repository.erase (iter);
- }
- }
-
- unlock ();
- }
-
- void socket_helper_update_input_context (int client)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_helper_update_input_context (" << client << ")\n";
-
- uint32 type;
- uint32 value;
-
- if (m_recv_trans.get_data (type) && m_recv_trans.get_data (value)) {
- m_signal_update_input_context ((int)type, (int)value);
-
- int focused_client;
- uint32 focused_context;
- get_focused_context (focused_client, focused_context);
-
- ClientInfo client_info = socket_get_client_info (focused_client);
- if (client_info.type == FRONTEND_CLIENT) {
- Socket client_socket (focused_client);
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (focused_context);
- m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT);
- m_send_trans.put_data (type);
- m_send_trans.put_data (value);
- m_send_trans.write_to_socket (client_socket);
- } else {
- std::cerr << "focused client is not existed!!!" << "\n";
- }
- }
- }
-
- void socket_helper_send_private_command (int client)
- {
- SCIM_DEBUG_MAIN(4) << __FUNCTION__ << " (" << client << ")\n";
-
- String command;
-
- if (m_recv_trans.get_data (command)) {
- int focused_client;
- uint32 focused_context;
- String focused_uuid = get_focused_context (focused_client, focused_context);
-
- ClientInfo client_info = socket_get_client_info (focused_client);
- if (client_info.type == FRONTEND_CLIENT) {
- Socket socket_client (focused_client);
- lock ();
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (focused_context);
- m_send_trans.put_command (SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND);
- m_send_trans.put_data (command);
- m_send_trans.write_to_socket (socket_client);
- unlock ();
- }
- }
- }
-
- void socket_reset_helper_input_context (const String &uuid, int client, uint32 context)
- {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- Socket client_socket (it->second.id);
- uint32 ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (SCIM_TRANS_CMD_PANEL_RESET_INPUT_CONTEXT);
- m_send_trans.write_to_socket (client_socket);
- }
- }
-
- void socket_reset_input_context (int client, uint32 context)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_reset_input_context \n";
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
- socket_reset_helper_input_context (m_current_helper_uuid, client, context);
- }
-
- bool helper_select_aux (uint32 item)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::helper_select_aux \n";
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_SELECT_AUX);
- m_send_trans.put_data ((uint32)item);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
- }
-
- return false;
- }
-
- bool helper_select_candidate (uint32 item)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::helper_select_candidate \n";
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (SCIM_TRANS_CMD_SELECT_CANDIDATE);
- m_send_trans.put_data ((uint32)item);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
- }
-
- return false;
- }
-
- bool helper_lookup_table_page_up (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::helper_lookup_table_page_up \n";
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_UP);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
- }
-
- return false;
- }
-
- bool helper_lookup_table_page_down (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::helper_lookup_table_page_down \n";
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_DOWN);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
- }
-
- return false;
- }
-
- bool helper_update_lookup_table_page_size (uint32 size)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::helper_update_lookup_table_page_size \n";
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE_PAGE_SIZE);
- m_send_trans.put_data (size);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
- }
-
- return false;
- }
-
- bool helper_update_candidate_item_layout (const std::vector<uint32> &row_items)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_CANDIDATE_ITEM_LAYOUT);
- m_send_trans.put_data (row_items);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
- }
-
- return false;
- }
-
- bool helper_select_associate (uint32 item)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::helper_select_associate \n";
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_SELECT_ASSOCIATE);
- m_send_trans.put_data ((uint32)item);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
- }
-
- return false;
- }
-
- bool helper_associate_table_page_up (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::helper_associate_table_page_up \n";
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_ASSOCIATE_TABLE_PAGE_UP);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
- }
-
- return false;
- }
-
- bool helper_associate_table_page_down (void)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::helper_associate_table_page_down \n";
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_ASSOCIATE_TABLE_PAGE_DOWN);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
- }
-
- return false;
- }
-
- bool helper_update_associate_table_page_size (uint32 size)
- {
- SCIM_DEBUG_MAIN(4) << "PanelAgent::helper_update_associate_table_page_size \n";
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_ASSOCIATE_TABLE_PAGE_SIZE);
- m_send_trans.put_data (size);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
- }
-
- return false;
- }
-
- bool helper_update_displayed_candidate_number (uint32 size)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_DISPLAYED_CANDIDATE);
- m_send_trans.put_data (size);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
- }
-
- return false;
- }
-
- bool helper_longpress_candidate (uint32 index)
- {
- SCIM_DEBUG_MAIN(4) << __func__ << "\n";
-
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT) {
- HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
-
- if (it != m_helper_client_index.end ()) {
- int client;
- uint32 context;
- Socket client_socket (it->second.id);
- uint32 ctx;
-
- get_focused_context (client, context);
- ctx = get_helper_ic (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (ctx);
- m_send_trans.put_data (m_current_helper_uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_LONGPRESS_CANDIDATE);
- m_send_trans.put_data (index);
- m_send_trans.write_to_socket (client_socket);
-
- return true;
- }
- }
-
- std::cerr << __func__ << " is failed!!!\n";
- return false;
- }
-
- void helper_all_update_spot_location (int x, int y)
- {
- SCIM_DEBUG_MAIN (5) << "PanelAgent::helper_all_update_spot_location (" << x << "," << y << ")\n";
-
- HelperInfoRepository::iterator hiit = m_helper_info_repository.begin ();
-
- int client;
- uint32 context;
- String uuid = get_focused_context (client, context);
-
- lock ();
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
-
- /* FIXME: We presume that client and context are both less than 65536.
- * Hopefully, it should be true in any UNIXs.
- * So it's ok to combine client and context into one uint32. */
- m_send_trans.put_data (get_helper_ic (client, context));
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION);
- m_send_trans.put_data ((uint32) x);
- m_send_trans.put_data ((uint32) y);
-
- for (; hiit != m_helper_info_repository.end (); ++ hiit) {
- if (hiit->second.option & SCIM_HELPER_NEED_SPOT_LOCATION_INFO) {
- Socket client_socket (hiit->first);
- m_send_trans.write_to_socket (client_socket);
- }
- }
-
- unlock ();
- }
-
- void helper_all_update_cursor_position (int cursor_pos)
- {
- SCIM_DEBUG_MAIN (5) << "PanelAgent::helper_all_update_cursor_position (" << cursor_pos << ")\n";
-
- HelperInfoRepository::iterator hiit = m_helper_info_repository.begin ();
-
- int client;
- uint32 context;
- String uuid = get_focused_context (client, context);
-
- lock ();
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
- m_send_trans.put_data (get_helper_ic (client, context));
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_CURSOR_POSITION);
- m_send_trans.put_data ((uint32) cursor_pos);
-
- for (; hiit != m_helper_info_repository.end (); ++ hiit) {
- Socket client_socket (hiit->first);
- m_send_trans.write_to_socket (client_socket);
- }
-
- unlock ();
- }
-
- void helper_all_update_screen (int screen)
- {
- SCIM_DEBUG_MAIN (5) << "PanelAgent::helper_all_update_screen (" << screen << ")\n";
-
- HelperInfoRepository::iterator hiit = m_helper_info_repository.begin ();
-
- int client;
- uint32 context;
- String uuid;
-
- lock ();
-
- uuid = get_focused_context (client, context);
-
- m_send_trans.clear ();
- m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
-
- /* FIXME: We presume that client and context are both less than 65536.
- * Hopefully, it should be true in any UNIXs.
- * So it's ok to combine client and context into one uint32. */
- m_send_trans.put_data (get_helper_ic (client, context));
- m_send_trans.put_data (uuid);
- m_send_trans.put_command (SCIM_TRANS_CMD_UPDATE_SCREEN);
- m_send_trans.put_data ((uint32) screen);
-
- for (; hiit != m_helper_info_repository.end (); ++ hiit) {
- if (hiit->second.option & SCIM_HELPER_NEED_SCREEN_INFO) {
- Socket client_socket (hiit->first);
- m_send_trans.write_to_socket (client_socket);
- }
- }
-
- unlock ();
- }
-
- const String & get_focused_context (int &client, uint32 &context, bool force_last_context = false) const
- {
- if (m_current_socket_client >= 0) {
- client = m_current_socket_client;
- context = m_current_client_context;
- return m_current_context_uuid;
- } else {
- client = m_last_socket_client;
- context = m_last_client_context;
- return m_last_context_uuid;
- }
- }
-
-private:
- void socket_transaction_start (void)
- {
- m_signal_transaction_start ();
- }
-
- void socket_transaction_end (void)
- {
- m_signal_transaction_end ();
- }
-
- void lock (void)
- {
- m_signal_lock ();
- }
- void unlock (void)
- {
- m_signal_unlock ();
- }
-};
-
-PanelAgent::PanelAgent ()
- : m_impl (new PanelAgentImpl ())
-{
-}
-
-PanelAgent::~PanelAgent ()
-{
- delete m_impl;
-}
-
-bool
-PanelAgent::initialize (const String &config, const String &display, bool resident)
-{
- return m_impl->initialize (config, display, resident);
-}
-
-bool
-PanelAgent::valid (void) const
-{
- return m_impl->valid ();
-}
-
-bool
-PanelAgent::run (void)
-{
- return m_impl->run ();
-}
-
-void
-PanelAgent::stop (void)
-{
- if (m_impl != NULL)
- m_impl->stop ();
-}
-
-int
-PanelAgent::get_helper_list (std::vector <HelperInfo> & helpers) const
-{
- return m_impl->get_helper_list (helpers);
-}
-
-void PanelAgent::hide_helper (const String &uuid)
-{
- m_impl->hide_helper (uuid);
-}
-TOOLBAR_MODE_T
-PanelAgent::get_current_toolbar_mode () const
-{
- return m_impl->get_current_toolbar_mode ();
-}
-
-void
-PanelAgent::get_current_ise_geometry (rectinfo &rect)
-{
- m_impl->get_current_ise_geometry (rect);
-}
-
-String
-PanelAgent::get_current_helper_uuid () const
-{
- return m_impl->get_current_helper_uuid ();
-}
-
-String
-PanelAgent::get_current_helper_name () const
-{
- return m_impl->get_current_helper_name ();
-}
-
-String
-PanelAgent::get_current_ise_name () const
-{
- return m_impl->get_current_ise_name ();
-}
-
-void
-PanelAgent::set_current_toolbar_mode (TOOLBAR_MODE_T mode)
-{
- m_impl->set_current_toolbar_mode (mode);
-}
-
-void
-PanelAgent::set_current_ise_name (String &name)
-{
- m_impl->set_current_ise_name (name);
-}
-
-void
-PanelAgent::set_current_helper_option (uint32 option)
-{
- m_impl->set_current_helper_option (option);
-}
-
-void
-PanelAgent::update_candidate_panel_event (uint32 nType, uint32 nValue)
-{
- m_impl->update_panel_event (ISM_TRANS_CMD_UPDATE_ISF_CANDIDATE_PANEL, nType, nValue);
-}
-
-void
-PanelAgent::update_input_panel_event (uint32 nType, uint32 nValue)
-{
- m_impl->update_panel_event (ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT, nType, nValue);
-}
-
-bool
-PanelAgent::move_preedit_caret (uint32 position)
-{
- return m_impl->move_preedit_caret (position);
-}
-
-bool
-PanelAgent::request_help (void)
-{
- return m_impl->request_help ();
-}
-
-bool
-PanelAgent::request_factory_menu (void)
-{
- return m_impl->request_factory_menu ();
-}
-
-bool
-PanelAgent::change_factory (const String &uuid)
-{
- return m_impl->change_factory (uuid);
-}
-
-bool
-PanelAgent::helper_candidate_show (void)
-{
- return m_impl->helper_candidate_show ();
-}
-
-bool
-PanelAgent::helper_candidate_hide (void)
-{
- return m_impl->helper_candidate_hide ();
-}
-
-bool
-PanelAgent::candidate_more_window_show (void)
-{
- return m_impl->candidate_more_window_show ();
-}
-
-bool
-PanelAgent::candidate_more_window_hide (void)
-{
- return m_impl->candidate_more_window_hide ();
-}
-
-bool
-PanelAgent::update_helper_lookup_table (const LookupTable &table)
-{
- return m_impl->update_helper_lookup_table (table);
-}
-
-bool
-PanelAgent::select_aux (uint32 item)
-{
- return m_impl->select_aux (item);
-}
-
-bool
-PanelAgent::select_candidate (uint32 item)
-{
- return m_impl->select_candidate (item);
-}
-
-bool
-PanelAgent::lookup_table_page_up (void)
-{
- return m_impl->lookup_table_page_up ();
-}
-
-bool
-PanelAgent::lookup_table_page_down (void)
-{
- return m_impl->lookup_table_page_down ();
-}
-
-bool
-PanelAgent::update_lookup_table_page_size (uint32 size)
-{
- return m_impl->update_lookup_table_page_size (size);
-}
-
-bool
-PanelAgent::update_candidate_item_layout (const std::vector<uint32> &row_items)
-{
- return m_impl->update_candidate_item_layout (row_items);
-}
-
-bool
-PanelAgent::select_associate (uint32 item)
-{
- return m_impl->select_associate (item);
-}
-
-bool
-PanelAgent::associate_table_page_up (void)
-{
- return m_impl->associate_table_page_up ();
-}
-
-bool
-PanelAgent::associate_table_page_down (void)
-{
- return m_impl->associate_table_page_down ();
-}
-
-bool
-PanelAgent::update_associate_table_page_size (uint32 size)
-{
- return m_impl->update_associate_table_page_size (size);
-}
-
-bool
-PanelAgent::update_displayed_candidate_number (uint32 size)
-{
- return m_impl->update_displayed_candidate_number (size);
-}
-
-void
-PanelAgent::send_longpress_event (int type, int index)
-{
- m_impl->send_longpress_event (type, index);
-}
-
-bool
-PanelAgent::trigger_property (const String &property)
-{
- return m_impl->trigger_property (property);
-}
-
-bool
-PanelAgent::trigger_helper_property (int client,
- const String &property)
-{
- return m_impl->trigger_helper_property (client, property);
-}
-
-bool
-PanelAgent::start_helper (const String &uuid)
-{
- return m_impl->start_helper (uuid, -2, 0);
-}
-
-bool
-PanelAgent::stop_helper (const String &uuid)
-{
- return m_impl->stop_helper (uuid, -2, 0);
-}
-
-void
-PanelAgent::set_default_ise (const DEFAULT_ISE_T &ise)
-{
- m_impl->set_default_ise (ise);
-}
-
-void
-PanelAgent::set_should_shared_ise (const bool should_shared_ise)
-{
- m_impl->set_should_shared_ise (should_shared_ise);
-}
-
-bool
-PanelAgent::reset_keyboard_ise (void) const
-{
- return m_impl->reset_keyboard_ise ();
-}
-
-int
-PanelAgent::get_active_ise_list (std::vector<String> &strlist)
-{
- return m_impl->get_active_ise_list (strlist);
-}
-
-int
-PanelAgent::get_helper_manager_id (void)
-{
- return m_impl->get_helper_manager_id ();
-}
-
-bool
-PanelAgent::has_helper_manager_pending_event (void)
-{
- return m_impl->has_helper_manager_pending_event ();
-}
-
-bool
-PanelAgent::filter_helper_manager_event (void)
-{
- return m_impl->filter_helper_manager_event ();
-}
-
-int
-PanelAgent::send_display_name (String &name)
-{
- return m_impl->send_display_name (name);
-}
-
-bool
-PanelAgent::reload_config (void)
-{
- return m_impl->reload_config ();
-}
-
-bool
-PanelAgent::exit (void)
-{
- return m_impl->exit ();
-}
-
-bool
-PanelAgent::filter_event (int fd)
-{
- return m_impl->filter_event (fd);
-}
-
-bool
-PanelAgent::filter_exception_event (int fd)
-{
- return m_impl->filter_exception_event (fd);
-}
-
-int
-PanelAgent::get_server_id (void)
-{
- return m_impl->get_server_id ();
-}
-
-void
-PanelAgent::update_ise_list (std::vector<String> &strList)
-{
- m_impl->update_ise_list (strList);
-}
-
-Connection
-PanelAgent::signal_connect_reload_config (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_reload_config (slot);
-}
-
-Connection
-PanelAgent::signal_connect_turn_on (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_turn_on (slot);
-}
-
-Connection
-PanelAgent::signal_connect_turn_off (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_turn_off (slot);
-}
-
-Connection
-PanelAgent::signal_connect_show_panel (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_show_panel (slot);
-}
-
-Connection
-PanelAgent::signal_connect_hide_panel (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_hide_panel (slot);
-}
-
-Connection
-PanelAgent::signal_connect_update_screen (PanelAgentSlotInt *slot)
-{
- return m_impl->signal_connect_update_screen (slot);
-}
-
-Connection
-PanelAgent::signal_connect_update_spot_location (PanelAgentSlotIntIntInt *slot)
-{
- return m_impl->signal_connect_update_spot_location (slot);
-}
-
-Connection
-PanelAgent::signal_connect_update_factory_info (PanelAgentSlotFactoryInfo *slot)
-{
- return m_impl->signal_connect_update_factory_info (slot);
-}
-
-Connection
-PanelAgent::signal_connect_start_default_ise (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_start_default_ise (slot);
-}
-
-Connection
-PanelAgent::signal_connect_stop_default_ise (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_stop_default_ise (slot);
-}
-
-Connection
-PanelAgent::signal_connect_set_candidate_ui (PanelAgentSlotIntInt *slot)
-{
- return m_impl->signal_connect_set_candidate_ui (slot);
-}
-
-Connection
-PanelAgent::signal_connect_get_candidate_ui (PanelAgentSlotIntInt2 *slot)
-{
- return m_impl->signal_connect_get_candidate_ui (slot);
-}
-
-Connection
-PanelAgent::signal_connect_set_candidate_position (PanelAgentSlotIntInt *slot)
-{
- return m_impl->signal_connect_set_candidate_position (slot);
-}
-
-Connection
-PanelAgent::signal_connect_get_candidate_geometry (PanelAgentSlotRect *slot)
-{
- return m_impl->signal_connect_get_candidate_geometry (slot);
-}
-
-Connection
-PanelAgent::signal_connect_get_input_panel_geometry (PanelAgentSlotRect *slot)
-{
- return m_impl->signal_connect_get_input_panel_geometry (slot);
-}
-
-Connection
-PanelAgent::signal_connect_set_keyboard_ise (PanelAgentSlotString *slot)
-{
- return m_impl->signal_connect_set_keyboard_ise (slot);
-}
-
-Connection
-PanelAgent::signal_connect_get_keyboard_ise (PanelAgentSlotString2 *slot)
-{
- return m_impl->signal_connect_get_keyboard_ise (slot);
-}
-
-Connection
-PanelAgent::signal_connect_show_help (PanelAgentSlotString *slot)
-{
- return m_impl->signal_connect_show_help (slot);
-}
-
-Connection
-PanelAgent::signal_connect_show_factory_menu (PanelAgentSlotFactoryInfoVector *slot)
-{
- return m_impl->signal_connect_show_factory_menu (slot);
-}
-
-Connection
-PanelAgent::signal_connect_show_preedit_string (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_show_preedit_string (slot);
-}
-
-Connection
-PanelAgent::signal_connect_show_aux_string (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_show_aux_string (slot);
-}
-
-Connection
-PanelAgent::signal_connect_show_lookup_table (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_show_lookup_table (slot);
-}
-
-Connection
-PanelAgent::signal_connect_show_associate_table (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_show_associate_table (slot);
-}
-
-Connection
-PanelAgent::signal_connect_hide_preedit_string (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_hide_preedit_string (slot);
-}
-
-Connection
-PanelAgent::signal_connect_hide_aux_string (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_hide_aux_string (slot);
-}
-
-Connection
-PanelAgent::signal_connect_hide_lookup_table (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_hide_lookup_table (slot);
-}
-
-Connection
-PanelAgent::signal_connect_hide_associate_table (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_hide_associate_table (slot);
-}
-
-Connection
-PanelAgent::signal_connect_update_preedit_string (PanelAgentSlotAttributeStringInt *slot)
-{
- return m_impl->signal_connect_update_preedit_string (slot);
-}
-
-Connection
-PanelAgent::signal_connect_update_preedit_caret (PanelAgentSlotInt *slot)
-{
- return m_impl->signal_connect_update_preedit_caret (slot);
-}
-
-Connection
-PanelAgent::signal_connect_update_aux_string (PanelAgentSlotAttributeString *slot)
-{
- return m_impl->signal_connect_update_aux_string (slot);
-}
-
-Connection
-PanelAgent::signal_connect_update_lookup_table (PanelAgentSlotLookupTable *slot)
-{
- return m_impl->signal_connect_update_lookup_table (slot);
-}
-
-Connection
-PanelAgent::signal_connect_update_associate_table (PanelAgentSlotLookupTable *slot)
-{
- return m_impl->signal_connect_update_associate_table (slot);
-}
-
-Connection
-PanelAgent::signal_connect_register_properties (PanelAgentSlotPropertyList *slot)
-{
- return m_impl->signal_connect_register_properties (slot);
-}
-
-Connection
-PanelAgent::signal_connect_update_property (PanelAgentSlotProperty *slot)
-{
- return m_impl->signal_connect_update_property (slot);
-}
-
-Connection
-PanelAgent::signal_connect_register_helper_properties (PanelAgentSlotIntPropertyList *slot)
-{
- return m_impl->signal_connect_register_helper_properties (slot);
-}
-
-Connection
-PanelAgent::signal_connect_update_helper_property (PanelAgentSlotIntProperty *slot)
-{
- return m_impl->signal_connect_update_helper_property (slot);
-}
-
-Connection
-PanelAgent::signal_connect_register_helper (PanelAgentSlotIntHelperInfo *slot)
-{
- return m_impl->signal_connect_register_helper (slot);
-}
-
-Connection
-PanelAgent::signal_connect_remove_helper (PanelAgentSlotInt *slot)
-{
- return m_impl->signal_connect_remove_helper (slot);
-}
-
-Connection
-PanelAgent::signal_connect_set_active_ise_by_uuid (PanelAgentSlotStringBool *slot)
-{
- return m_impl->signal_connect_set_active_ise_by_uuid (slot);
-}
-
-Connection
-PanelAgent::signal_connect_focus_in (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_focus_in (slot);
-}
-
-Connection
-PanelAgent::signal_connect_focus_out (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_focus_out (slot);
-}
-
-Connection
-PanelAgent::signal_connect_expand_candidate (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_expand_candidate (slot);
-}
-
-Connection
-PanelAgent::signal_connect_contract_candidate (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_contract_candidate (slot);
-}
-
-Connection
-PanelAgent::signal_connect_select_candidate (PanelAgentSlotInt *slot)
-{
- return m_impl->signal_connect_select_candidate (slot);
-}
-
-Connection
-PanelAgent::signal_connect_get_ise_list (PanelAgentSlotBoolStringVector *slot)
-{
- return m_impl->signal_connect_get_ise_list (slot);
-}
-
-Connection
-PanelAgent::signal_connect_get_all_helper_ise_info (PanelAgentSlotBoolHelperInfo *slot)
-{
- return m_impl->signal_connect_get_all_helper_ise_info (slot);
-}
-
-Connection
-PanelAgent::signal_connect_set_has_option_helper_ise_info (PanelAgentSlotStringBool *slot)
-{
- return m_impl->signal_connect_set_has_option_helper_ise_info (slot);
-}
-
-Connection
-PanelAgent::signal_connect_set_enable_helper_ise_info (PanelAgentSlotStringBool *slot)
-{
- return m_impl->signal_connect_set_enable_helper_ise_info (slot);
-}
-
-Connection
-PanelAgent::signal_connect_show_helper_ise_list (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_show_helper_ise_list (slot);
-}
-
-Connection
-PanelAgent::signal_connect_show_helper_ise_selector (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_show_helper_ise_selector (slot);
-}
-
-Connection
-PanelAgent::signal_connect_is_helper_ise_enabled (PanelAgentSlotStringInt *slot)
-{
- return m_impl->signal_connect_is_helper_ise_enabled (slot);
-}
-
-Connection
-PanelAgent::signal_connect_get_ise_information (PanelAgentSlotBoolString4int2 *slot)
-{
- return m_impl->signal_connect_get_ise_information (slot);
-}
-
-Connection
-PanelAgent::signal_connect_get_keyboard_ise_list (PanelAgentSlotBoolStringVector *slot)
-{
- return m_impl->signal_connect_get_keyboard_ise_list (slot);
-}
-
-Connection
-PanelAgent::signal_connect_update_ise_geometry (PanelAgentSlotIntIntIntInt *slot)
-{
- return m_impl->signal_connect_update_ise_geometry (slot);
-}
-
-Connection
-PanelAgent::signal_connect_get_language_list (PanelAgentSlotStringVector *slot)
-{
- return m_impl->signal_connect_get_language_list (slot);
-}
-
-Connection
-PanelAgent::signal_connect_get_all_language (PanelAgentSlotStringVector *slot)
-{
- return m_impl->signal_connect_get_all_language (slot);
-}
-
-Connection
-PanelAgent::signal_connect_get_ise_language (PanelAgentSlotStrStringVector *slot)
-{
- return m_impl->signal_connect_get_ise_language (slot);
-}
-
-Connection
-PanelAgent::signal_connect_get_ise_info_by_uuid (PanelAgentSlotStringISEINFO *slot)
-{
- return m_impl->signal_connect_get_ise_info_by_uuid (slot);
-}
-
-Connection
-PanelAgent::signal_connect_send_key_event (PanelAgentSlotKeyEvent *slot)
-{
- return m_impl->signal_connect_send_key_event (slot);
-}
-
-Connection
-PanelAgent::signal_connect_accept_connection (PanelAgentSlotInt *slot)
-{
- return m_impl->signal_connect_accept_connection (slot);
-}
-
-Connection
-PanelAgent::signal_connect_close_connection (PanelAgentSlotInt *slot)
-{
- return m_impl->signal_connect_close_connection (slot);
-}
-
-Connection
-PanelAgent::signal_connect_exit (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_exit (slot);
-}
-
-Connection
-PanelAgent::signal_connect_transaction_start (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_transaction_start (slot);
-}
-
-Connection
-PanelAgent::signal_connect_transaction_end (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_transaction_end (slot);
-}
-
-Connection
-PanelAgent::signal_connect_lock (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_lock (slot);
-}
-
-Connection
-PanelAgent::signal_connect_unlock (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_unlock (slot);
-}
-
-Connection
-PanelAgent::signal_connect_update_input_context (PanelAgentSlotIntInt *slot)
-{
- return m_impl->signal_connect_update_input_context (slot);
-}
-
-Connection
-PanelAgent::signal_connect_show_ise (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_show_ise (slot);
-}
-
-Connection
-PanelAgent::signal_connect_hide_ise (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_hide_ise (slot);
-}
-
-Connection
-PanelAgent::signal_connect_will_show_ack (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_will_show_ack (slot);
-}
-
-Connection
-PanelAgent::signal_connect_will_hide_ack (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_will_hide_ack (slot);
-}
-
-Connection
-PanelAgent::signal_connect_set_keyboard_mode (PanelAgentSlotInt *slot)
-{
- return m_impl->signal_connect_set_keyboard_mode (slot);
-}
-
-Connection
-PanelAgent::signal_connect_candidate_will_hide_ack (PanelAgentSlotVoid *slot)
-{
- return m_impl->signal_connect_candidate_will_hide_ack (slot);
-}
-
-Connection
-PanelAgent::signal_connect_get_ise_state (PanelAgentSlotInt2 *slot)
-{
- return m_impl->signal_connect_get_ise_state (slot);
-}
-
-Connection
-PanelAgent::signal_connect_get_recent_ise_geometry (PanelAgentSlotIntRect *slot)
-{
- return m_impl->signal_connect_get_recent_ise_geometry (slot);
-}
-
-Connection
-PanelAgent::signal_connect_check_privilege_by_sockfd (PanelAgentSlotIntString2 *slot)
-{
- return m_impl->signal_connect_check_privilege_by_sockfd (slot);
-}
-} /* namespace scim */
-
-/*
-vi:ts=4:nowrap:ai:expandtab
-*/
-
#include <unistd.h>
#include <string.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+# undef LOG_TAG
+#endif
+#define LOG_TAG "ISF_PANEL_CLIENT"
+
namespace scim {
typedef Signal1<void, int>
int cmd;
uint32 context = (uint32)(-1);
- if (!recv.get_command (cmd) || cmd != SCIM_TRANS_CMD_REPLY)
+ if (!recv.get_command (cmd) || cmd != SCIM_TRANS_CMD_REPLY) {
+ LOGW ("wrong format of transaction");
return true;
+ }
/* No context id available, so there will be some global command. */
if (recv.get_data_type () == SCIM_TRANS_DATA_COMMAND) {
}
/* Now for context related command. */
- if (!recv.get_data (context))
+ if (!recv.get_data (context)) {
+ LOGW ("wrong format of transaction");
return true;
+ }
while (recv.get_command (cmd)) {
switch (cmd) {
std::vector<uint32> row_items;
if (recv.get_data (row_items))
m_signal_update_candidate_item_layout ((int) context, row_items);
+ else
+ LOGW("wrong format of transaction");
}
break;
case SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE_PAGE_SIZE:
uint32 size;
if (recv.get_data (size))
m_signal_update_lookup_table_page_size ((int) context, (int) size);
+ else
+ LOGW("wrong format of transaction");
}
break;
case SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_UP:
String property;
if (recv.get_data (property))
m_signal_trigger_property ((int) context, property);
+ else
+ LOGW("wrong format of transaction");
}
break;
case SCIM_TRANS_CMD_PROCESS_HELPER_EVENT:
Transaction trans;
if (recv.get_data (target_uuid) && recv.get_data (helper_uuid) && recv.get_data (trans))
m_signal_process_helper_event ((int) context, target_uuid, helper_uuid, trans);
+ else
+ LOGW("wrong format of transaction");
}
break;
case SCIM_TRANS_CMD_MOVE_PREEDIT_CARET:
uint32 caret;
if (recv.get_data (caret))
m_signal_move_preedit_caret ((int) context, (int) caret);
+ else
+ LOGW("wrong format of transaction");
}
break;
case ISM_TRANS_CMD_SELECT_AUX:
uint32 item;
if (recv.get_data (item))
m_signal_select_aux ((int) context, (int) item);
+ else
+ LOGW("wrong format of transaction");
}
break;
case SCIM_TRANS_CMD_SELECT_CANDIDATE:
uint32 item;
if (recv.get_data (item))
m_signal_select_candidate ((int) context, (int) item);
+ else
+ LOGW("wrong format of transaction");
}
break;
case SCIM_TRANS_CMD_PROCESS_KEY_EVENT:
KeyEvent key;
if (recv.get_data (key))
m_signal_process_key_event ((int) context, key);
+ else
+ LOGW("wrong format of transaction");
}
break;
case SCIM_TRANS_CMD_COMMIT_STRING:
WideString wstr;
if (recv.get_data (wstr))
m_signal_commit_string ((int) context, wstr);
+ else
+ LOGW("wrong format of transaction");
}
break;
case SCIM_TRANS_CMD_FORWARD_KEY_EVENT:
KeyEvent key;
if (recv.get_data (key))
m_signal_forward_key_event ((int) context, key);
+ else
+ LOGW("wrong format of transaction");
}
break;
case SCIM_TRANS_CMD_PANEL_REQUEST_HELP:
String sfid;
if (recv.get_data (sfid))
m_signal_change_factory ((int) context, sfid);
+ else
+ LOGW("wrong format of transaction");
}
break;
case ISM_TRANS_CMD_PANEL_RESET_KEYBOARD_ISE:
if (recv.get_data (wstr) && recv.get_data (attrs)
&& recv.get_data (caret))
m_signal_update_preedit_string ((int) context, wstr, attrs, (int)caret);
+ else
+ LOGW("wrong format of transaction");
}
break;
case SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET:
uint32 caret;
if (recv.get_data (caret))
m_signal_update_preedit_caret ((int) context, (int) caret);
+ else
+ LOGW("wrong format of transaction");
}
break;
case ISM_TRANS_CMD_TURN_ON_LOG:
DebugOutput::set_verbose_level (0);
}
}
+ else
+ LOGW("wrong format of transaction");
}
break;
case SCIM_TRANS_CMD_GET_SURROUNDING_TEXT:
uint32 maxlen_after;
if (recv.get_data (maxlen_before) && recv.get_data (maxlen_after))
m_signal_get_surrounding_text ((int) context, (int)maxlen_before, (int)maxlen_after);
+ else
+ LOGW("wrong format of transaction");
}
break;
case SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT:
uint32 len;
if (recv.get_data (offset) && recv.get_data (len))
m_signal_delete_surrounding_text ((int) context, (int)offset, (int)len);
+ else
+ LOGW("wrong format of transaction");
}
break;
case SCIM_TRANS_CMD_GET_SELECTION:
uint32 end;
if (recv.get_data (start) && recv.get_data (end))
m_signal_set_selection ((int) context, (int)start, (int)end);
+ else
+ LOGW("wrong format of transaction");
}
break;
case ISM_TRANS_CMD_UPDATE_DISPLAYED_CANDIDATE:
uint32 number;
if (recv.get_data (number))
m_signal_update_displayed_candidate_number ((int) context, (int)number);
+ else
+ LOGW("wrong format of transaction");
}
break;
case ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_SHOW:
uint32 index;
if (recv.get_data (index))
m_signal_longpress_candidate ((int) context, (int)index);
+ else
+ LOGW("wrong format of transaction");
}
break;
case ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT:
uint32 type, value;
if (recv.get_data (type) && recv.get_data (value))
m_signal_update_ise_input_context ((int) context, (int)type, (int)value);
+ else
+ LOGW("wrong format of transaction");
}
break;
case ISM_TRANS_CMD_UPDATE_ISF_CANDIDATE_PANEL:
uint32 type, value;
if (recv.get_data (type) && recv.get_data (value))
m_signal_update_isf_candidate_panel ((int) context, (int)type, (int)value);
+ else
+ LOGW("wrong format of transaction");
}
break;
case SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND:
String str;
if (recv.get_data (str))
m_signal_send_private_command ((int) context, str);
+ else
+ LOGW("wrong format of transaction");
}
break;
default:
- break;
+ {
+ LOGW("unknow cmd: %d", cmd);
+ break;
+ }
}
}
return true;
trans.put_command (SCIM_TRANS_CMD_OK);
if (trans.write_to_socket (socket))
return true;
+ else
+ LOGW ("write_to_socket() failed");
} else {
- LOGW ("read_from_socket() failed %d\n", timeout);
+ LOGW ("read_from_socket() failed %d", timeout);
trans.clear ();
trans.put_command (SCIM_TRANS_CMD_REPLY);
trans.write_to_socket (socket);
}
} else {
- LOGW ("write_to_socket() failed\n");
+ LOGW ("write_to_socket() failed");
}
return false;
// Client is ok, return the client type.
return (client_type == "ConnectionTester") ? String ("") : client_type;
+ } else {
+ LOGW ("write_to_socket() failed");
}
+ } else {
+ LOGW ("wrong format of SCIM_TRANS_CMD_OPEN_CONNECTION transaction");
}
+ } else {
+ LOGW ("read_from_socket() failed %d", timeout);
}
return String ("");
}
--disable-filter-sctc \
%if %{with wayland}
--disable-efl-immodule \
-%else
- --disable-wsc-efl \
%endif
--disable-frontend-x11 \
--disable-multiwindow-support \
mkdir -p %{buildroot}/opt/apps/scim/lib/scim-1.0/1.4.0/Helper
mkdir -p %{buildroot}/opt/apps/scim/lib/scim-1.0/1.4.0/SetupUI
mkdir -p %{buildroot}/opt/apps/scim/lib/scim-1.0/1.4.0/IMEngine
-
+mkdir -p %{buildroot}/opt/apps/scim/lib/scim-1.0/1.4.0/PanelAgent
%find_lang scim
cat scim.lang > isf.lang
%dir /opt/apps/scim/lib/scim-1.0/1.4.0/Helper
%dir /opt/apps/scim/lib/scim-1.0/1.4.0/SetupUI
%dir /opt/apps/scim/lib/scim-1.0/1.4.0/IMEngine
+%dir /opt/apps/scim/lib/scim-1.0/1.4.0/PanelAgent
%dir /etc/scim/conf
%{_prefix}/lib/systemd/user/default.target.wants/scim.path
%{_prefix}/lib/systemd/user/scim.service
%{_optexecdir}/isf-demo-efl
%{_bindir}/isf-panel-efl
%if %{with wayland}
-%{_bindir}/isf-wsc-efl
+
%else
%{_libdir}/ecore_imf/modules/*/*/*.so
%endif
%{_bindir}/scim
%{_bindir}/isf-log
%{_libdir}/scim-1.0/1.4.0/IMEngine/socket.so
+%{_libdir}/scim-1.0/1.4.0/PanelAgent/*.so
%{_libdir}/scim-1.0/1.4.0/Config/simple.so
%{_libdir}/scim-1.0/1.4.0/Config/socket.so
%{_libdir}/scim-1.0/1.4.0/FrontEnd/*.so
Description=Start the input service framework panel
[Service]
-ExecStart=/usr/bin/isf-wsc-efl
+ExecStart=/usr/bin/isf-panel-efl
Environment="DISPLAY=:0.0" "HOME=%h" USE_OZONE_WAYLAND_VKB=1 OZONE_WAYLAND_USE_XDG_SHELL='defined'
EnvironmentFile=/run/tizen-system-env
Restart=always