From 665db07b0a275cea62165c8ada947ff066ac73ca Mon Sep 17 00:00:00 2001 From: InHong Han Date: Wed, 15 Jan 2020 16:28:31 +0900 Subject: [PATCH] Modified to not send invalid geometry to app Change-Id: Ibfbfec25f7816a7cb3b62f2b9bb32b8b5fc72d99 --- src/sclconnection-isf.cpp | 7 +++++++ src/sclcoreimpl.cpp | 1 + src/sclcoreui-efl.cpp | 28 ++++++++++++++++++++++++++++ src/sclcoreui-efl.h | 5 +++++ src/sclcoreui.cpp | 14 ++++++++++++++ src/sclcoreui.h | 10 ++++++++++ 6 files changed, 65 insertions(+) diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp index b8f4f4f..e8063a5 100644 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -190,6 +190,13 @@ static void slot_ise_show(const scim::HelperAgent *agent, int ic, char *buf, siz ui->process_keyboard_ui_state_change(KEYBOARD_UI_STATE_WILL_SHOW); } callback->on_ise_show(ic, impl->get_screen_rotation_degree(), ise_context); + 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); if (ui) { ui->process_keyboard_ui_state_change(KEYBOARD_UI_STATE_DID_SHOW); } diff --git a/src/sclcoreimpl.cpp b/src/sclcoreimpl.cpp index 7606978..f8a7970 100644 --- a/src/sclcoreimpl.cpp +++ b/src/sclcoreimpl.cpp @@ -368,6 +368,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() diff --git a/src/sclcoreui-efl.cpp b/src/sclcoreui-efl.cpp index 536be64..869af01 100644 --- a/src/sclcoreui-efl.cpp +++ b/src/sclcoreui-efl.cpp @@ -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}; diff --git a/src/sclcoreui-efl.h b/src/sclcoreui-efl.h index 69ed65b..82d03af 100644 --- a/src/sclcoreui-efl.h +++ b/src/sclcoreui-efl.h @@ -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]; }; diff --git a/src/sclcoreui.cpp b/src/sclcoreui.cpp index eff366b..d3eb46f 100644 --- a/src/sclcoreui.cpp +++ b/src/sclcoreui.cpp @@ -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 diff --git a/src/sclcoreui.h b/src/sclcoreui.h index 57cc030..c8d1df1 100644 --- a/src/sclcoreui.h +++ b/src/sclcoreui.h @@ -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; -- 2.34.1