diff options
author | Jihoon Kim <jihoon48.kim@samsung.com> | 2013-04-13 17:11:32 +0900 |
---|---|---|
committer | Jihoon Kim <jihoon48.kim@samsung.com> | 2013-04-13 17:11:32 +0900 |
commit | af31393a09251e7a42897fdaca893600d5221e03 (patch) | |
tree | 6286609ac753263407dbe08f3680f30d146b4639 /src/lib/ecore_imf/ecore_imf_context.c | |
parent | 58d7c5c1dcef38ab671b6066aa779e725b693022 (diff) |
ecore_imf: Add ecore_imf_context_input_panel_event_callback_call, clear API
Diffstat (limited to 'src/lib/ecore_imf/ecore_imf_context.c')
-rw-r--r-- | src/lib/ecore_imf/ecore_imf_context.c | 92 |
1 files changed, 86 insertions, 6 deletions
diff --git a/src/lib/ecore_imf/ecore_imf_context.c b/src/lib/ecore_imf/ecore_imf_context.c index 7c8318e547..f1e88211c7 100644 --- a/src/lib/ecore_imf/ecore_imf_context.c +++ b/src/lib/ecore_imf/ecore_imf_context.c | |||
@@ -190,6 +190,12 @@ ecore_imf_context_del(Ecore_IMF_Context *ctx) | |||
190 | free(fn); | 190 | free(fn); |
191 | } | 191 | } |
192 | 192 | ||
193 | if (ctx->input_panel_callbacks) | ||
194 | { | ||
195 | EINA_LIST_FREE(ctx->input_panel_callbacks, fn) | ||
196 | free(fn); | ||
197 | } | ||
198 | |||
193 | ECORE_MAGIC_SET(ctx, ECORE_MAGIC_NONE); | 199 | ECORE_MAGIC_SET(ctx, ECORE_MAGIC_NONE); |
194 | free(ctx); | 200 | free(ctx); |
195 | } | 201 | } |
@@ -268,7 +274,6 @@ ecore_imf_context_hide(Ecore_IMF_Context *ctx) | |||
268 | return; | 274 | return; |
269 | } | 275 | } |
270 | 276 | ||
271 | show_req_ctx = NULL; | ||
272 | if (ctx->klass->hide) ctx->klass->hide(ctx); | 277 | if (ctx->klass->hide) ctx->klass->hide(ctx); |
273 | } | 278 | } |
274 | 279 | ||
@@ -792,7 +797,6 @@ ecore_imf_context_input_panel_hide(Ecore_IMF_Context *ctx) | |||
792 | return; | 797 | return; |
793 | } | 798 | } |
794 | 799 | ||
795 | show_req_ctx = NULL; | ||
796 | if (ctx->klass->hide) ctx->klass->hide(ctx); | 800 | if (ctx->klass->hide) ctx->klass->hide(ctx); |
797 | } | 801 | } |
798 | 802 | ||
@@ -1060,6 +1064,8 @@ ecore_imf_context_input_panel_event_callback_add(Ecore_IMF_Context *ctx, | |||
1060 | void (*func) (void *data, Ecore_IMF_Context *ctx, int value), | 1064 | void (*func) (void *data, Ecore_IMF_Context *ctx, int value), |
1061 | const void *data) | 1065 | const void *data) |
1062 | { | 1066 | { |
1067 | Ecore_IMF_Input_Panel_Callback_Node *fn = NULL; | ||
1068 | |||
1063 | if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) | 1069 | if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) |
1064 | { | 1070 | { |
1065 | ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, | 1071 | ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, |
@@ -1067,8 +1073,16 @@ ecore_imf_context_input_panel_event_callback_add(Ecore_IMF_Context *ctx, | |||
1067 | return; | 1073 | return; |
1068 | } | 1074 | } |
1069 | 1075 | ||
1070 | if (ctx->klass->input_panel_event_callback_add) | 1076 | if (!func) return; |
1071 | ctx->klass->input_panel_event_callback_add(ctx, type, func, (void *)data); | 1077 | |
1078 | fn = calloc(1, sizeof (Ecore_IMF_Input_Panel_Callback_Node)); | ||
1079 | if (!fn) return; | ||
1080 | |||
1081 | fn->func = func; | ||
1082 | fn->data = data; | ||
1083 | fn->type = type; | ||
1084 | |||
1085 | ctx->input_panel_callbacks = eina_list_append(ctx->input_panel_callbacks, fn); | ||
1072 | } | 1086 | } |
1073 | 1087 | ||
1074 | EAPI void | 1088 | EAPI void |
@@ -1076,6 +1090,10 @@ ecore_imf_context_input_panel_event_callback_del(Ecore_IMF_Context *ctx, | |||
1076 | Ecore_IMF_Input_Panel_Event type, | 1090 | Ecore_IMF_Input_Panel_Event type, |
1077 | void (*func) (void *data, Ecore_IMF_Context *ctx, int value)) | 1091 | void (*func) (void *data, Ecore_IMF_Context *ctx, int value)) |
1078 | { | 1092 | { |
1093 | Eina_List *l = NULL; | ||
1094 | Eina_List *l_next = NULL; | ||
1095 | Ecore_IMF_Input_Panel_Callback_Node *fn = NULL; | ||
1096 | |||
1079 | if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) | 1097 | if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) |
1080 | { | 1098 | { |
1081 | ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, | 1099 | ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, |
@@ -1083,8 +1101,70 @@ ecore_imf_context_input_panel_event_callback_del(Ecore_IMF_Context *ctx, | |||
1083 | return; | 1101 | return; |
1084 | } | 1102 | } |
1085 | 1103 | ||
1086 | if (ctx->klass->input_panel_event_callback_del) | 1104 | if (!func) return; |
1087 | ctx->klass->input_panel_event_callback_del(ctx, type, func); | 1105 | if (!ctx->input_panel_callbacks) return; |
1106 | |||
1107 | EINA_LIST_FOREACH_SAFE(ctx->input_panel_callbacks, l, l_next, fn) | ||
1108 | { | ||
1109 | if ((fn) && (fn->func == func) && (fn->type == type)) | ||
1110 | { | ||
1111 | free(fn); | ||
1112 | ctx->input_panel_callbacks = eina_list_remove_list(ctx->input_panel_callbacks, l); | ||
1113 | return; | ||
1114 | } | ||
1115 | } | ||
1116 | } | ||
1117 | |||
1118 | EAPI void | ||
1119 | ecore_imf_context_input_panel_event_callback_call(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Event type, int value) | ||
1120 | { | ||
1121 | Ecore_IMF_Input_Panel_Callback_Node *fn = NULL; | ||
1122 | Eina_List *l = NULL; | ||
1123 | |||
1124 | if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) | ||
1125 | { | ||
1126 | ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, | ||
1127 | "ecore_imf_context_input_panel_event_callback_call"); | ||
1128 | return; | ||
1129 | } | ||
1130 | |||
1131 | EINA_LIST_FOREACH(ctx->input_panel_callbacks, l, fn) | ||
1132 | { | ||
1133 | if ((fn) && (fn->type == type) && (fn->func)) | ||
1134 | { | ||
1135 | fn->func(fn->data, ctx, value); | ||
1136 | if (type == ECORE_IMF_INPUT_PANEL_STATE_EVENT && | ||
1137 | value == ECORE_IMF_INPUT_PANEL_STATE_HIDE && | ||
1138 | show_req_ctx == ctx) | ||
1139 | show_req_ctx = NULL; | ||
1140 | } | ||
1141 | } | ||
1142 | } | ||
1143 | |||
1144 | EAPI void | ||
1145 | ecore_imf_context_input_panel_event_callback_clear(Ecore_IMF_Context *ctx) | ||
1146 | { | ||
1147 | Ecore_IMF_Input_Panel_Callback_Node *fn = NULL; | ||
1148 | Eina_List *l = NULL; | ||
1149 | |||
1150 | if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) | ||
1151 | { | ||
1152 | ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, | ||
1153 | "ecore_imf_context_input_panel_event_callback_clear"); | ||
1154 | return; | ||
1155 | } | ||
1156 | |||
1157 | for (l = ctx->input_panel_callbacks; l;) | ||
1158 | { | ||
1159 | fn = (Ecore_IMF_Input_Panel_Callback_Node *)l->data; | ||
1160 | |||
1161 | if (fn) | ||
1162 | { | ||
1163 | ctx->input_panel_callbacks = eina_list_remove(ctx->input_panel_callbacks, fn); | ||
1164 | free (fn); | ||
1165 | } | ||
1166 | l = l->next; | ||
1167 | } | ||
1088 | } | 1168 | } |
1089 | 1169 | ||
1090 | EAPI void | 1170 | EAPI void |