From: Daniel Juyung Seo Date: Mon, 24 Nov 2014 06:29:39 +0000 (+0900) Subject: test_notify,popup: Add key event reacting examples. X-Git-Tag: v1.13.0-alpha1~225 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f6277c71c046a131dfb4fb523272a20503681e8;p=platform%2Fupstream%2Felementary.git test_notify,popup: Add key event reacting examples. There is a bug in notify. This test reveals the bugs :) --- diff --git a/src/bin/test_notify.c b/src/bin/test_notify.c index f5ae7cb..3d00006 100644 --- a/src/bin/test_notify.c +++ b/src/bin/test_notify.c @@ -37,6 +37,15 @@ _notify_block(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_ printf("Notify block area clicked!!\n"); } +static void +_notify_key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, + Evas_Object *obj EINA_UNUSED, void *event_info) +{ + Evas_Event_Key_Down *ev = event_info; + + printf("Key down: %s\n", ev->keyname); +} + void test_notify(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { @@ -89,6 +98,8 @@ test_notify(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in elm_notify_timeout_set(notify, 5.0); evas_object_smart_callback_add(notify, "timeout", _notify_timeout, NULL); evas_object_smart_callback_add(notify, "block,clicked", _notify_block, NULL); + evas_object_event_callback_add(notify, EVAS_CALLBACK_KEY_DOWN, + _notify_key_down_cb, NULL); bx = elm_box_add(win); elm_object_content_set(notify, bx); diff --git a/src/bin/test_popup.c b/src/bin/test_popup.c index 0685a7c..61f0688 100644 --- a/src/bin/test_popup.c +++ b/src/bin/test_popup.c @@ -107,6 +107,15 @@ _list_click(void *data EINA_UNUSED, Evas_Object *obj, } static void +_popup_key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, + Evas_Object *obj EINA_UNUSED, void *event_info) +{ + Evas_Event_Key_Down *ev = event_info; + + printf("Key: %s\n", ev->keyname); +} + +static void _popup_center_text_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { @@ -117,6 +126,8 @@ _popup_center_text_cb(void *data, Evas_Object *obj EINA_UNUSED, "timeout value is 3 seconds"); elm_popup_timeout_set(popup, 3.0); evas_object_smart_callback_add(popup, "timeout", _response_cb, popup); + evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, + _popup_key_down_cb, NULL); // popup show should be called after adding all the contents and the buttons // of popup to set the focus into popup's contents correctly.