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:
Maciej Suminski 2017-11-08 11:40:34 +01:00
parent 7d24a576e4
commit 40129d2244
2 changed files with 4 additions and 39 deletions

View File

@ -198,9 +198,6 @@ TOOL_MANAGER::TOOL_MANAGER() :
m_menuActive( false )
{
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 )
{
pushViewControls();
applyViewControls( st );
bool end = !st->cofunc->Resume();
saveViewControls( st );
popViewControls();
if( end )
it = finishTool( st );
@ -576,12 +571,10 @@ void TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
st->transitions.clear();
// got match? Run the handler.
pushViewControls();
applyViewControls( st );
st->idle = false;
st->cofunc->Call( aEvent );
saveViewControls( st );
popViewControls();
if( !st->cofunc->Running() )
finishTool( st ); // The couroutine has finished immediately?
@ -734,21 +727,21 @@ TOOL_MANAGER::ID_LIST::iterator TOOL_MANAGER::finishTool( TOOL_STATE* aState )
bool TOOL_MANAGER::ProcessEvent( const TOOL_EVENT& aEvent )
{
if( TOOL_STATE* active = GetCurrentToolState() )
saveViewControls( active );
bool hotkey_handled = processEvent( aEvent );
if( TOOL_STATE* active = GetCurrentToolState() )
{
applyViewControls( active );
}
if( m_view->IsDirty() )
{
auto f = dynamic_cast<EDA_DRAW_FRAME*>( GetEditFrame() );
if( f )
{
f->GetGalCanvas()->Refresh(); // fixme: ugly hack, provide a method in TOOL_DISPATCHER.
}
}
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 )
{
// Early dispatch of events destined for the TOOL_MANAGER

View File

@ -479,18 +479,6 @@ private:
*/
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.
///> @return true if a hotkey was handled
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.
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.
bool m_passEvent;