From: lokilee73 Date: Thu, 24 Nov 2016 08:00:37 +0000 (+0900) Subject: powerkey-popup : add home key callback in mobile X-Git-Tag: accepted/tizen/3.0/common/20161125.101629^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F29%2F99829%2F2;p=platform%2Fcore%2Fsystem%2Fsystem-popup.git powerkey-popup : add home key callback in mobile Change-Id: I5d96b368f2c37dd6e487dbffb19c4205b2ff5ec7 Signed-off-by: lokilee73 --- diff --git a/src/powerkey/powerkey-mobile.c b/src/powerkey/powerkey-mobile.c index 411d38f..0feb0a6 100755 --- a/src/powerkey/powerkey-mobile.c +++ b/src/powerkey/powerkey-mobile.c @@ -33,6 +33,10 @@ #define DEVICED_OBJECT_PATH "/Org/Tizen/System/DeviceD" #define DEVICED_INTERFACE_NAME DEVICED_BUS_NAME +#define POWEROFF_KEY "XF86PowerOff" +#define BACK_KEY "XF86Back" +#define HOME_KEY "XF86Home" + int clicked_index = 0; static void pm_state_changed(keynode_t *key, void *data); @@ -196,6 +200,23 @@ static Evas_Object* gl_image_get_cb(void *data, Evas_Object *obj, const char *pa } } +Eina_Bool KeyUpCb(void *data, int type, void *event) +{ + Ecore_Event_Key *e = event; + const struct popup_ops *ops = data; + + if (!strncmp(e->key, BACK_KEY, sizeof(BACK_KEY)) || !strncmp(e->key, HOME_KEY, sizeof(HOME_KEY))) + { + _D("HOME_KEY or BACK KEY is pressed"); + if (ops) + unload_simple_popup(ops); + terminate_if_no_popup(); + } + + // Let the event continue to other callbacks. + return ECORE_CALLBACK_PASS_ON; +} + int powerkey_list(bundle *b, const struct popup_ops *ops) { Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); @@ -229,8 +250,8 @@ int powerkey_list(bundle *b, const struct popup_ops *ops) box = elm_box_add(popup); evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - /* back key */ - eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, event_back_key_up, (void*)ops); + /* back & home key */ + ecore_event_handler_add(ECORE_EVENT_KEY_UP, KeyUpCb, (void*)ops); /* genlist */ genlist = elm_genlist_add(box);