This commit is contained in:
YuSanka 2022-05-04 12:44:31 +02:00
parent ff58e73ef2
commit 7380787b3a

View File

@ -3481,6 +3481,28 @@ void Tab::activate_selected_page(std::function<void()> throw_if_canceled)
toggle_options(); toggle_options();
} }
#ifdef WIN32
// Override the wxCheckForInterrupt to process inperruptions just from key or mouse
// and to avoid an unwanted early call of CallAfter()
static bool CheckForInterrupt(wxWindow* wnd)
{
wxCHECK(wnd, false);
MSG msg;
while (::PeekMessage(&msg, ((HWND)((wnd)->GetHWND())), WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
while (::PeekMessage(&msg, ((HWND)((wnd)->GetHWND())), WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
return true;
}
#endif //WIN32
bool Tab::tree_sel_change_delayed() bool Tab::tree_sel_change_delayed()
{ {
// There is a bug related to Ubuntu overlay scrollbars, see https://github.com/prusa3d/PrusaSlicer/issues/898 and https://github.com/prusa3d/PrusaSlicer/issues/952. // There is a bug related to Ubuntu overlay scrollbars, see https://github.com/prusa3d/PrusaSlicer/issues/898 and https://github.com/prusa3d/PrusaSlicer/issues/952.
@ -3517,7 +3539,7 @@ bool Tab::tree_sel_change_delayed()
auto throw_if_canceled = std::function<void()>([this](){ auto throw_if_canceled = std::function<void()>([this](){
#ifdef WIN32 #ifdef WIN32
wxCheckForInterrupt(m_treectrl); CheckForInterrupt(m_treectrl);
if (m_page_switch_planned) if (m_page_switch_planned)
throw UIBuildCanceled(); throw UIBuildCanceled();
#else // WIN32 #else // WIN32