Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Mac: Fix mouse tap on 10.5.

There's no Block support in the runtime on 10.5, so the old code
wouldn't work.
  • Loading branch information
jorgenpt committed Aug 8, 2013
1 parent f79d823 commit cbfbe092c49c92d6ff1eb0f07af92c69f3a361e9
Showing with 11 additions and 4 deletions.
  1. +11 −4 src/video/cocoa/SDL_cocoamousetap.m
@@ -131,6 +131,12 @@
return event;
}

static void
SemaphorePostCallback(CFRunLoopTimerRef timer, void *info)
{
SDL_SemPost((SDL_sem*)info);
}

static int
Cocoa_MouseTapThread(void *data)
{
@@ -163,10 +169,11 @@

tapdata->runloop = CFRunLoopGetCurrent();
CFRunLoopAddSource(tapdata->runloop, tapdata->runloopSource, kCFRunLoopCommonModes);
CFRunLoopPerformBlock(tapdata->runloop, kCFRunLoopCommonModes, ^{
/* We signal this *after* the run loop has started, indicating it's safe to CFRunLoopStop it. */
SDL_SemPost(tapdata->runloopStartedSemaphore);
});
CFRunLoopTimerContext context = {.info = tapdata->runloopStartedSemaphore};
/* We signal the runloop started semaphore *after* the run loop has started, indicating it's safe to CFRunLoopStop it. */
CFRunLoopTimerRef timer = CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent(), 0, 0, 0, &SemaphorePostCallback, &context);
CFRunLoopAddTimer(tapdata->runloop, timer, kCFRunLoopCommonModes);
CFRelease(timer);

/* Run the event loop to handle events in the event tap. */
CFRunLoopRun();

0 comments on commit cbfbe09

Please sign in to comment.