Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
YuSanka committed May 4, 2022
1 parent ff58e73 commit 7380787
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/slic3r/GUI/Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3481,6 +3481,28 @@ void Tab::activate_selected_page(std::function<void()> 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.
Expand Down Expand Up @@ -3517,7 +3539,7 @@ bool Tab::tree_sel_change_delayed()

auto throw_if_canceled = std::function<void()>([this](){
#ifdef WIN32
wxCheckForInterrupt(m_treectrl);
CheckForInterrupt(m_treectrl);
if (m_page_switch_planned)
throw UIBuildCanceled();
#else // WIN32
Expand Down

0 comments on commit 7380787

Please sign in to comment.