Fix a focus issue in GAL canvas:

Sometimes there is no window that has the focus (it happens when an other PCB_BASE_FRAME is opened and is iconized on Windows).
This commit is contained in:
jean-pierre charras 2017-10-30 15:12:41 +01:00
parent e8e10c9245
commit 6300041ce4
1 changed files with 7 additions and 0 deletions

View File

@ -313,6 +313,13 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
int type = aEvent.GetEventType();
// Sometimes there is no window that has the focus (it happens when an other PCB_BASE_FRAME
// is opened and is iconized on Windows).
// In this case, gives the focus to the parent PCB_BASE_FRAME (for an obscure reason,
// when happens, the GAL canvas itself does not accept the focus)
if( wxWindow::FindFocus() == nullptr )
static_cast<PCB_BASE_FRAME*>( m_toolMgr->GetEditFrame() )->SetFocus();
// Mouse handling
// Note: wxEVT_LEFT_DOWN event must always be skipped.
if( type == wxEVT_MOTION || type == wxEVT_MOUSEWHEEL ||