From 110728af485620723590a51e86ffb7a7fc7c011c Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 12 May 2022 11:05:06 -0700 Subject: [PATCH] Prevent focus stealing in some Linux WMs OnEnter events will only raise the windows within KiCad rather than between applications Fixes https://gitlab.com/kicad/code/kicad/issues/10809 --- common/tool/tool_dispatcher.cpp | 2 +- common/view/wx_view_controls.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/tool/tool_dispatcher.cpp b/common/tool/tool_dispatcher.cpp index da052004ca..f84f8b524d 100644 --- a/common/tool/tool_dispatcher.cpp +++ b/common/tool/tool_dispatcher.cpp @@ -452,7 +452,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent ) { wxWindow* holderWindow = dynamic_cast( m_toolMgr->GetToolHolder() ); -#if defined( _WIN32 ) +#if defined( _WIN32 ) || defined( __WXGTK__ ) // Mouse events may trigger regardless of window status (windows feature) // However we need to avoid focus fighting (especially modals) if( holderWindow && KIPLATFORM::UI::IsWindowActive( holderWindow ) ) diff --git a/common/view/wx_view_controls.cpp b/common/view/wx_view_controls.cpp index f8f8990821..8ad3039302 100644 --- a/common/view/wx_view_controls.cpp +++ b/common/view/wx_view_controls.cpp @@ -459,8 +459,8 @@ void WX_VIEW_CONTROLS::onEnter( wxMouseEvent& aEvent ) return; } -#if defined( _WIN32 ) - // Win32 transmits mouse move and wheel events to all controls below the mouse regardless +#if defined( _WIN32 ) || defined( __WXGTK__ ) + // Win32 and some *nix WMs transmit mouse move and wheel events to all controls below the mouse regardless // of focus. Forcing the focus here will cause the EDA FRAMES to immediately become the // top level active window. if( m_parentPanel->GetParent() != nullptr )