From: Ji-hoon Lee Date: Tue, 18 Oct 2016 07:24:42 +0000 (+0900) Subject: Restore conformant info when WILL_HIDE canceled and showed again X-Git-Tag: accepted/tizen/common/20161018.175456~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ff115ad94f158a44834f133f5fada148f3b69f4;p=platform%2Fcore%2Fuifw%2Fisf.git Restore conformant info when WILL_HIDE canceled and showed again Change-Id: I1b58a81370a952151a3475f74d44bd172f647dc2 --- diff --git a/ism/extras/wayland_immodule/wayland_imcontext.c b/ism/extras/wayland_immodule/wayland_imcontext.c index 9ec0062..8c92dcb 100644 --- a/ism/extras/wayland_immodule/wayland_imcontext.c +++ b/ism/extras/wayland_immodule/wayland_imcontext.c @@ -654,6 +654,7 @@ _send_input_panel_hide_request(Ecore_IMF_Context *ctx) } } +static Eina_Rectangle _conformant_area_backup = { 0, 0, 0, 0 }; static Eina_Bool reset_conformant_area(Ecore_IMF_Context *ctx) { Eina_Bool reset = EINA_FALSE; @@ -672,6 +673,10 @@ static Eina_Bool reset_conformant_area(Ecore_IMF_Context *ctx) if (ecore_imf_context_client_canvas_get(ctx) && ecore_wl_window_conformant_get(window) && (w != 0 || h != 0)) { reset = EINA_TRUE; + _conformant_area_backup.x = x; + _conformant_area_backup.y = y; + _conformant_area_backup.w = w; + _conformant_area_backup.h = h; } } } @@ -692,6 +697,44 @@ static Eina_Bool reset_conformant_area(Ecore_IMF_Context *ctx) return reset; } +static void resetore_conformant_area(Ecore_IMF_Context *ctx) +{ + Eina_Bool restore = EINA_FALSE; + Ecore_Wl_Window *window = NULL; + + if (!ctx) return; + + WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx); + if (imcontext) window = imcontext->window; + + if (window) { + int x = 0, y = 0, w = 0, h = 0; + Eina_Bool result = ecore_wl_window_keyboard_geometry_get(window, &x, &y, &w, &h); + + if (result) { + if (ecore_imf_context_client_canvas_get(ctx) && ecore_wl_window_conformant_get(window) && + (w == 0 || h == 0)) { + restore = EINA_TRUE; + } + } + } + LOGD("restore %d", restore); + if (restore) { + ecore_wl_window_keyboard_geometry_set(window, + _conformant_area_backup.x, _conformant_area_backup.y, + _conformant_area_backup.w, _conformant_area_backup.h); + + Ecore_Wl_Event_Conformant_Change *ev; + ev = calloc(1, sizeof(Ecore_Wl_Event_Conformant_Change)); + if (ev) { + ev->win = ecore_wl_window_id_get(window); + ev->part_type = 1; + ev->state = 0; + ecore_event_add(ECORE_WL_EVENT_CONFORMANT_CHANGE, ev, NULL, NULL); + } + } +} + static void _send_will_hide_ack(WaylandIMContext *imcontext) { @@ -1752,7 +1795,9 @@ text_input_private_command(void *data, if (!imcontext || !imcontext->ctx) return; const char *szConformantReset = "CONFORMANT_RESET"; - LOGD("Checking command : %s %s", command, szConformantReset); + const char *szConformantRestore = "CONFORMANT_RESTORE"; + LOGD("Checking command : %s", command); + if (strncmp(command, szConformantReset, strlen(szConformantReset)) == 0) { Ecore_Wl_Window *window = imcontext->window; if (!window) return; @@ -1760,6 +1805,11 @@ text_input_private_command(void *data, if (!reset_conformant_area(imcontext->ctx)) { _send_will_hide_ack(imcontext); } + } else if (strncmp(command, szConformantRestore, strlen(szConformantRestore)) == 0) { + Ecore_Wl_Window *window = imcontext->window; + if (!window) return; + + resetore_conformant_area(imcontext->ctx); } else { ecore_imf_context_event_callback_call(imcontext->ctx, ECORE_IMF_CALLBACK_PRIVATE_COMMAND_SEND, (void *)command); }