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

fix: fullscreen crashing with no roundedCorners and no frame #39795

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions shell/browser/native_window_mac.mm
Expand Up @@ -689,9 +689,6 @@ void ReorderChildWindowAbove(NSWindow* child_window, NSWindow* other_window) {
}

void NativeWindowMac::SetFullScreen(bool fullscreen) {
if (!has_frame() && !HasStyleMask(NSWindowStyleMaskTitled))
return;

// [NSWindow -toggleFullScreen] is an asynchronous operation, which means
// that it's possible to call it while a fullscreen transition is currently
// in process. This can create weird behavior (incl. phantom windows),
Expand Down Expand Up @@ -724,7 +721,8 @@ void ReorderChildWindowAbove(NSWindow* child_window, NSWindow* other_window) {
? FullScreenTransitionState::kEntering
: FullScreenTransitionState::kExiting;

[window_ toggleFullScreenMode:nil];
if (![window_ toggleFullScreenMode:nil])
fullscreen_transition_state_ = FullScreenTransitionState::kNone;
}

bool NativeWindowMac::IsFullscreen() const {
Expand Down
2 changes: 1 addition & 1 deletion shell/browser/ui/cocoa/electron_ns_window.h
Expand Up @@ -44,7 +44,7 @@ class ScopedDisableResize {
- (electron::NativeWindowMac*)shell;
- (id)accessibilityFocusedUIElement;
- (NSRect)originalContentRectForFrameRect:(NSRect)frameRect;
- (void)toggleFullScreenMode:(id)sender;
- (BOOL)toggleFullScreenMode:(id)sender;
- (NSImage*)_cornerMask;
@end

Expand Down
7 changes: 6 additions & 1 deletion shell/browser/ui/cocoa/electron_ns_window.mm
Expand Up @@ -334,7 +334,10 @@ - (void)performClose:(id)sender {
}
}

- (void)toggleFullScreenMode:(id)sender {
- (BOOL)toggleFullScreenMode:(id)sender {
if (!shell_->has_frame() && !shell_->HasStyleMask(NSWindowStyleMaskTitled))
return NO;

bool is_simple_fs = shell_->IsSimpleFullScreen();
bool always_simple_fs = shell_->always_simple_fullscreen();

Expand Down Expand Up @@ -363,6 +366,8 @@ - (void)toggleFullScreenMode:(id)sender {
bool maximizable = shell_->IsMaximizable();
shell_->SetMaximizable(maximizable);
}

return YES;
}

- (void)performMiniaturize:(id)sender {
Expand Down