Mailing Lists: Apple Mailing Lists

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

Virtual keycodes for CGEvents, scan codes, and international keyboards



I have a number of questions about how virtual keycodes are generated for CG Events.

A. I've been looking everywhere trying to find the mapping from virtual keycodes in CGEvents to "whatever" but haven't found anything. I noticed a reference to a 'uchr' resource and the function UCKeyTranslate in the Unicode Utilities that can map a keycode to a Unicode character. However, the virtual keycodes appear to map to all sorts of things other than Unicode characters:
- Media Control (e.g. volume up and down, start, stop, mute, track skip)
- Function Keys
- Numeric Keypad
- Navigation keys (e.g. Home, Page Down)
- Language input keys (e.g. Kana key)
- etc.


Is there a place that defines what all these mappings are?

Also, it would be great if these mappings take into account the various international keyboards out there? (Japanese, Chinese, Tibetan, Hebrew, Arabic, etc.) Although I wouldn't mind if there was something for the standard US English USB keyboard.

B. Some keys don't seem to map to a virtual keycode and keyboard CGEvents aren't generated. For example, the Mute key on my keyboard generates an NX_SYSDEFINED Event sent but I don't know how to look into these to figure out what they mean.

B. I'm not totally sure how these CGEvents are generated in the first place. For example, I have a Dell keyboard hooked up to my Mac. There are a number of Internet navigation keys that generate no CGEvents at all (SYSDEFINED even). My guess is that the HID driver for the device puts them the in the Quart Event system queue and then they are dispatched to whomever wants access to Quartz Events (Carbon and Cocoa). With no driver, there is no scan code to virtual key conversion so no event is generated.

My real goal is to be able to be able to get raw scancodes from the keyboard and to inject scancodes into this event queue and have virtual keys be given to the user via CGEvents. If the CGEvents come from the driver directly, then I suppose I would need to act like a driver and deal with the scancode to virtual keycode mapping myself. Then I could deal with third-party keyboards that have special keys (Internet keys, gaming keyboards, etc.) and all international keyboards.

Anyway, these are a lot of questions but I would appreciate any info you may have and pointers to places to research this more.

Doug Hill
Oracle Corp.

P.S. Is there anywhere one can buy a Japanese Macintosh keyboard in the US? All Apple Stores, Company Store, and third party retailers I've talked to all tell me No. Do I have to buy a plane ticket to Japan just to buy an Apple keyboard?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartz-dev/email@hidden


This email sent to email@hidden
References: 
 >Re: Is there a CI ripple distortion? (From: Scott Thompson <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.