Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Differentiating between left and right modifier keys



I am writing a program that needs to handle keypress events, this is not a problem in most cases, but I want to be able to differentiate between left/right control/shift/alt/command.  I've tried the following two approaches:

Subscribe to kEventRawKeyModifiersChanged.  This will get me a mask of the modifer keys, but the mask has one bit for each left/right modifier pair (some legacy documentation shows this bit-array having separate bits for left and right modifiers, but it doesn't seem to be the case anymore).  Pressing left shift then right shift gives me two events, but the second one has the same mask as the first.  I've tried GetCurrentEventKeyModifiers, but it returns the same mask.

Talking to the keyboard through the HID libraries.  Using the samples provided by apple, I was able to find the keyboard, ask it if it had a left shift key and a right shift key (it said yes to both), but I never got key events for them.  I tried this with non-modifier keys and it worked just fine.

I know this is possible, since SDL is able to differentiate between left and right shift, but I think it does this using the X11 libraries, which I'd like to avoid if possible.  I'm hoping that I've just missed something simple in one of the above approaches.  Any advice would be great.

thanks!
-Jonathan
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.