From c61a6289c595027b40399064c998cdfc3ee5b5a8 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Thu, 7 Jan 2021 13:16:23 +0100 Subject: [PATCH] update notification before erasing finished ones --- src/slic3r/GUI/NotificationManager.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index 5695eb62f..64217ecf0 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -1387,15 +1387,19 @@ void NotificationManager::update_notifications() if (!top_level_wnd->IsActive()) return; - static size_t last_size = m_pop_notifications.size(); + //static size_t last_size = m_pop_notifications.size(); + //request frames + int64_t next_render = std::numeric_limits::max(); for (auto it = m_pop_notifications.begin(); it != m_pop_notifications.end();) { std::unique_ptr& notification = *it; + notification->set_paused(m_hovered); + notification->update_state(); + next_render = std::min(next_render, notification->next_render()); if (notification->get_state() == PopNotification::EState::Finished) it = m_pop_notifications.erase(it); else { - notification->set_paused(m_hovered); - notification->update_state(); + ++it; } } @@ -1436,16 +1440,11 @@ void NotificationManager::update_notifications() if (m_requires_render) m_requires_update = true; */ - //request frames - int64_t next_render = std::numeric_limits::max(); - const int64_t max = std::numeric_limits::max(); - for (const std::unique_ptr& notification : m_pop_notifications) { - next_render = std::min(next_render, notification->next_render()); - } + if (next_render == 0) - wxGetApp().plater()->get_current_canvas3D()->request_extra_framee_delayed(33); //few milliseconds to get from GLCanvas::render - else if (next_render < max) + wxGetApp().plater()->get_current_canvas3D()->request_extra_frame_delayed(33); //few milliseconds to get from GLCanvas::render + else if (next_render < std::numeric_limits::max()) wxGetApp().plater()->get_current_canvas3D()->request_extra_frame_delayed(int(next_render)); /*