diff options
author | ExMix <rahuba.youri@mapswithme.com> | 2014-11-18 10:50:27 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:32:48 +0300 |
commit | 764ec6d83b08bd8103ae9f688f00c0469a40606b (patch) | |
tree | 9d9345487f0f1759edb653973cd27d64c058df3d /gui | |
parent | 690a8e1f9cc5692fc560408802c96658bad877f3 (diff) |
[core] correct touch process when gui subsystem was not be initialized
Diffstat (limited to 'gui')
-rw-r--r-- | gui/controller.cpp | 16 | ||||
-rw-r--r-- | gui/controller.hpp | 2 |
2 files changed, 15 insertions, 3 deletions
diff --git a/gui/controller.cpp b/gui/controller.cpp index 4a5b7ae2e7..ff70718f40 100644 --- a/gui/controller.cpp +++ b/gui/controller.cpp @@ -48,6 +48,9 @@ namespace gui bool Controller::OnTapStarted(m2::PointD const & pt) { + if (GetCacheScreen() == nullptr) + return false; + shared_ptr<Element> e = SelectTopElement(pt, true); if (e) { @@ -62,6 +65,9 @@ namespace gui bool Controller::OnTapMoved(m2::PointD const & pt) { + if (GetCacheScreen() == nullptr) + return false; + if (m_focusedElement) { if (!m_LastTapCancelled) @@ -84,6 +90,9 @@ namespace gui bool Controller::OnTapEnded(m2::PointD const & pt) { + if (GetCacheScreen() == nullptr) + return false; + if (m_focusedElement) { // re-checking, whether we are above the gui element. @@ -109,6 +118,9 @@ namespace gui bool Controller::OnTapCancelled(m2::PointD const & pt) { + if (GetCacheScreen() == nullptr) + return false; + if (m_focusedElement) { m_focusedElement->onTapCancelled(pt); @@ -163,7 +175,7 @@ namespace gui m_GlyphCache = 0; m_Density = graphics::EDensityLDPI; m_InvalidateFn = TInvalidateFn(); - m_CacheScreen = 0; + m_CacheScreen = nullptr; PurgeElements(); @@ -172,7 +184,7 @@ namespace gui void Controller::DrawFrame(graphics::Screen * screen) { - if (m_CacheScreen == NULL) + if (m_CacheScreen == nullptr) return; screen->beginFrame(); diff --git a/gui/controller.hpp b/gui/controller.hpp index ca370bb661..f9f99496ea 100644 --- a/gui/controller.hpp +++ b/gui/controller.hpp @@ -77,7 +77,7 @@ namespace gui StringsBundle const * m_bundle; /// Screen, which is used to cache gui::Elements into display lists. - graphics::Screen * m_CacheScreen; + graphics::Screen * m_CacheScreen = nullptr; /// Should we call the onTapEnded when the tap finished(we should /// not if the tap was cancelled while moving). |