diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 1d6c3b117..df70a787e 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4906,8 +4906,15 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) { #if defined(__WXMSW__) || defined(__linux__) // On Windows and Linux needs focus in order to catch key events - if (m_canvas != nullptr) - m_canvas->SetFocus(); + if (m_canvas != nullptr) { + // Only set focus, if the top level window of this canvas is active. + auto p = dynamic_cast(evt.GetEventObject()); + while (p->GetParent()) + p = p->GetParent(); + auto *top_level_wnd = dynamic_cast(p); + if (top_level_wnd && top_level_wnd->IsActive()) + m_canvas->SetFocus(); + } m_mouse.set_start_position_2D_as_invalid(); #endif