Skip to content

Commit 69f04b5

Browse files
committed
Simplify GLFWWindow.toggleFullScreen.
1 parent 213af23 commit 69f04b5

1 file changed

Lines changed: 4 additions & 23 deletions

File tree

src/cocoa_window.m

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -763,10 +763,7 @@ - (void)doCommandBySelector:(SEL)selector
763763
// GLFW window class
764764
//------------------------------------------------------------------------
765765

766-
@interface GLFWWindow : NSWindow {
767-
NSRect preFullScreenFrame;
768-
769-
}
766+
@interface GLFWWindow : NSWindow {}
770767
@end
771768

772769
@implementation GLFWWindow
@@ -782,25 +779,9 @@ - (BOOL)canBecomeMainWindow
782779
return YES;
783780
}
784781

785-
786-
- (void)toggleFullScreen:(id)sender {
787-
// NSLog(@"Custom resize handled instead of native fullscreen");
788-
NSScreen *screen = [NSScreen mainScreen];
789-
NSRect screenFrame = [screen visibleFrame];
790-
NSRect currentFrame = [self frame];
791-
792-
BOOL isCurrentlyFullscreen = NSEqualRects(currentFrame, screenFrame);
793-
794-
if (isCurrentlyFullscreen) {
795-
// Restore previous size only if we have a stored frame
796-
if (!NSEqualRects(preFullScreenFrame, NSZeroRect)) {
797-
[self setFrame:preFullScreenFrame display:YES animate:YES];
798-
preFullScreenFrame = NSZeroRect; // Reset
799-
}
800-
} else {
801-
preFullScreenFrame = currentFrame;
802-
[self setFrame:screenFrame display:YES animate:YES]; // Go fullscreen
803-
}
782+
- (void)toggleFullScreen:(id)sender
783+
{
784+
[self zoom:sender];
804785
}
805786

806787
@end

0 commit comments

Comments
 (0)