Skip to content

Commit

Permalink
[osx] changed, exclude from 10.4 runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
davilla committed Oct 5, 2011
1 parent f338863 commit 5d57233
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions xbmc/osx/HotKeyController.m
Expand Up @@ -265,24 +265,32 @@ - (id)init
m_active = NO; m_active = NO;
m_controlSysPower = NO; m_controlSysPower = NO;
m_controlSysVolume = NO; m_controlSysVolume = NO;
m_eventPort = CGEventTapCreate(kCGSessionEventTap,
kCGHeadInsertEventTap, kCGEventTapOptionDefault, if (floor(NSAppKitVersionNumber) < 949)
CGEventMaskBit(NX_SYSDEFINED), tapEventCallback, self);
if (m_eventPort == NULL)
{ {
NSLog(@"Fatal Error: Event Tap could not be created"); // check runtime, we only allow this on 10.5+
return self; 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; return self;
} }


- (void)dealloc - (void)dealloc
{ {
CFRelease(m_eventPort); if (m_eventPort)
CFRelease(m_eventPort);
[super dealloc]; [super dealloc];
} }
@end @end

0 comments on commit 5d57233

Please sign in to comment.