From 2fd1461537df171f703d7717ecd198159f881204 Mon Sep 17 00:00:00 2001 From: Albert Malewski Date: Thu, 22 Oct 2015 14:28:05 +0200 Subject: [PATCH] Exiting from Screen zoom by pressing "Escape" or "Backspace" key. [Issue] https://bugs.tizen.org/jira/browse/TT-225 [Problem] User cannot exit the screen zoom. [Cause] Screen zoom is not in ViewManager stack, so it can't be supported by onBackPressed callback. [Solution] Added boost signal in PlatformInputManager on "Escape" and "Backspace" keys. [Verify] Launch browser > Open web page > More Menu > Screen zoom Zoom up/down the page. Then press "escape" -> Screen zoom should disappear and the page should return to normal scale. Change-Id: Ica7a37a9fe15f3bb27bf4f54dce53238b90cb7b5 --- services/PlatformInputManager/PlatformInputManager.cpp | 2 ++ services/PlatformInputManager/PlatformInputManager.h | 1 + services/SimpleUI/SimpleUI.cpp | 11 ++++++++++- services/SimpleUI/SimpleUI.h | 1 + services/ZoomUI/ZoomUI.cpp | 18 ++++++++++++++++++ services/ZoomUI/ZoomUI.h | 2 ++ 6 files changed, 34 insertions(+), 1 deletion(-) diff --git a/services/PlatformInputManager/PlatformInputManager.cpp b/services/PlatformInputManager/PlatformInputManager.cpp index 4d6cd8f..8a552e9 100644 --- a/services/PlatformInputManager/PlatformInputManager.cpp +++ b/services/PlatformInputManager/PlatformInputManager.cpp @@ -85,6 +85,8 @@ Eina_Bool PlatformInputManager::__filter(void *data, void */*loop_data*/, int ty // MERGE_ME dont know if should be commented out else if(!keyName.compare("BackSpace") || !keyName.compare("XF86Back")) self->backPressed(); + else if(!keyName.compare("Escape")) + self->escapePressed(); } else if(type == ECORE_EVENT_KEY_UP) { M_ASSERT(event); Ecore_Event_Key *ev = static_cast(event); diff --git a/services/PlatformInputManager/PlatformInputManager.h b/services/PlatformInputManager/PlatformInputManager.h index 781a418..4533561 100644 --- a/services/PlatformInputManager/PlatformInputManager.h +++ b/services/PlatformInputManager/PlatformInputManager.h @@ -54,6 +54,7 @@ public: boost::signals2::signal leftPressed; boost::signals2::signal rightPressed; boost::signals2::signal backPressed; + boost::signals2::signal escapePressed; boost::signals2::signal mouseClicked; /** diff --git a/services/SimpleUI/SimpleUI.cpp b/services/SimpleUI/SimpleUI.cpp index c86fd31..97b4ffa 100644 --- a/services/SimpleUI/SimpleUI.cpp +++ b/services/SimpleUI/SimpleUI.cpp @@ -420,6 +420,7 @@ void SimpleUI::connectModelSignals() m_platformInputManager->returnPressed.connect(boost::bind(&elm_exit)); m_platformInputManager->backPressed.connect(boost::bind(&SimpleUI::onBackPressed, this)); + m_platformInputManager->escapePressed.connect(boost::bind(&SimpleUI::onEscapePressed, this)); m_platformInputManager->mouseClicked.connect( boost::bind(&SimpleUI::onMouseClick, this)); @@ -628,7 +629,9 @@ void SimpleUI::setwvIMEStatus(bool status) void SimpleUI::onBackPressed() { BROWSER_LOGD("[%s]", __func__); - if (m_webPageUI->isHomePageActive()) { + if (m_zoomUI->isVisible()) { + m_zoomUI->escapeZoom(); + } else if (m_webPageUI->isHomePageActive()) { m_quickAccess->backButtonClicked(); } else { if (!m_webPageUI->getURIEntry().hasFocus() && !m_wvIMEStatus) @@ -636,6 +639,12 @@ void SimpleUI::onBackPressed() } } +void SimpleUI::onEscapePressed() +{ + BROWSER_LOGD("[%s]", __func__); + m_zoomUI->escapeZoom(); +} + void SimpleUI::reloadEnable(bool enable) { m_webPageUI->setReloadButtonEnabled(enable); diff --git a/services/SimpleUI/SimpleUI.h b/services/SimpleUI/SimpleUI.h index 4a2293b..35a56da 100644 --- a/services/SimpleUI/SimpleUI.h +++ b/services/SimpleUI/SimpleUI.h @@ -227,6 +227,7 @@ private: void onReturnPressed(MenuButton *m); void onBackPressed(); + void onEscapePressed(); void searchWebPage(std::string &text, int flags); diff --git a/services/ZoomUI/ZoomUI.cpp b/services/ZoomUI/ZoomUI.cpp index c7fa331..aa76abd 100644 --- a/services/ZoomUI/ZoomUI.cpp +++ b/services/ZoomUI/ZoomUI.cpp @@ -103,6 +103,15 @@ void ZoomUI::showNavigation() evas_object_show(m_nav_layout); } +bool ZoomUI::isVisible() +{ + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + if (evas_object_visible_get(m_layout) || (*(getZoom()) != ZOOM_DEFAULT)) + return true; + else + return false; +} + void ZoomUI::createLayout(Evas_Object *parent) { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); @@ -248,6 +257,15 @@ void ZoomUI::_zoom_value_confirmed(void* data, Evas*, Evas_Object*, void* event_ } } +void ZoomUI::escapeZoom() +{ + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + if (isVisible()) { + setZoom(ZoomUI::ZOOM_DEFAULT); + hideUI(); + } +} + Eina_Bool ZoomUI::_key_down_cb(void* data, int, void* event_info) { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); diff --git a/services/ZoomUI/ZoomUI.h b/services/ZoomUI/ZoomUI.h index a2966f2..c9dd81f 100644 --- a/services/ZoomUI/ZoomUI.h +++ b/services/ZoomUI/ZoomUI.h @@ -46,6 +46,8 @@ public: void show(Evas_Object* parent); void showNavigation(); void clearItems(); + bool isVisible(); + void escapeZoom(); boost::signals2::signal closeZoomUI; boost::signals2::signal setZoom; -- 2.7.4