Re: Left Alt and Right Alt



"Ian King" <king eiffel com> writes:
> Is there anyway to dynamically query whether a Left Alt key is pressed and
> not the right, I am using GDK_MOD1_MASK at the moment but this seems to do
> both.
> 

If you're using Alt as a modifier, then it will produce
broken/surprising behavior for end users if you distinguish these
(mod1 doesn't actually even have to be on the keys labeled "Alt", on
my system it's only on one of them, etc.). 

But the basic way you'd do this is to track key press / key release
events and keep a flag whether the left/right alt keys are pressed.
event->keyval == GDK_Alt_L, event->keyval == GDK_Alt_R.

Also some disabled users may be using a "sticky modifiers" feature
where they tap alt, release, then tap another key. I'm not sure if you
get the key release event before or after the MOD1_MASK flag
disappears in this case.

Havoc






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]