ATTN: OSX Devs - Found and "fixed" a bug with SDL2 on OSX 10.10

Hey Guys

So the runloop code had some issues on Yosemite. Namely it would beachball until the first event could finally be sent. God knows why, but [NSAppnextEventMatchingMask:NSAnyEventMaskuntilDate:[NSDatedistantPast] inMode:NSDefaultRunLoopModedequeue:YES]; would forever return nil and never deliver any events.

I got around this by adding the following just before the for loop in Cocoa_PumpEvents
My guess is [NSApp sendEvent] MUST get called at least once so OSX knows the app is alive.

//better let cocoa know that we're at least here somehow
static BOOL atLeastOnce = FALSE;
    NSTimeIntervalti = [[NSProcessInfoprocessInfo] systemUptime];
    NSEvent*someEvent = [NSEventmouseEventWithType:NSMouseMovedlocation:NSMakePoint(100, 100) modifierFlags:0timestamp:ti windowNumber:0context:nileventNumber:0clickCount:0pressure:0];
    [NSApp postEvent:someEvent atStart:YES];
    atLeastOnce = TRUE;

pool = [[NSAutoreleasePoolalloc] init];
for ( ; ; ) {


Feel free to use this solution when working on SDL in the future


Hi there,

Are you able to confirm that this bug is, in fact, with SDL2 with a test sample that reliably reproduces the bug? If so, I?d love to see it. I?m asking because I seem to have recently stumbled upon an issue in some of my engine tests that sounds like what you are describing.

I haven?t done much digging around to see what is going on in my problem ? it isn?t something that I can even reliably reproduce.

Jeffrey Carpenter <@Jeffrey_Carpenter>

-------------- next part --------------
A non-text attachment was scrubbed…
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1572 bytes
Desc: not available