aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/edje/src/lib/edje_entry.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/edje/src/lib/edje_entry.c')
-rw-r--r--libraries/edje/src/lib/edje_entry.c462
1 files changed, 373 insertions, 89 deletions
diff --git a/libraries/edje/src/lib/edje_entry.c b/libraries/edje/src/lib/edje_entry.c
index 563497d..f94883f 100644
--- a/libraries/edje/src/lib/edje_entry.c
+++ b/libraries/edje/src/lib/edje_entry.c
@@ -12,7 +12,6 @@ typedef struct _Sel Sel;
12typedef struct _Anchor Anchor; 12typedef struct _Anchor Anchor;
13 13
14static void _edje_entry_imf_cursor_info_set(Entry *en); 14static void _edje_entry_imf_cursor_info_set(Entry *en);
15static void _edje_entry_imf_context_reset(Entry *en);
16 15
17struct _Entry 16struct _Entry
18{ 17{
@@ -29,12 +28,15 @@ struct _Entry
29 Eina_List *anchorlist; 28 Eina_List *anchorlist;
30 Eina_List *itemlist; 29 Eina_List *itemlist;
31 char *selection; 30 char *selection;
31 Edje_Input_Panel_Lang input_panel_lang;
32 Eina_Bool selecting : 1; 32 Eina_Bool selecting : 1;
33 Eina_Bool have_selection : 1; 33 Eina_Bool have_selection : 1;
34 Eina_Bool select_allow : 1; 34 Eina_Bool select_allow : 1;
35 Eina_Bool select_mod_start : 1; 35 Eina_Bool select_mod_start : 1;
36 Eina_Bool select_mod_end : 1; 36 Eina_Bool select_mod_end : 1;
37 Eina_Bool had_sel : 1; 37 Eina_Bool had_sel : 1;
38 Eina_Bool input_panel_enable : 1;
39 Eina_Bool prediction_allow : 1;
38 40
39#ifdef HAVE_ECORE_IMF 41#ifdef HAVE_ECORE_IMF
40 Eina_Bool have_preedit : 1; 42 Eina_Bool have_preedit : 1;
@@ -179,6 +181,27 @@ _edje_focus_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
179} 181}
180 182
181static void 183static void
184_text_filter_markup_prepend_internal(Entry *en, Evas_Textblock_Cursor *c, char *text)
185{
186 Edje_Markup_Filter_Callback *cb;
187 Eina_List *l;
188
189 EINA_LIST_FOREACH(en->rp->edje->markup_filter_callbacks, l, cb)
190 {
191 if (!strcmp(cb->part, en->rp->part->name))
192 {
193 cb->func(cb->data, en->rp->edje->obj, cb->part, &text);
194 if (!text) break;
195 }
196 }
197 if (text)
198 {
199 evas_object_textblock_text_markup_prepend(c, text);
200 free(text);
201 }
202}
203
204static void
182_text_filter_text_prepend(Entry *en, Evas_Textblock_Cursor *c, const char *text) 205_text_filter_text_prepend(Entry *en, Evas_Textblock_Cursor *c, const char *text)
183{ 206{
184 char *text2; 207 char *text2;
@@ -196,8 +219,11 @@ _text_filter_text_prepend(Entry *en, Evas_Textblock_Cursor *c, const char *text)
196 } 219 }
197 if (text2) 220 if (text2)
198 { 221 {
199 evas_textblock_cursor_text_prepend(c, text2); 222 char *markup_text;
223 markup_text = evas_textblock_text_utf8_to_markup(NULL, text2);
200 free(text2); 224 free(text2);
225 if (markup_text)
226 _text_filter_markup_prepend_internal(en, c, markup_text);
201 } 227 }
202} 228}
203 229
@@ -219,8 +245,61 @@ _text_filter_format_prepend(Entry *en, Evas_Textblock_Cursor *c, const char *tex
219 } 245 }
220 if (text2) 246 if (text2)
221 { 247 {
222 evas_textblock_cursor_format_prepend(c, text2); 248 char *s, *markup_text;
249
250 s = text2;
251 if (*s == '+')
252 {
253 s++;
254 while (*s == ' ') s++;
255 if (!s)
256 {
257 free(text2);
258 return;
259 }
260 markup_text = (char*) malloc(strlen(s) + 3);
261 if (markup_text)
262 {
263 *(markup_text) = '<';
264 strncpy((markup_text + 1), s, strlen(s));
265 *(markup_text + strlen(s) + 1) = '>';
266 *(markup_text + strlen(s) + 2) = '\0';
267 }
268 }
269 else if (s[0] == '-')
270 {
271 s++;
272 while (*s == ' ') s++;
273 if (!s)
274 {
275 free(text2);
276 return;
277 }
278 markup_text = (char*) malloc(strlen(s) + 4);
279 if (markup_text)
280 {
281 *(markup_text) = '<';
282 *(markup_text + 1) = '/';
283 strncpy((markup_text + 2), s, strlen(s));
284 *(markup_text + strlen(s) + 2) = '>';
285 *(markup_text + strlen(s) + 3) = '\0';
286 }
287 }
288 else
289 {
290 markup_text = (char*) malloc(strlen(s) + 4);
291 if (markup_text)
292 {
293 *(markup_text) = '<';
294 strncpy((markup_text + 1), s, strlen(s));
295 *(markup_text + strlen(s) + 1) = '/';
296 *(markup_text + strlen(s) + 2) = '>';
297 *(markup_text + strlen(s) + 3) = '\0';
298 }
299 }
223 free(text2); 300 free(text2);
301 if (markup_text)
302 _text_filter_markup_prepend_internal(en, c, markup_text);
224 } 303 }
225} 304}
226 305
@@ -241,10 +320,7 @@ _text_filter_markup_prepend(Entry *en, Evas_Textblock_Cursor *c, const char *tex
241 } 320 }
242 } 321 }
243 if (text2) 322 if (text2)
244 { 323 _text_filter_markup_prepend_internal(en, c, text2);
245 evas_object_textblock_text_markup_prepend(c, text2);
246 free(text2);
247 }
248} 324}
249 325
250static void 326static void
@@ -397,7 +473,7 @@ static void
397_sel_extend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en) 473_sel_extend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
398{ 474{
399 if (!en->sel_end) return; 475 if (!en->sel_end) return;
400 _edje_entry_imf_context_reset(en); 476 _edje_entry_imf_context_reset(en->rp);
401 _sel_enable(c, o, en); 477 _sel_enable(c, o, en);
402 if (!evas_textblock_cursor_compare(c, en->sel_end)) return; 478 if (!evas_textblock_cursor_compare(c, en->sel_end)) return;
403 evas_textblock_cursor_copy(c, en->sel_end); 479 evas_textblock_cursor_copy(c, en->sel_end);
@@ -413,7 +489,7 @@ static void
413_sel_preextend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en) 489_sel_preextend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
414{ 490{
415 if (!en->sel_end) return; 491 if (!en->sel_end) return;
416 _edje_entry_imf_context_reset(en); 492 _edje_entry_imf_context_reset(en->rp);
417 _sel_enable(c, o, en); 493 _sel_enable(c, o, en);
418 if (!evas_textblock_cursor_compare(c, en->sel_start)) return; 494 if (!evas_textblock_cursor_compare(c, en->sel_start)) return;
419 evas_textblock_cursor_copy(c, en->sel_start); 495 evas_textblock_cursor_copy(c, en->sel_start);
@@ -882,7 +958,7 @@ _anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
882 char *p; 958 char *p;
883 an = calloc(1, sizeof(Anchor)); 959 an = calloc(1, sizeof(Anchor));
884 if (!an) 960 if (!an)
885 break; 961 break;
886 962
887 an->en = en; 963 an->en = en;
888 p = strstr(s, "href="); 964 p = strstr(s, "href=");
@@ -903,7 +979,7 @@ _anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
903 { 979 {
904 s = evas_textblock_node_format_text_get(node); 980 s = evas_textblock_node_format_text_get(node);
905 if ((!strcmp(s, "- a")) || (!strcmp(s, "-a"))) 981 if ((!strcmp(s, "- a")) || (!strcmp(s, "-a")))
906 break; 982 break;
907 } 983 }
908 984
909 if (node) 985 if (node)
@@ -932,7 +1008,7 @@ _anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
932 char *p; 1008 char *p;
933 an = calloc(1, sizeof(Anchor)); 1009 an = calloc(1, sizeof(Anchor));
934 if (!an) 1010 if (!an)
935 break; 1011 break;
936 1012
937 an->en = en; 1013 an->en = en;
938 an->item = 1; 1014 an->item = 1;
@@ -986,12 +1062,14 @@ _range_del_emit(Edje *ed, Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __
986 _edje_emit(ed, "entry,changed", en->rp->part->name); 1062 _edje_emit(ed, "entry,changed", en->rp->part->name);
987 _edje_emit_full(ed, "entry,changed,user", en->rp->part->name, info, 1063 _edje_emit_full(ed, "entry,changed,user", en->rp->part->name, info,
988 _free_entry_change_info); 1064 _free_entry_change_info);
1065 _sel_clear(en->cursor, en->rp->object, en);
989} 1066}
990 1067
991static void 1068static void
992_range_del(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en) 1069_range_del(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en)
993{ 1070{
994 evas_textblock_cursor_range_delete(en->sel_start, en->sel_end); 1071 evas_textblock_cursor_range_delete(en->sel_start, en->sel_end);
1072 _sel_clear(en->cursor, en->rp->object, en);
995} 1073}
996 1074
997static void 1075static void
@@ -1041,7 +1119,7 @@ _edje_entry_hide_visible_password(Edje_Real_Part *rp)
1041 if (!strcmp(text, "+ password=off")) 1119 if (!strcmp(text, "+ password=off"))
1042 { 1120 {
1043 evas_textblock_node_format_remove_pair(rp->object, 1121 evas_textblock_node_format_remove_pair(rp->object,
1044 (Evas_Object_Textblock_Node_Format *) node); 1122 (Evas_Object_Textblock_Node_Format *) node);
1045 break; 1123 break;
1046 } 1124 }
1047 } 1125 }
@@ -1075,7 +1153,7 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1075 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) || 1153 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
1076 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE)) 1154 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE))
1077 return; 1155 return;
1078 if (!ev->key) return; 1156 if (!ev->keyname) return;
1079 1157
1080#ifdef HAVE_ECORE_IMF 1158#ifdef HAVE_ECORE_IMF
1081 if (en->imf_context) 1159 if (en->imf_context)
@@ -1089,9 +1167,9 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1089 } 1167 }
1090#endif 1168#endif
1091 1169
1092 if ((!strcmp(ev->key, "Escape")) || 1170 if ((!strcmp(ev->keyname, "Escape")) ||
1093 (!strcmp(ev->key, "Return")) || (!strcmp(ev->key, "KP_Enter"))) 1171 (!strcmp(ev->keyname, "Return")) || (!strcmp(ev->keyname, "KP_Enter")))
1094 _edje_entry_imf_context_reset(en); 1172 _edje_entry_imf_context_reset(rp);
1095 1173
1096 old_cur_pos = evas_textblock_cursor_pos_get(en->cursor); 1174 old_cur_pos = evas_textblock_cursor_pos_get(en->cursor);
1097 1175
@@ -1100,13 +1178,13 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1100 shift = evas_key_modifier_is_set(ev->modifiers, "Shift"); 1178 shift = evas_key_modifier_is_set(ev->modifiers, "Shift");
1101 multiline = rp->part->multiline; 1179 multiline = rp->part->multiline;
1102 cursor_changed = EINA_FALSE; 1180 cursor_changed = EINA_FALSE;
1103 if (!strcmp(ev->key, "Escape")) 1181 if (!strcmp(ev->keyname, "Escape"))
1104 { 1182 {
1105 // dead keys here. Escape for now (should emit these) 1183 // dead keys here. Escape for now (should emit these)
1106 _edje_emit(ed, "entry,key,escape", rp->part->name); 1184 _edje_emit(ed, "entry,key,escape", rp->part->name);
1107 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1185 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1108 } 1186 }
1109 else if (!strcmp(ev->key, "Up") || !strcmp(ev->key, "KP_Up")) 1187 else if (!strcmp(ev->keyname, "Up") || !strcmp(ev->keyname, "KP_Up"))
1110 { 1188 {
1111 if (multiline) 1189 if (multiline)
1112 { 1190 {
@@ -1119,14 +1197,14 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1119 if (en->select_allow) 1197 if (en->select_allow)
1120 { 1198 {
1121 if (shift) _sel_extend(en->cursor, rp->object, en); 1199 if (shift) _sel_extend(en->cursor, rp->object, en);
1200 else _sel_clear(en->cursor, rp->object, en);
1122 } 1201 }
1123 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1202 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1124 } 1203 }
1125 _sel_clear(en->cursor, rp->object, en);
1126 _edje_emit(ed, "entry,key,up", rp->part->name); 1204 _edje_emit(ed, "entry,key,up", rp->part->name);
1127 _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name); 1205 _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name);
1128 } 1206 }
1129 else if (!strcmp(ev->key, "Down") || !strcmp(ev->key, "KP_Down")) 1207 else if (!strcmp(ev->keyname, "Down") || !strcmp(ev->keyname, "KP_Down"))
1130 { 1208 {
1131 if (multiline) 1209 if (multiline)
1132 { 1210 {
@@ -1139,14 +1217,14 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1139 if (en->select_allow) 1217 if (en->select_allow)
1140 { 1218 {
1141 if (shift) _sel_extend(en->cursor, rp->object, en); 1219 if (shift) _sel_extend(en->cursor, rp->object, en);
1220 else _sel_clear(en->cursor, rp->object, en);
1142 } 1221 }
1143 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1222 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1144 } 1223 }
1145 _sel_clear(en->cursor, rp->object, en);
1146 _edje_emit(ed, "entry,key,down", rp->part->name); 1224 _edje_emit(ed, "entry,key,down", rp->part->name);
1147 _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name); 1225 _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name);
1148 } 1226 }
1149 else if (!strcmp(ev->key, "Left") || !strcmp(ev->key, "KP_Left")) 1227 else if (!strcmp(ev->keyname, "Left") || !strcmp(ev->keyname, "KP_Left"))
1150 { 1228 {
1151 if (en->select_allow) 1229 if (en->select_allow)
1152 { 1230 {
@@ -1159,13 +1237,13 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1159 if (en->select_allow) 1237 if (en->select_allow)
1160 { 1238 {
1161 if (shift) _sel_extend(en->cursor, rp->object, en); 1239 if (shift) _sel_extend(en->cursor, rp->object, en);
1240 else _sel_clear(en->cursor, rp->object, en);
1162 } 1241 }
1163 _sel_clear(en->cursor, rp->object, en);
1164 _edje_emit(ed, "entry,key,left", rp->part->name); 1242 _edje_emit(ed, "entry,key,left", rp->part->name);
1165 _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name); 1243 _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name);
1166 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1244 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1167 } 1245 }
1168 else if (!strcmp(ev->key, "Right") || !strcmp(ev->key, "KP_Right")) 1246 else if (!strcmp(ev->keyname, "Right") || !strcmp(ev->keyname, "KP_Right"))
1169 { 1247 {
1170 if (en->select_allow) 1248 if (en->select_allow)
1171 { 1249 {
@@ -1178,13 +1256,13 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1178 if (en->select_allow) 1256 if (en->select_allow)
1179 { 1257 {
1180 if (shift) _sel_extend(en->cursor, rp->object, en); 1258 if (shift) _sel_extend(en->cursor, rp->object, en);
1259 else _sel_clear(en->cursor, rp->object, en);
1181 } 1260 }
1182 _sel_clear(en->cursor, rp->object, en);
1183 _edje_emit(ed, "entry,key,right", rp->part->name); 1261 _edje_emit(ed, "entry,key,right", rp->part->name);
1184 _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name); 1262 _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name);
1185 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1263 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1186 } 1264 }
1187 else if (!strcmp(ev->key, "BackSpace")) 1265 else if (!strcmp(ev->keyname, "BackSpace"))
1188 { 1266 {
1189 if (control && !en->have_selection) 1267 if (control && !en->have_selection)
1190 { 1268 {
@@ -1221,7 +1299,7 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1221 _edje_emit(ed, "entry,key,backspace", rp->part->name); 1299 _edje_emit(ed, "entry,key,backspace", rp->part->name);
1222 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1300 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1223 } 1301 }
1224 else if (!strcmp(ev->key, "Delete") || !strcmp(ev->key, "KP_Delete")) 1302 else if (!strcmp(ev->keyname, "Delete") || !strcmp(ev->keyname, "KP_Delete"))
1225 { 1303 {
1226 if (control) 1304 if (control)
1227 { 1305 {
@@ -1255,7 +1333,7 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1255 _edje_emit(ed, "entry,key,delete", rp->part->name); 1333 _edje_emit(ed, "entry,key,delete", rp->part->name);
1256 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1334 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1257 } 1335 }
1258 else if (!strcmp(ev->key, "Home") || !strcmp(ev->key, "KP_Home")) 1336 else if (!strcmp(ev->keyname, "Home") || !strcmp(ev->keyname, "KP_Home"))
1259 { 1337 {
1260 if (en->select_allow) 1338 if (en->select_allow)
1261 { 1339 {
@@ -1273,7 +1351,7 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1273 _edje_emit(ed, "entry,key,home", rp->part->name); 1351 _edje_emit(ed, "entry,key,home", rp->part->name);
1274 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1352 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1275 } 1353 }
1276 else if (!strcmp(ev->key, "End") || !strcmp(ev->key, "KP_End")) 1354 else if (!strcmp(ev->keyname, "End") || !strcmp(ev->keyname, "KP_End"))
1277 { 1355 {
1278 if (en->select_allow) 1356 if (en->select_allow)
1279 { 1357 {
@@ -1291,33 +1369,36 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1291 _edje_emit(ed, "entry,key,end", rp->part->name); 1369 _edje_emit(ed, "entry,key,end", rp->part->name);
1292 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1370 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1293 } 1371 }
1294 else if ((control) && (!strcmp(ev->key, "v"))) 1372 else if ((control) && (!shift) && (!strcmp(ev->keyname, "v")))
1295 { 1373 {
1296 _edje_emit(ed, "entry,paste,request", rp->part->name); 1374 _edje_emit(ed, "entry,paste,request", rp->part->name);
1297 _edje_emit(ed, "entry,paste,request,3", rp->part->name); 1375 _edje_emit(ed, "entry,paste,request,3", rp->part->name);
1298 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1376 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1299 } 1377 }
1300 else if ((control) && (!strcmp(ev->key, "a"))) 1378 else if ((control) && (!strcmp(ev->keyname, "a")))
1301 { 1379 {
1302 _edje_emit(ed, "entry,selection,all,request", rp->part->name); 1380 if (shift)
1303 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1381 {
1304 } 1382 _edje_emit(ed, "entry,selection,none,request", rp->part->name);
1305 else if ((control) && (!strcmp(ev->key, "A"))) 1383 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1306 { 1384 }
1307 _edje_emit(ed, "entry,selection,none,request", rp->part->name); 1385 else
1308 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1386 {
1387 _edje_emit(ed, "entry,selection,all,request", rp->part->name);
1388 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1389 }
1309 } 1390 }
1310 else if ((control) && ((!strcmp(ev->key, "c") || (!strcmp(ev->key, "Insert"))))) 1391 else if ((control) && (((!shift) && !strcmp(ev->keyname, "c")) || !strcmp(ev->keyname, "Insert")))
1311 { 1392 {
1312 _edje_emit(ed, "entry,copy,notify", rp->part->name); 1393 _edje_emit(ed, "entry,copy,notify", rp->part->name);
1313 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1394 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1314 } 1395 }
1315 else if ((control) && ((!strcmp(ev->key, "x") || (!strcmp(ev->key, "m"))))) 1396 else if ((control) && (!shift) && ((!strcmp(ev->keyname, "x") || (!strcmp(ev->keyname, "m")))))
1316 { 1397 {
1317 _edje_emit(ed, "entry,cut,notify", rp->part->name); 1398 _edje_emit(ed, "entry,cut,notify", rp->part->name);
1318 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1399 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1319 } 1400 }
1320 else if ((control) && (!strcmp(ev->key, "z"))) 1401 else if ((control) && (!strcmp(ev->keyname, "z")))
1321 { 1402 {
1322 if (shift) 1403 if (shift)
1323 { 1404 {
@@ -1331,19 +1412,19 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1331 } 1412 }
1332 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1413 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1333 } 1414 }
1334 else if ((control) && (!strcmp(ev->key, "y"))) 1415 else if ((control) && (!shift) && (!strcmp(ev->keyname, "y")))
1335 { 1416 {
1336 // redo 1417 // redo
1337 _edje_emit(ed, "entry,redo,request", rp->part->name); 1418 _edje_emit(ed, "entry,redo,request", rp->part->name);
1338 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1419 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1339 } 1420 }
1340 else if ((control) && (!strcmp(ev->key, "w"))) 1421 else if ((control) && (!shift) && (!strcmp(ev->keyname, "w")))
1341 { 1422 {
1342 _sel_clear(en->cursor, rp->object, en); 1423 _sel_clear(en->cursor, rp->object, en);
1343 // select current word? 1424 // select current word?
1344 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1425 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1345 } 1426 }
1346 else if (!strcmp(ev->key, "Tab")) 1427 else if (!strcmp(ev->keyname, "Tab"))
1347 { 1428 {
1348 if (multiline) 1429 if (multiline)
1349 { 1430 {
@@ -1362,7 +1443,6 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1362 _range_del_emit(ed, en->cursor, rp->object, en); 1443 _range_del_emit(ed, en->cursor, rp->object, en);
1363 info->merge = EINA_TRUE; 1444 info->merge = EINA_TRUE;
1364 } 1445 }
1365 _sel_clear(en->cursor, rp->object, en);
1366 info->change.insert.pos = 1446 info->change.insert.pos =
1367 evas_textblock_cursor_pos_get(en->cursor); 1447 evas_textblock_cursor_pos_get(en->cursor);
1368 info->change.insert.content = eina_stringshare_add("<tab/>"); 1448 info->change.insert.content = eina_stringshare_add("<tab/>");
@@ -1378,12 +1458,12 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1378 } 1458 }
1379 _edje_emit(ed, "entry,key,tab", rp->part->name); 1459 _edje_emit(ed, "entry,key,tab", rp->part->name);
1380 } 1460 }
1381 else if ((!strcmp(ev->key, "ISO_Left_Tab")) && (multiline)) 1461 else if ((!strcmp(ev->keyname, "ISO_Left_Tab")) && (multiline))
1382 { 1462 {
1383 // remove a tab 1463 // remove a tab
1384 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1464 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1385 } 1465 }
1386 else if (!strcmp(ev->key, "Prior") || !strcmp(ev->key, "KP_Prior")) 1466 else if (!strcmp(ev->keyname, "Prior") || !strcmp(ev->keyname, "KP_Prior"))
1387 { 1467 {
1388 if (en->select_allow) 1468 if (en->select_allow)
1389 { 1469 {
@@ -1394,12 +1474,12 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1394 if (en->select_allow) 1474 if (en->select_allow)
1395 { 1475 {
1396 if (shift) _sel_extend(en->cursor, rp->object, en); 1476 if (shift) _sel_extend(en->cursor, rp->object, en);
1477 else _sel_clear(en->cursor, rp->object, en);
1397 } 1478 }
1398 _sel_clear(en->cursor, rp->object, en);
1399 _edje_emit(ed, "entry,key,pgup", rp->part->name); 1479 _edje_emit(ed, "entry,key,pgup", rp->part->name);
1400 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1480 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1401 } 1481 }
1402 else if (!strcmp(ev->key, "Next") || !strcmp(ev->key, "KP_Next")) 1482 else if (!strcmp(ev->keyname, "Next") || !strcmp(ev->keyname, "KP_Next"))
1403 { 1483 {
1404 if (en->select_allow) 1484 if (en->select_allow)
1405 { 1485 {
@@ -1410,12 +1490,12 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1410 if (en->select_allow) 1490 if (en->select_allow)
1411 { 1491 {
1412 if (shift) _sel_extend(en->cursor, rp->object, en); 1492 if (shift) _sel_extend(en->cursor, rp->object, en);
1493 else _sel_clear(en->cursor, rp->object, en);
1413 } 1494 }
1414 _sel_clear(en->cursor, rp->object, en);
1415 _edje_emit(ed, "entry,key,pgdn", rp->part->name); 1495 _edje_emit(ed, "entry,key,pgdn", rp->part->name);
1416 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1496 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1417 } 1497 }
1418 else if ((!strcmp(ev->key, "Return")) || (!strcmp(ev->key, "KP_Enter"))) 1498 else if ((!strcmp(ev->keyname, "Return")) || (!strcmp(ev->keyname, "KP_Enter")))
1419 { 1499 {
1420 if (multiline) 1500 if (multiline)
1421 { 1501 {
@@ -1427,7 +1507,6 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1427 _range_del_emit(ed, en->cursor, rp->object, en); 1507 _range_del_emit(ed, en->cursor, rp->object, en);
1428 info->merge = EINA_TRUE; 1508 info->merge = EINA_TRUE;
1429 } 1509 }
1430 _sel_clear(en->cursor, rp->object, en);
1431 1510
1432 info->change.insert.pos = 1511 info->change.insert.pos =
1433 evas_textblock_cursor_pos_get(en->cursor); 1512 evas_textblock_cursor_pos_get(en->cursor);
@@ -1470,7 +1549,6 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1470 _range_del_emit(ed, en->cursor, rp->object, en); 1549 _range_del_emit(ed, en->cursor, rp->object, en);
1471 info->merge = EINA_TRUE; 1550 info->merge = EINA_TRUE;
1472 } 1551 }
1473 _sel_clear(en->cursor, rp->object, en);
1474 1552
1475 info->change.insert.pos = 1553 info->change.insert.pos =
1476 evas_textblock_cursor_pos_get(en->cursor); 1554 evas_textblock_cursor_pos_get(en->cursor);
@@ -1580,7 +1658,7 @@ _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS
1580 } 1658 }
1581#endif 1659#endif
1582 1660
1583 _edje_entry_imf_context_reset(en); 1661 _edje_entry_imf_context_reset(rp);
1584 1662
1585 en->select_mod_start = EINA_FALSE; 1663 en->select_mod_start = EINA_FALSE;
1586 en->select_mod_end = EINA_FALSE; 1664 en->select_mod_end = EINA_FALSE;
@@ -1593,8 +1671,35 @@ _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS
1593 if (ev->button == 2) dosel = EINA_FALSE; 1671 if (ev->button == 2) dosel = EINA_FALSE;
1594 if (dosel) 1672 if (dosel)
1595 { 1673 {
1596 // double click -> select word 1674 if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK)
1597 // triple click -> select line 1675 {
1676 en->have_selection = EINA_FALSE;
1677 en->selecting = EINA_FALSE;
1678 _sel_clear(en->cursor, rp->object, en);
1679 tc = evas_object_textblock_cursor_new(rp->object);
1680 evas_textblock_cursor_copy(en->cursor, tc);
1681 evas_textblock_cursor_line_char_first(en->cursor);
1682 _sel_start(en->cursor, rp->object, en);
1683 evas_textblock_cursor_line_char_last(en->cursor);
1684 _sel_extend(en->cursor, rp->object, en);
1685
1686 goto end;
1687 }
1688 else if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1689 {
1690 en->have_selection = EINA_FALSE;
1691 en->selecting = EINA_FALSE;
1692 _sel_clear(en->cursor, rp->object, en);
1693 tc = evas_object_textblock_cursor_new(rp->object);
1694 evas_textblock_cursor_copy(en->cursor, tc);
1695 evas_textblock_cursor_word_start(en->cursor);
1696 _sel_start(en->cursor, rp->object, en);
1697 evas_textblock_cursor_word_end(en->cursor);
1698 evas_textblock_cursor_char_next(en->cursor);
1699 _sel_extend(en->cursor, rp->object, en);
1700
1701 goto end;
1702 }
1598 } 1703 }
1599 tc = evas_object_textblock_cursor_new(rp->object); 1704 tc = evas_object_textblock_cursor_new(rp->object);
1600 evas_textblock_cursor_copy(en->cursor, tc); 1705 evas_textblock_cursor_copy(en->cursor, tc);
@@ -1695,13 +1800,14 @@ _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS
1695 } 1800 }
1696 } 1801 }
1697 } 1802 }
1803 end:
1698 if (evas_textblock_cursor_compare(tc, en->cursor)) 1804 if (evas_textblock_cursor_compare(tc, en->cursor))
1699 { 1805 {
1700 _edje_emit(rp->edje, "cursor,changed", rp->part->name); 1806 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
1701 _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name); 1807 _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name);
1702 } 1808 }
1703 evas_textblock_cursor_free(tc); 1809 evas_textblock_cursor_free(tc);
1704 1810
1705 _edje_entry_imf_cursor_info_set(en); 1811 _edje_entry_imf_cursor_info_set(en);
1706 1812
1707 _edje_entry_real_part_configure(rp); 1813 _edje_entry_real_part_configure(rp);
@@ -1724,6 +1830,8 @@ _edje_part_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED
1724 if (ev->button != 1) return; 1830 if (ev->button != 1) return;
1725 if (!rp) return; 1831 if (!rp) return;
1726 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; 1832 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1833 if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK) return;
1834 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) return;
1727 en = rp->entry_data; 1835 en = rp->entry_data;
1728 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) || 1836 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
1729 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE)) 1837 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
@@ -1741,7 +1849,7 @@ _edje_part_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED
1741 } 1849 }
1742#endif 1850#endif
1743 1851
1744 _edje_entry_imf_context_reset(en); 1852 _edje_entry_imf_context_reset(rp);
1745 1853
1746 tc = evas_object_textblock_cursor_new(rp->object); 1854 tc = evas_object_textblock_cursor_new(rp->object);
1747 evas_textblock_cursor_copy(en->cursor, tc); 1855 evas_textblock_cursor_copy(en->cursor, tc);
@@ -1911,7 +2019,7 @@ _edje_part_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS
1911 } 2019 }
1912 evas_textblock_cursor_free(tc); 2020 evas_textblock_cursor_free(tc);
1913 2021
1914 _edje_entry_imf_context_reset(en); 2022 _edje_entry_imf_context_reset(rp);
1915 _edje_entry_imf_cursor_info_set(en); 2023 _edje_entry_imf_cursor_info_set(en);
1916 2024
1917 _edje_entry_real_part_configure(rp); 2025 _edje_entry_real_part_configure(rp);
@@ -2035,6 +2143,8 @@ _edje_entry_real_part_init(Edje_Real_Part *rp)
2035 { 2143 {
2036 evas_object_show(en->cursor_bg); 2144 evas_object_show(en->cursor_bg);
2037 evas_object_show(en->cursor_fg); 2145 evas_object_show(en->cursor_fg);
2146 en->input_panel_enable = EINA_TRUE;
2147
2038#ifdef HAVE_ECORE_IMF 2148#ifdef HAVE_ECORE_IMF
2039 ecore_imf_init(); 2149 ecore_imf_init();
2040 2150
@@ -2078,6 +2188,9 @@ _edje_entry_real_part_init(Edje_Real_Part *rp)
2078 ecore_imf_context_input_mode_set(en->imf_context, 2188 ecore_imf_context_input_mode_set(en->imf_context,
2079 rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD ? 2189 rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD ?
2080 ECORE_IMF_INPUT_MODE_INVISIBLE : ECORE_IMF_INPUT_MODE_FULL); 2190 ECORE_IMF_INPUT_MODE_INVISIBLE : ECORE_IMF_INPUT_MODE_FULL);
2191
2192 if (rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD)
2193 ecore_imf_context_input_panel_language_set(en->imf_context, ECORE_IMF_INPUT_PANEL_LANG_ALPHABET);
2081#endif 2194#endif
2082 } 2195 }
2083#ifdef HAVE_ECORE_IMF 2196#ifdef HAVE_ECORE_IMF
@@ -2111,9 +2224,9 @@ _edje_entry_real_part_shutdown(Edje_Real_Part *rp)
2111 { 2224 {
2112 if (en->imf_context) 2225 if (en->imf_context)
2113 { 2226 {
2114 ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _edje_entry_imf_event_commit_cb); 2227 ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _edje_entry_imf_event_commit_cb);
2115 ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, _edje_entry_imf_event_delete_surrounding_cb); 2228 ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, _edje_entry_imf_event_delete_surrounding_cb);
2116 ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _edje_entry_imf_event_preedit_changed_cb); 2229 ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _edje_entry_imf_event_preedit_changed_cb);
2117 2230
2118 ecore_imf_context_del(en->imf_context); 2231 ecore_imf_context_del(en->imf_context);
2119 en->imf_context = NULL; 2232 en->imf_context = NULL;
@@ -2192,7 +2305,7 @@ _edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text)
2192{ 2305{
2193 Entry *en = rp->entry_data; 2306 Entry *en = rp->entry_data;
2194 if (!en) return; 2307 if (!en) return;
2195 _edje_entry_imf_context_reset(en); 2308 _edje_entry_imf_context_reset(rp);
2196 // set text as markup 2309 // set text as markup
2197 _sel_clear(en->cursor, rp->object, en); 2310 _sel_clear(en->cursor, rp->object, en);
2198 evas_object_textblock_text_markup_set(rp->object, text); 2311 evas_object_textblock_text_markup_set(rp->object, text);
@@ -2231,12 +2344,11 @@ _edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text)
2231{ 2344{
2232 Entry *en = rp->entry_data; 2345 Entry *en = rp->entry_data;
2233 if (!en) return; 2346 if (!en) return;
2234 _edje_entry_imf_context_reset(en); 2347 _edje_entry_imf_context_reset(rp);
2235 2348
2236 // prepend markup @ cursor pos 2349 // prepend markup @ cursor pos
2237 if (en->have_selection) 2350 if (en->have_selection)
2238 _range_del(en->cursor, rp->object, en); 2351 _range_del(en->cursor, rp->object, en);
2239 _sel_clear(en->cursor, rp->object, en);
2240 //xx 2352 //xx
2241// evas_object_textblock_text_markup_prepend(en->cursor, text); 2353// evas_object_textblock_text_markup_prepend(en->cursor, text);
2242 _text_filter_markup_prepend(en, en->cursor, text); 2354 _text_filter_markup_prepend(en, en->cursor, text);
@@ -2282,7 +2394,7 @@ _edje_entry_select_all(Edje_Real_Part *rp)
2282 Entry *en = rp->entry_data; 2394 Entry *en = rp->entry_data;
2283 if (!en) return; 2395 if (!en) return;
2284 2396
2285 _edje_entry_imf_context_reset(en); 2397 _edje_entry_imf_context_reset(rp);
2286 2398
2287 _sel_clear(en->cursor, rp->object, en); 2399 _sel_clear(en->cursor, rp->object, en);
2288 _curs_start(en->cursor, rp->object, en); 2400 _curs_start(en->cursor, rp->object, en);
@@ -2301,7 +2413,7 @@ _edje_entry_select_begin(Edje_Real_Part *rp)
2301 Entry *en = rp->entry_data; 2413 Entry *en = rp->entry_data;
2302 if (!en) return; 2414 if (!en) return;
2303 2415
2304 _edje_entry_imf_context_reset(en); 2416 _edje_entry_imf_context_reset(rp);
2305 2417
2306 _sel_clear(en->cursor, rp->object, en); 2418 _sel_clear(en->cursor, rp->object, en);
2307 _sel_enable(en->cursor, rp->object, en); 2419 _sel_enable(en->cursor, rp->object, en);
@@ -2318,7 +2430,7 @@ _edje_entry_select_extend(Edje_Real_Part *rp)
2318{ 2430{
2319 Entry *en = rp->entry_data; 2431 Entry *en = rp->entry_data;
2320 if (!en) return; 2432 if (!en) return;
2321 _edje_entry_imf_context_reset(en); 2433 _edje_entry_imf_context_reset(rp);
2322 _sel_extend(en->cursor, rp->object, en); 2434 _sel_extend(en->cursor, rp->object, en);
2323 2435
2324 _edje_entry_imf_cursor_info_set(en); 2436 _edje_entry_imf_cursor_info_set(en);
@@ -2440,6 +2552,35 @@ _edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *
2440} 2552}
2441 2553
2442void 2554void
2555_edje_entry_user_insert(Edje_Real_Part *rp, const char *text)
2556{
2557 Entry *en = rp->entry_data;
2558 Edje_Entry_Change_Info *info = calloc(1, sizeof(*info));
2559 info->insert = EINA_TRUE;
2560 info->change.insert.plain_length = 1;
2561 info->change.insert.content = eina_stringshare_add(text);
2562 {
2563 char *tmp;
2564 tmp = evas_textblock_text_markup_to_utf8(rp->object,
2565 info->change.insert.content);
2566 info->change.insert.plain_length = eina_unicode_utf8_get_len(tmp);
2567 free(tmp);
2568 }
2569
2570 if (en->have_selection)
2571 {
2572 _range_del_emit(rp->edje, en->cursor, rp->object, en);
2573 info->merge = EINA_TRUE;
2574 }
2575 info->change.insert.pos = evas_textblock_cursor_pos_get(en->cursor);
2576 _text_filter_text_prepend(en, en->cursor, text);
2577 _edje_emit(rp->edje, "entry,changed", rp->part->name);
2578 _edje_emit_full(rp->edje, "entry,changed,user", rp->part->name,
2579 info, _free_entry_change_info);
2580 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2581}
2582
2583void
2443_edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow) 2584_edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow)
2444{ 2585{
2445 Entry *en = rp->entry_data; 2586 Entry *en = rp->entry_data;
@@ -2463,12 +2604,25 @@ _edje_entry_select_abort(Edje_Real_Part *rp)
2463 { 2604 {
2464 en->selecting = EINA_FALSE; 2605 en->selecting = EINA_FALSE;
2465 2606
2466 _edje_entry_imf_context_reset(en); 2607 _edje_entry_imf_context_reset(rp);
2467 _edje_entry_imf_cursor_info_set(en); 2608 _edje_entry_imf_cursor_info_set(en);
2468 _edje_entry_real_part_configure(rp); 2609 _edje_entry_real_part_configure(rp);
2469 } 2610 }
2470} 2611}
2471 2612
2613void *
2614_edje_entry_imf_context_get(Edje_Real_Part *rp)
2615{
2616 Entry *en = rp->entry_data;
2617 if (!en) return NULL;
2618
2619#ifdef HAVE_ECORE_IMF
2620 return en->imf_context;
2621#else
2622 return NULL;
2623#endif
2624}
2625
2472void 2626void
2473_edje_entry_autocapital_type_set(Edje_Real_Part *rp, Edje_Text_Autocapital_Type autocapital_type) 2627_edje_entry_autocapital_type_set(Edje_Real_Part *rp, Edje_Text_Autocapital_Type autocapital_type)
2474{ 2628{
@@ -2499,16 +2653,37 @@ _edje_entry_autocapital_type_get(Edje_Real_Part *rp)
2499} 2653}
2500 2654
2501void 2655void
2656_edje_entry_prediction_allow_set(Edje_Real_Part *rp, Eina_Bool prediction)
2657{
2658 Entry *en = rp->entry_data;
2659
2660 if (!en) return;
2661 en->prediction_allow = prediction;
2662#ifdef HAVE_ECORE_IMF
2663 if (en->imf_context)
2664 ecore_imf_context_prediction_allow_set(en->imf_context, prediction);
2665#endif
2666}
2667
2668Eina_Bool
2669_edje_entry_prediction_allow_get(Edje_Real_Part *rp)
2670{
2671 Entry *en = rp->entry_data;
2672 if (!en) return EINA_FALSE;
2673
2674 return en->prediction_allow;
2675}
2676
2677void
2502_edje_entry_input_panel_enabled_set(Edje_Real_Part *rp, Eina_Bool enabled) 2678_edje_entry_input_panel_enabled_set(Edje_Real_Part *rp, Eina_Bool enabled)
2503{ 2679{
2504 Entry *en = rp->entry_data; 2680 Entry *en = rp->entry_data;
2505 2681
2506 if (!en) return; 2682 if (!en) return;
2683 en->input_panel_enable = enabled;
2507#ifdef HAVE_ECORE_IMF 2684#ifdef HAVE_ECORE_IMF
2508 if (en->imf_context) 2685 if (en->imf_context)
2509 ecore_imf_context_input_panel_enabled_set(en->imf_context, enabled); 2686 ecore_imf_context_input_panel_enabled_set(en->imf_context, enabled);
2510#else
2511 (void) enabled;
2512#endif 2687#endif
2513} 2688}
2514 2689
@@ -2517,11 +2692,121 @@ _edje_entry_input_panel_enabled_get(Edje_Real_Part *rp)
2517{ 2692{
2518 Entry *en = rp->entry_data; 2693 Entry *en = rp->entry_data;
2519 if (!en) return EINA_FALSE; 2694 if (!en) return EINA_FALSE;
2695
2696 return en->input_panel_enable;
2697}
2698
2699void
2700_edje_entry_input_panel_show(Edje_Real_Part *rp)
2701{
2702 Entry *en = rp->entry_data;
2703
2704 if (!en) return;
2705#ifdef HAVE_ECORE_IMF
2706 if (en->imf_context)
2707 ecore_imf_context_input_panel_show(en->imf_context);
2708#endif
2709}
2710
2711void
2712_edje_entry_input_panel_hide(Edje_Real_Part *rp)
2713{
2714 Entry *en = rp->entry_data;
2715
2716 if (!en) return;
2520#ifdef HAVE_ECORE_IMF 2717#ifdef HAVE_ECORE_IMF
2521 if (en->imf_context) 2718 if (en->imf_context)
2522 return ecore_imf_context_input_panel_enabled_get(en->imf_context); 2719 ecore_imf_context_input_panel_hide(en->imf_context);
2523#endif 2720#endif
2721}
2722
2723void
2724_edje_entry_input_panel_language_set(Edje_Real_Part *rp, Edje_Input_Panel_Lang lang)
2725{
2726 Entry *en = rp->entry_data;
2524 2727
2728 if (!en) return;
2729 en->input_panel_lang = lang;
2730#ifdef HAVE_ECORE_IMF
2731 if (en->imf_context)
2732 ecore_imf_context_input_panel_language_set(en->imf_context, lang);
2733#endif
2734}
2735
2736Edje_Input_Panel_Lang
2737_edje_entry_input_panel_language_get(Edje_Real_Part *rp)
2738{
2739 Entry *en = rp->entry_data;
2740 if (!en) return EDJE_INPUT_PANEL_LANG_AUTOMATIC;
2741
2742 return en->input_panel_lang;
2743}
2744
2745void
2746_edje_entry_input_panel_imdata_set(Edje_Real_Part *rp, const void *data, int len)
2747{
2748 Entry *en = rp->entry_data;
2749 if (!en) return;
2750#ifdef HAVE_ECORE_IMF
2751 if (en->imf_context)
2752 ecore_imf_context_input_panel_imdata_set(en->imf_context, data, len);
2753#endif
2754}
2755
2756void
2757_edje_entry_input_panel_imdata_get(Edje_Real_Part *rp, void *data, int *len)
2758{
2759 Entry *en = rp->entry_data;
2760 if (!en) return;
2761#ifdef HAVE_ECORE_IMF
2762 if (en->imf_context)
2763 ecore_imf_context_input_panel_imdata_get(en->imf_context, data, len);
2764#endif
2765}
2766
2767void
2768_edje_entry_input_panel_return_key_type_set(Edje_Real_Part *rp, Edje_Input_Panel_Return_Key_Type return_key_type)
2769{
2770 Entry *en = rp->entry_data;
2771 if (!en) return;
2772#ifdef HAVE_ECORE_IMF
2773 if (en->imf_context)
2774 ecore_imf_context_input_panel_return_key_type_set(en->imf_context, return_key_type);
2775#endif
2776}
2777
2778Edje_Input_Panel_Return_Key_Type
2779_edje_entry_input_panel_return_key_type_get(Edje_Real_Part *rp)
2780{
2781 Entry *en = rp->entry_data;
2782 if (!en) return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
2783#ifdef HAVE_ECORE_IMF
2784 if (en->imf_context)
2785 return ecore_imf_context_input_panel_return_key_type_get(en->imf_context);
2786#endif
2787 return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
2788}
2789
2790void
2791_edje_entry_input_panel_return_key_disabled_set(Edje_Real_Part *rp, Eina_Bool disabled)
2792{
2793 Entry *en = rp->entry_data;
2794 if (!en) return;
2795#ifdef HAVE_ECORE_IMF
2796 if (en->imf_context)
2797 ecore_imf_context_input_panel_return_key_disabled_set(en->imf_context, disabled);
2798#endif
2799}
2800
2801Eina_Bool
2802_edje_entry_input_panel_return_key_disabled_get(Edje_Real_Part *rp)
2803{
2804 Entry *en = rp->entry_data;
2805 if (!en) return EINA_FALSE;
2806#ifdef HAVE_ECORE_IMF
2807 if (en->imf_context)
2808 return ecore_imf_context_input_panel_return_key_disabled_get(en->imf_context);
2809#endif
2525 return EINA_FALSE; 2810 return EINA_FALSE;
2526} 2811}
2527 2812
@@ -2568,7 +2853,7 @@ _edje_entry_cursor_next(Edje_Real_Part *rp, Edje_Cursor cur)
2568 Evas_Textblock_Cursor *c = _cursor_get(rp, cur); 2853 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2569 if (!c) return EINA_FALSE; 2854 if (!c) return EINA_FALSE;
2570 2855
2571 _edje_entry_imf_context_reset(en); 2856 _edje_entry_imf_context_reset(rp);
2572 2857
2573 if (!evas_textblock_cursor_char_next(c)) 2858 if (!evas_textblock_cursor_char_next(c))
2574 { 2859 {
@@ -2589,7 +2874,7 @@ _edje_entry_cursor_prev(Edje_Real_Part *rp, Edje_Cursor cur)
2589 Evas_Textblock_Cursor *c = _cursor_get(rp, cur); 2874 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2590 if (!c) return EINA_FALSE; 2875 if (!c) return EINA_FALSE;
2591 2876
2592 _edje_entry_imf_context_reset(en); 2877 _edje_entry_imf_context_reset(rp);
2593 2878
2594 if (!evas_textblock_cursor_char_prev(c)) 2879 if (!evas_textblock_cursor_char_prev(c))
2595 { 2880 {
@@ -2615,7 +2900,7 @@ _edje_entry_cursor_up(Edje_Real_Part *rp, Edje_Cursor cur)
2615 int ln; 2900 int ln;
2616 if (!c) return EINA_FALSE; 2901 if (!c) return EINA_FALSE;
2617 2902
2618 _edje_entry_imf_context_reset(en); 2903 _edje_entry_imf_context_reset(rp);
2619 2904
2620 ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL); 2905 ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL);
2621 ln--; 2906 ln--;
@@ -2649,7 +2934,7 @@ _edje_entry_cursor_down(Edje_Real_Part *rp, Edje_Cursor cur)
2649 int ln; 2934 int ln;
2650 if (!c) return EINA_FALSE; 2935 if (!c) return EINA_FALSE;
2651 2936
2652 _edje_entry_imf_context_reset(en); 2937 _edje_entry_imf_context_reset(rp);
2653 2938
2654 ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL); 2939 ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL);
2655 ln++; 2940 ln++;
@@ -2679,7 +2964,7 @@ _edje_entry_cursor_begin(Edje_Real_Part *rp, Edje_Cursor cur)
2679 Evas_Textblock_Cursor *c = _cursor_get(rp, cur); 2964 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2680 if (!c) return; 2965 if (!c) return;
2681 2966
2682 _edje_entry_imf_context_reset(en); 2967 _edje_entry_imf_context_reset(rp);
2683 2968
2684 evas_textblock_cursor_paragraph_first(c); 2969 evas_textblock_cursor_paragraph_first(c);
2685 _sel_update(c, rp->object, rp->entry_data); 2970 _sel_update(c, rp->object, rp->entry_data);
@@ -2696,7 +2981,7 @@ _edje_entry_cursor_end(Edje_Real_Part *rp, Edje_Cursor cur)
2696 Evas_Textblock_Cursor *c = _cursor_get(rp, cur); 2981 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2697 if (!c) return; 2982 if (!c) return;
2698 2983
2699 _edje_entry_imf_context_reset(en); 2984 _edje_entry_imf_context_reset(rp);
2700 2985
2701 _curs_end(c, rp->object, rp->entry_data); 2986 _curs_end(c, rp->object, rp->entry_data);
2702 _sel_update(c, rp->object, rp->entry_data); 2987 _sel_update(c, rp->object, rp->entry_data);
@@ -2721,7 +3006,7 @@ _edje_entry_cursor_copy(Edje_Real_Part *rp, Edje_Cursor cur, Edje_Cursor dst)
2721 evas_textblock_cursor_copy(c, d); 3006 evas_textblock_cursor_copy(c, d);
2722 _sel_update(c, rp->object, rp->entry_data); 3007 _sel_update(c, rp->object, rp->entry_data);
2723 3008
2724 _edje_entry_imf_context_reset(en); 3009 _edje_entry_imf_context_reset(rp);
2725 _edje_entry_imf_cursor_info_set(en); 3010 _edje_entry_imf_cursor_info_set(en);
2726 _edje_emit(rp->edje, "cursor,changed", rp->part->name); 3011 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2727 _edje_entry_real_part_configure(rp); 3012 _edje_entry_real_part_configure(rp);
@@ -2733,7 +3018,7 @@ _edje_entry_cursor_line_begin(Edje_Real_Part *rp, Edje_Cursor cur)
2733 Entry *en = rp->entry_data; 3018 Entry *en = rp->entry_data;
2734 Evas_Textblock_Cursor *c = _cursor_get(rp, cur); 3019 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2735 if (!c) return; 3020 if (!c) return;
2736 _edje_entry_imf_context_reset(en); 3021 _edje_entry_imf_context_reset(rp);
2737 3022
2738 evas_textblock_cursor_line_char_first(c); 3023 evas_textblock_cursor_line_char_first(c);
2739 _sel_update(c, rp->object, rp->entry_data); 3024 _sel_update(c, rp->object, rp->entry_data);
@@ -2750,7 +3035,7 @@ _edje_entry_cursor_line_end(Edje_Real_Part *rp, Edje_Cursor cur)
2750 Entry *en = rp->entry_data; 3035 Entry *en = rp->entry_data;
2751 Evas_Textblock_Cursor *c = _cursor_get(rp, cur); 3036 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
2752 if (!c) return; 3037 if (!c) return;
2753 _edje_entry_imf_context_reset(en); 3038 _edje_entry_imf_context_reset(rp);
2754 evas_textblock_cursor_line_char_last(c); 3039 evas_textblock_cursor_line_char_last(c);
2755 _sel_update(c, rp->object, rp->entry_data); 3040 _sel_update(c, rp->object, rp->entry_data);
2756 3041
@@ -2810,9 +3095,9 @@ _edje_entry_cursor_pos_set(Edje_Real_Part *rp, Edje_Cursor cur, int pos)
2810 if (!c) return; 3095 if (!c) return;
2811 /* Abort if cursor position didn't really change */ 3096 /* Abort if cursor position didn't really change */
2812 if (evas_textblock_cursor_pos_get(c) == pos) 3097 if (evas_textblock_cursor_pos_get(c) == pos)
2813 return; 3098 return;
2814 3099
2815 _edje_entry_imf_context_reset(en); 3100 _edje_entry_imf_context_reset(rp);
2816 evas_textblock_cursor_pos_set(c, pos); 3101 evas_textblock_cursor_pos_set(c, pos);
2817 _sel_update(c, rp->object, rp->entry_data); 3102 _sel_update(c, rp->object, rp->entry_data);
2818 3103
@@ -2855,14 +3140,14 @@ _edje_entry_input_panel_layout_get(Edje_Real_Part *rp)
2855 return EDJE_INPUT_PANEL_LAYOUT_INVALID; 3140 return EDJE_INPUT_PANEL_LAYOUT_INVALID;
2856} 3141}
2857 3142
2858static void 3143void
2859_edje_entry_imf_context_reset(Entry *en) 3144_edje_entry_imf_context_reset(Edje_Real_Part *rp)
2860{ 3145{
3146 Entry *en = rp->entry_data;
3147 if (!en) return;
2861#ifdef HAVE_ECORE_IMF 3148#ifdef HAVE_ECORE_IMF
2862 if (en->imf_context) 3149 if (en->imf_context)
2863 ecore_imf_context_reset(en->imf_context); 3150 ecore_imf_context_reset(en->imf_context);
2864#else
2865 (void) en;
2866#endif 3151#endif
2867} 3152}
2868 3153
@@ -3019,7 +3304,6 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx __UN
3019 { 3304 {
3020 /* delete selected characters */ 3305 /* delete selected characters */
3021 _range_del_emit(ed, en->cursor, rp->object, en); 3306 _range_del_emit(ed, en->cursor, rp->object, en);
3022 _sel_clear(en->cursor, rp->object, en);
3023 } 3307 }
3024 3308
3025 /* delete preedit characters */ 3309 /* delete preedit characters */