Re: [AD] OS X keyboard

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Wed, Jan 12, 2011 at 7:48 AM, Peter Wang <novalazy@xxxxxxxxxx> wrote:
> Just a friendly request/reminder to any OS X users: the keyboard driver
> is not working as it should.
>
> 1. modifier and dead keys should not generate KEY_CHAR events
This doesn't look too hard.
> 2. non-ASCII character input is not implemented
My initial investigation seems to suggest that unicode characters
(specifically I tried to send e-acute by pressing alt-e e as Evert did
in the a.cc thread) aren't sent through NSEvent. I may have done
something wrong.
Pete
Trivial patch to get rid of those Index out of bounds errors:
Index: keybd.m
===================================================================
--- keybd.m	(revision 14261)
+++ keybd.m	(working copy)
@@ -207,10 +207,12 @@
     * is held down. This is needed to get the correct behavior when caps
     * lock is on (ie, letters are upper case)
     */
-	const char raw_character = [[event charactersIgnoringModifiers]
characterAtIndex: 0];
-	const char upper_character = [[event characters] characterAtIndex: 0];
-	int scancode = mac_to_scancode[[event keyCode]];
-	int modifiers = [event modifierFlags];
+   NSString* raw = [event charactersIgnoringModifiers];
+   NSString* upper = [event characters];
+   const unichar raw_character = [raw length] > 0 ? [raw
characterAtIndex: 0] : 0;
+   const unichar upper_character = [upper length] > 0 ? [upper
characterAtIndex: 0] : 0;
+   int scancode = mac_to_scancode[[event keyCode]];
+   int modifiers = [event modifierFlags];
    int key_shifts;
    bool is_repeat = pressed ? ([event isARepeat] == YES) : false;




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/