ecore_imf/wayland: support feature to change layout of virtual keyboard

This commit is contained in:
Jihoon Kim 2015-05-20 18:47:58 +09:00
parent e41d1f2cb4
commit 21106fd5f0
3 changed files with 50 additions and 1 deletions

View File

@ -75,6 +75,7 @@ struct _WaylandIMContext
uint32_t serial;
uint32_t reset_serial;
uint32_t content_purpose;
};
static unsigned int
@ -643,6 +644,10 @@ wayland_im_context_focus_in(Ecore_IMF_Context *ctx)
wl_text_input_show_input_panel(imcontext->text_input);
wl_text_input_activate(imcontext->text_input, seat,
ecore_wl_window_surface_get(imcontext->window));
wl_text_input_set_content_type(imcontext->text_input,
WL_TEXT_INPUT_CONTENT_HINT_NONE,
imcontext->content_purpose);
}
}
@ -813,6 +818,47 @@ wayland_im_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int
}
}
EAPI void
wayland_im_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout)
{
WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx);
switch (layout) {
case ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER:
imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NUMBER;
break;
case ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL:
imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_EMAIL;
break;
case ECORE_IMF_INPUT_PANEL_LAYOUT_URL:
imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_URL;
break;
case ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER:
imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_PHONE;
break;
case ECORE_IMF_INPUT_PANEL_LAYOUT_IP:
imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NUMBER;
break;
case ECORE_IMF_INPUT_PANEL_LAYOUT_MONTH:
imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_DATE;
break;
case ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY:
imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_DIGITS;
break;
case ECORE_IMF_INPUT_PANEL_LAYOUT_TERMINAL:
imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_TERMINAL;
break;
case ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD:
imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_PASSWORD;
break;
case ECORE_IMF_INPUT_PANEL_LAYOUT_DATETIME:
imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_DATETIME;
break;
default:
imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NORMAL;
break;
}
}
WaylandIMContext *wayland_im_context_new (struct wl_text_input_manager *text_input_manager)
{

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_input_panel_layout_set(Ecore_IMF_Context *ctx,
Ecore_IMF_Input_Panel_Layout layout);
WaylandIMContext *wayland_im_context_new (struct wl_text_input_manager *text_input_manager);
extern int _ecore_imf_wayland_log_dom;

View File

@ -64,7 +64,7 @@ static Ecore_IMF_Context_Class wayland_imf_class =
NULL, /* autocapital_type_set */
NULL, /* control panel show */
NULL, /* control panel hide */
NULL, /* input_panel_layout_set */
wayland_im_context_input_panel_layout_set, /* input_panel_layout_set */
NULL, /* input_panel_layout_get, */
NULL, /* input_panel_language_set, */
NULL, /* input_panel_language_get, */