seoz pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=4f6277c71c046a131dfb4fb523272a20503681e8

commit 4f6277c71c046a131dfb4fb523272a20503681e8
Author: Daniel Juyung Seo <seojuyu...@gmail.com>
Date:   Mon Nov 24 15:29:39 2014 +0900

    test_notify,popup: Add key event reacting examples.
    
    There is a bug in notify. This test reveals the bugs :)
---
 src/bin/test_notify.c | 11 +++++++++++
 src/bin/test_popup.c  | 11 +++++++++++
 2 files changed, 22 insertions(+)

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.

-- 


Reply via email to