#include "scim_private.h"
#include "scim.h"
#include "scim_stl_map.h"
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
#include <Ecore_X.h>
#endif
-#if HAVE_X
+#ifdef HAVE_X
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#endif
-#if HAVE_ECOREWL
+#ifdef HAVE_ECOREWL
#include <Ecore_Wayland.h>
#endif
#include <Elementary.h>
-#if HAVE_VCONF
+#ifdef HAVE_VCONF
#include <vconf.h>
#include <vconf-keys.h>
#endif
#include <notification.h>
#include <notification_internal.h>
#endif
-#if HAVE_TTS
+#ifdef HAVE_TTS
#include <tts.h>
#endif
#include <E_DBus.h>
-#if HAVE_FEEDBACK
+#ifdef HAVE_FEEDBACK
#include <feedback.h>
#endif
-#if HAVE_BLUETOOTH
+#ifdef HAVE_BLUETOOTH
#include <bluetooth.h>
#endif
-#if HAVE_PKGMGR_INFO
+#ifdef HAVE_PKGMGR_INFO
#include <package_manager.h>
#include <pkgmgr-info.h>
#endif
/////////////////////////////////////////////////////////////////////////////
static Evas_Object *efl_create_window (const char *strWinName, const char *strEffect);
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
static void efl_set_transient_for_app_window (Ecore_X_Window window);
#endif
static int efl_get_app_window_angle (void);
static int efl_get_ise_window_angle (void);
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
static int efl_get_quickpanel_window_angle (void);
#endif
static void slot_recv_remote_surrounding_text (int cursor, const String &text);
#endif
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
static Eina_Bool efl_create_control_window (void);
static Ecore_X_Window efl_get_app_window (void);
static Ecore_X_Window efl_get_quickpanel_window (void);
static Ecore_Timer *_check_size_timer = NULL;
static Ecore_Timer *_longpress_timer = NULL;
static Ecore_Timer *_destroy_timer = NULL;
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
static Ecore_Timer *_off_prepare_done_timer = NULL;
#endif
static Ecore_Timer *_candidate_hide_timer = NULL;
static Ecore_Timer *_ise_hide_timer = NULL;
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
static Ecore_X_Window _ise_window = 0;
static Ecore_X_Window _app_window = 0;
static Ecore_X_Window _control_window = 0;
static Ecore_X_Window _input_win = 0;
#endif
-#if HAVE_PKGMGR_INFO
+#ifdef HAVE_PKGMGR_INFO
static package_manager_h pkgmgr = NULL;
static VectorPairStringUint32 g_pkgids_to_be_uninstalled;
static Ecore_Timer *g_release_uninstalled_ime_info_timer = NULL;
static NotificationData ise_selector_module_noti = {"Select input method", NULL, ISF_ISE_SELECTOR_ICON_FILE, "", 0};
#endif
-#if HAVE_TTS
+#ifdef HAVE_TTS
static tts_h _tts = NULL;
#endif
-#if HAVE_FEEDBACK
+#ifdef HAVE_FEEDBACK
static bool feedback_initialized = false;
#endif
static bool launch_remote_input = false;
#endif
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
static Ecore_Event_Handler *_candidate_show_handler = NULL;
#endif
static struct GeometryCache _portrait_recent_ise_geometry = {0, 0, {0, 0, 0, 0}};
static struct GeometryCache _landscape_recent_ise_geometry = {0, 0, {0, 0, 0, 0}};
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
static void get_input_window (void)
{
int win_ret = -1;
struct rectinfo info = {0, 0, 0, 0};
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
int w = 0, h = 0;
Ecore_X_Window gnb_win = efl_get_global_navigation_window ();
if (gnb_win > 0)
int win_w = _screen_width, win_h = _screen_height;
int angle = (_ise_angle == -1) ? efl_get_app_window_angle () : _ise_angle;
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/* The height of global navigation bar */
int gnb_height = h;
}
} else {
/* READ ISE's SIZE HINT HERE */
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/*
int pos_x, pos_y, width, height;
if (ecore_x_e_window_rotation_geometry_get (_ise_window, angle,
return info;
}
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/**
* @brief Set keyboard geometry for autoscroll.
* This includes the ISE geometry together with candidate window
}
}
-#if HAVE_PKGMGR_INFO
+#ifdef HAVE_PKGMGR_INFO
/**
* @brief Insert or update ime_info data with pkgid.
*
_config->reload ();
_info_manager->reload_config ();
-#if HAVE_VCONF
+#ifdef HAVE_VCONF
vconf_set_str (VCONFKEY_ISF_ACTIVE_KEYBOARD_UUID, uuid.c_str ());
#endif
}
(_ise_height > 0 && (_candidate_height - height) > _ise_height) ||
((_candidate_angle == 90 || _candidate_angle == 270) && (_ise_width < _screen_height)) ||
((_candidate_angle == 0 || _candidate_angle == 180) && (_ise_width > _screen_width ))) {
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
set_keyboard_geometry_atom_info (_app_window, get_ise_geometry ());
#endif
_info_manager->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
LOGD ("window_rotation_geometry_set (_candidate_window), port (%d, %d), land (%d, %d)\n",
port_width, port_height, land_width, land_height);
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/*
ecore_x_e_window_rotation_geometry_set (elm_win_xwindow_get (_candidate_window),
0, 0, 0, port_width, port_height);
int x = 0, y = 0, width = 0, height = 0;
/* Get candidate window size */
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/*
if (_candidate_angle == 90 || _candidate_angle == 270) {
ecore_x_e_window_rotation_geometry_get (elm_win_xwindow_get (_candidate_window), _candidate_angle,
return ECORE_CALLBACK_CANCEL;
}
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/**
* @brief Callback function for off_prepare_done.
*
return ECORE_CALLBACK_CANCEL;
}
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/**
* @brief Delete candidate show handler.
*
_candidate_state = WINDOW_STATE_WILL_SHOW;
}
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
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
}
if (_candidate_state != WINDOW_STATE_SHOW) {
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
if (_candidate_show_handler) {
LOGD ("Was still waiting for CANDIDATE_WINDOW_SHOW....\n");
} else {
if (_candidate_mode == FIXED_CANDIDATE_WINDOW) {
_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
+#ifdef HAVE_ECOREX
if (_ise_state == WINDOW_STATE_SHOW) {
set_keyboard_geometry_atom_info (_app_window, get_ise_geometry ());
} else {
if (_click_object == ISF_EFL_CANDIDATE_0 || _click_object == ISF_EFL_CANDIDATE_ITEMS) {
int index = GPOINTER_TO_INT (data) >> 8;
-#if HAVE_FEEDBACK
+#ifdef HAVE_FEEDBACK
if (feedback_initialized) {
int feedback_result = 0;
bool sound_feedback = _config->read (SCIM_GLOBAL_CONFIG_PANEL_SOUND_FEEDBACK, false);
}
}
-#if HAVE_TTS
+#ifdef HAVE_TTS
/**
* @brief Open TTS device.
*
_wait_stop_event = false;
}
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/**
* @brief Mouse over (find focus object and play text by TTS) when screen reader is enabled.
*
/* FIXME: Should consider emoji case */
String mbs = utf8_wcstombs (g_isf_candidate_table.get_candidate_in_current_page (i));
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << " play candidate string: " << mbs << "\n";
-#if HAVE_TTS
+#ifdef HAVE_TTS
ui_play_tts (mbs.c_str ());
#endif
_candidate_tts_focus_index = i;
ui_tts_focus_rect_show (x, y, width, height);
}
}
-#if HAVE_TTS
+#ifdef HAVE_TTS
if (strTts.length () > 0)
ui_play_tts (strTts.c_str ());
#endif
_candidate_width = _candidate_port_width;
_candidate_height = _candidate_port_height_min;
}
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/*
ecore_x_e_window_rotation_geometry_set (elm_win_xwindow_get (_candidate_window),
0, 0, 0, _candidate_port_width, _candidate_port_height_min);
ui_create_native_candidate_window ();
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
unsigned int set = 1;
ecore_x_window_prop_card32_set (elm_win_xwindow_get (_candidate_window),
/* Get candidate window position */
ecore_evas_geometry_get (ecore_evas_ecore_evas_get (evas_object_evas_get (_candidate_window)), &x, &y, &width, &height);
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/*
int pos_x = 0, pos_y = 0;
if (_candidate_angle == 90 || _candidate_angle == 270)
_soft_candidate_width = width;
_soft_candidate_height = height;
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
set_keyboard_geometry_atom_info (_app_window, get_ise_geometry());
#endif
_info_manager->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
//////////////////////////////////////////////////////////////////////
// End of Candidate Functions
//////////////////////////////////////////////////////////////////////
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/**
* @brief Set transient for app window.
*
static int efl_get_app_window_angle ()
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
return efl_get_window_rotate_angle (efl_get_app_window ());
#else
//FIXME:
static int efl_get_ise_window_angle ()
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
return efl_get_window_rotate_angle (_ise_window);
#else
//FIXME:
#endif
}
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/**
* @brief Get angle of quickpanel window.
*
static void efl_set_showing_effect_for_app_window (Evas_Object *win, const char* strEffect)
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
ecore_x_icccm_name_class_set (elm_win_xwindow_get (static_cast<Evas_Object*>(win)), strEffect, "ISF");
#endif
}
return win;
}
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/**
* @brief Create elementary control window.
*
static Evas_Coord scr_w = 0, scr_h = 0;
if (scr_w == 0 || scr_h == 0) {
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
uint w = 0, h = 0;
if (efl_get_default_zone_geometry_info (ecore_x_window_root_first_get (), NULL, NULL, &w, &h)) {
scr_w = w;
_updated_hide_state_geometry = false;
}
_ise_angle = -1;
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
ecore_x_event_mask_unset (_app_window, ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE);
#endif
if (_candidate_window) {
}
}
-#if HAVE_VCONF
+#ifdef HAVE_VCONF
char *lang_str = vconf_get_str (VCONFKEY_LANGSET);
if (lang_str) {
if (_ime_info.size () > 0 && _ime_info[0].display_lang.compare(lang_str) == 0)
}
-#if HAVE_PKGMGR_INFO
+#ifdef HAVE_PKGMGR_INFO
if (!pkgmgr) {
int ret = package_manager_create (&pkgmgr);
if (ret == PACKAGE_MANAGER_ERROR_NONE) {
_ise_reported_geometry.geometry.width = width;
_ise_reported_geometry.geometry.height = height;
if (_ise_state == WINDOW_STATE_SHOW) {
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
set_keyboard_geometry_atom_info (_app_window, _ise_reported_geometry.geometry);
#endif
_info_manager->update_input_panel_event (ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, 0);
if (_candidate_window == NULL)
ui_create_candidate_window ();
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
if (_candidate_state == WINDOW_STATE_SHOW &&
(_candidate_area_1_visible || _candidate_area_2_visible)) {
efl_set_transient_for_app_window (elm_win_xwindow_get (_candidate_window));
ui_settle_candidate_window ();
ui_candidate_delete_destroy_timer ();
-#if HAVE_FEEDBACK
+#ifdef HAVE_FEEDBACK
int feedback_result = feedback_initialize ();
if (FEEDBACK_ERROR_NONE == feedback_result) {
ui_settle_candidate_window ();
}
-#if HAVE_FEEDBACK
+#ifdef HAVE_FEEDBACK
int feedback_result = feedback_deinitialize ();
if (FEEDBACK_ERROR_NONE == feedback_result)
bool invalid = false;
-#if HAVE_PKGMGR_INFO
+#ifdef HAVE_PKGMGR_INFO
/* When changing the active (default) keyboard, initialize ime_info DB if appid is invalid.
This may be necessary if IME packages are changed while panel process is terminated. */
pkgmgrinfo_appinfo_h handle = NULL;
}
}
-#if HAVE_PKGMGR_INFO
+#ifdef HAVE_PKGMGR_INFO
/**
* @brief Finds appid with specific category
*
int ret;
app_control_h app_control;
char *app_id = NULL;
-#if HAVE_PKGMGR_INFO
+#ifdef HAVE_PKGMGR_INFO
pkgmgrinfo_appinfo_filter_h handle;
if (ime_list_app.length() < 1) {
int ret;
app_control_h app_control;
char *app_id = NULL;
-#if HAVE_PKGMGR_INFO
+#ifdef HAVE_PKGMGR_INFO
pkgmgrinfo_appinfo_filter_h handle;
if (ime_selector_app.length() < 1) {
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
get_input_window ();
#endif
}
static void slot_register_helper_properties (int id, const PropertyList &props)
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/* WMSYNC, #2 Receiving X window ID from ISE */
/* FIXME : We should add an API to set window id of ISE */
Property prop = props[0];
LOGD ("slot_show_ise ()\n");
delete_ise_hide_timer ();
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/* 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 ();
static void slot_will_hide_ack (void)
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/* WMSYNC, #8 Let the Window Manager to actually hide keyboard window */
// WILL_HIDE_REQUEST_DONE Ack to WM
Ecore_X_Window root_window = ecore_x_window_root_get (_control_window);
static void slot_candidate_will_hide_ack (void)
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
LOGD ("candidate_will_hide_ack\n");
if (_candidate_state == WINDOW_STATE_WILL_HIDE) {
candidate_window_hide ();
String strDisplay = display;
String scim_helper_path;
-#if HAVE_PKGMGR_INFO
+#ifdef HAVE_PKGMGR_INFO
char *execpath = NULL;
int ret;
pkgmgrinfo_appinfo_h appinfo_handle;
elm_exit ();
}
-#if HAVE_VCONF
+#ifdef HAVE_VCONF
static void update_ise_locale ()
{
char *lang_str = vconf_get_str (VCONFKEY_LANGSET);
set_language_and_locale ();
bool need_to_init_db = false;
-#if HAVE_PKGMGR_INFO
+#ifdef HAVE_PKGMGR_INFO
int ret = 0;
bool exist = false;
char *label = NULL;
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
-#if HAVE_VCONF
+#ifdef HAVE_VCONF
char *lang_str = vconf_get_str (VCONFKEY_LANGSET);
if (lang_str) {
unsigned int val = 0;
#endif
-#if HAVE_VCONF
+#ifdef HAVE_VCONF
int input_detect = false;
#endif
_info_manager->stop_helper (helper_uuid);
_soft_keyboard_launched = false;
}
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
ecore_x_event_mask_set (efl_get_quickpanel_window (), ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
#endif
create_notification (&hwkbd_module_noti);
#endif
-#if HAVE_VCONF
+#ifdef HAVE_VCONF
vconf_get_bool (VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, &input_detect);
if (!input_detect) {
delete_notification (&hwkbd_module_noti);
#endif
-#if HAVE_VCONF
+#ifdef HAVE_VCONF
vconf_get_bool (VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, &input_detect);
if (input_detect) {
_config->reload ();
}
-#if HAVE_BLUETOOTH
+#ifdef HAVE_BLUETOOTH
/**
* @brief Callback function for the connection state of Bluetooth Keyboard
*
}
#endif
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/**
* @brief Callback function for ECORE_X_EVENT_WINDOW_PROPERTY.
*
_info_manager->update_input_panel_event (
ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_SHOW);
-#if HAVE_VCONF
+#ifdef HAVE_VCONF
vconf_set_int (VCONFKEY_ISF_INPUT_PANEL_STATE, VCONFKEY_ISF_INPUT_PANEL_STATE_SHOW);
#endif
ui_settle_candidate_window ();
}
-#if HAVE_VCONF
+#ifdef HAVE_VCONF
vconf_set_int (VCONFKEY_ISF_INPUT_PANEL_STATE, VCONFKEY_ISF_INPUT_PANEL_STATE_HIDE);
#endif
ui_tts_focus_rect_hide ();
}
-#if HAVE_TTS
+#ifdef HAVE_TTS
if (strTts.length () > 0)
ui_play_tts (strTts.c_str ());
#endif
Eina_Bool check_focus_out_by_popup_win ()
{
Eina_Bool ret = EINA_FALSE;
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
Ecore_X_Window focus_win = ecore_x_window_focus_get ();
Ecore_X_Window_Type win_type = ECORE_X_WINDOW_TYPE_UNKNOWN;
return ret;
}
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
/**
* @brief Callback function for focus out event of application window
*
String display_name = String ();
char buf[256] = {0};
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
Ecore_Event_Handler *xclient_message_handler = NULL;
Ecore_Event_Handler *xwindow_property_handler = NULL;
Ecore_Event_Handler *xwindow_focus_out_handler = NULL;
/* Connect the configuration reload signal. */
_config_connection = _config->signal_connect_reload (slot (config_reload_cb));
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
if (!efl_create_control_window ()) {
LOGW ("Failed to create control window\n");
goto cleanup;
set_language_and_locale ();
-#if HAVE_VCONF
+#ifdef HAVE_VCONF
/* Add callback function for input language and display language */
vconf_notify_key_changed (VCONFKEY_LANGSET, display_language_changed_cb, NULL);
vconf_notify_key_changed (VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, keyboard_mode_changed_cb, NULL);
} catch (scim::Exception & e) {
std::cerr << e.what () << "\n";
}
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
xclient_message_handler = ecore_event_handler_add (ECORE_X_EVENT_CLIENT_MESSAGE, x_event_client_message_cb, NULL);
xwindow_property_handler = ecore_event_handler_add (ECORE_X_EVENT_WINDOW_PROPERTY, x_event_window_property_cb, NULL);
xwindow_focus_out_handler = ecore_event_handler_add (ECORE_X_EVENT_WINDOW_FOCUS_OUT, x_event_window_focus_out_cb, NULL);
#endif
-#if HAVE_BLUETOOTH
+#ifdef HAVE_BLUETOOTH
/* Register the callback function of Bluetooth connection */
ret = bt_initialize ();
if (ret != BT_ERROR_NONE)
_config->flush ();
ret = 0;
-#if HAVE_BLUETOOTH
+#ifdef HAVE_BLUETOOTH
/* deinitialize the callback function of Bluetooth connection */
ret = bt_hid_host_deinitialize ();
if (ret != BT_ERROR_NONE)
LOGW ("bt_deinitialize failed: %d\n", ret);
#endif
-#if HAVE_ECOREX
+#ifdef HAVE_ECOREX
if (xclient_message_handler) {
ecore_event_handler_del (xclient_message_handler);
xclient_message_handler = NULL;
}
#endif
-#if HAVE_VCONF
+#ifdef HAVE_VCONF
/* Remove callback function for input language and display language */
vconf_ignore_key_changed (VCONFKEY_LANGSET, display_language_changed_cb);
vconf_ignore_key_changed (VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, keyboard_mode_changed_cb);
ui_candidate_delete_check_size_timer ();
ui_candidate_delete_longpress_timer ();
ui_candidate_delete_destroy_timer ();
-#if HAVE_PKGMGR_INFO
+#ifdef HAVE_PKGMGR_INFO
if (pkgmgr) {
package_manager_destroy (pkgmgr);
pkgmgr = NULL;
}
#endif
-#if HAVE_TTS
+#ifdef HAVE_TTS
ui_close_tts ();
#endif