aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavilla <davilla@4pi.com>2011-10-05 11:19:53 -0400
committerdavilla <davilla@4pi.com>2011-10-05 11:20:22 -0400
commit5d57233307172470542b072dc32d0b605ff51e75 (patch)
tree597af826d18bc45f029d0e0eab0835999979a7dc
parentf3388631714abdb12ac3d882db372f6eaf5df26b (diff)
[osx] changed, exclude from 10.4 runtime
-rw-r--r--xbmc/osx/HotKeyController.m28
1 files changed, 18 insertions, 10 deletions
diff --git a/xbmc/osx/HotKeyController.m b/xbmc/osx/HotKeyController.m
index b4033fa456..46d3478f12 100644
--- a/xbmc/osx/HotKeyController.m
+++ b/xbmc/osx/HotKeyController.m
@@ -265,24 +265,32 @@ static CGEventRef tapEventCallback(CGEventTapProxy proxy, CGEventType type, CGEv
m_active = NO;
m_controlSysPower = NO;
m_controlSysVolume = NO;
- m_eventPort = CGEventTapCreate(kCGSessionEventTap,
- kCGHeadInsertEventTap, kCGEventTapOptionDefault,
- CGEventMaskBit(NX_SYSDEFINED), tapEventCallback, self);
- if (m_eventPort == NULL)
+
+ if (floor(NSAppKitVersionNumber) < 949)
{
- NSLog(@"Fatal Error: Event Tap could not be created");
- return self;
+ // check runtime, we only allow this on 10.5+
+ m_eventPort = NULL;
+ }
+ else
+ {
+ m_eventPort = CGEventTapCreate(kCGSessionEventTap,
+ kCGHeadInsertEventTap, kCGEventTapOptionDefault,
+ CGEventMaskBit(NX_SYSDEFINED), tapEventCallback, self);
+ if (m_eventPort != NULL)
+ {
+ // Run this in a separate thread so that a slow app
+ // doesn't lag the event tap
+ [NSThread detachNewThreadSelector:@selector(eventTapThread) toTarget:self withObject:nil];
+ }
}
-
- // Run this in a separate thread so that a slow app doesn't lag the event tap
- [NSThread detachNewThreadSelector:@selector(eventTapThread) toTarget:self withObject:nil];
}
return self;
}
- (void)dealloc
{
- CFRelease(m_eventPort);
+ if (m_eventPort)
+ CFRelease(m_eventPort);
[super dealloc];
}
@end