From 85d929ff19c72574918947b1724fce008aa5655e Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 25 Nov 2016 13:59:21 +0900 Subject: [PATCH] Send input panel geometry event before SHOW event Change-Id: I3bcb21fd714c0c1ec4fc75a9285ae602cbe4532c --- src/e_mod_input_panel.c | 25 +++++++++++++++++++++++++ src/e_mod_main.c | 19 +++++++++++-------- src/e_mod_main.h | 1 + 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/e_mod_input_panel.c b/src/e_mod_input_panel.c index 1a8a454..76d3bb8 100644 --- a/src/e_mod_input_panel.c +++ b/src/e_mod_input_panel.c @@ -613,6 +613,31 @@ e_input_panel_client_find(E_Client *ec) return EINA_FALSE; } +/* If ec is NULL, it will check the very first item that is found in our surfaces list */ +Eina_Bool +e_input_panel_client_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h) +{ + E_Input_Panel_Surface *ips; + Eina_List *l; + + if (!g_input_panel) return EINA_FALSE; + if (!x || !y || !w || !h) return EINA_FALSE; + + EINA_LIST_FOREACH(g_input_panel->surfaces, l, ips) + { + if (!ips->ec) continue; + if (ips->ec == ec || !ec) { + *x = ips->ec->x; + *y = ips->ec->y; + *w = ips->ec->w; + *h = ips->ec->h; + return EINA_TRUE; + } + } + + return EINA_FALSE; +} + Eina_Bool e_input_panel_init(void) { diff --git a/src/e_mod_main.c b/src/e_mod_main.c index a7e3c0f..d39380b 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -169,8 +169,10 @@ _input_panel_hide(struct wl_client *client, struct wl_resource *resource, Eina_B text_input->input_panel_visibile = EINA_FALSE; if (text_input->resource) - wl_text_input_send_input_panel_state(text_input->resource, - WL_TEXT_INPUT_INPUT_PANEL_STATE_HIDE); + { + wl_text_input_send_input_panel_geometry(text_input->resource, 0, 0, 0, 0); + wl_text_input_send_input_panel_state(text_input->resource, WL_TEXT_INPUT_INPUT_PANEL_STATE_HIDE); + } if (force_hide) { @@ -779,10 +781,6 @@ _e_text_input_method_context_cb_hide_input_panel(struct wl_client *client EINA_U text_input->input_panel_visibile = EINA_FALSE; - if (text_input->resource) - wl_text_input_send_input_panel_state(text_input->resource, - WL_TEXT_INPUT_INPUT_PANEL_STATE_HIDE); - if (g_text_input && g_text_input->resource && g_client) _input_panel_hide(g_client, g_text_input->resource, EINA_FALSE); @@ -1212,8 +1210,13 @@ _e_text_input_cb_input_panel_show(struct wl_client *client, struct wl_resource * g_input_panel_state = E_INPUT_PANEL_STATE_WILL_SHOW; if (text_input->resource) - wl_text_input_send_input_panel_state(text_input->resource, - WL_TEXT_INPUT_INPUT_PANEL_STATE_SHOW); + { + int x = 0, y = 0, w = 0, h = 0; + if (e_input_panel_client_geometry_get(NULL, &x, &y, &w, &h)) + wl_text_input_send_input_panel_geometry(text_input->resource, x, y, w, h); + + wl_text_input_send_input_panel_state(text_input->resource, WL_TEXT_INPUT_INPUT_PANEL_STATE_SHOW); + } e_input_panel_transient_for_set(client_surface_ec); } diff --git a/src/e_mod_main.h b/src/e_mod_main.h index 2f1e687..bfa324e 100644 --- a/src/e_mod_main.h +++ b/src/e_mod_main.h @@ -7,6 +7,7 @@ Eina_Bool e_input_panel_init(void); void e_input_panel_shutdown(void); void e_input_panel_visibility_change(Eina_Bool visible); Eina_Bool e_input_panel_client_find(E_Client *ec); +Eina_Bool e_input_panel_client_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h); EINTERN void e_input_panel_wait_update_set(Eina_Bool wait_update); EINTERN void e_input_panel_transient_for_set(E_Client *parent); -- 2.7.4