From 7380787b3a53252beb4650ccd1edb8ce2027a1db Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 4 May 2022 12:44:31 +0200 Subject: [PATCH] Settings Tab: Fix for https://dev.prusa3d.com/browse/SPE-1229 --- src/slic3r/GUI/Tab.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 86394819e..96151d8c7 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3481,6 +3481,28 @@ void Tab::activate_selected_page(std::function throw_if_canceled) 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() { // 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([this](){ #ifdef WIN32 - wxCheckForInterrupt(m_treectrl); + CheckForInterrupt(m_treectrl); if (m_page_switch_planned) throw UIBuildCanceled(); #else // WIN32