diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2010-09-30 17:09:03 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2010-09-30 17:09:03 +0000 |
commit | 13cf693343722e3db261fa44eff1b0f8d9115e08 (patch) | |
tree | d06f3733ae362846e271f6b60bf8a457946ffab0 /AppKit | |
parent | b61c01f4d7cf69ba0cac74afd18ec9f05d5526eb (diff) |
[Author: dmaclach]
Fix up GTMCarbonEvent to fix a major bug with comparing events.
Also increases error checking and makes debugging easier.
R=thomasvl
DELTA=18 (6 added, 0 deleted, 12 changed)
Diffstat (limited to 'AppKit')
-rw-r--r-- | AppKit/GTMCarbonEvent.m | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/AppKit/GTMCarbonEvent.m b/AppKit/GTMCarbonEvent.m index 7753f1b..a0fd6ef 100644 --- a/AppKit/GTMCarbonEvent.m +++ b/AppKit/GTMCarbonEvent.m @@ -578,17 +578,17 @@ GTMOBJECT_SINGLETON_BOILERPLATE(GTMCarbonEventDispatcherHandler, userInfo:userInfo whenPressed:onKeyDown] autorelease]; require(newKey, CantCreateKey); - if (RegisterEventHotKey((UInt32)keyCode, - GTMCocoaToCarbonKeyModifiers(cocoaModifiers), - keyID, - [self eventTarget], - 0, - &theRef) == noErr) { - [newKey setHotKeyRef:theRef]; - [hotkeys_ addObject:newKey]; - } else { - newKey = nil; - } + require_noerr_action(RegisterEventHotKey((UInt32)keyCode, + GTMCocoaToCarbonKeyModifiers(cocoaModifiers), + keyID, + [self eventTarget], + 0, + &theRef), + CantRegisterHotKey, newKey = nil); + [newKey setHotKeyRef:theRef]; + [hotkeys_ addObject:newKey]; + +CantRegisterHotKey: CantCreateKey: return newKey; } @@ -704,7 +704,7 @@ CantCreateKey: - (BOOL)isEqual:(id)object { return [object isMemberOfClass:[self class]] - && (hotKeyRef_ = [object hotKeyRef]); + && (hotKeyRef_ == [object hotKeyRef]); } // Does this record match key |keyID| @@ -744,6 +744,12 @@ CantCreateKey: - (void)setHotKeyRef:(EventHotKeyRef)ref { hotKeyRef_ = ref; } + +- (NSString *)description { + return [NSString stringWithFormat:@"<%@ %p> - ref %p signature %d id %d", + [self class], self, hotKeyRef_, id_.signature, id_.id]; +} + @end |