Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show buttons when entering fullscreen #62

Open
wants to merge 1 commit into
base: nw19
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ class NativeAppWindowCocoa : public extensions::NativeAppWindow,
// Called when the window enters fullscreen.
void WindowDidEnterFullscreen();

// Called when the window is about exits fullscreen.
void WindowWillExitFullscreen();

// Called when the window exits fullscreen.
void WindowDidExitFullscreen();

Expand Down
25 changes: 25 additions & 0 deletions chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ - (void)windowDidEnterFullScreen:(NSNotification*)notification {
appWindow_->WindowDidEnterFullscreen();
}

- (void)windowWillExitFullScreen:(NSNotification*)notification {
if (appWindow_)
appWindow_->WindowWillExitFullscreen();
}

- (void)windowDidExitFullScreen:(NSNotification*)notification {
if (appWindow_)
appWindow_->WindowDidExitFullscreen();
Expand Down Expand Up @@ -825,6 +830,26 @@ - (void)setMouseDownCanMoveWindow:(BOOL)can_move;
is_maximized_ = false;
is_fullscreen_ = true;
app_window_->OnNativeWindowChanged();

// #5651: show system buttons when entered fullscreen
if (!has_frame_) {
[[window() standardWindowButton:NSWindowZoomButton] setHidden:NO];
[[window() standardWindowButton:NSWindowMiniaturizeButton] setHidden:NO];
[[window() standardWindowButton:NSWindowCloseButton] setHidden:NO];
[[window() standardWindowButton:NSWindowZoomButton] setEnabled:YES];
}
}

void NativeAppWindowCocoa::WindowWillExitFullscreen() {
// #5651: and hide these buttons when about to exit fullscreen
// If doing this in WindowDidExitFullscreen, users will see the buttons
// disappear after restored to normal.
if (!has_frame_) {
[[window() standardWindowButton:NSWindowZoomButton] setHidden:YES];
[[window() standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES];
[[window() standardWindowButton:NSWindowCloseButton] setHidden:YES];
[[window() standardWindowButton:NSWindowZoomButton] setEnabled:NO];
}
}

void NativeAppWindowCocoa::WindowDidExitFullscreen() {
Expand Down