Fix event processing bug which kept ModEdit's context menu from working.
This commit is contained in:
parent
34527630d0
commit
1a988e8d85
|
@ -665,44 +665,41 @@ bool TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we're pendingWait then we had better have a cofunc to process the wait.
|
||||||
|
wxASSERT( !st || !st->pendingWait || st->cofunc );
|
||||||
|
|
||||||
// the tool state handler is waiting for events (i.e. called Wait() method)
|
// the tool state handler is waiting for events (i.e. called Wait() method)
|
||||||
if( st && st->pendingWait )
|
if( st && st->cofunc && st->pendingWait && st->waitEvents.Matches( aEvent ) )
|
||||||
{
|
{
|
||||||
if( st->waitEvents.Matches( aEvent ) )
|
if( !aEvent.FirstResponder() )
|
||||||
|
const_cast<TOOL_EVENT*>( &aEvent )->SetFirstResponder( st->theTool );
|
||||||
|
|
||||||
|
// got matching event? clear wait list and wake up the coroutine
|
||||||
|
st->wakeupEvent = aEvent;
|
||||||
|
st->pendingWait = false;
|
||||||
|
st->waitEvents.clear();
|
||||||
|
|
||||||
|
wxLogTrace( kicadTraceToolStack,
|
||||||
|
"TOOL_MANAGER::dispatchInternal - Waking tool %s for event: %s",
|
||||||
|
st->theTool->GetName(), aEvent.Format() );
|
||||||
|
|
||||||
|
setActiveState( st );
|
||||||
|
bool end = !st->cofunc->Resume();
|
||||||
|
|
||||||
|
if( end )
|
||||||
{
|
{
|
||||||
if( !aEvent.FirstResponder() )
|
it = finishTool( st );
|
||||||
const_cast<TOOL_EVENT*>( &aEvent )->SetFirstResponder( st->theTool );
|
increment = false;
|
||||||
|
}
|
||||||
|
|
||||||
// got matching event? clear wait list and wake up the coroutine
|
// If the tool did not request the event be passed to other tools, we're done
|
||||||
st->wakeupEvent = aEvent;
|
if( !st->wakeupEvent.PassEvent() )
|
||||||
st->pendingWait = false;
|
{
|
||||||
st->waitEvents.clear();
|
wxLogTrace( kicadTraceToolStack,
|
||||||
|
"TOOL_MANAGER::dispatchInternal - %s stopped passing event: %s",
|
||||||
|
st->theTool->GetName(), aEvent.Format() );
|
||||||
|
|
||||||
if( st->cofunc )
|
return true;
|
||||||
{
|
|
||||||
wxLogTrace( kicadTraceToolStack,
|
|
||||||
"TOOL_MANAGER::dispatchInternal - Waking tool %s for event: %s",
|
|
||||||
st->theTool->GetName(), aEvent.Format() );
|
|
||||||
|
|
||||||
setActiveState( st );
|
|
||||||
bool end = !st->cofunc->Resume();
|
|
||||||
|
|
||||||
if( end )
|
|
||||||
{
|
|
||||||
it = finishTool( st );
|
|
||||||
increment = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the tool did not request the event be passed to other tools, we're done
|
|
||||||
if( !st->wakeupEvent.PassEvent() )
|
|
||||||
{
|
|
||||||
wxLogTrace( kicadTraceToolStack,
|
|
||||||
"TOOL_MANAGER::dispatchInternal - %s stopped passing event: %s",
|
|
||||||
st->theTool->GetName(), aEvent.Format() );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -821,8 +818,11 @@ void TOOL_MANAGER::DispatchContextMenu( const TOOL_EVENT& aEvent )
|
||||||
if( st->contextMenuTrigger == CMENU_BUTTON && !aEvent.IsClick( BUT_RIGHT ) )
|
if( st->contextMenuTrigger == CMENU_BUTTON && !aEvent.IsClick( BUT_RIGHT ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
st->pendingWait = true;
|
if( st->cofunc )
|
||||||
st->waitEvents = TOOL_EVENT( TC_ANY, TA_ANY );
|
{
|
||||||
|
st->pendingWait = true;
|
||||||
|
st->waitEvents = TOOL_EVENT( TC_ANY, TA_ANY );
|
||||||
|
}
|
||||||
|
|
||||||
// Store the menu pointer in case it is changed by the TOOL when handling menu events
|
// Store the menu pointer in case it is changed by the TOOL when handling menu events
|
||||||
ACTION_MENU* m = st->contextMenu;
|
ACTION_MENU* m = st->contextMenu;
|
||||||
|
|
Loading…
Reference in New Issue