Fix the toolbar showing when titleBarStyle is hidden-inset
This commit is contained in:
parent
f53aabaef5
commit
13bfb099a2
2 changed files with 17 additions and 5 deletions
|
@ -91,6 +91,10 @@ class NativeWindowMac : public NativeWindow {
|
||||||
UpdateDraggableRegionViews(draggable_regions_);
|
UpdateDraggableRegionViews(draggable_regions_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the attribute of NSWindow while work around a bug of zoom button.
|
||||||
|
void SetStyleMask(bool on, NSUInteger flag);
|
||||||
|
void SetCollectionBehavior(bool on, NSUInteger flag);
|
||||||
|
|
||||||
bool should_hide_native_toolbar_in_fullscreen() const {
|
bool should_hide_native_toolbar_in_fullscreen() const {
|
||||||
return should_hide_native_toolbar_in_fullscreen_;
|
return should_hide_native_toolbar_in_fullscreen_;
|
||||||
}
|
}
|
||||||
|
@ -120,10 +124,6 @@ class NativeWindowMac : public NativeWindow {
|
||||||
// whehter we can drag.
|
// whehter we can drag.
|
||||||
void UpdateDraggableRegionViews(const std::vector<DraggableRegion>& regions);
|
void UpdateDraggableRegionViews(const std::vector<DraggableRegion>& regions);
|
||||||
|
|
||||||
// Set the attribute of NSWindow while work around a bug of zo0m button.
|
|
||||||
void SetStyleMask(bool on, NSUInteger flag);
|
|
||||||
void SetCollectionBehavior(bool on, NSUInteger flag);
|
|
||||||
|
|
||||||
base::scoped_nsobject<AtomNSWindow> window_;
|
base::scoped_nsobject<AtomNSWindow> window_;
|
||||||
base::scoped_nsobject<AtomNSWindowDelegate> window_delegate_;
|
base::scoped_nsobject<AtomNSWindowDelegate> window_delegate_;
|
||||||
|
|
||||||
|
|
|
@ -214,10 +214,22 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
[[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]);
|
[[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]);
|
||||||
[toolbar setShowsBaselineSeparator:NO];
|
[toolbar setShowsBaselineSeparator:NO];
|
||||||
[window setToolbar:toolbar];
|
[window setToolbar:toolbar];
|
||||||
|
|
||||||
|
// Set window style to hide the toolbar, otherwise the toolbar will show in
|
||||||
|
// fullscreen mode.
|
||||||
|
shell_->SetStyleMask(true, NSFullSizeContentViewWindowMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)windowWillExitFullScreen:(NSNotification*)notification {
|
||||||
|
// Turn off the style for toolbar.
|
||||||
|
if (shell_->should_hide_native_toolbar_in_fullscreen())
|
||||||
|
shell_->SetStyleMask(false, NSFullSizeContentViewWindowMask);
|
||||||
|
}
|
||||||
|
|
||||||
- (void)windowDidExitFullScreen:(NSNotification*)notification {
|
- (void)windowDidExitFullScreen:(NSNotification*)notification {
|
||||||
|
// For certain versions of OS X the fullscreen button will automatically show
|
||||||
|
// after exiting fullscreen mode.
|
||||||
if (!shell_->has_frame()) {
|
if (!shell_->has_frame()) {
|
||||||
NSWindow* window = shell_->GetNativeWindow();
|
NSWindow* window = shell_->GetNativeWindow();
|
||||||
[[window standardWindowButton:NSWindowFullScreenButton] setHidden:YES];
|
[[window standardWindowButton:NSWindowFullScreenButton] setHidden:YES];
|
||||||
|
@ -486,7 +498,7 @@ NativeWindowMac::NativeWindowMac(
|
||||||
[window_ setReleasedWhenClosed:NO];
|
[window_ setReleasedWhenClosed:NO];
|
||||||
|
|
||||||
// Hide the title bar.
|
// Hide the title bar.
|
||||||
if ((titleBarStyle == "hidden") || (titleBarStyle == "hidden-inset")) {
|
if (titleBarStyle == "hidden-inset") {
|
||||||
[window_ setTitlebarAppearsTransparent:YES];
|
[window_ setTitlebarAppearsTransparent:YES];
|
||||||
[window_ setTitleVisibility:NSWindowTitleHidden];
|
[window_ setTitleVisibility:NSWindowTitleHidden];
|
||||||
if (titleBarStyle == "hidden-inset") {
|
if (titleBarStyle == "hidden-inset") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue