← Back to team overview

kicad-developers team mailing list archive

common/tool/tool_dispatcher needs fixing.

 

Hi Jeff,

Sorry to bother you, but could you have a look into this file, and
especially into void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent ).

There are 2 things that need fixing  (related to key event handling),
because our key event handler has bugs:

1 - the first is related to ESC key:
if a ESC key is typed, first avent is set:
 evt = TOOL_EVENT( TC_COMMAND, TA_CANCEL_TOOL );
and later:
m_toolMgr->ProcessEvent( *evt ); returns false: this is a bug.
Obviously, the key event is handled, and this line should return true.
(I recently added a workaround, but fixing the bug is better)
A golden rule on wxWidgets is: skip the key event if not handled by a
window or frame or..., or do not skip it when handled.

2 - the second issue is OSX specific:
Have a look to line 492 to 495:
the char event is not skipped ( when not handled ) on OSX.
I am thinking this is incorrect (at least in Debug mode it should be
skipped when not handled).
I am guessing this ugly hack comes from the time the tool dispatcher was
broken, and skip any key event, even when it was handled (and that was a
serious bug).
This is fortunately no longer the case.
But this conditional compilation creates a difference between OSX and
other OS.
We don't need that.
And it explains why you did not see some bugs related to hotkeys.

Thanks.

-- 
Jean-Pierre CHARRAS


Follow ups