Fixed cursor freeze after canceling a tool with cursor over a drag point
Fixes: lp:1716702 * https://bugs.launchpad.net/kicad/+bug/1716702
This commit is contained in:
parent
7d24a576e4
commit
40129d2244
|
@ -198,9 +198,6 @@ TOOL_MANAGER::TOOL_MANAGER() :
|
||||||
m_menuActive( false )
|
m_menuActive( false )
|
||||||
{
|
{
|
||||||
m_actionMgr = new ACTION_MANAGER( this );
|
m_actionMgr = new ACTION_MANAGER( this );
|
||||||
|
|
||||||
// Keep default VIEW_CONTROLS settings at the bottom of the stack
|
|
||||||
m_vcStack.push( KIGFX::VC_SETTINGS() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -533,11 +530,9 @@ void TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
if( st->cofunc )
|
if( st->cofunc )
|
||||||
{
|
{
|
||||||
pushViewControls();
|
|
||||||
applyViewControls( st );
|
applyViewControls( st );
|
||||||
bool end = !st->cofunc->Resume();
|
bool end = !st->cofunc->Resume();
|
||||||
saveViewControls( st );
|
saveViewControls( st );
|
||||||
popViewControls();
|
|
||||||
|
|
||||||
if( end )
|
if( end )
|
||||||
it = finishTool( st );
|
it = finishTool( st );
|
||||||
|
@ -576,12 +571,10 @@ void TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
|
||||||
st->transitions.clear();
|
st->transitions.clear();
|
||||||
|
|
||||||
// got match? Run the handler.
|
// got match? Run the handler.
|
||||||
pushViewControls();
|
|
||||||
applyViewControls( st );
|
applyViewControls( st );
|
||||||
st->idle = false;
|
st->idle = false;
|
||||||
st->cofunc->Call( aEvent );
|
st->cofunc->Call( aEvent );
|
||||||
saveViewControls( st );
|
saveViewControls( st );
|
||||||
popViewControls();
|
|
||||||
|
|
||||||
if( !st->cofunc->Running() )
|
if( !st->cofunc->Running() )
|
||||||
finishTool( st ); // The couroutine has finished immediately?
|
finishTool( st ); // The couroutine has finished immediately?
|
||||||
|
@ -734,20 +727,20 @@ TOOL_MANAGER::ID_LIST::iterator TOOL_MANAGER::finishTool( TOOL_STATE* aState )
|
||||||
|
|
||||||
bool TOOL_MANAGER::ProcessEvent( const TOOL_EVENT& aEvent )
|
bool TOOL_MANAGER::ProcessEvent( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
|
if( TOOL_STATE* active = GetCurrentToolState() )
|
||||||
|
saveViewControls( active );
|
||||||
|
|
||||||
bool hotkey_handled = processEvent( aEvent );
|
bool hotkey_handled = processEvent( aEvent );
|
||||||
|
|
||||||
if( TOOL_STATE* active = GetCurrentToolState() )
|
if( TOOL_STATE* active = GetCurrentToolState() )
|
||||||
{
|
|
||||||
applyViewControls( active );
|
applyViewControls( active );
|
||||||
}
|
|
||||||
|
|
||||||
if( m_view->IsDirty() )
|
if( m_view->IsDirty() )
|
||||||
{
|
{
|
||||||
auto f = dynamic_cast<EDA_DRAW_FRAME*>( GetEditFrame() );
|
auto f = dynamic_cast<EDA_DRAW_FRAME*>( GetEditFrame() );
|
||||||
|
|
||||||
if( f )
|
if( f )
|
||||||
{
|
|
||||||
f->GetGalCanvas()->Refresh(); // fixme: ugly hack, provide a method in TOOL_DISPATCHER.
|
f->GetGalCanvas()->Refresh(); // fixme: ugly hack, provide a method in TOOL_DISPATCHER.
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return hotkey_handled;
|
return hotkey_handled;
|
||||||
|
@ -855,19 +848,6 @@ void TOOL_MANAGER::applyViewControls( TOOL_STATE* aState )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TOOL_MANAGER::pushViewControls()
|
|
||||||
{
|
|
||||||
m_vcStack.push( m_viewControls->GetSettings() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void TOOL_MANAGER::popViewControls()
|
|
||||||
{
|
|
||||||
m_viewControls->ApplySettings( m_vcStack.top() );
|
|
||||||
m_vcStack.pop();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool TOOL_MANAGER::processEvent( const TOOL_EVENT& aEvent )
|
bool TOOL_MANAGER::processEvent( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
// Early dispatch of events destined for the TOOL_MANAGER
|
// Early dispatch of events destined for the TOOL_MANAGER
|
||||||
|
|
|
@ -479,18 +479,6 @@ private:
|
||||||
*/
|
*/
|
||||||
void applyViewControls( TOOL_STATE* aState );
|
void applyViewControls( TOOL_STATE* aState );
|
||||||
|
|
||||||
/**
|
|
||||||
* Function pushViewControls()
|
|
||||||
* Stores the current VIEW_CONTROLS settings on the stack.
|
|
||||||
*/
|
|
||||||
void pushViewControls();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function pushViewControls()
|
|
||||||
* Restores VIEW_CONTROLS settings from the stack.
|
|
||||||
*/
|
|
||||||
void popViewControls();
|
|
||||||
|
|
||||||
///> Main function for event processing.
|
///> Main function for event processing.
|
||||||
///> @return true if a hotkey was handled
|
///> @return true if a hotkey was handled
|
||||||
bool processEvent( const TOOL_EVENT& aEvent );
|
bool processEvent( const TOOL_EVENT& aEvent );
|
||||||
|
@ -524,9 +512,6 @@ private:
|
||||||
/// Queue that stores events to be processed at the end of the event processing cycle.
|
/// Queue that stores events to be processed at the end of the event processing cycle.
|
||||||
std::list<TOOL_EVENT> m_eventQueue;
|
std::list<TOOL_EVENT> m_eventQueue;
|
||||||
|
|
||||||
///> VIEW_CONTROLS settings stack
|
|
||||||
std::stack<KIGFX::VC_SETTINGS> m_vcStack;
|
|
||||||
|
|
||||||
/// Flag saying if the currently processed event should be passed to other tools.
|
/// Flag saying if the currently processed event should be passed to other tools.
|
||||||
bool m_passEvent;
|
bool m_passEvent;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue