diff --git a/platforms/iOS/vm/OSX/SqueakOSXApplication.m b/platforms/iOS/vm/OSX/SqueakOSXApplication.m index b517cb3661..f38feb817d 100644 --- a/platforms/iOS/vm/OSX/SqueakOSXApplication.m +++ b/platforms/iOS/vm/OSX/SqueakOSXApplication.m @@ -38,8 +38,12 @@ Some of this code was funded via a grant from the European Smalltalk User Group #import "SqueakOSXApplication.h" #import "sqSqueakOSXScreenAndWindow.h" +#import "SqueakOSXAppDelegate.h" +#import "sqSqueakOSXApplication.h" -@implementation SqueakOSXApplication +@implementation SqueakOSXApplication + +extern SqueakOSXAppDelegate *gDelegateApp; -(void)sendEvent:(NSEvent*)anEvent { @@ -66,4 +70,10 @@ - (void)showHelp:(id)sender; [[NSWorkspace sharedWorkspace] openURL: url]; } #endif + +- (void)orderFrontStandardAboutPanel:(id)sender; +{ + [super orderFrontStandardAboutPanel: sender]; + [gDelegateApp.squeakApplication setAboutWindow: [self keyWindow]]; +} @end diff --git a/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m b/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m index 8ee610291e..3c8298f5a3 100644 --- a/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m +++ b/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m @@ -67,6 +67,20 @@ - (sqButton) resolveModifier:(sqModifier)modifier forMouseButton:(sqButton)mouse @implementation sqSqueakOSXApplication (events) +// This method filters the event that should not be processed by the Squeak Application. +// This events are related to windows that are launched from a third party library (as SDL) +// Check pumpRunLoopEventSendAndSignal:(BOOL)signal for more details. + +// The events processed by the VM are the ones in the main window or in the about window. +- (BOOL) shouldFilterEvent: (NSEvent*)event { + + sqSqueakOSXApplication * sqApplication = (sqSqueakOSXApplication*)gDelegateApp.squeakApplication; + + return event.window + && event.window != gDelegateApp.window + && event.window != [sqApplication aboutWindow]; +} + // Consume all pending events in the NSApp // Events may come from the window open by the VM or windows open by other windowing systems // We need to consume all events in the queue, otherwise this may produce lockups when e.g., switching resolutions @@ -81,7 +95,7 @@ - (void) pumpRunLoopEventSendAndSignal:(BOOL)signal { dequeue:YES])) { // If the event is not a system event or an event of *this* window, queue the event // Otherwise treat the event normally and send it to the app - if (event.window && event.window != gDelegateApp.window){ + if ([self shouldFilterEvent: event]){ [alienEventQueue addObject: event]; }else{ [NSApp sendEvent: event]; diff --git a/platforms/iOS/vm/OSX/sqSqueakOSXApplication.h b/platforms/iOS/vm/OSX/sqSqueakOSXApplication.h index 63dbf73773..15bb2d34b9 100644 --- a/platforms/iOS/vm/OSX/sqSqueakOSXApplication.h +++ b/platforms/iOS/vm/OSX/sqSqueakOSXApplication.h @@ -41,9 +41,12 @@ #import "sqSqueakMainApplication.h" @interface sqSqueakOSXApplication : sqSqueakMainApplication { - NSCursor *squeakCursor; + NSWindow *aboutWindow; + NSCursor *squeakCursor; + } @property (nonatomic,strong) NSCursor *squeakCursor; +@property (nonatomic,strong) NSWindow *aboutWindow; - (int) parseArgument: (NSString *) argData peek: (char *) peek; - (void) parseArgs: (NSArray *) args; diff --git a/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m b/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m index 661146ac04..5fb1986838 100644 --- a/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m +++ b/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m @@ -104,6 +104,7 @@ void mtfsfi(unsigned long long fpscr) {} @implementation sqSqueakOSXApplication @synthesize squeakCursor; +@synthesize aboutWindow; - (void) setupFloat { fldcw(0x12bf); /* signed infinity, round to nearest, REAL8, disable intrs, disable signals */