Veto mouse warping from DRC dialog
Fixes: lp:1824630
* https://bugs.launchpad.net/kicad/+bug/1824630
(cherry picked from commit dec5d80180
)
This commit is contained in:
parent
90787e84bf
commit
f90049dd9e
|
@ -689,7 +689,6 @@ void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
m_viewControls->ForceCursorPosition( true, m_menuCursor );
|
m_viewControls->ForceCursorPosition( true, m_menuCursor );
|
||||||
m_warpMouseAfterContextMenu = true;
|
|
||||||
|
|
||||||
// Display a copy of menu
|
// Display a copy of menu
|
||||||
std::unique_ptr<CONTEXT_MENU> menu( m->Clone() );
|
std::unique_ptr<CONTEXT_MENU> menu( m->Clone() );
|
||||||
|
@ -715,6 +714,9 @@ void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
|
||||||
dispatchInternal( evt );
|
dispatchInternal( evt );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Restore setting in case it was vetoed
|
||||||
|
m_warpMouseAfterContextMenu = true;
|
||||||
|
|
||||||
// Notify the tools that menu has been closed
|
// Notify the tools that menu has been closed
|
||||||
TOOL_EVENT evt( TC_COMMAND, TA_CONTEXT_MENU_CLOSED );
|
TOOL_EVENT evt( TC_COMMAND, TA_CONTEXT_MENU_CLOSED );
|
||||||
evt.SetParameter( m );
|
evt.SetParameter( m );
|
||||||
|
|
|
@ -372,6 +372,11 @@ public:
|
||||||
*/
|
*/
|
||||||
const KIGFX::VC_SETTINGS& GetCurrentToolVC() const;
|
const KIGFX::VC_SETTINGS& GetCurrentToolVC() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables mouse warping after the current context menu is closed.
|
||||||
|
* Must be called before invoking each context menu.
|
||||||
|
* It's a good idea to call this from non-modal dialogs (e.g. DRC window).
|
||||||
|
*/
|
||||||
void VetoContextMenuMouseWarp()
|
void VetoContextMenuMouseWarp()
|
||||||
{
|
{
|
||||||
m_warpMouseAfterContextMenu = false;
|
m_warpMouseAfterContextMenu = false;
|
||||||
|
|
|
@ -478,6 +478,7 @@ void DIALOG_DRC_CONTROL::doSelectionMenu( const DRC_ITEM* aItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
WINDOW_THAWER thawer( m_brdEditor );
|
WINDOW_THAWER thawer( m_brdEditor );
|
||||||
|
m_brdEditor->GetToolManager()->VetoContextMenuMouseWarp();
|
||||||
m_brdEditor->GetToolManager()->RunAction( PCB_ACTIONS::selectionMenu, true, &items );
|
m_brdEditor->GetToolManager()->RunAction( PCB_ACTIONS::selectionMenu, true, &items );
|
||||||
|
|
||||||
// If we got an item, focus on it
|
// If we got an item, focus on it
|
||||||
|
|
Loading…
Reference in New Issue