Implemented option window show request handler 80/40880/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Wed, 3 Dec 2014 05:45:26 +0000 (14:45 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 10 Jun 2015 07:24:09 +0000 (16:24 +0900)
Change-Id: Ic4df44a06c48b1f050b78c173a13844fc46206ae

packaging/libscl-core.spec
src/sclconnection-isf.cpp
src/sclcoreimpl.cpp
src/sclcoreimpl.h
src/sclcoretypes.h
src/sclcoreui-efl.cpp

index fd3ef65..a4cb58f 100644 (file)
@@ -34,6 +34,9 @@ A devel pacakge of libscl-core library that helps developing S/W Keyboard
 
 
 %build
+export CFLAGS+=" -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS+=" -DTIZEN_DEBUG_ENABLE"
+export FFLAGS+=" -DTIZEN_DEBUG_ENABLE"
 cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
 make %{?jobs:-j%jobs}
 
index d45f912..debff6f 100644 (file)
@@ -485,6 +485,17 @@ static void slot_turn_on_log (const scim::HelperAgent *agent, scim::uint32 &on)
     }
 }
 
+static void slot_show_ise_option_window (const scim::HelperAgent *agent, int ic, const scim::String &uuid) {
+    CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
+    if (impl) {
+        CSCLCoreUI *core_ui = impl->get_core_ui();
+        if (core_ui) {
+            LOGD("slot_show_ise_option_window() called!!!\n");
+            core_ui->create_option_window(OPTION_WINDOW_TYPE_SETTING_APPLICATION);
+        }
+    }
+}
+
 /* Internal input handler function */
 Eina_Bool input_handler (void *data, Ecore_Fd_Handler *fd_handler)
 {
@@ -584,7 +595,7 @@ sclboolean CSCLConnectionISF::init()
     m_helper_agent.signal_connect_associate_table_page_down (scim::slot (slot_associate_table_page_down));
     m_helper_agent.signal_connect_update_associate_table_page_size (scim::slot (slot_update_associate_table_page_size));
     m_helper_agent.signal_connect_turn_on_log (scim::slot (slot_turn_on_log));
-
+    m_helper_agent.signal_connect_show_option_window (scim::slot (slot_show_ise_option_window));
 
     return ret;
 }
index 00c982e..43b1ca4 100644 (file)
@@ -70,6 +70,16 @@ ISCLCoreEventCallback* CSCLCoreImpl::get_core_event_callback()
     return ret;
 }
 
+CSCLCoreUI* CSCLCoreImpl::get_core_ui()
+{
+    return &m_core_ui;
+}
+
+CSCLConnection* CSCLCoreImpl::get_connection()
+{
+    return &m_connection;
+}
+
 void CSCLCoreImpl::config_reload()
 {
     m_connection.config_reload();
index 5547d75..e11a04c 100644 (file)
@@ -45,6 +45,9 @@ public:
     void set_core_event_callback(ISCLCoreEventCallback *callback);
     ISCLCoreEventCallback* get_core_event_callback();
 
+    CSCLCoreUI* get_core_ui();
+    CSCLConnection* get_connection();
+
     void config_reload();
     sclboolean config_read_int(const sclchar *name, sclint &value);
     sclboolean config_read_string(const sclchar *name, std::string &value);
index 14193c4..5243fdc 100644 (file)
@@ -36,7 +36,7 @@ typedef enum _SCLKeyMask
 typedef enum _SCLOptionWindowType
 {
     OPTION_WINDOW_TYPE_NORMAL,
-    OPTION_WINDOW_TYPE_SETTINGAPPLICATION,
+    OPTION_WINDOW_TYPE_SETTING_APPLICATION,
 
     OPTION_WINDOW_TYPE_MAX,
 } SCLOptionWindowType;
index 4a4dbb3..00d69cb 100644 (file)
@@ -51,8 +51,8 @@ sclboolean CSCLCoreUIEFL::init()
     m_rotation_degree = -1;
 
     for (int loop = 0;loop < OPTION_WINDOW_TYPE_MAX;loop++) {
-        m_option_window_info[OPTION_WINDOW_TYPE_NORMAL].window = SCLWINDOW_INVALID;
-        m_option_window_info[OPTION_WINDOW_TYPE_NORMAL].handler = NULL;
+        m_option_window_info[loop].window = SCLWINDOW_INVALID;
+        m_option_window_info[loop].handler = NULL;
     }
 
     return ret;
@@ -413,12 +413,55 @@ set_transient_for_app_window(Evas_Object *window)
     }
 }
 
+static void
+set_transient_for_isf_setting_window(Evas_Object *window)
+{
+    /* Set a transient window for window stack */
+    /* Gets the current XID of the active window into the root window property  */
+    Atom type_return;
+    unsigned long nitems_return;
+    unsigned long bytes_after_return;
+    int format_return;
+    unsigned char *data = NULL;
+    Ecore_X_Window xControlWindow, xSettingWindow;
+    Ecore_X_Window xWindow = elm_win_xwindow_get(window);
+    gint ret = 0;
+
+    ret = XGetWindowProperty ((Display *)ecore_x_display_get(), ecore_x_window_root_get(xWindow),
+        ecore_x_atom_get("_ISF_CONTROL_WINDOW"),
+        0, G_MAXLONG, False, XA_WINDOW, &type_return,
+        &format_return, &nitems_return, &bytes_after_return,
+        &data);
+
+    if (ret == Success) {
+        if (data) {
+            if (type_return == XA_WINDOW) {
+                xControlWindow = *(Window *)data;
+
+                ecore_x_window_prop_xid_get (xControlWindow, ecore_x_atom_get ("ISF Setting window"),
+                    ECORE_X_ATOM_WINDOW, &xSettingWindow, 1);
+
+                LOGD("TRANSIENT_FOR SET : %x , %x", xSettingWindow, xWindow);
+                ecore_x_icccm_transient_for_set(xWindow, xSettingWindow);
+            }
+            XFree(data);
+        }
+    }
+}
+
 sclwindow CSCLCoreUIEFL::create_option_window(SCLOptionWindowType type)
 {
     if (type < 0 || type >= OPTION_WINDOW_TYPE_MAX) {
         return SCLWINDOW_INVALID;
     }
 
+    /* Just in case the previous option window for setting application exists */
+    if (type == OPTION_WINDOW_TYPE_SETTING_APPLICATION) {
+        if (m_option_window_info[type].window != SCLWINDOW_INVALID) {
+            destroy_option_window(m_option_window_info[type].window);
+        }
+    }
+
     Evas_Object *window = elm_win_util_standard_add("Option window", "Option window");
 
     const char *szProfile[] = {"mobile", ""};
@@ -440,23 +483,26 @@ sclwindow CSCLCoreUIEFL::create_option_window(SCLOptionWindowType type)
 
     elm_win_indicator_mode_set (window, ELM_WIN_INDICATOR_SHOW);
 
+    CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
+    if (impl) {
+        ISCLCoreEventCallback *callback = impl->get_core_event_callback();
+        if (callback) {
+            callback->on_create_option_window(window, type);
+        }
+    }
+
     Ecore_Event_Handler *handler = NULL;
     if (type == OPTION_WINDOW_TYPE_NORMAL) {
         handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, focus_out_cb, &m_option_window_info[type]);
         set_transient_for_app_window(window);
+    } else if (type == OPTION_WINDOW_TYPE_SETTING_APPLICATION) {
+        set_transient_for_isf_setting_window(window);
+        evas_object_show(window);
     }
 
     m_option_window_info[type].window = window;
     m_option_window_info[type].handler = handler;
 
-    CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
-    if (impl) {
-        ISCLCoreEventCallback *callback = impl->get_core_event_callback();
-        if (callback) {
-            callback->on_create_option_window(window, type);
-        }
-    }
-
     return window;
 }
 
@@ -472,14 +518,14 @@ void CSCLCoreUIEFL::destroy_option_window(sclwindow window)
 
     for (int loop = 0;loop < OPTION_WINDOW_TYPE_MAX;loop++) {
         if (m_option_window_info[loop].window == window) {
-            m_option_window_info[OPTION_WINDOW_TYPE_NORMAL].window = SCLWINDOW_INVALID;
+            evas_object_del(NATIVE_WINDOW_CAST(window));
+            m_option_window_info[loop].window = SCLWINDOW_INVALID;
             if (m_option_window_info[loop].handler) {
                 ecore_event_handler_del(m_option_window_info[loop].handler);
                 m_option_window_info[loop].handler = NULL;
             }
         }
     }
-    evas_object_del(NATIVE_WINDOW_CAST(window));
 }
 
 void CSCLCoreUIEFL::set_screen_rotation_degree(int degree)