Veto mouse warping from DRC dialog

Fixes: lp:1824630
* https://bugs.launchpad.net/kicad/+bug/1824630
This commit is contained in:
Jon Evans 2019-04-13 11:22:48 -04:00
parent 9ea7fe5338
commit dec5d80180
3 changed files with 9 additions and 1 deletions

View File

@ -689,7 +689,6 @@ void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
}
m_viewControls->ForceCursorPosition( true, m_menuCursor );
m_warpMouseAfterContextMenu = true;
// Display a copy of menu
std::unique_ptr<CONTEXT_MENU> menu( m->Clone() );
@ -715,6 +714,9 @@ void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
dispatchInternal( evt );
}
// Restore setting in case it was vetoed
m_warpMouseAfterContextMenu = true;
// Notify the tools that menu has been closed
TOOL_EVENT evt( TC_COMMAND, TA_CONTEXT_MENU_CLOSED );
evt.SetParameter( m );

View File

@ -372,6 +372,11 @@ public:
*/
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()
{
m_warpMouseAfterContextMenu = false;

View File

@ -436,6 +436,7 @@ void DIALOG_DRC_CONTROL::doSelectionMenu( const DRC_ITEM* aItem )
}
WINDOW_THAWER thawer( m_brdEditor );
m_brdEditor->GetToolManager()->VetoContextMenuMouseWarp();
m_brdEditor->GetToolManager()->RunAction( PCB_ACTIONS::selectionMenu, true, &items );
// If we got an item, focus on it