← Back to team overview

kicad-developers team mailing list archive

Re: '/' hotkey

 

On 3/1/2018 10:56 AM, jp charras wrote:
> 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.

I don't think this is big problem.  Generally, menu accelerators are
translated into a command events.  Propagating the character event could
lead to unexpected behavior where one or more command events could be
triggered.  I suppose there could be cases where you would want multiple
commands generated for a single key press but it seems unlikely.

> 
> 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 key modifier state is required as well.  The translated key code is
not enough information to make a useful decision for fixing the issue.
I'm going to commit the wxKeyEvent trace code that I've written so I can
we can gather up all of the relevant wxKeyEvent information and come up
with a reasonable solution.

> 
> 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.

Irregardless of how the key events are received, they need to be mapped
correctly to a common key to have any chance of making non-alphabetic
keys usable as hot keys in KiCad.

> 
> 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.
> 


References