From 6300041ce4675be9d0d0102d6f00ebe76ab2133a Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 30 Oct 2017 15:12:41 +0100 Subject: [PATCH] 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). --- common/tool/tool_dispatcher.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/tool/tool_dispatcher.cpp b/common/tool/tool_dispatcher.cpp index 5c9113fbba..f45fb01863 100644 --- a/common/tool/tool_dispatcher.cpp +++ b/common/tool/tool_dispatcher.cpp @@ -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( m_toolMgr->GetEditFrame() )->SetFocus(); + // Mouse handling // Note: wxEVT_LEFT_DOWN event must always be skipped. if( type == wxEVT_MOTION || type == wxEVT_MOUSEWHEEL ||