From 5992a09979f3afdcc513e07a519848eb1d0c5faa Mon Sep 17 00:00:00 2001 From: InHong Han Date: Wed, 12 Jul 2017 15:32:45 +0900 Subject: [PATCH] Added input_panel_position_set interface Change-Id: I3232509184baffe9679d2187de1d68c734b25d0c --- ism/extras/wayland_immodule/wayland_imcontext.c | 37 +++++++++++++++++++++++++ ism/extras/wayland_immodule/wayland_imcontext.h | 3 ++ ism/extras/wayland_immodule/wayland_module.c | 3 +- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/ism/extras/wayland_immodule/wayland_imcontext.c b/ism/extras/wayland_immodule/wayland_imcontext.c index 5fa2cae..a55529f 100644 --- a/ism/extras/wayland_immodule/wayland_imcontext.c +++ b/ism/extras/wayland_immodule/wayland_imcontext.c @@ -218,6 +218,12 @@ struct _WaylandIMContext Eina_Bool has_conformant; char *prediction_hint; char *mime_type; + + struct + { + int x; + int y; + } input_panel_position; // }; @@ -1656,6 +1662,10 @@ show_input_panel(Ecore_IMF_Context *ctx) if (imcontext->mime_type) wl_text_input_set_mime_type(imcontext->text_input, imcontext->mime_type); + if (imcontext->input_panel_position.x >= 0 && imcontext->input_panel_position.y >= 0) + wl_text_input_set_input_panel_position(imcontext->text_input, + imcontext->input_panel_position.x, imcontext->input_panel_position.y); + SECURE_LOGD ("ctx : %p, layout : %d, layout variation : %d\n", ctx, layout, layout_variation); SECURE_LOGD ("language : %d, cursor position : %d, input hint : %#x, bidi direction : %d\n", @@ -1671,6 +1681,8 @@ show_input_panel(Ecore_IMF_Context *ctx) ecore_imf_context_client_window_get (ctx), (imcontext->content_hint & WL_TEXT_INPUT_CONTENT_HINT_SENSITIVE_DATA) ? 1 : 0, ecore_imf_context_prediction_allow_get (ctx)); + SECURE_LOGD ("mime_type : %s, input panel position x : %d, y : %d\n", + imcontext->mime_type, imcontext->input_panel_position.x, imcontext->input_panel_position.y); if (_active_context_canvas && !evas_focus_state_get (_active_context_canvas)) { LOGW ("Canvas does not have focus!\n"); @@ -2593,6 +2605,9 @@ wayland_im_context_add(Ecore_IMF_Context *ctx) imcontext->caps_mask = MOD_CAPS_MASK; imcontext->num_mask = MOD_NUM_MASK; + imcontext->input_panel_position.x = -1; + imcontext->input_panel_position.y = -1; + imcontext->text_input = wl_text_input_manager_create_text_input(imcontext->text_input_manager); @@ -2724,6 +2739,10 @@ wayland_im_context_focus_in(Ecore_IMF_Context *ctx) if (imcontext->mime_type) wl_text_input_set_mime_type(imcontext->text_input, imcontext->mime_type); + + if (imcontext->input_panel_position.x >= 0 && imcontext->input_panel_position.y >= 0) + wl_text_input_set_input_panel_position(imcontext->text_input, + imcontext->input_panel_position.x, imcontext->input_panel_position.y); } if (ecore_imf_context_input_panel_enabled_get(ctx)) @@ -3486,6 +3505,24 @@ wayland_im_context_mime_type_accept_set (Ecore_IMF_Context *ctx, const char *mim } } +void +wayland_im_context_input_panel_position_set (Ecore_IMF_Context *ctx, int x, int y) +{ + WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx); + if (!imcontext) return; + + if ((imcontext->input_panel_position.x != x) || (imcontext->input_panel_position.y != y)) { + imcontext->input_panel_position.x = x; + imcontext->input_panel_position.y = y; + } + + if (imcontext->input && imcontext->text_input) { + LOGD ("ctx : %p, x = %d, y = %d\n", ctx, x, y); + wl_text_input_set_input_panel_position(imcontext->text_input, + imcontext->input_panel_position.x, imcontext->input_panel_position.y); + } +} + WaylandIMContext *wayland_im_context_new (struct wl_text_input_manager *text_input_manager) { WaylandIMContext *context = calloc(1, sizeof(WaylandIMContext)); diff --git a/ism/extras/wayland_immodule/wayland_imcontext.h b/ism/extras/wayland_immodule/wayland_imcontext.h index ffd3c16..ae16469 100644 --- a/ism/extras/wayland_immodule/wayland_imcontext.h +++ b/ism/extras/wayland_immodule/wayland_imcontext.h @@ -128,6 +128,9 @@ wayland_im_context_prediction_hint_set (Ecore_IMF_Context *ctx, const char *pred void wayland_im_context_mime_type_accept_set (Ecore_IMF_Context *ctx, const char *mime_type); +void +wayland_im_context_input_panel_position_set (Ecore_IMF_Context *ctx, int x, int y); + WaylandIMContext *wayland_im_context_new (struct wl_text_input_manager *text_input_manager); extern int _ecore_imf_wayland_log_dom; diff --git a/ism/extras/wayland_immodule/wayland_module.c b/ism/extras/wayland_immodule/wayland_module.c index 3d7b744..01d0ee6 100644 --- a/ism/extras/wayland_immodule/wayland_module.c +++ b/ism/extras/wayland_immodule/wayland_module.c @@ -81,7 +81,8 @@ static Ecore_IMF_Context_Class wayland_imf_class = wayland_im_context_bidi_direction_set, /* bidi_direction_set */ wayland_im_context_input_panel_keyboard_mode_get, /* input_panel_keyboard_mode_get */ wayland_im_context_prediction_hint_set, /* prediction_hint_set */ - wayland_im_context_mime_type_accept_set /* mime_type_accept_set */ + wayland_im_context_mime_type_accept_set, /* mime_type_accept_set */ + wayland_im_context_input_panel_position_set/* input_panel_position_set */ }; static struct wl_text_input_manager *text_input_manager = NULL; -- 2.7.4