Skip to content

Commit 11bd9b9

Browse files
committed
Merge pull request #111 from macvim-dev/feature/no_title_bar_window
MMNoTitleBarWindowKey for hiding titlebar
2 parents f583b11 + fb26de7 commit 11bd9b9

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

src/MacVim/MMWindow.m

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ - (void)dealloc
108108
[super dealloc];
109109
}
110110

111+
- (BOOL) canBecomeMainWindow {
112+
return YES;
113+
}
114+
115+
- (BOOL) canBecomeKeyWindow {
116+
return YES;
117+
}
118+
111119
- (BOOL)hideTablineSeparator:(BOOL)hide
112120
{
113121
BOOL isHidden = [tablineSeparator isHidden];
@@ -227,4 +235,15 @@ - (IBAction)realToggleFullScreen:(id)sender
227235
#endif
228236
}
229237

238+
- (void)setToolbar:(NSToolbar *)toolbar
239+
{
240+
if ([[NSUserDefaults standardUserDefaults]
241+
boolForKey:MMNoTitleBarWindowKey]) {
242+
// MacVim can't have toolbar with No title bar setting.
243+
return;
244+
}
245+
246+
[super setToolbar:toolbar];
247+
}
248+
230249
@end // MMWindow

src/MacVim/MMWindowController.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ - (id)initWithVimController:(MMVimController *)controller
130130
| NSMiniaturizableWindowMask | NSResizableWindowMask
131131
| NSUnifiedTitleAndToolbarWindowMask;
132132

133+
if ([[NSUserDefaults standardUserDefaults]
134+
boolForKey:MMNoTitleBarWindowKey]) {
135+
// No title bar setting
136+
styleMask &= ~NSTitledWindowMask;
137+
}
138+
133139
// Use textured background on Leopard or later (skip the 'if' on Tiger for
134140
// polished metal window).
135141
if ([[NSUserDefaults standardUserDefaults] boolForKey:MMTexturedWindowKey]

src/MacVim/Miscellaneous.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ extern NSString *MMTranslateCtrlClickKey;
3737
extern NSString *MMTopLeftPointKey;
3838
extern NSString *MMOpenInCurrentWindowKey;
3939
extern NSString *MMNoFontSubstitutionKey;
40+
extern NSString *MMNoTitleBarWindowKey;
4041
extern NSString *MMLoginShellKey;
4142
extern NSString *MMUntitledWindowKey;
4243
extern NSString *MMTexturedWindowKey;

src/MacVim/Miscellaneous.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
NSString *MMTopLeftPointKey = @"MMTopLeftPoint";
3030
NSString *MMOpenInCurrentWindowKey = @"MMOpenInCurrentWindow";
3131
NSString *MMNoFontSubstitutionKey = @"MMNoFontSubstitution";
32+
NSString *MMNoTitleBarWindowKey = @"MMNoTitleBarWindow";
3233
NSString *MMLoginShellKey = @"MMLoginShell";
3334
NSString *MMUntitledWindowKey = @"MMUntitledWindow";
3435
NSString *MMTexturedWindowKey = @"MMTexturedWindow";

0 commit comments

Comments
 (0)