From 306f7916419317398adaf36e50ba4f8435407147 Mon Sep 17 00:00:00 2001 From: IoI_xD Date: Thu, 5 Mar 2026 22:52:25 -0700 Subject: [PATCH] mac: apple doesn't give us a reliable way to check if events are pending but we have to do the nextEventMatching trick anyways because the alternating pending implementation breaks opengl. --- include/Mw/LowLevel/Cocoa.h | 2 +- src/backend/cocoa.m | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/include/Mw/LowLevel/Cocoa.h b/include/Mw/LowLevel/Cocoa.h index 889cdf7..58401b2 100644 --- a/include/Mw/LowLevel/Cocoa.h +++ b/include/Mw/LowLevel/Cocoa.h @@ -79,7 +79,7 @@ MwLL parent; MilskoFakePointer *handle; NSUInteger strHash; - MwBool pendingTicker; + NSEvent *lastEvent; } + (MilskoCocoa *)newWithParent:(MwLL)parent diff --git a/src/backend/cocoa.m b/src/backend/cocoa.m index 93f68d7..0f21dd3 100644 --- a/src/backend/cocoa.m +++ b/src/backend/cocoa.m @@ -236,23 +236,12 @@ static CGPoint pointFlip(CGPoint point) { _forceRender = MwFALSE; return 1; } -// Apple does not give you a reliable way to tell when events are coming. I -// found this out by accident by stumbling upon a comment wxWidget's code, -// thought I could figure out something better, and I ended up with the same -// solution they tried and can confirm it doesn't work. -// Thanks Tim Cook. -#if 0 self->lastEvent = [self->window nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES]; - return self->lastEvent != NULL; -#endif - // And unlike wxWidgets we can't just return 1, so instead we alternate - // between such. - return (self->pendingTicker = !self->pendingTicker); }; - (void)getNextEvent {