Commit 8a690e5e authored by spqchan's avatar spqchan Committed by Commit bot

[Mac] Fix for the fullscreen toolbar issue with Active Spaces

Made sure that the menubar state is correct when the active space is
changed

BUG=647111

Review-Url: https://codereview.chromium.org/2351283004
Cr-Commit-Position: refs/heads/master@{#420645}
parent 6087e041
...@@ -240,6 +240,13 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler, ...@@ -240,6 +240,13 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler,
selector:@selector(windowDidResignMain:) selector:@selector(windowDidResignMain:)
name:NSWindowDidResignMainNotification name:NSWindowDidResignMainNotification
object:window]; object:window];
// Register for Active Space change notifications.
[[[NSWorkspace sharedWorkspace] notificationCenter]
addObserver:self
selector:@selector(activeSpaceDidChange:)
name:NSWorkspaceActiveSpaceDidChangeNotification
object:nil];
} }
- (void)exitFullscreenMode { - (void)exitFullscreenMode {
...@@ -265,6 +272,12 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler, ...@@ -265,6 +272,12 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler,
[self updateMenuBarAndDockVisibility]; [self updateMenuBarAndDockVisibility];
} }
- (void)activeSpaceDidChange:(NSNotification*)notification {
menubarFraction_ = kHideFraction;
menubarState_ = FullscreenMenubarState::HIDDEN;
[browserController_ layoutSubviews];
}
- (CGFloat)floatingBarVerticalOffset { - (CGFloat)floatingBarVerticalOffset {
return kFloatingBarVerticalOffset; return kFloatingBarVerticalOffset;
} }
...@@ -477,6 +490,10 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler, ...@@ -477,6 +490,10 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler,
if (![self isMouseOnScreen] && progress > menubarFraction_) if (![self isMouseOnScreen] && progress > menubarFraction_)
return; return;
// Ignore the menubarFraction changes if the Space is inactive.
if (![[browserController_ window] isOnActiveSpace])
return;
if (IsCGFloatEqual(progress, kShowFraction)) if (IsCGFloatEqual(progress, kShowFraction))
menubarState_ = FullscreenMenubarState::SHOWN; menubarState_ = FullscreenMenubarState::SHOWN;
else if (IsCGFloatEqual(progress, kHideFraction)) else if (IsCGFloatEqual(progress, kHideFraction))
...@@ -635,6 +652,7 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler, ...@@ -635,6 +652,7 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler,
- (void)cleanup { - (void)cleanup {
[self cancelAnimationAndTimer]; [self cancelAnimationAndTimer];
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
[[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self];
[self removeTrackingAreaIfNecessary]; [self removeTrackingAreaIfNecessary];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment