ecore_imf/wayland: support autocapital mode in wayland text input

@feature
This commit is contained in:
Jihoon Kim 2015-05-27 14:39:37 +09:00
parent 684c51360f
commit c5f0eea83d
3 changed files with 23 additions and 2 deletions

View File

@ -76,6 +76,7 @@ struct _WaylandIMContext
uint32_t serial;
uint32_t reset_serial;
uint32_t content_purpose;
uint32_t content_hint;
};
static unsigned int
@ -646,7 +647,7 @@ wayland_im_context_focus_in(Ecore_IMF_Context *ctx)
ecore_wl_window_surface_get(imcontext->window));
wl_text_input_set_content_type(imcontext->text_input,
WL_TEXT_INPUT_CONTENT_HINT_NONE,
imcontext->content_hint,
imcontext->content_purpose);
}
}
@ -818,6 +819,23 @@ wayland_im_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int
}
}
EAPI void wayland_im_context_autocapital_type_set(Ecore_IMF_Context *ctx,
Ecore_IMF_Autocapital_Type autocapital_type)
{
WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx);
imcontext->content_hint &= ~(WL_TEXT_INPUT_CONTENT_HINT_AUTO_CAPITALIZATION |
WL_TEXT_INPUT_CONTENT_HINT_UPPERCASE |
WL_TEXT_INPUT_CONTENT_HINT_LOWERCASE);
if (autocapital_type == ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE)
imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_AUTO_CAPITALIZATION;
else if (autocapital_type == ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER)
imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_UPPERCASE;
else
imcontext->content_hint |= WL_TEXT_INPUT_CONTENT_HINT_LOWERCASE;
}
EAPI void
wayland_im_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout)
{

View File

@ -60,6 +60,9 @@ EAPI void wayland_im_context_cursor_location_set(Ecore_IMF_Context *ctx,
int width,
int height);
EAPI void wayland_im_context_autocapital_type_set(Ecore_IMF_Context *ctx,
Ecore_IMF_Autocapital_Type autocapital_type);
EAPI void wayland_im_context_input_panel_layout_set(Ecore_IMF_Context *ctx,
Ecore_IMF_Input_Panel_Layout layout);

View File

@ -61,7 +61,7 @@ static Ecore_IMF_Context_Class wayland_imf_class =
wayland_im_context_filter_event, /* filter_event */
wayland_im_context_preedit_string_with_attributes_get, /* preedit_string_with_attribute_get */
NULL, /* prediction_allow_set */
NULL, /* autocapital_type_set */
wayland_im_context_autocapital_type_set, /* autocapital_type_set */
NULL, /* control panel show */
NULL, /* control panel hide */
wayland_im_context_input_panel_layout_set, /* input_panel_layout_set */