← Back to team overview

kicad-developers team mailing list archive

Re: '/' hotkey

 

Le 01/03/2018 à 15:47, Wayne Stambaugh a écrit :
> On 3/1/2018 9:28 AM, Jon Evans wrote:
>> Here's a blog post from the developers of Atom editor talking about
>> solving this problem:
>> https://blog.atom.io/2016/10/17/the-wonderful-world-of-keyboards.html
> 
> I always new keyboard issues were bad but I didn't think they were this
> bad.  Someone needs to sit down with keyboard and/or os manufactures and
> start beating them about the head and shoulders with a clue bat until
> they fix this mess.  So basically we have to create key mappers to
> handle both os and keyboard layout differences to have any hope of
> providing sane hotkey behavior.
> 

On Windows (only) there is a much more annoying issue:
if a key is used as accelerator key in menu, the key is captured and key events do not propagate.

When a key is typed, first a EVT_CHAR_HOOK is sent to other windows,
and if not captured a second key event: a EVT_CHAR is sent.

But in a EVT_CHAR_HOOK the key code is the base key code, not the actual key code.
if the key is the ? / key (? is  shift+/) the key code is /
and ? only in EVT_CHAR (assuming you have used shift+/)

Here is a trace (on a French keyboard equivalent to the "? /" key is "? ," ) of "shift+,"
The  "shift+," (therefore the ? letter) was typed:
16:37:38: EDA_DRAW_PANEL::OnCharHook key 2C (,)
16:37:38: EDA_DRAW_FRAME::OnCharHook key 2C (,)
16:37:38: EDA_DRAW_PANEL::OnKeyEvent key 3F (?)
and the Hotkey list is show (as expected).
not also the '?' is not captured perhaps it is not the base letter of the key or because the actual
code is shift + someting

Now the trace of the same key not shifted ("," letter typed)
16:42:59: EDA_DRAW_PANEL::OnCharHook key 2C (,)
16:42:59: EDA_DRAW_FRAME::OnCharHook key 2C (,)

The trace shows the key "? ," was captured (the Hotkey list is show)
and not EVT_CHAR was fired (perhaps because the ',' is the base key).

Therefore for EVT_CHAR_HOOK events only the key (not the letter) has meaning.
This is only inside a EVT_CHAR the letter is identified.
And it looks like the accelerator key is a key, not a letter.

I spent a lot of time to try to fix it, but never succeed.
(I have only a workaround specific to Windows)

I am not sure this is specific to wxWidgets.
I have seen some other applications having this strange behavior.

-- 
Jean-Pierre CHARRAS


Follow ups

References