From: Ji-hoon Lee Date: Wed, 25 May 2016 07:12:10 +0000 (+0900) Subject: Modified to send set_ready request when we recved RENDER_PRE event X-Git-Tag: accepted/tizen/common/20160627.191353~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=39b45002bb2f0bfb24d52156c91fde6e20603946;p=platform%2Fcore%2Fuifw%2Flibscl-core.git Modified to send set_ready request when we recved RENDER_PRE event Change-Id: I157f0d993afde7a8c8f8fd5adc46ed54abf8709d --- diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp index 54d0e5b..136fe6f 100644 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -161,7 +161,14 @@ static void slot_ise_show(const scim::HelperAgent *agent, int ic, char *buf, siz } else { LOGD("\n-=-= WARNING - buf %p len %d size %d \n", buf, len, sizeof(ise_context)); } + CSCLCoreUI* ui = impl->get_core_ui(); + if (ui) { + ui->process_keyboard_ui_state_change(KEYBOARD_UI_STATE_WILL_SHOW); + } callback->on_ise_show(ic, impl->get_screen_rotation_degree(), ise_context); + if (ui) { + ui->process_keyboard_ui_state_change(KEYBOARD_UI_STATE_DID_SHOW); + } } } } @@ -171,7 +178,14 @@ static void slot_ise_hide(const scim::HelperAgent *agent, int ic, const scim::St if (impl) { ISCLCoreEventCallback *callback = impl->get_core_event_callback(); if (callback) { + CSCLCoreUI* ui = impl->get_core_ui(); + if (ui) { + ui->process_keyboard_ui_state_change(KEYBOARD_UI_STATE_WILL_HIDE); + } callback->on_ise_hide(ic, ic_uuid.c_str()); + if (ui) { + ui->process_keyboard_ui_state_change(KEYBOARD_UI_STATE_DID_HIDE); + } } } } diff --git a/src/sclcoreui-efl.cpp b/src/sclcoreui-efl.cpp index 1b582e4..310315d 100644 --- a/src/sclcoreui-efl.cpp +++ b/src/sclcoreui-efl.cpp @@ -43,9 +43,20 @@ struct WaylandKeyboard struct wl_surface *surface; struct wl_input_panel *ip; struct wl_output *output; + struct wl_input_panel_surface *ips; }; struct WaylandKeyboard wlkb = {0}; + +#define RENDER_PRE_TIMEOUT 1.0f +static Ecore_Timer *_render_pre_timer = NULL; +static void delete_render_pre_timer() +{ + if (_render_pre_timer) { + ecore_timer_del(_render_pre_timer); + _render_pre_timer = NULL; + } +} #endif using namespace scl; @@ -295,7 +306,6 @@ _wayland_setup(struct WaylandKeyboard *wlkb, Evas_Object *main_window) Eina_Inlist *globals; struct wl_registry *registry; Ecore_Wl_Global *global; - struct wl_input_panel_surface *ips; if (!(registry = ecore_wl_registry_get())) return false; @@ -342,13 +352,13 @@ _wayland_setup(struct WaylandKeyboard *wlkb, Evas_Object *main_window) return false; } - ips = wl_input_panel_get_input_panel_surface(wlkb->ip, wlkb->surface); - if (!ips) { + wlkb->ips = wl_input_panel_get_input_panel_surface(wlkb->ip, wlkb->surface); + if (!wlkb->ips) { LOGW("Couldn't get input panel surface\n"); return false; } - wl_input_panel_surface_set_toplevel(ips, wlkb->output, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM); + wl_input_panel_surface_set_toplevel(wlkb->ips, wlkb->output, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM); return true; } @@ -667,3 +677,60 @@ void CSCLCoreUIEFL::set_screen_rotation_degree(int degree) { m_rotation_degree = degree; } + +#ifdef WAYLAND +static void _render_pre_cb(void *data, Evas *e, void *event_info) +{ + LOGD("_render_pre_cb() called, now invoking wl_input_panel_surface_set_ready()"); + + wl_input_panel_surface_set_ready(wlkb.ips, 1); + + Evas_Object *main_window = NATIVE_WINDOW_CAST(data); + evas_event_callback_del_full(evas_object_evas_get(main_window), + EVAS_CALLBACK_RENDER_PRE, _render_pre_cb, main_window); + + delete_render_pre_timer(); +} + +static Eina_Bool _render_pre_timeout(void *data) +{ + LOGD("_render_pre_timer expired, forcing to call _render_pre_cb() callback"); + + _render_pre_cb(data, NULL, NULL); + + return ECORE_CALLBACK_CANCEL; +} +#endif + +void CSCLCoreUIEFL::process_keyboard_ui_state_change(KEYBOARD_UI_STATE state) +{ +#ifdef WAYLAND + static Evas_Object *force_update_helper_obj = NULL; + static int force_update_num = 0; + + if (state == KEYBOARD_UI_STATE_WILL_SHOW) { + evas_event_callback_add(evas_object_evas_get(NATIVE_WINDOW_CAST(m_main_window)), + EVAS_CALLBACK_RENDER_PRE, _render_pre_cb, (void*)m_main_window); + _render_pre_timer = ecore_timer_add (RENDER_PRE_TIMEOUT, _render_pre_timeout, (void*)m_main_window); + LOGD("Registered RENDER_PRE callback, _render_pre_cb() and a timer callback"); + } else if (state == KEYBOARD_UI_STATE_DID_SHOW) { + LOGD("Forcing keyboard window to render : %d", force_update_num); + + /* Since the ISE is waiting for RENDER_PRE event, we need to make sure the render event is + * occured on our ISE window. Since right now there is no proper way to trigger render event + * manually, we are creating a half transparent box above the keyboard window. Need to find + * more appropriate way to generate render event */ + if (force_update_helper_obj) evas_object_del(force_update_helper_obj); + force_update_helper_obj = elm_bg_add (NATIVE_WINDOW_CAST(m_main_window)); + evas_object_color_set(force_update_helper_obj, 255, 255, 255, 1); + evas_object_resize(force_update_helper_obj, 1, 1); + evas_object_move(force_update_helper_obj, force_update_num % 100, 0); + evas_object_layer_set(force_update_helper_obj, EVAS_LAYER_MAX); + evas_object_show (force_update_helper_obj); + force_update_num++; + } else if (state == KEYBOARD_UI_STATE_WILL_HIDE) { + if (force_update_helper_obj) evas_object_del(force_update_helper_obj); + force_update_helper_obj = NULL; + } +#endif +} diff --git a/src/sclcoreui-efl.h b/src/sclcoreui-efl.h index 148fad7..1a3435d 100644 --- a/src/sclcoreui-efl.h +++ b/src/sclcoreui-efl.h @@ -51,6 +51,8 @@ public: virtual void destroy_option_window(sclwindow window); void set_screen_rotation_degree(int degree); + + void process_keyboard_ui_state_change(KEYBOARD_UI_STATE state); private: sclboolean m_initialized; diff --git a/src/sclcoreui.cpp b/src/sclcoreui.cpp index c72f971..e7ea1f6 100644 --- a/src/sclcoreui.cpp +++ b/src/sclcoreui.cpp @@ -106,4 +106,11 @@ void CSCLCoreUI::destroy_option_window(sclwindow window) if (m_impl) { m_impl->destroy_option_window(window); } +} + +void CSCLCoreUI::process_keyboard_ui_state_change(KEYBOARD_UI_STATE state) +{ + if (m_impl) { + m_impl->process_keyboard_ui_state_change(state); + } } \ No newline at end of file diff --git a/src/sclcoreui.h b/src/sclcoreui.h index d836417..ad15281 100644 --- a/src/sclcoreui.h +++ b/src/sclcoreui.h @@ -27,6 +27,14 @@ namespace scl { +enum KEYBOARD_UI_STATE +{ + KEYBOARD_UI_STATE_DID_HIDE, + KEYBOARD_UI_STATE_WILL_HIDE, + KEYBOARD_UI_STATE_DID_SHOW, + KEYBOARD_UI_STATE_WILL_SHOW, +}; + /** * @brief The base class that provides features for a soft-keyboard * @@ -70,6 +78,11 @@ public: */ virtual void destroy_option_window(sclwindow window); + /** + * @brief This API requests each SCLCoreUI backends to process keyboard UI state change event + */ + virtual void process_keyboard_ui_state_change(KEYBOARD_UI_STATE state); + protected: std::string m_backend_identifier;