Restore Alt+Zoom behavior

This commit is contained in:
Lior Halphon 2025-06-07 18:49:45 +03:00
parent f0a672c39e
commit 42732b20eb
3 changed files with 28 additions and 1 deletions

View File

@ -56,7 +56,7 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" tabbingMode="disallowed" id="xOd-HO-29H" userLabel="Window">
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" tabbingMode="disallowed" id="xOd-HO-29H" userLabel="Window" customClass="GBWindow">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowCollectionBehavior key="collectionBehavior" fullScreenPrimary="YES"/>
<rect key="contentRect" x="0.0" y="0.0" width="160" height="144"/>

5
Cocoa/GBWindow.h Normal file
View File

@ -0,0 +1,5 @@
#import <Cocoa/Cocoa.h>
@interface GBWindow : NSWindow
@end

22
Cocoa/GBWindow.m Normal file
View File

@ -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