Close Open Panels if a document is opened via other means

This commit is contained in:
Lior Halphon 2017-01-24 23:10:50 +02:00
parent a5f72627fe
commit 6f94664428

View File

@ -275,6 +275,14 @@ static void printImage(GB_gameboy_t *gb, uint32_t *image, uint8_t height,
- (void)windowControllerDidLoadNib:(NSWindowController *)aController { - (void)windowControllerDidLoadNib:(NSWindowController *)aController {
[super windowControllerDidLoadNib:aController]; [super windowControllerDidLoadNib:aController];
/* Close Open Panels, if any */
for (NSWindow *window in [[NSApplication sharedApplication] windows]) {
if ([window isKindOfClass:[NSOpenPanel class]]) {
[(NSOpenPanel *)window cancel:self];
}
}
self.consoleOutput.textContainerInset = NSMakeSize(4, 4); self.consoleOutput.textContainerInset = NSMakeSize(4, 4);
[self.view becomeFirstResponder]; [self.view becomeFirstResponder];
self.view.shouldBlendFrameWithPrevious = ![[NSUserDefaults standardUserDefaults] boolForKey:@"DisableFrameBlending"]; self.view.shouldBlendFrameWithPrevious = ![[NSUserDefaults standardUserDefaults] boolForKey:@"DisableFrameBlending"];