Skip to content
Snippets Groups Projects
Commit 4b606628 authored by George Nachman's avatar George Nachman
Browse files

Make dock and menu bar autohide in prelion fullscreen mode.

parent 21e8f5b5
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -44,6 +44,8 @@ static const int NSApplicationPresentationAutoHideToolbar = (1 << 11);
static const int NSApplicationPresentationFullScreen = (1 << 10);
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
static const int NSApplicationPresentationAutoHideDock = (1 << 0);
static const int NSApplicationPresentationAutoHideMenuBar = (1 << 2);
typedef unsigned int NSApplicationPresentationOptions;
#endif
 
Loading
Loading
Loading
Loading
@@ -200,7 +200,7 @@ NSString *sessionsKey = @"sessions";
// If you create a window with a minimize button and the menu bar is hidden then the
// minimize button is disabled. Currently the only window type with a miniaturize button
// is NORMAL.
[NSMenu setMenuBarVisible:YES];
[self showMenuBar];
}
// Force the nib to load
[self window];
Loading
Loading
@@ -394,14 +394,12 @@ NSString *sessionsKey = @"sessions";
object: nil];
 
[self setWindowInited: YES];
if (_fullScreen) {
[self hideMenuBar];
}
useTransparency_ = YES;
fullscreenTabs_ = [[NSUserDefaults standardUserDefaults] boolForKey:@"ShowFullScreenTabBar"];
number_ = [[iTermController sharedInstance] allocateWindowNumber];
if (windowType == WINDOW_TYPE_FORCE_FULL_SCREEN) {
windowType_ = WINDOW_TYPE_FULL_SCREEN;
[self hideMenuBar];
}
 
if (IsLionOrLater()) {
Loading
Loading
@@ -976,8 +974,10 @@ NSString *sessionsKey = @"sessions";
[tabBarControl setDelegate:nil];
 
[self disableBlur];
if (_fullScreen) {
[NSMenu setMenuBarVisible:YES];
// If a fullscreen window is closing, hide the menu bar unless it's only fullscreen because it's
// mid-toggle in which case it's really the window that's replacing us that is fullscreen.
if (_fullScreen && !togglingFullScreen_) {
[self showMenuBar];
}
 
// Save frame position for last window
Loading
Loading
@@ -1155,7 +1155,7 @@ NSString *sessionsKey = @"sessions";
__FILE__, __LINE__, aNotification);
 
if (_fullScreen) {
[NSMenu setMenuBarVisible:YES];
[self showMenuBar];
}
// update the cursor
[[[self currentSession] TEXTVIEW] refresh];
Loading
Loading
@@ -1389,7 +1389,7 @@ NSString *sessionsKey = @"sessions";
// shown. Thus, we must show the menu bar before creating the new window.
// It is not hidden in the other clause of this if statement because
// hiding the menu bar must be done after setting the window's frame.
[NSMenu setMenuBarVisible:YES];
[self showMenuBar];
PtyLog(@"toggleFullScreenMode - allocate new terminal");
// TODO: restore previous window type
NSScreen *currentScreen = [[[[iTermController sharedInstance] currentTerminal] window] screen];
Loading
Loading
@@ -3004,10 +3004,19 @@ NSString *sessionsKey = @"sessions";
currentScreen = [NSScreen mainScreen];
 
if (currentScreen == menubarScreen) {
[NSMenu setMenuBarVisible:NO];
int flags = NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar;
[[[iTermApplication sharedApplication] delegate] setFutureApplicationPresentationOptions:flags
unset:0];
}
}
 
- (void)showMenuBar
{
int flags = NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar;
[[[iTermApplication sharedApplication] delegate] setFutureApplicationPresentationOptions:0
unset:flags];
}
// Utility
+ (void)breakDown:(NSString *)cmdl cmdPath:(NSString **)cmd cmdArgs:(NSArray **)path
{
Loading
Loading
Loading
Loading
@@ -173,4 +173,8 @@ void DebugLog(NSString* value);
// a class method to provide the keys for KVC:
+(NSArray*)kvcKeys;
 
// Implements the 10.6 api but is callable in 10.5 and tries to implement
// some subset of the flags.
- (void)setFutureApplicationPresentationOptions:(int)flags unset:(int)antiflags;
@end
Loading
Loading
@@ -90,15 +90,20 @@ static BOOL hasBecomeActive = NO;
[ITAddressBookMgr sharedInstance];
[PreferencePanel sharedInstance];
 
[self setFutureApplicationPresentationOptions:NSApplicationPresentationFullScreen unset:0];
}
- (void)setFutureApplicationPresentationOptions:(int)flags unset:(int)antiflags
{
if ([NSApp respondsToSelector:@selector(presentationOptions)]) {
// This crazy hackery is done so that we can use 10.6 and 10.7 features
// while compiling against the 10.5 SDK.
 
// presentationOptions = [NSApp presentationOptions]
NSMethodSignature *presentationOptionsSignature = [NSApp->isa
instanceMethodSignatureForSelector:@selector(presentationOptions)];
instanceMethodSignatureForSelector:@selector(presentationOptions)];
NSInvocation *presentationOptionsInvocation = [NSInvocation
invocationWithMethodSignature:presentationOptionsSignature];
invocationWithMethodSignature:presentationOptionsSignature];
[presentationOptionsInvocation setTarget:NSApp];
[presentationOptionsInvocation setSelector:@selector(presentationOptions)];
[presentationOptionsInvocation invoke];
Loading
Loading
@@ -106,7 +111,8 @@ static BOOL hasBecomeActive = NO;
NSUInteger presentationOptions;
[presentationOptionsInvocation getReturnValue:&presentationOptions];
 
presentationOptions |= NSApplicationPresentationFullScreen;
presentationOptions |= flags;
presentationOptions &= ~antiflags;
 
// [NSAppObj setPresentationOptions:presentationOptions];
NSMethodSignature *setSig = [NSApp->isa instanceMethodSignatureForSelector:@selector(setPresentationOptions:)];
Loading
Loading
@@ -115,6 +121,14 @@ static BOOL hasBecomeActive = NO;
[setInv setSelector:@selector(setPresentationOptions:)];
[setInv setArgument:&presentationOptions atIndex:2];
[setInv invoke];
} else {
// Emulate setPresentationOptions API for OS 10.5.
if (flags & NSApplicationPresentationAutoHideMenuBar) {
SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar);
} else if (antiflags & NSApplicationPresentationAutoHideMenuBar) {
SetSystemUIMode(kUIModeNormal, 0);
}
}
}
 
Loading
Loading
Loading
Loading
@@ -1201,7 +1201,7 @@ static void RollOutHotkeyTerm(PseudoTerminal* term, BOOL itermWasActiveWhenHotke
if (currentTerm && ![currentTerm isHotKeyWindow] && [currentTerm fullScreen]) {
[currentTerm hideMenuBar];
} else {
[NSMenu setMenuBarVisible:YES];
[currentTerm showMenuBar];
}
}
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment