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,
selector:@selector(windowDidResignMain:)
name:NSWindowDidResignMainNotification
object:window];
// Register for Active Space change notifications.
[[[NSWorkspace sharedWorkspace] notificationCenter]
addObserver:self
selector:@selector(activeSpaceDidChange:)
name:NSWorkspaceActiveSpaceDidChangeNotification
object:nil];
}
- (void)exitFullscreenMode {
......@@ -265,6 +272,12 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler,
[self updateMenuBarAndDockVisibility];
}
- (void)activeSpaceDidChange:(NSNotification*)notification {
menubarFraction_ = kHideFraction;
menubarState_ = FullscreenMenubarState::HIDDEN;
[browserController_ layoutSubviews];
}
- (CGFloat)floatingBarVerticalOffset {
return kFloatingBarVerticalOffset;
}
......@@ -477,6 +490,10 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler,
if (![self isMouseOnScreen] && progress > menubarFraction_)
return;
// Ignore the menubarFraction changes if the Space is inactive.
if (![[browserController_ window] isOnActiveSpace])
return;
if (IsCGFloatEqual(progress, kShowFraction))
menubarState_ = FullscreenMenubarState::SHOWN;
else if (IsCGFloatEqual(progress, kHideFraction))
......@@ -635,6 +652,7 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler,
- (void)cleanup {
[self cancelAnimationAndTimer];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self];
[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