From 9ed1ad06f7dd1fb43502ffdd7f5bfef502d7d69b Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Fri, 6 Nov 2020 00:37:05 -0500 Subject: [PATCH] The canvas should get the focus on clicks not the window Fix #6308 --- common/tool/tool_dispatcher.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/common/tool/tool_dispatcher.cpp b/common/tool/tool_dispatcher.cpp index c699b38faf..eed7e68275 100644 --- a/common/tool/tool_dispatcher.cpp +++ b/common/tool/tool_dispatcher.cpp @@ -457,8 +457,8 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent ) if( isMouseClick( type ) ) { - if( holderWindow ) - holderWindow->SetFocus(); + if( m_toolMgr->GetToolHolder() && m_toolMgr->GetToolHolder()->GetToolCanvas() ) + m_toolMgr->GetToolHolder()->GetToolCanvas()->SetFocus(); } // Mouse handling @@ -497,16 +497,6 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent ) evt->SetMousePosition( pos ); } } - -#ifdef __APPLE__ - // TODO That's a big ugly workaround, somehow DRAWPANEL_GAL loses focus - // after second LMB click and currently I have no means to do better debugging - if( type == wxEVT_LEFT_UP ) - { - if( m_toolMgr->GetToolHolder() && m_toolMgr->GetToolHolder()->GetToolCanvas() ) - m_toolMgr->GetToolHolder()->GetToolCanvas()->SetFocus(); - } -#endif /* __APPLE__ */ } else if( type == wxEVT_CHAR_HOOK || type == wxEVT_CHAR ) {