From 71e53f05c968b185a23b387af400e778918f1402 Mon Sep 17 00:00:00 2001 From: "azanar@carrel.org" Date: Sat, 2 Apr 2011 17:27:45 +0000 Subject: [PATCH] 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. --- lib/platform/COSXKeyState.cpp | 16 ---------------- lib/platform/COSXScreen.cpp | 4 ++-- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/lib/platform/COSXKeyState.cpp b/lib/platform/COSXKeyState.cpp index 1a4285e0..2757b1ae 100644 --- a/lib/platform/COSXKeyState.cpp +++ b/lib/platform/COSXKeyState.cpp @@ -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]; diff --git a/lib/platform/COSXScreen.cpp b/lib/platform/COSXScreen.cpp index ae3ee661..f766b165 100644 --- a/lib/platform/COSXScreen.cpp +++ b/lib/platform/COSXScreen.cpp @@ -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);