Modified to not send invalid geometry to app 17/222817/2
authorInHong Han <inhong1.han@samsung.com>
Wed, 15 Jan 2020 07:28:31 +0000 (16:28 +0900)
committerInHong Han <inhong1.han@samsung.com>
Mon, 20 Jan 2020 08:58:25 +0000 (17:58 +0900)
Change-Id: Ibfbfec25f7816a7cb3b62f2b9bb32b8b5fc72d99
(cherry picked from commit 665db07b0a275cea62165c8ada947ff066ac73ca)

src/sclconnection-isf.cpp
src/sclcoreimpl.cpp
src/sclcoreui-efl.cpp
src/sclcoreui-efl.h
src/sclcoreui.cpp
src/sclcoreui.h

index dc09b23..8a8ba86 100644 (file)
@@ -191,8 +191,16 @@ static void slot_ise_show(const scim::HelperAgent *agent, int ic, char *buf, siz
             }
             callback->on_ise_show(ic, impl->get_screen_rotation_degree(), ise_context);
             if (ui) {
+                SclSize portrait;
+                SclSize landscape;
+                ui->get_keyboard_size(&portrait, &landscape);
+                /* If the ime_set_size() API is not called and IME is shown, the app can not receive the keyboard window's geometry from ISF.
+                And the ime_set_size() API is not called unless the IME size changes.
+                */
+                ui->update_keyboard_geometry(portrait, landscape);
                 ui->process_keyboard_ui_state_change(KEYBOARD_UI_STATE_DID_SHOW);
-            }
+            } else
+                LOGW("Failed to get core UI");
 
 #ifdef WEBSOCKET
             g_websocket.on_set_layout(ise_context.layout);
index dd8a5b0..34c4740 100644 (file)
@@ -373,6 +373,7 @@ int CSCLCoreImpl::get_screen_rotation_degree()
 void CSCLCoreImpl::set_keyboard_size_hints(SclSize portrait, SclSize landscape)
 {
     m_core_ui.set_keyboard_size_hints(portrait, landscape);
+    m_core_ui.update_keyboard_geometry(portrait, landscape);
 }
 
 sclwindow CSCLCoreImpl::create_option_window()
index 536be64..869af01 100644 (file)
@@ -80,6 +80,10 @@ CSCLCoreUIEFL::CSCLCoreUIEFL()
     m_main_window = SCLWINDOW_INVALID;
     m_appid = NULL;
     m_display = NULL;
+    m_portrait_size.width = 0;
+    m_portrait_size.height = 0;
+    m_landscape_size.width = 0;
+    m_landscape_size.height = 0;
 
     memset(m_option_window_info, 0x00, sizeof(m_option_window_info));
 }
@@ -141,6 +145,9 @@ void CSCLCoreUIEFL::set_keyboard_size_hints(SclSize portrait, SclSize landscape)
     */
 #endif
     LOGD("%d %d %d %d", portrait.width, portrait.height, landscape.width, landscape.height);
+
+    m_portrait_size = portrait;
+    m_landscape_size = landscape;
 }
 
 void CSCLCoreUIEFL::set_floating_mode(sclboolean floating_mode)
@@ -155,6 +162,27 @@ void CSCLCoreUIEFL::set_floating_drag_enabled(sclboolean enabled)
         wl_input_panel_surface_set_floating_drag_enabled(wlkb.ips, enabled);
 }
 
+void CSCLCoreUIEFL::update_keyboard_geometry(SclSize portrait, SclSize landscape)
+{
+    Evas_Object *main_window = NATIVE_WINDOW_CAST(m_main_window);
+    Evas_Coord win_w = 0, win_h = 0;
+    elm_win_screen_size_get(main_window, NULL, NULL, &win_w, &win_h);
+    int degree = elm_win_rotation_get(main_window);
+    CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
+    if (impl) {
+        if (degree == 0 || degree == 180)
+            impl->update_geometry((win_w - portrait.width) / 2, win_h - portrait.height, portrait.width, portrait.height);
+        else
+            impl->update_geometry((win_h - landscape.width) / 2, win_w - landscape.height, landscape.width, landscape.height);
+    }
+}
+
+void CSCLCoreUIEFL::get_keyboard_size(SclSize *portrait, SclSize *landscape)
+{
+    *portrait = m_portrait_size;
+    *landscape = m_landscape_size;
+}
+
 static int language_changed_cb(void *event_info, void* data)
 {
     char clang[_POSIX_PATH_MAX] = {0};
index 69ed65b..82d03af 100644 (file)
@@ -64,6 +64,9 @@ public:
 
     void set_floating_mode(sclboolean floating_mode);
     void set_floating_drag_enabled(sclboolean enabled);
+
+    void update_keyboard_geometry(SclSize portrait, SclSize landscape);
+    void get_keyboard_size(SclSize *portrait, SclSize *landscape);
 private:
     sclboolean m_initialized;
 
@@ -71,6 +74,8 @@ private:
     sclwindow m_main_window;
     const sclchar *m_appid;
     const sclchar *m_display;
+    SclSize m_portrait_size;
+    SclSize m_landscape_size;
 
     OptionWindowInfo m_option_window_info[OPTION_WINDOW_TYPE_MAX];
 };
index bcadaa7..3bebc7f 100644 (file)
@@ -145,4 +145,18 @@ void CSCLCoreUI::set_floating_drag_enabled(sclboolean enabled)
     if (m_impl) {
         m_impl->set_floating_drag_enabled(enabled);
     }
+}
+
+void CSCLCoreUI::update_keyboard_geometry(SclSize portrait, SclSize landscape)
+{
+    if (m_impl) {
+        m_impl->update_keyboard_geometry(portrait, landscape);
+    }
+}
+
+void CSCLCoreUI::get_keyboard_size(SclSize *portrait, SclSize *landscape)
+{
+    if (m_impl) {
+        m_impl->get_keyboard_size(portrait, landscape);
+    }
 }
\ No newline at end of file
index b61f013..2fa9f58 100644 (file)
@@ -106,6 +106,16 @@ public:
      */
     virtual void set_floating_drag_enabled(sclboolean enabled);
 
+    /**
+     * @brief Requests to update the keyboard window's geometry
+     */
+    virtual void update_keyboard_geometry(SclSize portrait, SclSize landscape);
+
+    /**
+     * @brief Requests to get the keyboard size
+     */
+    virtual void get_keyboard_size(SclSize *portrait, SclSize *landscape);
+
 protected:
     std::string m_backend_identifier;