From 42732b20ebb1b7e6da84aea4fd4db11c5351b7fc Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sat, 7 Jun 2025 18:49:45 +0300 Subject: [PATCH] Restore Alt+Zoom behavior --- Cocoa/Document.xib | 2 +- Cocoa/GBWindow.h | 5 +++++ Cocoa/GBWindow.m | 22 ++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 Cocoa/GBWindow.h create mode 100644 Cocoa/GBWindow.m diff --git a/Cocoa/Document.xib b/Cocoa/Document.xib index 1f78d4a..1b93456 100644 --- a/Cocoa/Document.xib +++ b/Cocoa/Document.xib @@ -56,7 +56,7 @@ - + diff --git a/Cocoa/GBWindow.h b/Cocoa/GBWindow.h new file mode 100644 index 0000000..f391e07 --- /dev/null +++ b/Cocoa/GBWindow.h @@ -0,0 +1,5 @@ +#import + +@interface GBWindow : NSWindow + +@end diff --git a/Cocoa/GBWindow.m b/Cocoa/GBWindow.m new file mode 100644 index 0000000..4b4e273 --- /dev/null +++ b/Cocoa/GBWindow.m @@ -0,0 +1,22 @@ +#import "GBWindow.h" + +@interface NSWindow(private) +- (void)_zoomFill:(id)sender; +@end + +/* + For some reason, Apple replaced the alt + zoom button behavior to be "fill" rather than zoom. + I don't like that. It prevents SameBoy's integer scaling from working. Let's restore it. +*/ + +@implementation GBWindow +- (void)_zoomFill:(id)sender +{ + if (sender == [self standardWindowButton:NSWindowZoomButton] && + (self.currentEvent.modifierFlags & NSEventModifierFlagOption)) { + [self zoom:sender]; + return; + } + [super _zoomFill:sender]; +} +@end