OSX Leopard keyboard input API other than cocoa
I am currently trying to get simple keyboard input on OSX, right now I am doing it through the Leopard HID Manager object and that generally works, but since that is pretty low level I am wondering if there is an API available that has some extra functionality build it like key repetition or Unicode support (since when I catch the events on HID I/O level I think I have to write all these fancy extras from scratch). I know carbon event handlers(NewEventHandlerUPP) are capable of that but I am pretty sure that they are deprecated since you can't find anything about them in the current OSX reference and I don't want to use anything deprecated, so I am wondering if there is any alternative I didn't come across during my开发者_运维技巧 search!
Thanks!
No.
At the Unicode level, the official API of receiving input is NSTextInputClient
protocol in Objective-C, and the official API of processing input between the keyboard and the program is the Input Method Kit
.
And you can never write a sufficiently fancy extra correctly from scratch. You need to get the user's setting of the international keyboard and modify the key obtained accordingly. And you can never write an input method from scratch which turns the raw key input to Chinese or Japanese ...
So, I think the sane choices are either
- Just get the raw ASCII data from the keyboard and don't aim for more, or
- Use Cocoa at least around the key input handling, to get additional features.
精彩评论