From 16270b8cf95a2e7edb44a737ae9687f549c2113b Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Wed, 18 Jan 2017 10:12:35 +0900 Subject: [PATCH] Check conformant reset state together with reset_conformant() success Since the conformant is reset right after _input_panel_hide() call, at the time that immodule receives conformant_reset request from wl_textinput module, reset_conformant_area() function might return false since the keyboard geometry is already set to 0x0. So, even the keyboard geometry is set to 0x0, check the conformant reset state to ensure there is no preceding conformant reset request being processed. Change-Id: I26f7062c52d3f3763167d4cfa87b3437ee7e8ad4 --- ism/extras/wayland_immodule/wayland_imcontext.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ism/extras/wayland_immodule/wayland_imcontext.c b/ism/extras/wayland_immodule/wayland_imcontext.c index 0b8529b..e373330 100644 --- a/ism/extras/wayland_immodule/wayland_imcontext.c +++ b/ism/extras/wayland_immodule/wayland_imcontext.c @@ -109,6 +109,7 @@ static Ecore_Event_Handler *_conformant_change_handler = NULL; static Eina_Bool _custom_conformant_event = EINA_FALSE; static Eina_Bool _received_will_hide_event = EINA_FALSE; static Eina_Bool _conformant_reset_done = EINA_FALSE; +static Eina_Bool _conformant_reset_started = EINA_FALSE; static Evas *_active_context_canvas = NULL; static unsigned int _active_context_window_id = 0; @@ -904,6 +905,8 @@ static Eina_Bool reset_conformant_area(Ecore_IMF_Context *ctx) ev->state = 0; ecore_event_add(ECORE_WL_EVENT_CONFORMANT_CHANGE, ev, NULL, NULL); } + + _conformant_reset_started = EINA_TRUE; } return reset; @@ -947,6 +950,7 @@ static void restore_conformant_area(Ecore_IMF_Context *ctx) ev->state = 0; ecore_event_add(ECORE_WL_EVENT_CONFORMANT_CHANGE, ev, NULL, NULL); } + _conformant_reset_started = EINA_FALSE; } } @@ -968,7 +972,7 @@ _hide_timer_handler(void *data) Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)data; _send_input_panel_hide_request(ctx); - if (!reset_conformant_area(ctx)) { + if (!reset_conformant_area(ctx) && !_conformant_reset_started) { LOGD("No need to reset conformant, sending ACK right away"); _send_will_hide_ack((WaylandIMContext *)ecore_imf_context_data_get(ctx)); } @@ -992,12 +996,13 @@ _input_panel_hide(Ecore_IMF_Context *ctx, Eina_Bool instant) if (!ctx) return; will_hide = EINA_TRUE; + _conformant_reset_started = EINA_FALSE; if (instant || (_hide_timer && ecore_timer_pending_get(_hide_timer) <= 0.0)) { _clear_hide_timer(); _send_input_panel_hide_request(ctx); - if (!reset_conformant_area(ctx)) { + if (!reset_conformant_area(ctx) && !_conformant_reset_started) { LOGD("No need to reset conformant, sending ACK right away"); _send_will_hide_ack((WaylandIMContext *)ecore_imf_context_data_get(ctx)); } @@ -1375,6 +1380,7 @@ static void _render_post_cb(void *data, Evas *e, void *event_info) { void *callback = evas_event_callback_del(e, EVAS_CALLBACK_RENDER_POST, _render_post_cb); _conformant_reset_done = EINA_TRUE; + _conformant_reset_started = EINA_FALSE; LOGD("[_render_post_cb], _conformant_reset_done = 1 , %p\n", callback); send_will_hide_ack(NULL); } @@ -1397,6 +1403,7 @@ static Eina_Bool _conformant_change_cb(void *data, int ev_type, void *ev) LOGD("_conformant_reset_done = 0, registering _render_post_cb : %p %p\n", _active_context_canvas, window); _conformant_reset_done = EINA_FALSE; if (_active_context_canvas && ecore_wl_window_conformant_get(window) && !_custom_conformant_event) { + evas_event_callback_del(_active_context_canvas, EVAS_CALLBACK_RENDER_POST, _render_post_cb); evas_event_callback_add(_active_context_canvas, EVAS_CALLBACK_RENDER_POST, _render_post_cb, ctx); } } else { @@ -2058,7 +2065,11 @@ text_input_private_command(void *data, Ecore_Wl_Window *window = imcontext->window; if (!window) return; - if (!reset_conformant_area(imcontext->ctx)) { + if (!reset_conformant_area(imcontext->ctx) && !_conformant_reset_started) { + LOGD("Could not reset conformant area, send will_hide_ack right away %d", _conformant_reset_started); + _send_will_hide_ack(imcontext); + } else if (_conformant_reset_done) { + LOGD("Conformant reset has been already finished, send will_hide_ack right away"); _send_will_hide_ack(imcontext); } } else if (strncmp(command, szConformantRestore, strlen(szConformantRestore)) == 0) { -- 2.7.4