mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-20 22:18:30 +00:00
fix: Home start shows Prepare or a blank window, and Prepare opens slowly (#15878)
This commit is contained in:
1 parent
e77d179bbe
commit
237cd10eb5
16 files changed
+421
-342
No files matched your search
@@ -3,6 +3,7 @@
|
||||
#include <chrono>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <wx/evtloop.h>
|
||||
|
||||
#include "libslic3r/Utils.hpp"
|
||||
|
||||
@@ -23,12 +24,9 @@ constexpr int quiet_ms = 500;
|
||||
// queued meanwhile are handled first; a click waits at most a slice plus the unit that
|
||||
// overran it.
|
||||
constexpr int slice_ms = 40;
|
||||
// On GTK a due timer runs ahead of repaints and posted events, so the next slice waits a few ms.
|
||||
#ifdef __WXGTK__
|
||||
// Delay before the next slice; on GTK a due timer runs ahead of repaints and posted events,
|
||||
// and wxOSX rejects a 0 ms timer.
|
||||
constexpr int next_slice_ms = 5;
|
||||
#else
|
||||
constexpr int next_slice_ms = 0;
|
||||
#endif
|
||||
|
||||
// True when unhandled keyboard, button, touch or pen input is queued; only Windows can ask.
|
||||
bool input_pending()
|
||||
@@ -42,6 +40,13 @@ bool input_pending()
|
||||
#endif
|
||||
}
|
||||
|
||||
// True inside a wxYield(), where a slice would build pages in the middle of the code that yielded.
|
||||
bool yielding()
|
||||
{
|
||||
const wxEventLoopBase* loop = wxEventLoopBase::GetActive();
|
||||
return loop != nullptr && loop->IsYielding();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
IdleScheduler::IdleScheduler(std::function<int()> input_idle_ms) : m_input_idle_ms(std::move(input_idle_ms))
|
||||
@@ -69,7 +74,7 @@ void IdleScheduler::tick()
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
if (m_input_idle_ms() < quiet_ms || input_pending()) {
|
||||
if (m_input_idle_ms() < quiet_ms || input_pending() || yielding()) {
|
||||
start();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user