diff --git a/drape_frontend/drape_engine.cpp b/drape_frontend/drape_engine.cpp index 86d55c13cd..7a635642a0 100644 --- a/drape_frontend/drape_engine.cpp +++ b/drape_frontend/drape_engine.cpp @@ -180,17 +180,17 @@ void DrapeEngine::Scale(double factor, m2::PointD const & pxPoint, bool isAnim) void DrapeEngine::SetModelViewCenter(m2::PointD const & centerPt, int zoom, bool isAnim) { - AddUserEvent(make_unique_dp(centerPt, zoom, isAnim)); + PostUserEvent(make_unique_dp(centerPt, zoom, isAnim)); } void DrapeEngine::SetModelViewRect(m2::RectD const & rect, bool applyRotation, int zoom, bool isAnim) { - AddUserEvent(make_unique_dp(rect, applyRotation, zoom, isAnim)); + PostUserEvent(make_unique_dp(rect, applyRotation, zoom, isAnim)); } void DrapeEngine::SetModelViewAnyRect(m2::AnyRectD const & rect, bool isAnim) { - AddUserEvent(make_unique_dp(rect, isAnim)); + PostUserEvent(make_unique_dp(rect, isAnim)); } void DrapeEngine::ClearUserMarksGroup(size_t layerId) @@ -355,6 +355,13 @@ void DrapeEngine::RecacheGui(bool needResetOldGui) MessagePriority::Normal); } +void DrapeEngine::PostUserEvent(drape_ptr && e) +{ + m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, + make_unique_dp(std::move(e)), + MessagePriority::Normal); +} + void DrapeEngine::AddUserEvent(drape_ptr && e) { m_frontend->AddUserEvent(std::move(e)); @@ -389,7 +396,7 @@ void DrapeEngine::ResizeImpl(int w, int h) { gui::DrapeGui::Instance().SetSurfaceSize(m2::PointF(w, h)); m_viewport.SetViewport(0, 0, w, h); - AddUserEvent(make_unique_dp(w, h)); + PostUserEvent(make_unique_dp(w, h)); } void DrapeEngine::SetCompassInfo(location::CompassInfo const & info) diff --git a/drape_frontend/drape_engine.hpp b/drape_frontend/drape_engine.hpp index d7eef6d035..d611600168 100644 --- a/drape_frontend/drape_engine.hpp +++ b/drape_frontend/drape_engine.hpp @@ -214,6 +214,7 @@ public: private: void AddUserEvent(drape_ptr && e); + void PostUserEvent(drape_ptr && e); void ModelViewChanged(ScreenBase const & screen); void MyPositionModeChanged(location::EMyPositionMode mode, bool routingActive); diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp index af2494c1da..6d86bd6465 100755 --- a/drape_frontend/frontend_renderer.cpp +++ b/drape_frontend/frontend_renderer.cpp @@ -810,6 +810,13 @@ void FrontendRenderer::AcceptMessage(ref_ptr message) break; } + case Message::PostUserEvent: + { + ref_ptr msg = message; + AddUserEvent(msg->AcceptEvent()); + break; + } + default: ASSERT(false, ()); } diff --git a/drape_frontend/message.hpp b/drape_frontend/message.hpp index 49253626db..2577d605f9 100644 --- a/drape_frontend/message.hpp +++ b/drape_frontend/message.hpp @@ -82,6 +82,7 @@ public: SetPosteffectEnabled, RunFirstLaunchAnimation, UpdateMetalines, + PostUserEvent, }; virtual ~Message() {} diff --git a/drape_frontend/message_subclasses.hpp b/drape_frontend/message_subclasses.hpp index ede68d3860..38612a964a 100644 --- a/drape_frontend/message_subclasses.hpp +++ b/drape_frontend/message_subclasses.hpp @@ -16,6 +16,7 @@ #include "drape_frontend/selection_shape.hpp" #include "drape_frontend/tile_utils.hpp" #include "drape_frontend/traffic_generator.hpp" +#include "drape_frontend/user_event_stream.hpp" #include "drape_frontend/user_mark_shapes.hpp" #include "drape_frontend/user_marks_provider.hpp" @@ -1206,4 +1207,19 @@ class UpdateMetalinesMessage : public Message public: Type GetType() const override { return Message::UpdateMetalines; } }; + +class PostUserEventMessage : public Message +{ +public: + PostUserEventMessage(drape_ptr && event) + : m_event(std::move(event)) + {} + + Type GetType() const override { return Message::PostUserEvent; } + + drape_ptr && AcceptEvent() { return std::move(m_event); } + +private: + drape_ptr m_event; +}; } // namespace df