Can't close a popover window after adding a child window
| Originator: | stephan.michels | ||
| Number: | rdar://14354025 | Date Originated: | 04-Jul-2013 10:59 AM |
| Status: | Open | Resolved: | |
| Product: | OS X SDK | Product Version: | Mountain Lion |
| Classification: | Serious Bug | Reproducible: | Always |
Summary:
If I add a child window to a semi-transient popover window, then I can't close the popover anymore by clicking outside of the window.
Steps to Reproduce:
Here is a little snippet to reproduce the problem:
@interface SMAppDelegate () <NSApplicationDelegate, NSPopoverDelegate>
@property (assign) IBOutlet NSWindow *window;
@property (weak) IBOutlet NSPopover *popover;
@property (weak) IBOutlet NSView *popoverView;
@end
@implementation SMAppDelegate
- (IBAction)openPopover:(id)sender {
[self.popover showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSMinYEdge];
}
- (void)popoverDidShow:(NSNotification *)notification {
// get window of the popover
NSWindow *window = self.popoverView.window;
// create overlay window
NSWindow *overlayWindow = [[NSWindow alloc] initWithContentRect:window.frame
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO];
overlayWindow.backgroundColor = [NSColor colorWithCalibratedRed:1.0 green:0.0 blue:0.0 alpha:0.4];
overlayWindow.opaque = NO;
overlayWindow.hasShadow = NO;
overlayWindow.acceptsMouseMovedEvents = NO;
overlayWindow.ignoresMouseEvents = YES;
// you can't close the popover if you added a child window
[window addChildWindow:overlayWindow ordered:NSWindowAbove];
}
@end
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!