"Printer Host Upload Queue vanishes in the background [1.42.0-alpha1]"
the canvas3d used to grab focus when mouse entered a window even
if the top level window was not active. This was now changed and
the top level must be active for the canvas3d to grab the focus.
This commit is contained in:
bubnikv 2019-01-02 17:49:23 +01:00
parent e2daf05368
commit b7a92b5525

View File

@ -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<wxWindow*>(evt.GetEventObject());
while (p->GetParent())
p = p->GetParent();
auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(p);
if (top_level_wnd && top_level_wnd->IsActive())
m_canvas->SetFocus();
}
m_mouse.set_start_position_2D_as_invalid();
#endif