git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 42732b20ebb1b7e6da84aea4fd4db11c5351b7fc
parent f0a672c39e2cb32f48cd9523fb62a39f3b2317c0
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Sat,  7 Jun 2025 18:49:45 +0300

Restore Alt+Zoom behavior

Diffstat:
MCocoa/Document.xib2+-
ACocoa/GBWindow.h5+++++
ACocoa/GBWindow.m22++++++++++++++++++++++
3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/Cocoa/Document.xib b/Cocoa/Document.xib @@ -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"/> diff --git a/Cocoa/GBWindow.h b/Cocoa/GBWindow.h @@ -0,0 +1,5 @@ +#import <Cocoa/Cocoa.h> + +@interface GBWindow : NSWindow + +@end diff --git a/Cocoa/GBWindow.m 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

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.