From 3984326ee335da301f6d1c2440a2f176ba57a65b Mon Sep 17 00:00:00 2001 From: David Kocik Date: Wed, 26 Aug 2020 10:49:42 +0200 Subject: [PATCH] notification init() at first render, not notification creation. Hopefully a fix of issue #4647. --- src/slic3r/GUI/NotificationManager.cpp | 7 ++++++- src/slic3r/GUI/NotificationManager.hpp | 11 ++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index e27a4215c..47962f4b2 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -49,13 +49,17 @@ NotificationManager::PopNotification::PopNotification(const NotificationData &n, , m_text2 (n.text2) , m_evt_handler (evt_handler) { - init(); + //init(); } NotificationManager::PopNotification::~PopNotification() { } NotificationManager::PopNotification::RenderResult NotificationManager::PopNotification::render(GLCanvas3D& canvas, const float& initial_y) { + if (!m_initialized) + { + init(); + } if (m_finished) return RenderResult::Finished; if (m_close_pending) { @@ -228,6 +232,7 @@ void NotificationManager::PopNotification::init() } m_lines_count++; } + m_initialized = true; } void NotificationManager::PopNotification::set_next_window_size(ImGuiWrapper& imgui) { diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp index 0b066a3a0..a11d08394 100644 --- a/src/slic3r/GUI/NotificationManager.hpp +++ b/src/slic3r/GUI/NotificationManager.hpp @@ -121,6 +121,7 @@ public: const NotificationData m_data; int m_id; + bool m_initialized { false }; // Main text std::string m_text1; // Clickable text @@ -131,12 +132,12 @@ public: long m_remaining_time; bool m_counting_down; long m_last_remaining_time; - bool m_paused{ false }; - int m_countdown_frame{ 0 }; - bool m_fading_out{ false }; + bool m_paused { false }; + int m_countdown_frame { 0 }; + bool m_fading_out { false }; // total time left when fading beggins - float m_fading_time{ 0.0f }; - float m_current_fade_opacity{ 1.f }; + float m_fading_time { 0.0f }; + float m_current_fade_opacity { 1.f }; // If hidden the notif is alive but not visible to user bool m_hidden { false }; // m_finished = true - does not render, marked to delete