Subclass NSApplication and override this method: - (NSEvent *)nextEventMatchingMask:(NSUInteger)mask untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)deqFlag { NSEvent *event = [super nextEventMatchingMask:mask untilDate:expiration inMode:mode dequeue:deqFlag]; NSEventType type = [event type]; // 0 if event is nil if (type == NSLeftMouseDown || type == NSRightMouseDown) { if (m_popoverModalWindow != nil && [event window] != m_popoverModalWindow) { [self stopModalWithCode:NSCancelButton]; event = nil; } } return event; }
Then add this method, which you call instead of -runModalForWindow: - (NSInteger)runPopoverModalForWindow:(NSWindow *)theWindow { m_popoverModalWindow = theWindow; NSInteger result = [super runModalForWindow:theWindow]; m_popoverModalWindow = nil; return result; } _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com