Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed game window positions getting saved with the wrong frame if the…

…y were closed while in fullscreen mode.
  • Loading branch information...
commit 1429026830ffa8873c9cedfc8ebb5e9aa5b6ff27 1 parent ad72dec
@alunbestor authored
1  Boxer/BXDOSWindowController.h
@@ -44,6 +44,7 @@ extern NSString * const BXViewDidLiveResizeNotification;
NSSize currentScaledSize;
NSSize currentScaledResolution;
BOOL resizingProgrammatically;
+ BOOL windowIsClosing;
NSSize renderingViewSizeBeforeFullScreen;
NSString *autosaveNameBeforeFullScreen;
17 Boxer/BXDOSWindowController.m
@@ -554,7 +554,6 @@ - (NSRect) windowWillUseStandardFrame: (NSWindow *)theWindow defaultFrame: (NSRe
- (void) windowWillEnterFullScreen: (NSNotification *)notification
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center postNotificationName: BXSessionWillEnterFullScreenNotification object: [self document]];
@@ -604,8 +603,15 @@ - (void) windowDidExitFullScreen: (NSNotification *)notification
//Delete the old autosaved size before restoring the original
//autosave name. (This prevents Cocoa from resizing the window
//to match the old saved size as soon as we restore the autosave name.)
- [NSWindow removeFrameUsingName: [self autosaveNameBeforeFullScreen]];
- [[self window] setFrameAutosaveName: [self autosaveNameBeforeFullScreen]];
+ //FIX: this method will get called in Lion if the window closes while
+ //in fullscreen, in which case the frame will still be the fullscreen frame.
+ //Needless to say, we don't want to persist that frame in the user defaults.
+ if (!windowIsClosing)
+ {
+ [NSWindow removeFrameUsingName: [self autosaveNameBeforeFullScreen]];
+ [[self window] setFrameAutosaveName: [self autosaveNameBeforeFullScreen]];
+ }
//Force the renderer to redraw after the resize
[self _cleanUpAfterResize];
@@ -640,6 +646,11 @@ - (NSRect) window: (NSWindow *)window willReturnToFrame: (NSRect)frame
return newFrame;
+- (void) windowWillClose: (NSNotification *)notification
+ windowIsClosing = YES;
#pragma mark -
#pragma mark Drag-drop handlers
2  Boxer/BXDOSWindowControllerLion.m
@@ -31,6 +31,8 @@ - (void) windowDidLoad
- (void) windowWillClose: (NSNotification *)notification
+ [super windowWillClose: notification];
//Workaround for a Lion bug whereby if the window close button is triggered
//by a touch event that includes a resting touch, then the event system may
//try to send touchesCancelled: events to a now-deallocated view.
Please sign in to comment.
Something went wrong with that request. Please try again.