From 507b078eccf879b04adcb2375941de3341ae54a4 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 8 Dec 2017 16:34:07 +0900 Subject: [PATCH] Support to deliver autofill type Change-Id: I73e77bec92744df09c382604e4d554686dbc6b73 Signed-off-by: Jihoon Kim --- ism/extras/wayland_immodule/wayland_imcontext.c | 43 +++++++++++++++++++++ ism/modules/panelagent/wayland/isf_wsc_control.cpp | 6 +++ ism/modules/panelagent/wayland/isf_wsc_control.h | 1 + .../panelagent/wayland/isf_wsc_control_ui.cpp | 6 +++ .../panelagent/wayland/isf_wsc_control_ui.h | 1 + .../wayland/wayland_panel_agent_module.cpp | 45 ++++++++++++++++++++++ 6 files changed, 102 insertions(+) diff --git a/ism/extras/wayland_immodule/wayland_imcontext.c b/ism/extras/wayland_immodule/wayland_imcontext.c index a222f2a..80c9b16 100644 --- a/ism/extras/wayland_immodule/wayland_imcontext.c +++ b/ism/extras/wayland_immodule/wayland_imcontext.c @@ -3378,6 +3378,49 @@ wayland_im_context_input_hint_set(Ecore_IMF_Context *ctx, else imcontext->content_hint &= ~WL_TEXT_INPUT_CONTENT_HINT_MULTILINE; + // autofill + LOGD("autofill hint : %x\n", input_hints & ECORE_IMF_INPUT_HINT_AUTOFILL_MASK); + + switch(input_hints & ECORE_IMF_INPUT_HINT_AUTOFILL_MASK) + { + case ECORE_IMF_INPUT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_DATE: + imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_DATE; + break; + case ECORE_IMF_INPUT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_DAY: + imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_DAY; + break; + case ECORE_IMF_INPUT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_MONTH: + imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_MONTH; + break; + case ECORE_IMF_INPUT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_YEAR: + imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_YEAR; + break; + case ECORE_IMF_INPUT_HINT_AUTOFILL_CREDIT_CARD_NUMBER: + imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_CREDIT_CARD_NUMBER; + break; + case ECORE_IMF_INPUT_HINT_AUTOFILL_CREDIT_CARD_SECURITY_CODE: + imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_CREDIT_CARD_SECURITY_CODE; + break; + case ECORE_IMF_INPUT_HINT_AUTOFILL_EMAIL_ADDRESS: + imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_EMAIL_ADDRESS; + break; + case ECORE_IMF_INPUT_HINT_AUTOFILL_PHONE: + imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_PHONE; + break; + case ECORE_IMF_INPUT_HINT_AUTOFILL_POSTAL_ADDRESS: + imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_POSTAL_ADDRESS; + break; + case ECORE_IMF_INPUT_HINT_AUTOFILL_POSTAL_CODE: + imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_POSTAL_CODE; + break; + case ECORE_IMF_INPUT_HINT_AUTOFILL_ID: + imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_ID; + break; + case ECORE_IMF_INPUT_HINT_AUTOFILL_NAME: + imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_NAME; + break; + } + if (imcontext->input && imcontext->text_input) { LOGD("ctx : %p, input hint : %#x", ctx, input_hints); wl_text_input_set_content_type(imcontext->text_input, diff --git a/ism/modules/panelagent/wayland/isf_wsc_control.cpp b/ism/modules/panelagent/wayland/isf_wsc_control.cpp index 0a198c8..a71cc4f 100644 --- a/ism/modules/panelagent/wayland/isf_wsc_control.cpp +++ b/ism/modules/panelagent/wayland/isf_wsc_control.cpp @@ -237,6 +237,12 @@ int _isf_wsc_context_input_panel_prediction_hint_data_set (int context, const ch return 0; } +int _isf_wsc_context_input_hint_set (int context, Ecore_IMF_Input_Hints input_hint) +{ + g_info_manager->set_ise_input_hint (get_panel_client_id (), input_hint); + return 0; +} + /* vi:ts=4:expandtab:nowrap */ diff --git a/ism/modules/panelagent/wayland/isf_wsc_control.h b/ism/modules/panelagent/wayland/isf_wsc_control.h index d284c1e..bb43e26 100644 --- a/ism/modules/panelagent/wayland/isf_wsc_control.h +++ b/ism/modules/panelagent/wayland/isf_wsc_control.h @@ -68,6 +68,7 @@ extern "C" int _isf_wsc_context_input_panel_mime_type_accept_set (int context, const char *mime_type); int _isf_wsc_context_input_panel_finalize_content (int context, const char *text, int cursor_pos); int _isf_wsc_context_input_panel_prediction_hint_data_set (int context, const char *key, const char *value); + int _isf_wsc_context_input_hint_set (int context, Ecore_IMF_Input_Hints input_hint); #ifdef __cplusplus } diff --git a/ism/modules/panelagent/wayland/isf_wsc_control_ui.cpp b/ism/modules/panelagent/wayland/isf_wsc_control_ui.cpp index 01ef0f1..83c3a5c 100644 --- a/ism/modules/panelagent/wayland/isf_wsc_control_ui.cpp +++ b/ism/modules/panelagent/wayland/isf_wsc_control_ui.cpp @@ -310,3 +310,9 @@ void isf_wsc_context_input_panel_prediction_hint_data_set (WSCContextISF *ctx, c { _isf_wsc_context_input_panel_prediction_hint_data_set (_get_context_id(ctx), key, value); } + +void isf_wsc_context_input_hint_set (WSCContextISF *ctx, Ecore_IMF_Input_Hints input_hint) +{ + SECURE_LOGD("input hint : %d\n", input_hint); + _isf_wsc_context_input_hint_set (_get_context_id(ctx), input_hint); +} diff --git a/ism/modules/panelagent/wayland/isf_wsc_control_ui.h b/ism/modules/panelagent/wayland/isf_wsc_control_ui.h index fc39f17..0df5bfe 100644 --- a/ism/modules/panelagent/wayland/isf_wsc_control_ui.h +++ b/ism/modules/panelagent/wayland/isf_wsc_control_ui.h @@ -58,6 +58,7 @@ extern "C" void isf_wsc_context_input_panel_mime_type_accept_set (WSCContextISF *ctx, const char *mime_type); void isf_wsc_context_input_panel_finalize_content (WSCContextISF *ctx, const char *text, int cursor_pos); void isf_wsc_context_input_panel_prediction_hint_data_set (WSCContextISF *ctx, const char *key, const char *value); + void isf_wsc_context_input_hint_set (WSCContextISF *ctx, Ecore_IMF_Input_Hints input_hint); #ifdef __cplusplus } diff --git a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp index b9a9654..8138a6f 100644 --- a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp +++ b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp @@ -220,6 +220,8 @@ static int _ecore_wl_init_count #define MOD_NUM_MASK 0x100 #define MOD_Mod5_MASK 0x80 +#define WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_MASK 0xff0000 + //////////////////////////////wayland_panel_agent_module begin////////////////////////////////////////////////// #define scim_module_init wayland_LTX_scim_module_init @@ -294,6 +296,8 @@ _wsc_im_ctx_content_type (void *data, struct wl_input_method_context *im_ctx, ui wsc_ctx->language_initialized = EINA_TRUE; isf_wsc_context_input_panel_language_set (wsc_ctx, wsc_context_input_panel_language_get (wsc_ctx)); } + + isf_wsc_context_input_hint_set (wsc_ctx, wsc_context_input_hint_get (wsc_ctx)); } if (_TV) { @@ -2255,6 +2259,47 @@ Ecore_IMF_Input_Hints wsc_context_input_hint_get (WSCContextISF *wsc_ctx) else input_hint &= ~ECORE_IMF_INPUT_HINT_MULTILINE; + // autofill + switch (wsc_ctx->content_hint & WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_MASK) + { + case WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_DATE: + input_hint |= ECORE_IMF_INPUT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_DATE; + break; + case WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_DAY: + input_hint |= ECORE_IMF_INPUT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_DAY; + break; + case WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_MONTH: + input_hint |= ECORE_IMF_INPUT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_MONTH; + break; + case WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_YEAR: + input_hint |= ECORE_IMF_INPUT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_YEAR; + break; + case WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_CREDIT_CARD_NUMBER: + input_hint |= ECORE_IMF_INPUT_HINT_AUTOFILL_CREDIT_CARD_NUMBER; + break; + case WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_CREDIT_CARD_SECURITY_CODE: + input_hint |= ECORE_IMF_INPUT_HINT_AUTOFILL_CREDIT_CARD_SECURITY_CODE; + break; + case WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_EMAIL_ADDRESS: + input_hint |= ECORE_IMF_INPUT_HINT_AUTOFILL_EMAIL_ADDRESS; + break; + case WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_PHONE: + input_hint |= ECORE_IMF_INPUT_HINT_AUTOFILL_PHONE; + break; + case WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_POSTAL_ADDRESS: + input_hint |= ECORE_IMF_INPUT_HINT_AUTOFILL_POSTAL_ADDRESS; + break; + case WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_POSTAL_CODE: + input_hint |= ECORE_IMF_INPUT_HINT_AUTOFILL_POSTAL_CODE; + break; + case WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_ID: + input_hint |= ECORE_IMF_INPUT_HINT_AUTOFILL_ID; + break; + case WL_TEXT_INPUT_CONTENT_HINT_AUTOFILL_NAME: + input_hint |= ECORE_IMF_INPUT_HINT_AUTOFILL_NAME; + break; + } + return (Ecore_IMF_Input_Hints)input_hint; } -- 2.7.4