//
};
+typedef struct {
+ Ecore_IMF_Context *ctx;
+ WaylandIMContext *imcontext;
+} Ecore_Imf_Wayland_Imcontext_Pair;
+Eina_List *_ecore_imf_wayland_imcontext_pair_list = NULL;
+
+static void _ecore_imf_wayland_imcontext_pair_add (Ecore_IMF_Context *ctx, WaylandIMContext *imcontext)
+{
+ Ecore_Imf_Wayland_Imcontext_Pair *pair = malloc (sizeof (Ecore_Imf_Wayland_Imcontext_Pair));
+ if (pair) {
+ pair->ctx = ctx;
+ pair->imcontext = imcontext;
+
+ _ecore_imf_wayland_imcontext_pair_list = eina_list_append (_ecore_imf_wayland_imcontext_pair_list, pair);
+ }
+}
+
+static Ecore_Imf_Wayland_Imcontext_Pair* _ecore_imf_wayland_imcontext_pair_find (Ecore_IMF_Context *ctx)
+{
+ Eina_List *l;
+ Ecore_Imf_Wayland_Imcontext_Pair *pair;
+ EINA_LIST_FOREACH (_ecore_imf_wayland_imcontext_pair_list, l, pair)
+ if (pair->ctx == ctx) {
+ return pair;
+ }
+ LOGE("The Ecore_Imf %p if not found in Ecore_IMF-WaylandIMContext pair list!!", ctx);
+ return NULL;
+}
+
+static void _ecore_imf_wayland_imcontext_pair_del (Ecore_IMF_Context *ctx)
+{
+ Eina_List *l;
+ Eina_List *l_next;
+ Ecore_Imf_Wayland_Imcontext_Pair *pair;
+
+ EINA_LIST_FOREACH_SAFE (_ecore_imf_wayland_imcontext_pair_list, l, l_next, pair)
+ if (ctx == pair->ctx) {
+ free (pair);
+ _ecore_imf_wayland_imcontext_pair_list = eina_list_remove_list (_ecore_imf_wayland_imcontext_pair_list, l);
+ }
+}
+
+static void _ecore_imf_wayland_imcontext_pair_destroy ()
+{
+ if (_ecore_imf_wayland_imcontext_pair_list) {
+ Ecore_Imf_Wayland_Imcontext_Pair *pair;
+ EINA_LIST_FREE (_ecore_imf_wayland_imcontext_pair_list, pair)
+ free (pair);
+ _ecore_imf_wayland_imcontext_pair_list = NULL;
+ }
+}
+
+static int _ecore_imf_wayland_imcontext_pair_log ()
+{
+ char buffer[255] = { '\0' };
+ int count = 0;
+ Eina_List *l;
+ Ecore_Imf_Wayland_Imcontext_Pair *pair;
+ EINA_LIST_FOREACH(_ecore_imf_wayland_imcontext_pair_list, l, pair) {
+ if (pair) {
+ snprintf(buffer + strlen(buffer), 255 - strlen(buffer), "%s[%p/%p]", (count ? "," : ""), pair->ctx, pair->imcontext);
+ }
+ count++;
+ }
+ if (count == 0) {
+ LOGD("No Ecore_Imf / Wayland_Imcontext pair found");
+ } else {
+ LOGD("%d Pair(s) : %s", count, buffer);
+ }
+
+ return count;
+}
+
// TIZEN_ONLY(20150708): Support back key
static void _input_panel_hide(Ecore_IMF_Context *ctx, Eina_Bool instant);
static Eina_Bool show_input_panel(Ecore_IMF_Context *ctx);
void wayland_im_uninitialize ()
{
+ _ecore_imf_wayland_imcontext_pair_destroy ();
+
unregister_key_handler ();
_win_focus_out_handler_del ();
{
WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx);
+ Eina_Bool valid = EINA_FALSE;
+ Ecore_Imf_Wayland_Imcontext_Pair *pair = _ecore_imf_wayland_imcontext_pair_find(ctx);
+ if (pair && pair->imcontext == imcontext) {
+ _ecore_imf_wayland_imcontext_pair_del(ctx);
+ valid = EINA_TRUE;
+ }
+ else {
+ LOGE("The Ecore_Imf %p and WaylandIMContext %p pair not found!! pair : %p, pair->imcontext %p",
+ ctx, imcontext, pair, pair ? pair->imcontext : NULL);
+ _ecore_imf_wayland_imcontext_pair_log();
+ }
+
Ecore_Event_Key *ev;
- LOGD ("ctx : %p, focused_ctx : %p, show_req_ctx : %p", ctx, _focused_ctx, _show_req_ctx);
+ LOGD ("ctx : %p [%d], focused_ctx : %p, show_req_ctx : %p", ctx, valid, _focused_ctx, _show_req_ctx);
if (!imcontext) return;
return context;
}
+
+void wayland_im_context_pair_set (Ecore_IMF_Context *ctx, WaylandIMContext *imcontext)
+{
+ _ecore_imf_wayland_imcontext_pair_add (ctx, imcontext);
+}