[wx-dev] Keyboard handling problems
Alex Bligh
alex at alex.org.uk
Mon Aug 14 16:22:44 PDT 2006
Vadim Zeitlin wrote:
> AB> I don't understand how it can be expected to work where more than one
> AB> X key maps to the same modifier. IE if key X and key Y are both
> AB> modifiers that map to WXK_FOO, then what is wxGetKeyState(WXK_FOO)
> AB> meant to return? The status of X or Y?
>
> Not sure if this is what you meant, but just to confirm: yes, it should
> return "X | Y".
Oh I see what the wxGetKeyState is meant to do now. I think I also
see the bug. It seems to me to be broken where two key codes
map to the same WXK_xxx but are in different positions on the modifier
list. That's why both shift and control work, but the right ALT
doesn't.
If you swapped xmodmap around so right shift and right ctrl did
ctrl and shift respectively, then (as far as I can see) neither
key would work properly.
It's for this reason a modmap'd key to an Meta that doesn't produce
the same WXK_ as Meta isn't returning the key state right.
I think the fundamental problem here is we are trying to perform
a non-bijective mapping on keystates. If we considered the
*meaning* of WXK_SHIFT to be "is XModifier Shift down"
(rather than "is the shift key down"), and similarly WXK_ALT
to be "Is mod1 down" (IRRESPECTIVE of whether mod1 happens
to have ALT, CTRL, F1 or whatever assigned to it), and
a couple of others for the keys windows doesn't support, things
would probably be much simpler.
Alex
More information about the wx-dev
mailing list