diff --git a/src/MacVim/MMWindow.m b/src/MacVim/MMWindow.m index 05d3f4653a..d570c7833b 100644 --- a/src/MacVim/MMWindow.m +++ b/src/MacVim/MMWindow.m @@ -108,6 +108,14 @@ - (void)dealloc [super dealloc]; } +- (BOOL) canBecomeMainWindow { + return YES; +} + +- (BOOL) canBecomeKeyWindow { + return YES; +} + - (BOOL)hideTablineSeparator:(BOOL)hide { BOOL isHidden = [tablineSeparator isHidden]; @@ -227,4 +235,15 @@ - (IBAction)realToggleFullScreen:(id)sender #endif } +- (void)setToolbar:(NSToolbar *)toolbar +{ + if ([[NSUserDefaults standardUserDefaults] + boolForKey:MMNoTitleBarWindowKey]) { + // MacVim can't have toolbar with No title bar setting. + return; + } + + [super setToolbar:toolbar]; +} + @end // MMWindow diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m index ad46b95f5b..2faa2bd42d 100644 --- a/src/MacVim/MMWindowController.m +++ b/src/MacVim/MMWindowController.m @@ -130,6 +130,12 @@ - (id)initWithVimController:(MMVimController *)controller | NSMiniaturizableWindowMask | NSResizableWindowMask | NSUnifiedTitleAndToolbarWindowMask; + if ([[NSUserDefaults standardUserDefaults] + boolForKey:MMNoTitleBarWindowKey]) { + // No title bar setting + styleMask &= ~NSTitledWindowMask; + } + // Use textured background on Leopard or later (skip the 'if' on Tiger for // polished metal window). if ([[NSUserDefaults standardUserDefaults] boolForKey:MMTexturedWindowKey] diff --git a/src/MacVim/Miscellaneous.h b/src/MacVim/Miscellaneous.h index 52aaaea2ed..a8dbe98c50 100644 --- a/src/MacVim/Miscellaneous.h +++ b/src/MacVim/Miscellaneous.h @@ -37,6 +37,7 @@ extern NSString *MMTranslateCtrlClickKey; extern NSString *MMTopLeftPointKey; extern NSString *MMOpenInCurrentWindowKey; extern NSString *MMNoFontSubstitutionKey; +extern NSString *MMNoTitleBarWindowKey; extern NSString *MMLoginShellKey; extern NSString *MMUntitledWindowKey; extern NSString *MMTexturedWindowKey; diff --git a/src/MacVim/Miscellaneous.m b/src/MacVim/Miscellaneous.m index 9d719e49a4..48bf169c51 100644 --- a/src/MacVim/Miscellaneous.m +++ b/src/MacVim/Miscellaneous.m @@ -29,6 +29,7 @@ NSString *MMTopLeftPointKey = @"MMTopLeftPoint"; NSString *MMOpenInCurrentWindowKey = @"MMOpenInCurrentWindow"; NSString *MMNoFontSubstitutionKey = @"MMNoFontSubstitution"; +NSString *MMNoTitleBarWindowKey = @"MMNoTitleBarWindow"; NSString *MMLoginShellKey = @"MMLoginShell"; NSString *MMUntitledWindowKey = @"MMUntitledWindow"; NSString *MMTexturedWindowKey = @"MMTexturedWindow";