Fix for Bug #57. The event tap was never returning events of either of the types specified and so mapKeyFromEvent would prematurely return with a null-equivalent KeyButton. Pulling the entire block of code, as the value it produces isn't used anyway.

Also fixed an incorrect pair of constants in the event tap generation code. Luckily, the two constants resolve to the same integer value, but things would get ugly if either value changed.

Thanks to Peter Van der Beken (peterv@propagandism.org) for the patch.
This commit is contained in:
azanar@carrel.org 2011-04-02 17:27:45 +00:00
parent d4e3ead60a
commit 71e53f05c9
2 changed files with 2 additions and 18 deletions

View File

@ -284,22 +284,6 @@ COSXKeyState::mapKeyFromEvent(CKeyIDs& ids,
#endif
if (layoutValid) {
// choose action
UInt16 action;
switch (eventKind) {
case kEventRawKeyDown:
action = kUCKeyActionDown;
break;
case kEventRawKeyRepeat:
action = kUCKeyActionAutoKey;
break;
default:
return 0;
}
// translate key
UniCharCount count;
UniChar chars[2];

View File

@ -620,7 +620,7 @@ COSXScreen::enable()
// FIXME -- start watching jump zones
// kCGEventTapOptionDefault = 0x00000000 (Missing in 10.4, so specified literally)
m_eventTapPort=CGEventTapCreate(kCGHIDEventTap, kCGHIDEventTap, 0,
m_eventTapPort=CGEventTapCreate(kCGHIDEventTap, kCGHeadInsertEventTap, 0,
kCGEventMaskForAllEvents,
handleCGInputEvent,
this);
@ -640,7 +640,7 @@ COSXScreen::enable()
// there may be a better way to do this, but we register an event handler even if we're
// not on the primary display (acting as a client). This way, if a local event comes in
// (either keyboard or mouse), we can make sure to show the cursor if we've hidden it.
m_eventTapPort=CGEventTapCreate(kCGHIDEventTap, kCGHIDEventTap, 0,
m_eventTapPort=CGEventTapCreate(kCGHIDEventTap, kCGHeadInsertEventTap, 0,
kCGEventMaskForAllEvents,
handleCGInputEventSecondary,
this);