}
/**
- * @brief Get app window's x window id.
+ * @brief Get an window's x window id.
*
- * @param win_obj The Evas_Object handler of app window.
+ * @param name the property name.
+ * @return X window id.
*/
-static Ecore_X_Window efl_get_app_window (void)
+static Ecore_X_Window efl_get_window (const char *name)
{
- SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
-
- /* Gets the current XID of the active window from the root window property */
+ /* Gets the XID of the window from the root window property */
int ret = 0;
Atom type_return;
int format_return;
unsigned long nitems_return;
unsigned long bytes_after_return;
unsigned char *data = NULL;
- Ecore_X_Window xAppWindow = 0;
+ Ecore_X_Window window = 0;
ret = XGetWindowProperty ((Display *)ecore_x_display_get (),
ecore_x_window_root_get (_control_window),
- ecore_x_atom_get ("_ISF_ACTIVE_WINDOW"),
+ ecore_x_atom_get (name),
0, G_MAXLONG, False, XA_WINDOW, &type_return,
&format_return, &nitems_return, &bytes_after_return,
&data);
if (ret == Success) {
if ((type_return == XA_WINDOW) && (format_return == 32) && (data)) {
- void *pvoid = data;
- xAppWindow = *(Window *)pvoid;
+ window = *(Window *)data;
if (data)
XFree (data);
}
std::cerr << "XGetWindowProperty () is failed!!!\n";
}
- return xAppWindow;
+ return window;
}
/**
- * @brief Get clipboard window's x window id.
+ * @brief Get app window's x window id.
*
+ * @return the X window id of application to have focus or to request to show IME.
*/
-static Ecore_X_Window efl_get_clipboard_window (void)
+static Ecore_X_Window efl_get_app_window (void)
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
- /* Gets the XID of the clipboard window from the root window property */
- int ret = 0;
- Atom type_return;
- int format_return;
- unsigned long nitems_return;
- unsigned long bytes_after_return;
- unsigned char *data = NULL;
- Ecore_X_Window clipboard_window = 0;
-
- ret = XGetWindowProperty ((Display *)ecore_x_display_get (),
- ecore_x_window_root_get (_control_window),
- ecore_x_atom_get ("CBHM_ELM_WIN"),
- 0, G_MAXLONG, False, XA_WINDOW, &type_return,
- &format_return, &nitems_return, &bytes_after_return,
- &data);
+ return efl_get_window ("_ISF_ACTIVE_WINDOW");
+}
- if (ret == Success) {
- if ((type_return == XA_WINDOW) && (format_return == 32) && (data)) {
- clipboard_window = *(Window *)data;
- if (data)
- XFree (data);
- }
- } else {
- std::cerr << "XGetWindowProperty () is failed!!!\n";
- }
+/**
+ * @brief Get clipboard window's x window id.
+ *
+ * @return the X window id of clipboard.
+ */
+static Ecore_X_Window efl_get_clipboard_window (void)
+{
+ SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
- return clipboard_window;
+ return efl_get_window ("CBHM_ELM_WIN");
}
+/**
+ * @brief Get global natigation window's x window id.
+ *
+ * @return the X window id of global navigation.
+ */
static Ecore_X_Window efl_get_global_navigation_window (void)
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
- /* Gets the XID of the global navigation window from the root window property */
- int ret = 0;
- Atom type_return;
- int format_return;
- unsigned long nitems_return;
- unsigned long bytes_after_return;
- unsigned char *data = NULL;
- Ecore_X_Window gnb_window = 0;
-
- ret = XGetWindowProperty ((Display *)ecore_x_display_get (),
- ecore_x_window_root_get (_control_window),
- ecore_x_atom_get ("GNB_WIN"),
- 0, G_MAXLONG, False, XA_WINDOW, &type_return,
- &format_return, &nitems_return, &bytes_after_return,
- &data);
-
- if (ret == Success) {
- if ((type_return == XA_WINDOW) && (format_return == 32) && (data)) {
- gnb_window = *(Window *)data;
- if (data)
- XFree (data);
- }
- } else {
- std::cerr << "XGetWindowProperty () is failed!!!\n";
- }
-
- return gnb_window;
+ return efl_get_window ("GNB_WIN");
}
+/**
+ * @brief Get app window's x window id.
+ *
+ * @return the X window id of quick panel.
+ */
static Ecore_X_Window efl_get_quickpanel_window (void)
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";