From a3187a33a3ffb54639c185c4b382009b37c5536a Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Tue, 14 Aug 2012 10:47:26 +0000 Subject: [PATCH] we had enter being handled but not escape. FIX! SVN revision: 75251 --- legacy/elementary/src/lib/elm_entry.c | 12 ++++++++++++ legacy/elementary/src/lib/elm_entry.h | 1 + 2 files changed, 13 insertions(+) diff --git a/legacy/elementary/src/lib/elm_entry.c b/legacy/elementary/src/lib/elm_entry.c index f158b196d6..4b9f7cc76f 100644 --- a/legacy/elementary/src/lib/elm_entry.c +++ b/legacy/elementary/src/lib/elm_entry.c @@ -146,6 +146,7 @@ static void _entry_hover_anchor_clicked(void *data, Evas_Object *obj, void *even static const char SIG_CHANGED[] = "changed"; static const char SIG_CHANGED_USER[] = "changed,user"; static const char SIG_ACTIVATED[] = "activated"; +static const char SIG_ABORTED[] = "aborted"; static const char SIG_PRESS[] = "press"; static const char SIG_LONGPRESSED[] = "longpressed"; static const char SIG_CLICKED[] = "clicked"; @@ -173,6 +174,7 @@ static const char SIG_REDO_REQUEST[] = "redo,request"; static const Evas_Smart_Cb_Description _signals[] = { {SIG_CHANGED, ""}, {SIG_ACTIVATED, ""}, + {SIG_ABORTED, ""}, {SIG_PRESS, ""}, {SIG_LONGPRESSED, ""}, {SIG_CLICKED, ""}, @@ -1942,6 +1944,14 @@ _signal_key_enter(void *data, Evas_Object *obj __UNUSED__, const char *emission evas_object_smart_callback_call(data, SIG_ACTIVATED, NULL); } +static void +_signal_key_escape(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + evas_object_smart_callback_call(data, SIG_ABORTED, NULL); +} + static void _signal_mouse_down(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) { @@ -2500,6 +2510,8 @@ elm_entry_add(Evas_Object *parent) _signal_anchor_out, obj); edje_object_signal_callback_add(wd->ent, "entry,key,enter", "elm.text", _signal_key_enter, obj); + edje_object_signal_callback_add(wd->ent, "entry,key,escape", "elm.text", + _signal_key_escape, obj); edje_object_signal_callback_add(wd->ent, "mouse,down,1", "elm.text", _signal_mouse_down, obj); edje_object_signal_callback_add(wd->ent, "mouse,clicked,1", "elm.text", diff --git a/legacy/elementary/src/lib/elm_entry.h b/legacy/elementary/src/lib/elm_entry.h index 9df9903346..4ace8a1575 100644 --- a/legacy/elementary/src/lib/elm_entry.h +++ b/legacy/elementary/src/lib/elm_entry.h @@ -194,6 +194,7 @@ * @li "changed": The text within the entry was changed. * @li "changed,user": The text within the entry was changed because of user interaction. * @li "activated": The enter key was pressed on a single line entry. + * @li "aborted": The escape key was pressed on a single line entry. (since 1.7) * @li "press": A mouse button has been pressed on the entry. * @li "longpressed": A mouse button has been pressed and held for a couple * seconds.