Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/MacVim/MMFullScreenWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ - (MMFullScreenWindow *)initWithWindow:(NSWindow *)t view:(MMVimView *)v
// you can't change the style of an existing window in cocoa. create a new
// window and move the MMTextView into it.
// (another way would be to make the existing window large enough that the
// title bar is off screen. but that doesn't work with multiple screens).
// title bar is off screen. but that doesn't work with multiple screens).
self = [super initWithContentRect:[screen frame]
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
Expand Down Expand Up @@ -371,6 +371,15 @@ - (void)applicationDidChangeScreenParameters:(NSNotification *)notification
[self resizeVimView];
}

- (CGFloat) viewOffset {
CGFloat menuBarHeight = 0;
if([self screen] != [[NSScreen screens] objectAtIndex:0]) {
// Screens other than the primary screen will not hide their menu bar, adjust the visible view down by the menu height
menuBarHeight = [[[NSApplication sharedApplication] mainMenu] menuBarHeight]-1;
}
return menuBarHeight;
}

- (void)centerView
{
NSRect outer = [self frame], inner = [view frame];
Expand All @@ -379,7 +388,7 @@ - (void)centerView
// rendering issues may arise (screen looks blurry, each redraw clears the
// entire window, etc.).
NSPoint origin = { floor((outer.size.width - inner.size.width)/2),
floor((outer.size.height - inner.size.height)/2) };
floor((outer.size.height - inner.size.height)/2 - [self viewOffset]/2) };

[view setFrameOrigin:origin];
}
Expand Down Expand Up @@ -478,6 +487,8 @@ - (void)resizeVimView
// size since it compensates for menu and dock.
int maxRows, maxColumns;
NSSize size = [[self screen] frame].size;
size.height -= [self viewOffset];

[view constrainRows:&maxRows columns:&maxColumns toSize:size];

// Compute current fu size
Expand Down