Be more careful with forced cursor positions.

Fixes https://gitlab.com/kicad/code/kicad/issues/9977
This commit is contained in:
Jeff Young 2022-04-10 23:14:30 +01:00
parent 32a2490677
commit 29eb5931c2
6 changed files with 25 additions and 1 deletions

View File

@ -548,6 +548,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
Activate();
// Must be done after Activate() so that it gets set into the correct context
m_controls->ShowCursor( true );
m_controls->ForceCursorPosition( false );
// do not capture or auto-pan until we start placing some text
// Set initial cursor
setCursor();
@ -742,6 +743,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
m_controls->SetAutoPan( false );
m_controls->CaptureCursor( false );
m_controls->ForceCursorPosition( false );
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
if( selection().Empty() )
@ -795,6 +797,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
{
m_controls->SetAutoPan( false );
m_controls->CaptureCursor( false );
m_controls->ForceCursorPosition( false );
preview.Clear();
m_view->Update( &preview );
@ -818,6 +821,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
Activate();
// Must be done after Activate() so that it gets set into the correct context
m_controls->ShowCursor( true );
m_controls->ForceCursorPosition( false );
// Set initial cursor
setCursor();
@ -1362,6 +1366,7 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
m_view->Remove( &preview );
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
m_controls->ForceCursorPosition( false );
m_frame->PopTool( tool );
@ -1400,6 +1405,7 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
m_controls->ShowCursor( true );
m_controls->SetAutoPan( true );
m_controls->CaptureCursor( false );
m_controls->ForceCursorPosition( false );
// Set initial cursor
setCursor();
@ -1446,6 +1452,7 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
}
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
m_controls->ForceCursorPosition( false );
return 0;
}
@ -1541,6 +1548,7 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic,
};
m_controls->ShowCursor( true );
m_controls->ForceCursorPosition( false );
// Set initial cursor
setCursor();
@ -1861,6 +1869,7 @@ bool DRAWING_TOOL::drawArc( const std::string& aTool, PCB_SHAPE** aGraphic, bool
};
m_controls->ShowCursor( true );
m_controls->ForceCursorPosition( false );
// Set initial cursor
setCursor();
@ -2189,6 +2198,7 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
Activate();
// Must be done after Activate() so that it gets set into the correct context
m_controls->ShowCursor( true );
m_controls->ForceCursorPosition( false );
// Set initial cursor
setCursor();

View File

@ -752,6 +752,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
// Must be done after Activate() so that it gets set into the correct context
controls->ShowCursor( true );
controls->SetAutoPan( true );
controls->ForceCursorPosition( false );
if( aPickReference && !pickReferencePoint( _( "Select reference point for move..." ), "", "",
pickedReferencePoint ) )

View File

@ -328,6 +328,7 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
Activate();
// Must be done after Activate() so that it gets set into the correct context
getViewControls()->ShowCursor( true );
getViewControls()->ForceCursorPosition( false );
// Set initial cursor
setCursor();
@ -478,6 +479,7 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
statusPopup.Hide();
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
getViewControls()->ForceCursorPosition( false );
return 0;
}

View File

@ -123,8 +123,10 @@ int PCB_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
break;
}
else
{
setControls();
}
}
else if( evt->IsMotion() )
{
@ -152,8 +154,10 @@ int PCB_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
}
else
{
evt->SetPassEvent();
}
}
if( m_finalizeHandler )
{

View File

@ -52,6 +52,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
Activate();
// Must be done after Activate() so that it gets set into the correct context
controls()->ShowCursor( true );
controls()->ForceCursorPosition( false );
// do not capture or auto-pan until we start placing an item
PCB_GRID_HELPER grid( m_toolMgr, frame()->GetMagneticItemsSettings() );
@ -120,6 +121,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
controls()->SetAutoPan( false );
controls()->CaptureCursor( false );
controls()->ShowCursor( true );
controls()->ForceCursorPosition( false );
};
if( evt->IsCancelInteractive() )
@ -266,6 +268,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
controls()->SetAutoPan( false );
controls()->CaptureCursor( false );
controls()->ForceCursorPosition( false );
}

View File

@ -219,6 +219,7 @@ int PCB_VIEWER_TOOLS::MeasureTool( const TOOL_EVENT& aEvent )
view.SetVisible( &ruler, false );
controls.SetAutoPan( false );
controls.CaptureCursor( false );
controls.ForceCursorPosition( false );
originSet = false;
};
@ -227,6 +228,8 @@ int PCB_VIEWER_TOOLS::MeasureTool( const TOOL_EVENT& aEvent )
controls.ShowCursor( true );
controls.SetAutoPan( false );
controls.CaptureCursor( false );
controls.ForceCursorPosition( false );
// Set initial cursor
setCursor();
@ -339,6 +342,7 @@ int PCB_VIEWER_TOOLS::MeasureTool( const TOOL_EVENT& aEvent )
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
controls.SetAutoPan( false );
controls.CaptureCursor( false );
controls.ForceCursorPosition( false );
return 0;
}