diff options
author | Jihoon Kim <jihoon48.kim@samsung.com> | 2016-07-22 21:05:25 +0900 |
---|---|---|
committer | Jihoon Kim <jihoon48.kim@samsung.com> | 2016-07-22 21:05:25 +0900 |
commit | 79dfd2d12e0922ec44265bcdbbc070d440447e43 (patch) | |
tree | c65c1bee5fdc289bffef5804da9d8b7efdf5f33a | |
parent | 3244f71b1df54b204679bcab7ce422235e9f413a (diff) | |
download | isf-79dfd2d12e0922ec44265bcdbbc070d440447e43.tar.gz isf-79dfd2d12e0922ec44265bcdbbc070d440447e43.tar.bz2 isf-79dfd2d12e0922ec44265bcdbbc070d440447e43.zip |
Support to change auto capital type dynamically
Change-Id: Ic8a9fff512ff7822f44418e5db6423a116a23af8
-rw-r--r-- | ism/extras/wayland_immodule/wayland_imcontext.c | 82 | ||||
-rw-r--r-- | ism/modules/panelagent/wayland/isf_wsc_context.h | 2 | ||||
-rw-r--r-- | ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp | 6 |
3 files changed, 50 insertions, 40 deletions
diff --git a/ism/extras/wayland_immodule/wayland_imcontext.c b/ism/extras/wayland_immodule/wayland_imcontext.c index 0f6cf9c7..54e08839 100644 --- a/ism/extras/wayland_immodule/wayland_imcontext.c +++ b/ism/extras/wayland_immodule/wayland_imcontext.c @@ -757,6 +757,49 @@ static Eina_Bool _conformant_change_cb(void *data, int ev_type, void *ev) return ECORE_CALLBACK_PASS_ON; } +static uint32_t +get_purpose(Ecore_IMF_Context *ctx) +{ + int layout_variation = ecore_imf_context_input_panel_layout_variation_get (ctx); + uint32_t new_purpose = 0; + + WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx); + if (!imcontext) + return new_purpose; + + switch (imcontext->content_purpose) { + case WL_TEXT_INPUT_CONTENT_PURPOSE_DIGITS: + if (layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_SIGNED) + new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_DIGITS_SIGNED; + else if (layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_DECIMAL) + new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_DIGITS_DECIMAL; + else if (layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_SIGNED_AND_DECIMAL) + new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_DIGITS_SIGNEDDECIMAL; + else + new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_DIGITS; + break; + case WL_TEXT_INPUT_CONTENT_PURPOSE_PASSWORD: + if (layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD_VARIATION_NUMBERONLY) + new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_PASSWORD_DIGITS; + else + new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_PASSWORD; + break; + case WL_TEXT_INPUT_CONTENT_PURPOSE_NORMAL: + if (layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL_VARIATION_FILENAME) + new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_FILENAME; + else if (layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL_VARIATION_PERSON_NAME) + new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NAME; + else + new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NORMAL; + break; + default : + new_purpose = imcontext->content_purpose; + break; + } + + return new_purpose; +} + static Eina_Bool show_input_panel(Ecore_IMF_Context *ctx) { @@ -800,43 +843,12 @@ show_input_panel(Ecore_IMF_Context *ctx) // TIZEN_ONLY(20150715): Support input_panel_state_get _input_panel_state = ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW; - int layout_variation = ecore_imf_context_input_panel_layout_variation_get (ctx); - uint32_t new_purpose = 0; - switch (imcontext->content_purpose) { - case WL_TEXT_INPUT_CONTENT_PURPOSE_DIGITS: - if (layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_SIGNED) - new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_DIGITS_SIGNED; - else if (layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_DECIMAL) - new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_DIGITS_DECIMAL; - else if (layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_SIGNED_AND_DECIMAL) - new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_DIGITS_SIGNEDDECIMAL; - else - new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_DIGITS; - break; - case WL_TEXT_INPUT_CONTENT_PURPOSE_PASSWORD: - if (layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD_VARIATION_NUMBERONLY) - new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_PASSWORD_DIGITS; - else - new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_PASSWORD; - break; - case WL_TEXT_INPUT_CONTENT_PURPOSE_NORMAL: - if (layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL_VARIATION_FILENAME) - new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_FILENAME; - else if (layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL_VARIATION_PERSON_NAME) - new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NAME; - else - new_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NORMAL; - break; - default : - new_purpose = imcontext->content_purpose; - break; - } // wl_text_input_set_content_type(imcontext->text_input, imcontext->content_hint, - new_purpose); + get_purpose(ctx)); if (ecore_imf_context_surrounding_get(imcontext->ctx, &surrounding, &cursor_pos)) { if (surrounding) @@ -1941,6 +1953,12 @@ EAPI void wayland_im_context_autocapital_type_set(Ecore_IMF_Context *ctx, imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_UPPERCASE; else imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_LOWERCASE; + + if (imcontext->input && imcontext->text_input) { + wl_text_input_set_content_type(imcontext->text_input, + imcontext->content_hint, + get_purpose(ctx)); + } } EAPI void diff --git a/ism/modules/panelagent/wayland/isf_wsc_context.h b/ism/modules/panelagent/wayland/isf_wsc_context.h index 8e25098a..1f5d8441 100644 --- a/ism/modules/panelagent/wayland/isf_wsc_context.h +++ b/ism/modules/panelagent/wayland/isf_wsc_context.h @@ -75,7 +75,6 @@ struct _WSCContextISF { uint32_t return_key_type; uint32_t bidi_direction; - Eina_Bool context_changed; Eina_Bool return_key_disabled; WSCContextISFImpl *impl; @@ -97,7 +96,6 @@ struct _WSCContextISF { surrounding_cursor(0), return_key_type(0), bidi_direction(0), - context_changed(EINA_FALSE), return_key_disabled(EINA_FALSE), impl(NULL), id(0), diff --git a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp index 6459b533..1e108062 100644 --- a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp +++ b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp @@ -279,8 +279,6 @@ _wsc_im_ctx_content_type(void *data, struct wl_input_method_context *im_ctx, uin LOGD ("im_context = %p hint = %d purpose = %d\n", im_ctx, hint, purpose); - if (!wsc_ctx->context_changed) return; - wsc_ctx->content_hint = hint; wsc_ctx->content_purpose = purpose; @@ -292,8 +290,6 @@ _wsc_im_ctx_content_type(void *data, struct wl_input_method_context *im_ctx, uin isf_wsc_context_input_panel_language_set (wsc_ctx, wsc_context_input_panel_language_get(wsc_ctx)); caps_mode_check (wsc_ctx, EINA_TRUE, EINA_TRUE); - - wsc_ctx->context_changed = EINA_FALSE; } static void @@ -493,8 +489,6 @@ _wsc_im_activate(void *data, struct wl_input_method *input_method, struct wl_inp isf_wsc_context_add (wsc_ctx); - wsc_ctx->context_changed = EINA_TRUE; - isf_wsc_context_focus_in (wsc_ctx); int len = 0; |