From: sangwan.kwon Date: Tue, 21 Jun 2016 00:46:57 +0000 (+0900) Subject: Grab the home key event X-Git-Tag: accepted/tizen/common/20160623.154210^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8cc9dfc7e1be0dc9c147a78e5cbaeecd43dfd447;p=platform%2Fupstream%2Fcsr-framework.git Grab the home key event * If home key pressed, popup should exit. Change-Id: I20b3fb316bd1930284565bc9f683f17a83dbedcd Signed-off-by: sangwan.kwon --- diff --git a/packaging/csr-framework.spec b/packaging/csr-framework.spec index 6126eef..c7088b1 100644 --- a/packaging/csr-framework.spec +++ b/packaging/csr-framework.spec @@ -39,6 +39,7 @@ BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: pkgconfig(libsmack) BuildRequires: pkgconfig(capi-appfw-application) BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(efl-extension) BuildRequires: pkgconfig(icu-i18n) %if "%{?tizen_version}" == "3.0" BuildRequires: pkgconfig(cynara-client) diff --git a/src/framework/ui/popup/CMakeLists.txt b/src/framework/ui/popup/CMakeLists.txt index a396536..6f8dd01 100644 --- a/src/framework/ui/popup/CMakeLists.txt +++ b/src/framework/ui/popup/CMakeLists.txt @@ -20,6 +20,7 @@ PKG_CHECK_MODULES(${TARGET_CSR_POPUP}_DEP REQUIRED elementary + efl-extension libsystemd-daemon vconf pkgmgr-info diff --git a/src/framework/ui/popup/popup.cpp b/src/framework/ui/popup/popup.cpp index 0f78865..22ebb6f 100644 --- a/src/framework/ui/popup/popup.cpp +++ b/src/framework/ui/popup/popup.cpp @@ -25,6 +25,7 @@ #include #include +#include namespace Csr { namespace Ui { @@ -38,6 +39,8 @@ namespace { }; const std::string DEFAULT_URL("https://developer.tizen.org/"); + const std::string HOME_KEY("XF86Home"); + } Popup::Popup(int buttonN) @@ -52,6 +55,9 @@ Popup::Popup(int buttonN) evas_object_size_hint_min_set(m_win, m_winW, m_winH / 4); setRotationToWin(m_win); + eext_win_keygrab_set(m_win, HOME_KEY.c_str()); + ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, keyDownCb, NULL); + // Set popup properties. m_popup = elm_popup_add(m_win); setDefaultProperties(m_popup); @@ -265,5 +271,19 @@ void Popup::btnClickedCb(void *data, Evas_Object *, void *) response = *(reinterpret_cast(data)); elm_exit(); } + + +Eina_Bool Popup::keyDownCb(void *, int , void *ev) +{ + DEBUG("Key down event caught."); + auto event = reinterpret_cast(ev); + + if(event->key == HOME_KEY) + elm_exit(); + + // Let the event continue to other callbacks. + return ECORE_CALLBACK_PASS_ON; +} + } // namespace Ui } // namespace Csr diff --git a/src/framework/ui/popup/popup.h b/src/framework/ui/popup/popup.h index e977982..8e6518c 100644 --- a/src/framework/ui/popup/popup.h +++ b/src/framework/ui/popup/popup.h @@ -78,6 +78,7 @@ public: static void btnClickedCb(void *data, Evas_Object *, void *); static void hypertextClickedCb(void *data, Evas_Object *, void *); static void rotationChangedCb(void *data, Evas_Object *, void *); + static Eina_Bool keyDownCb(void *, int, void *); std::vector m_buttons; Evas_Object *m_hypertext;