forked from enlightenment/efl
ecore_imf/wayland: Add support to get input panel language locale
This commit is contained in:
parent
478433f0cf
commit
7564d49a83
|
@ -44,6 +44,7 @@ struct _WaylandIMContext
|
||||||
|
|
||||||
char *preedit_text;
|
char *preedit_text;
|
||||||
char *preedit_commit;
|
char *preedit_commit;
|
||||||
|
char *language;
|
||||||
Eina_List *preedit_attrs;
|
Eina_List *preedit_attrs;
|
||||||
int32_t preedit_cursor;
|
int32_t preedit_cursor;
|
||||||
|
|
||||||
|
@ -591,11 +592,17 @@ text_input_input_panel_state(void *data EINA_UNUSED,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
text_input_language(void *data EINA_UNUSED,
|
text_input_language(void *data,
|
||||||
struct wl_text_input *text_input EINA_UNUSED,
|
struct wl_text_input *text_input EINA_UNUSED,
|
||||||
uint32_t serial EINA_UNUSED,
|
uint32_t serial EINA_UNUSED,
|
||||||
const char *language EINA_UNUSED)
|
const char *language)
|
||||||
{
|
{
|
||||||
|
WaylandIMContext *imcontext = (WaylandIMContext *)data;
|
||||||
|
|
||||||
|
if (imcontext->language)
|
||||||
|
free(imcontext->language);
|
||||||
|
|
||||||
|
imcontext->language = strdup(language ? language : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -646,6 +653,12 @@ wayland_im_context_del(Ecore_IMF_Context *ctx)
|
||||||
|
|
||||||
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "context_del");
|
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "context_del");
|
||||||
|
|
||||||
|
if (imcontext->language)
|
||||||
|
{
|
||||||
|
free(imcontext->language);
|
||||||
|
imcontext->language = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (imcontext->text_input)
|
if (imcontext->text_input)
|
||||||
wl_text_input_destroy(imcontext->text_input);
|
wl_text_input_destroy(imcontext->text_input);
|
||||||
|
|
||||||
|
@ -951,6 +964,16 @@ wayland_im_context_input_panel_language_set(Ecore_IMF_Context *ctx,
|
||||||
imcontext->content_hint &= ~WL_TEXT_INPUT_CONTENT_HINT_LATIN;
|
imcontext->content_hint &= ~WL_TEXT_INPUT_CONTENT_HINT_LATIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
wayland_im_context_input_panel_language_locale_get(Ecore_IMF_Context *ctx,
|
||||||
|
char **locale)
|
||||||
|
{
|
||||||
|
WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx);
|
||||||
|
|
||||||
|
if (locale)
|
||||||
|
*locale = strdup(imcontext->language ? imcontext->language : "");
|
||||||
|
}
|
||||||
|
|
||||||
WaylandIMContext *wayland_im_context_new (struct wl_text_input_manager *text_input_manager)
|
WaylandIMContext *wayland_im_context_new (struct wl_text_input_manager *text_input_manager)
|
||||||
{
|
{
|
||||||
WaylandIMContext *context = calloc(1, sizeof(WaylandIMContext));
|
WaylandIMContext *context = calloc(1, sizeof(WaylandIMContext));
|
||||||
|
|
|
@ -79,6 +79,10 @@ EAPI void wayland_im_context_input_hint_set(Ecore_IMF_Context *ctx,
|
||||||
EAPI void wayland_im_context_input_panel_language_set(Ecore_IMF_Context *ctx,
|
EAPI void wayland_im_context_input_panel_language_set(Ecore_IMF_Context *ctx,
|
||||||
Ecore_IMF_Input_Panel_Lang lang);
|
Ecore_IMF_Input_Panel_Lang lang);
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
wayland_im_context_input_panel_language_locale_get(Ecore_IMF_Context *ctx,
|
||||||
|
char **locale);
|
||||||
|
|
||||||
WaylandIMContext *wayland_im_context_new (struct wl_text_input_manager *text_input_manager);
|
WaylandIMContext *wayland_im_context_new (struct wl_text_input_manager *text_input_manager);
|
||||||
|
|
||||||
extern int _ecore_imf_wayland_log_dom;
|
extern int _ecore_imf_wayland_log_dom;
|
||||||
|
|
|
@ -79,7 +79,7 @@ static Ecore_IMF_Context_Class wayland_imf_class =
|
||||||
NULL, /* input_panel_state_get */
|
NULL, /* input_panel_state_get */
|
||||||
NULL, /* input_panel_event_callback_add */
|
NULL, /* input_panel_event_callback_add */
|
||||||
NULL, /* input_panel_event_callback_del */
|
NULL, /* input_panel_event_callback_del */
|
||||||
NULL, /* input_panel_language_locale_get */
|
wayland_im_context_input_panel_language_locale_get, /* input_panel_language_locale_get */
|
||||||
NULL, /* candidate_window_geometry_get */
|
NULL, /* candidate_window_geometry_get */
|
||||||
wayland_im_context_input_hint_set, /* input_hint_set */
|
wayland_im_context_input_hint_set, /* input_hint_set */
|
||||||
NULL /* bidi_direction_set */
|
NULL /* bidi_direction_set */
|
||||||
|
|
Loading…
Reference in New Issue