From 642b009ec95bcac660de8e99541dbfafb0219288 Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Wed, 6 Feb 2013 14:50:04 +0100 Subject: [PATCH] Add to existing content view instead of replacing it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The window border drawing seems to be done by the root content view so it’s best to keep it around (as it may also do other things that we are unaware of). --- Frameworks/DocumentWindow/src/DocumentController.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Frameworks/DocumentWindow/src/DocumentController.mm b/Frameworks/DocumentWindow/src/DocumentController.mm index 77b54a19..ba7fb671 100644 --- a/Frameworks/DocumentWindow/src/DocumentController.mm +++ b/Frameworks/DocumentWindow/src/DocumentController.mm @@ -254,7 +254,6 @@ namespace self.window = [[NSWindow alloc] initWithContentRect:NSZeroRect styleMask:(NSTitledWindowMask|NSClosableWindowMask|NSResizableWindowMask|NSMiniaturizableWindowMask|NSTexturedBackgroundWindowMask) backing:NSBackingStoreBuffered defer:NO]; self.window.autorecalculatesKeyViewLoop = YES; self.window.collectionBehavior = NSWindowCollectionBehaviorFullScreenPrimary; - self.window.contentView = self.layoutView; self.window.delegate = self; self.window.releasedWhenClosed = NO; [self.window setContentBorderThickness:0 forEdge:NSMaxYEdge]; // top border @@ -262,6 +261,11 @@ namespace [self.window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge]; [self.window setAutorecalculatesContentBorderThickness:NO forEdge:NSMinYEdge]; + [self.layoutView setTranslatesAutoresizingMaskIntoConstraints:NO]; + [self.window.contentView addSubview:self.layoutView]; + [self.window.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[view]|" options:0 metrics:nil views:@{ @"view" : self.layoutView }]]; + [self.window.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[view]|" options:0 metrics:nil views:@{ @"view" : self.layoutView }]]; + [OakWindowFrameHelper windowFrameHelperWithWindow:self.window]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDefaultsDidChange:) name:NSUserDefaultsDidChangeNotification object:[NSUserDefaults standardUserDefaults]];