Merge branch 'master' of github.com:OoliteProject/oolite

This commit is contained in:
cim 2013-06-13 22:35:26 +01:00
commit 489d50754d
19 changed files with 63 additions and 1079 deletions

@ -1 +1 @@
Subproject commit 06326070677be965a84b1ecf4062db0430c9abf6
Subproject commit c63e20de5341f5b59cbe55fce2e295b0344cc0e3

View File

@ -505,8 +505,6 @@
1A7B967F0E620C9E00322821 /* OOSoundInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7B967E0E620C9E00322821 /* OOSoundInternal.h */; };
1A7BA8830D843485003C6CA3 /* ShipEntityScriptMethods.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7BA80B0D84231A003C6CA3 /* ShipEntityScriptMethods.h */; };
1A7BA8840D843485003C6CA3 /* ShipEntityScriptMethods.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7BA80C0D84231A003C6CA3 /* ShipEntityScriptMethods.m */; };
1A7BF96E15D7FE6A008DEB7F /* OOMacLegacyFullScreenController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7BF96C15D7FE6A008DEB7F /* OOMacLegacyFullScreenController.h */; };
1A7BF96F15D7FE6A008DEB7F /* OOMacLegacyFullScreenController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7BF96D15D7FE6A008DEB7F /* OOMacLegacyFullScreenController.m */; };
1A7C27CA14FA70A500F2D2A8 /* shader-uniform-bindings.plist in Copy Config */ = {isa = PBXBuildFile; fileRef = 1A7C27C814FA709500F2D2A8 /* shader-uniform-bindings.plist */; };
1A7C75C30CC39EC3005D0AA2 /* OOJSSun.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7C75980CC39D11005D0AA2 /* OOJSSun.m */; };
1A7C75C50CC39EC9005D0AA2 /* OOJSSun.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7C75990CC39D11005D0AA2 /* OOJSSun.h */; };
@ -772,6 +770,13 @@
remoteGlobalIDString = 8D5B49B6048680CD000E48DA;
remoteInfo = "Oolite-docktile";
};
1A1BB8A31767DD3500050283 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1AB2D61C15B86EA400177AAF /* OoliteUnitTests.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 1A0CD53615AF0BCE00970505;
remoteInfo = OoliteUnitTests;
};
1A3E019511C574AC000FF226 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1A3E018E11C574AC000FF226 /* Oolite-importer.xcodeproj */;
@ -828,13 +833,6 @@
remoteGlobalIDString = 8D5B49B6048680CD000E48DA;
remoteInfo = DebugOXP;
};
1AB2D62315B86EA500177AAF /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1AB2D61C15B86EA400177AAF /* OoliteUnitTests.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 1A0CD53615AF0BCE00970505;
remoteInfo = OoliteUnitTests;
};
1AB7760112CA2E53001478BB /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1AB775FC12CA2E53001478BB /* libjs.xcodeproj */;
@ -1793,8 +1791,6 @@
1A7B967E0E620C9E00322821 /* OOSoundInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOSoundInternal.h; sourceTree = "<group>"; };
1A7BA80B0D84231A003C6CA3 /* ShipEntityScriptMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShipEntityScriptMethods.h; sourceTree = "<group>"; };
1A7BA80C0D84231A003C6CA3 /* ShipEntityScriptMethods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShipEntityScriptMethods.m; sourceTree = "<group>"; };
1A7BF96C15D7FE6A008DEB7F /* OOMacLegacyFullScreenController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOMacLegacyFullScreenController.h; sourceTree = "<group>"; };
1A7BF96D15D7FE6A008DEB7F /* OOMacLegacyFullScreenController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOMacLegacyFullScreenController.m; sourceTree = "<group>"; };
1A7C27C814FA709500F2D2A8 /* shader-uniform-bindings.plist */ = {isa = PBXFileReference; explicitFileType = text; path = "shader-uniform-bindings.plist"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.simpleColoring; };
1A7C75980CC39D11005D0AA2 /* OOJSSun.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOJSSun.m; sourceTree = "<group>"; };
1A7C75990CC39D11005D0AA2 /* OOJSSun.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOJSSun.h; sourceTree = "<group>"; };
@ -1905,7 +1901,7 @@
1AB2AAF80C4CE0CC0008CF4E /* OOOXPVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOOXPVerifier.h; sourceTree = "<group>"; };
1AB2AAF90C4CE0CC0008CF4E /* OOOXPVerifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOOXPVerifier.m; sourceTree = "<group>"; };
1AB2AB120C4CE4070008CF4E /* verifyOXP.plist */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; name = verifyOXP.plist; path = ../../../Resources/Config/verifyOXP.plist; sourceTree = "<group>"; };
1AB2D61C15B86EA400177AAF /* OoliteUnitTests.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = OoliteUnitTests.xcodeproj; path = tests/OCUnitTests/OoliteUnitTests.xcodeproj; sourceTree = "<group>"; };
1AB2D61C15B86EA400177AAF /* OoliteUnitTests.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = OoliteUnitTests.xcodeproj; path = "Mac-specific/OCUnitTests/OoliteUnitTests.xcodeproj"; sourceTree = "<group>"; };
1AB4AEB60D688AD9003076D6 /* OOLogHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOLogHeader.h; sourceTree = "<group>"; };
1AB4AEB70D688AD9003076D6 /* OOLogHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOLogHeader.m; sourceTree = "<group>"; };
1AB5E1ED12BD628500C334DD /* OOJoystickManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOJoystickManager.h; sourceTree = "<group>"; };
@ -2152,6 +2148,14 @@
name = Products;
sourceTree = "<group>";
};
1A1BB8A01767DD3500050283 /* Products */ = {
isa = PBXGroup;
children = (
1A1BB8A41767DD3500050283 /* OoliteUnitTests.octest */,
);
name = Products;
sourceTree = "<group>";
};
1A2314300B9C667F00EF0852 /* Resources */ = {
isa = PBXGroup;
children = (
@ -2898,8 +2902,6 @@
1A033FB713268ABB006F9DB7 /* OOPDFView.m */,
1A54115914B8913E00B8A4BE /* OOMacJoystickManager.h */,
1A54115A14B8913E00B8A4BE /* OOMacJoystickManager.m */,
1A7BF96C15D7FE6A008DEB7F /* OOMacLegacyFullScreenController.h */,
1A7BF96D15D7FE6A008DEB7F /* OOMacLegacyFullScreenController.m */,
1A9FCF2115DAC8E100E965D5 /* OOMacSnowLeopardFullScreenController.h */,
1A9FCF2215DAC8E100E965D5 /* OOMacSnowLeopardFullScreenController.m */,
1A72F86715E14F1100281337 /* OOMacSystemStandardFullScreenController.h */,
@ -3203,14 +3205,6 @@
path = OXPVerifier;
sourceTree = "<group>";
};
1AB2D61D15B86EA400177AAF /* Products */ = {
isa = PBXGroup;
children = (
1AB2D62415B86EA500177AAF /* OoliteUnitTests.octest */,
);
name = Products;
sourceTree = "<group>";
};
1AB775FD12CA2E53001478BB /* Products */ = {
isa = PBXGroup;
children = (
@ -3568,7 +3562,6 @@
1ABA416215ADAB8D00F7E841 /* OOJSDock.h in Headers */,
1AF4AF4A15B858AA009243BE /* OOWeakSet.h in Headers */,
1AE1A94115D2C4E4003F4D56 /* OOFullScreenController.h in Headers */,
1A7BF96E15D7FE6A008DEB7F /* OOMacLegacyFullScreenController.h in Headers */,
1A9FCF2315DAC8E100E965D5 /* OOMacSnowLeopardFullScreenController.h in Headers */,
1A97528F15DECA6600108FA5 /* OOFullScreenWindow.h in Headers */,
1A72F86515E002E200281337 /* OOMouseInteractionMode.h in Headers */,
@ -3669,7 +3662,7 @@
ProjectRef = 1A3E018E11C574AC000FF226 /* Oolite-importer.xcodeproj */;
},
{
ProductGroup = 1AB2D61D15B86EA400177AAF /* Products */;
ProductGroup = 1A1BB8A01767DD3500050283 /* Products */;
ProjectRef = 1AB2D61C15B86EA400177AAF /* OoliteUnitTests.xcodeproj */;
},
{
@ -3693,6 +3686,13 @@
remoteRef = 1A01BCE611C569DF0011197F /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
1A1BB8A41767DD3500050283 /* OoliteUnitTests.octest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = OoliteUnitTests.octest;
remoteRef = 1A1BB8A31767DD3500050283 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
1A3E019611C574AC000FF226 /* Oolite.mdimporter */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
@ -3728,13 +3728,6 @@
remoteRef = 1A8FAA9D12F0E44D008FF5A2 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
1AB2D62415B86EA500177AAF /* OoliteUnitTests.octest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = OoliteUnitTests.octest;
remoteRef = 1AB2D62315B86EA500177AAF /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
1AB7760212CA2E53001478BB /* libjs_for_oolite.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@ -4044,7 +4037,6 @@
1ABA416315ADAB8D00F7E841 /* OOJSDock.m in Sources */,
1AF4AF4B15B858AA009243BE /* OOWeakSet.m in Sources */,
1AE1A94215D2C4E4003F4D56 /* OOFullScreenController.m in Sources */,
1A7BF96F15D7FE6A008DEB7F /* OOMacLegacyFullScreenController.m in Sources */,
1A9FCF2415DAC8E100E965D5 /* OOMacSnowLeopardFullScreenController.m in Sources */,
1A9FCF2615DAC9BC00E965D5 /* GameController+FullScreen.m in Sources */,
1A97529015DECA6600108FA5 /* OOFullScreenWindow.m in Sources */,

View File

@ -49,7 +49,7 @@
BlueprintIdentifier = "1A0CD53515AF0BCE00970505"
BuildableName = "OoliteUnitTests.octest"
BlueprintName = "OoliteUnitTests"
ReferencedContainer = "container:tests/OCUnitTests/OoliteUnitTests.xcodeproj">
ReferencedContainer = "container:Mac-specific/OCUnitTests/OoliteUnitTests.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>

View File

@ -63,7 +63,7 @@
BlueprintIdentifier = "1A0CD53515AF0BCE00970505"
BuildableName = "OoliteUnitTests.octest"
BlueprintName = "OoliteUnitTests"
ReferencedContainer = "container:tests/OCUnitTests/OoliteUnitTests.xcodeproj">
ReferencedContainer = "container:Mac-specific/OCUnitTests/OoliteUnitTests.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>

View File

@ -63,7 +63,7 @@
BlueprintIdentifier = "1A0CD53515AF0BCE00970505"
BuildableName = "OoliteUnitTests.octest"
BlueprintName = "OoliteUnitTests"
ReferencedContainer = "container:tests/OCUnitTests/OoliteUnitTests.xcodeproj">
ReferencedContainer = "container:Mac-specific/OCUnitTests/OoliteUnitTests.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>

View File

@ -59,15 +59,6 @@ static void UnapplyCursorState(OOMouseInteractionMode mode);
@end
#if !OOLITE_MAC_OS_X_10_6
@interface NSResponder (SnowLeopard)
- (void) setAcceptsTouchEvents:(BOOL)value;
@end
#endif
#if !OOLITE_MAC_OS_X_10_7
@interface NSView (Lion)

View File

@ -1,80 +0,0 @@
/*
OOMacLegacyFullScreenController.h
Full-screen controller used in 32-bit Mac builds.
Oolite
Copyright (C) 2004-2013 Giles C Williams and contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
*/
#import "OOFullScreenController.h"
#if OOLITE_MAC_OS_X && !OOLITE_64_BIT
#define OO_MAC_USE_LEGACY_FULL_SCREEN 1
@protocol OOMacLegacyFullScreenControllerDelegate;
@interface OOMacLegacyFullScreenController: OOFullScreenController
{
@private
id <OOMacLegacyFullScreenControllerDelegate> _delegate;
NSMutableArray *_displayModes;
NSUInteger _width, _height;
NSUInteger _refresh;
NSDictionary *_originalDisplayMode;
NSDictionary *_fullScreenDisplayMode;
NSOpenGLContext *_fullScreenContext;
NSUInteger _state;
bool _stayInFullScreenMode;
bool _callSuspendAction;
bool _switchRez;
bool _cursorHidden;
}
@property (nonatomic, assign) id <OOMacLegacyFullScreenControllerDelegate> delegate;
// The legacy full screen controller takes over event dispatch. Delegate's -handleFullScreenFrameTick is called each frame.
- (void) runFullScreenModalEventLoop;
// Suspend full screen mode at the end of the event loop and call delegate's -handleFullScreenSuspendedAction.
- (void) suspendFullScreen;
@end
@protocol OOMacLegacyFullScreenControllerDelegate
// Note: unlike standard delegate pattern, these are required.
- (void) handleFullScreenSuspendedAction;
- (void) handleFullScreenFrameTick;
- (void) scheduleFullScreenModeRestart;
@end
#endif

View File

@ -1,715 +0,0 @@
/*
OOMacLegacyFullScreenController.m
Oolite
Copyright (C) 2004-2013 Giles C Williams and contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
*/
#import "OOMacLegacyFullScreenController.h"
#if OOLITE_MAC_OS_X && !OOLITE_64_BIT
#import "GameController.h"
#import "OOCollectionExtractors.h"
#import "MyOpenGLView.h"
#import "Universe.h"
/* OS X apps are permitted to assume 800x600 screens. Under OS X, we always
start up in windowed mode. Therefore, the default size fits an 800x600
screen and leaves space for the menu bar and title bar.
*/
#define DISPLAY_DEFAULT_WIDTH 800
#define DISPLAY_DEFAULT_HEIGHT 540
#define DISPLAY_DEFAULT_REFRESH 75
enum
{
kStateNotFullScreen, // self.fullScreen = NO
kStateNominallyFullScreen, // self.fullScreen = YES, but not in runFullScreenModalEventLoop
kStateActuallyFullScreen
};
/*
To ensure the state manager's notion of GL state remains consistent, we
need to switch to the same state in each context when changing to and from
full screen mode. It doesn't matter very much which one we use.
*/
#define kFullScreenTransitonOpenGLState OPENGL_STATE_OPAQUE
static NSComparisonResult CompareDisplayModes(id arg1, id arg2, void *context);
@interface OOMacLegacyFullScreenController ()
@property (nonatomic, copy) NSDictionary *fullScreenDisplayMode;
@property (nonatomic, copy) NSDictionary *originalDisplayMode;
@property (nonatomic, retain) NSOpenGLContext *fullScreenContext;
- (void) beginFullScreenMode;
- (void) runFullScreenModalEventLoopInner;
- (void) recenterCursor;
- (void) hideCursor;
- (void) showCursor;
@end
@implementation OOMacLegacyFullScreenController
@synthesize delegate = _delegate;
@synthesize fullScreenDisplayMode = _fullScreenDisplayMode;
@synthesize originalDisplayMode = _originalDisplayMode;
@synthesize fullScreenContext = _fullScreenContext;
- (id) initWithGameView:(MyOpenGLView *)view
{
if ((self = [super initWithGameView:view]))
{
NSArray *modes = nil;
NSDictionary *mode = nil, *mode2 = nil;
NSUInteger modeWidth, modeHeight, color;
NSUInteger modeWidth2, modeHeight2, color2;
bool stretched, stretched2, interlaced, interlaced2;
float modeRefresh, modeRefresh2;
bool deleteFirst;
// Initial settings are current settings of screen.
NSDictionary *currentMode = (NSDictionary *)CGDisplayCurrentMode(kCGDirectMainDisplay);
_width = [currentMode oo_unsignedIntegerForKey:kOODisplayWidth];
_height = [currentMode oo_unsignedIntegerForKey:kOODisplayHeight];
_refresh = [currentMode oo_unsignedIntegerForKey:kOODisplayRefreshRate];
// Get the list of all available modes
modes = (NSArray *)CGDisplayAvailableModes(kCGDirectMainDisplay);
// Filter out modes that we don't want
_displayModes = [[NSMutableArray alloc] init];
for (mode in modes)
{
modeWidth = [mode oo_unsignedIntForKey:kOODisplayWidth];
modeHeight = [mode oo_unsignedIntForKey:kOODisplayHeight];
color = [mode oo_unsignedIntForKey:kOODisplayBitsPerPixel];
if (color < DISPLAY_MIN_COLOURS ||
modeWidth < DISPLAY_MIN_WIDTH ||
modeWidth > DISPLAY_MAX_WIDTH ||
modeHeight < DISPLAY_MIN_HEIGHT ||
modeHeight > DISPLAY_MAX_HEIGHT)
{
continue;
}
[_displayModes addObject:mode];
}
// Sort the filtered modes
[_displayModes sortUsingFunction:CompareDisplayModes context:NULL];
// ***JESTER_START*** 11/08/04
// Powerbooks return several "identical modes" CGDisplayAvailableModes doesn't appear
// to pick up refresh rates. Logged as Radar 3759831.
// In order to deal with this, we'll just edit out the duplicates.
/*
Bug 011893: restoring old display filtering code because my previous
assumption that using a set would filter out "duplicates" was broken.
The modes in question are not actually duplicates. For instance,
stretched modes look like "duplicates" from Oolite's perspective. The
Right Thing is to handle stretched modes properly. Also, the bug that
having "duplicates" causes (bad behaviour in config screen, see bug
011893) is really down to not tracking the selected display mode index
explictly.
Basically, this needs redoing, but shouldn't hold up 1.70.
-- Ahruman
*/
NSUInteger modeIndex, mode2Index;
for (modeIndex = 0; modeIndex + 1 < [_displayModes count]; modeIndex++)
{
mode = [_displayModes objectAtIndex:modeIndex];
modeWidth = [mode oo_unsignedIntForKey:kOODisplayWidth];
modeHeight = [mode oo_unsignedIntForKey:kOODisplayHeight];
modeRefresh = [mode oo_floatForKey:kOODisplayRefreshRate];
color = [mode oo_unsignedIntForKey:kOODisplayBitsPerPixel];
stretched = [mode oo_boolForKey:(NSString *)kCGDisplayModeIsStretched];
interlaced = [mode oo_boolForKey:(NSString *)kCGDisplayModeIsInterlaced];
for (mode2Index = modeIndex + 1; mode2Index < [_displayModes count]; ++mode2Index)
{
mode2 = [_displayModes objectAtIndex:mode2Index];
modeWidth2 = [mode2 oo_unsignedIntForKey:kOODisplayWidth];
modeHeight2 = [mode2 oo_unsignedIntForKey:kOODisplayHeight];
modeRefresh2 = [mode2 oo_floatForKey:kOODisplayRefreshRate];
color2 = [mode oo_unsignedIntForKey:kOODisplayBitsPerPixel];
stretched2 = [mode2 oo_boolForKey:(NSString *)kCGDisplayModeIsStretched];
interlaced2 = [mode2 oo_boolForKey:(NSString *)kCGDisplayModeIsInterlaced];
if (modeWidth == modeWidth2 &&
modeHeight == modeHeight2 &&
modeRefresh == modeRefresh2)
{
/* Modes are "duplicates" from Oolite's perspective, so one
needs to be removed. If one has higher colour depth, use
that one. Otherwise, If one is stretched and the other
isn't, remove the stretched one. Otherwise, if one is
interlaced and the other isn't, remove the interlaced one.
Otherwise, remove the one that comes later in the list.
*/
deleteFirst = false;
if (color < color2) deleteFirst = true;
else if (color == color2)
{
if (stretched && !stretched2) deleteFirst = true;
else if (stretched == stretched2)
{
if (interlaced && !interlaced2) deleteFirst = true;
}
}
if (deleteFirst)
{
[_displayModes removeObjectAtIndex:modeIndex];
modeIndex--;
break;
}
else
{
[_displayModes removeObjectAtIndex:mode2Index];
mode2Index--;
}
}
}
}
if ([_displayModes count] == 0)
{
[NSException raise:@"OoliteNoDisplayModes"
format:@"No acceptable display modes could be found!"];
}
self.fullScreenDisplayMode = [self findDisplayModeForWidth:_width height:_height refreshRate:_refresh];
if (self.fullScreenDisplayMode == nil)
{
// set full screen mode to first available mode
self.fullScreenDisplayMode = [_displayModes objectAtIndex:0];
_width = [self.fullScreenDisplayMode oo_unsignedIntegerForKey:kOODisplayWidth];
_height = [self.fullScreenDisplayMode oo_unsignedIntegerForKey:kOODisplayHeight];
_refresh = [self.fullScreenDisplayMode oo_unsignedIntegerForKey:kOODisplayRefreshRate];
}
}
return self;
}
- (void) dealloc
{
DESTROY(_displayModes);
DESTROY(_originalDisplayMode);
DESTROY(_fullScreenDisplayMode);
DESTROY(_fullScreenContext);
[super dealloc];
}
- (BOOL) inFullScreenMode
{
return _state != kStateNotFullScreen;
}
- (NSString *) stateString
{
// TEMP - for display.macLegacy (Also, there's a temp display.macLegacy in logcontrol.plist)
NSString *result = nil;
switch (_state)
{
case kStateNotFullScreen: result = @"kStateNotFullScreen"; break;
case kStateNominallyFullScreen: result = @"kStateNominallyFullScreen"; break;
case kStateActuallyFullScreen: result = @"kStateActuallyFullScreen"; break;
}
if (result == nil) result = [NSString stringWithFormat:@"<unknown state %i>", _state];
if (_stayInFullScreenMode) result = [result stringByAppendingString:@", stayInFullScreenMode"];
if (_callSuspendAction) result = [result stringByAppendingString:@", callSuspendAction"];
if (_switchRez) result = [result stringByAppendingString:@", switchRez"];
if (_cursorHidden) result = [result stringByAppendingString:@", cursorHidden"];
return result;
}
- (void) setFullScreenMode:(BOOL)value
{
OODebugLog(@"display.macLegacy.state", @"-setFullScreenMode:%@ called in state %@.", value ? @"YES" : @"NO", self.stateString);
OOLogIndentIf(@"display.macLegacy");
if (!value && self.fullScreenMode)
{
OODebugLog(@"display.macLegacy.state", @"Should switch FROM full screen mode; _stayInFullScreenMode set to NO.");
_stayInFullScreenMode = false;
}
else if (value && !self.fullScreenMode)
{
OODebugLog(@"display.macLegacy.state", @"Should switch TO full screen mode; calling -beginFullScreenMode.");
OOLogIndentIf(@"display.macLegacy");
[self beginFullScreenMode];
OOLogOutdentIf(@"display.macLegacy");
}
OOLogOutdentIf(@"display.macLegacy");
}
- (NSArray *) displayModes
{
return [NSArray arrayWithArray:_displayModes];
}
- (NSUInteger) indexOfCurrentDisplayMode
{
NSDictionary *mode = [self findDisplayModeForWidth:_width height:_height refreshRate:_refresh];
if (mode == nil) return NSNotFound;
else return [_displayModes indexOfObject:mode];
}
- (BOOL) setDisplayWidth:(NSUInteger)width height:(NSUInteger)height refreshRate:(NSUInteger)refresh
{
OODebugLog(@"display.macLegacy.state", @"%@ called in state %@.", NSStringFromSelector(_cmd), self.stateString);
NSDictionary *mode = [self findDisplayModeForWidth:width height:height refreshRate:refresh];
if (mode != nil)
{
_width = width;
_height = height;
_refresh = refresh;
self.fullScreenDisplayMode = mode;
if (self.fullScreenMode)
{
// Trigger mode switch.
_stayInFullScreenMode = false;
_switchRez = true;
}
return YES;
}
return NO;
}
- (NSDictionary *) findDisplayModeForWidth:(NSUInteger)width height:(NSUInteger)height refreshRate:(NSUInteger)refresh
{
OODebugLog(@"display.macLegacy.state", @"%@ called in state %@.", NSStringFromSelector(_cmd), self.stateString);
for (NSDictionary *mode in _displayModes)
{
NSUInteger modeWidth = [mode oo_unsignedIntegerForKey:kOODisplayWidth];
NSUInteger modeHeight = [mode oo_unsignedIntegerForKey:kOODisplayHeight];
NSUInteger modeRefresh = [mode oo_unsignedIntegerForKey:kOODisplayRefreshRate];
if ((modeWidth == width) && (modeHeight == height) && (modeRefresh == refresh))
{
return mode;
}
}
return nil;
}
- (void) runFullScreenModalEventLoop
{
OODebugLog(@"display.macLegacy.state", @"%@ called in state %@.", NSStringFromSelector(_cmd), self.stateString);
NSAssert(_state == kStateNominallyFullScreen, @"Internal usage error: %s called in wrong state.", __FUNCTION__);
@try
{
[self runFullScreenModalEventLoopInner];
}
@finally
{
_state = kStateNotFullScreen;
self.fullScreenContext = nil;
}
OODebugLog(@"display.macLegacy.state", @"%@ exiting in state %@.", NSStringFromSelector(_cmd), self.stateString);
}
- (void) suspendFullScreen
{
OODebugLog(@"display.macLegacy.state", @"%@ called in state %@.", NSStringFromSelector(_cmd), self.stateString);
NSAssert(_state != kStateNotFullScreen, @"Internal usage error: %s called in wrong state.", __FUNCTION__);
_stayInFullScreenMode = false;
_callSuspendAction = true;
OODebugLog(@"display.macLegacy.state", @"%@ exiting in state %@.", NSStringFromSelector(_cmd), self.stateString);
}
#pragma mark - Actual full screen mode handling
- (void) beginFullScreenMode
{
OODebugLog(@"display.macLegacy.state", @"%@ called in state %@.", NSStringFromSelector(_cmd), self.stateString);
NSAssert(_state == kStateNotFullScreen, @"Internal usage error: %s called in wrong state.", __FUNCTION__);
NSAutoreleasePool *setupPool = [NSAutoreleasePool new];
self.fullScreenDisplayMode = [self findDisplayModeForWidth:_width height:_height refreshRate:_refresh];
if (self.fullScreenDisplayMode == nil)
{
OOLogERR(@"display.mode.noneFound", @"Unable to find suitable full screen mode.");
return;
}
self.originalDisplayMode = (NSDictionary *)CGDisplayCurrentMode(kCGDirectMainDisplay);
OODebugLog(@"display.macLegacy.state", @"In -beginFullScreenMode; target mode found, switching state to nominally full screen.");
_state = kStateNominallyFullScreen;
_callSuspendAction = false;
// empty the event queue and strip all keys - stop problems with hangover keys
while ([NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES] != NULL) {}
[self.gameView clearKeys];
[self.gameView clearCommandF]; // Avoid immediately switching back to windowed mode.
[setupPool drain];
OODebugLog(@"display.macLegacy.state", @"%@ exiting in state %@.", NSStringFromSelector(_cmd), self.stateString);
}
- (void) runFullScreenModalEventLoopInner
{
OODebugLog(@"display.macLegacy.state", @"%@ called in state %@.", NSStringFromSelector(_cmd), self.stateString);
NSAssert(_state == kStateNominallyFullScreen, @"Internal usage error: %s called in wrong state.", __FUNCTION__);
int32_t mouseX = 0, mouseY = 0;
MyOpenGLView *gameView = self.gameView;
NSMutableData *attrData = [[gameView.pixelFormatAttributes mutableCopy] autorelease];
NSOpenGLPixelFormatAttribute *attrs = [attrData mutableBytes];
NSAssert(attrs[0] == NSOpenGLPFAWindow, @"Pixel format does not meet expectations.");
attrs[0] = NSOpenGLPFAFullScreen;
NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
[pixelFormat autorelease];
OODebugLog(@"display.macLegacy.state", @"Entering outer full screen loop in state %@.", self.stateString);
OOLogIndentIf(@"display.macLegacy");
// Outer loop exists to support switching out of full screen mode temporarily to show alerts and such.
for (;;)
{
/* Create an NSOpenGLContext with the FullScreen pixel format. By
specifying the non-FullScreen context as our "shareContext", we
automatically inherit all of the textures, display lists, and other
OpenGL objects it has defined.
*/
NSOpenGLContext *context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:gameView.openGLContext];
self.fullScreenContext = context;
[context release];
if (context == nil)
{
OOLogERR(@"display.context.create.failed", @"Failed to create fullScreenContext.");
return;
}
/* Take control of the display where we're about to go full-screen.
this stops windows from being shuffled around.
*/
OODebugLog(@"display.macLegacy.capture", @"Capturing all displays.");
CGDisplayErr err = CGCaptureAllDisplays();
if (err != CGDisplayNoErr)
{
OOLogERR(@"display.context.create.failed", @"Failed to capture displays.");
return;
}
// switch resolution!
OODebugLog(@"display.macLegacy.switch", @"Switching to display mode %@", self.fullScreenDisplayMode);
err = CGDisplaySwitchToMode(kCGDirectMainDisplay, (CFDictionaryRef)self.fullScreenDisplayMode);
if (err != CGDisplayNoErr)
{
OOLogERR(@"display.mode.switch.failed", @"Unable to change display for full-screen mode.");
return;
}
// Hide the cursor.
[self hideCursor];
[self recenterCursor];
/* Enter full-screen mode and make our full-screen context the active
context for OpenGL commands.
Also do a little dance to ensure OpenGLStateID is valid.
*/
OOSetOpenGLState(kFullScreenTransitonOpenGLState);
[context setFullScreen];
[context makeCurrentContext];
OOResetGLStateVerifier();
OOSetOpenGLState(kFullScreenTransitonOpenGLState);
// We are now officially in full-screen mode.
_state = kStateActuallyFullScreen;
/* Save the current swap interval so we can restore it later, and then
set the new swap interval to lock us to the display's refresh rate.
*/
OODebugLog(@"display.macLegacy.setSwapInterval", @"Setting swap interval to 1.");
CGLContextObj cglContext = CGLGetCurrentContext();
GLint savedSwapInterval;
CGLGetParameter(cglContext, kCGLCPSwapInterval, &savedSwapInterval);
CGLSetParameter(cglContext, kCGLCPSwapInterval, &(GLint){1});
/* Tell the scene the dimensions of the area it's going to render to,
so it can set up an appropriate viewport and viewing transformation.
*/
[gameView initialiseGLWithSize:(NSSize){ _width, _height }];
[UNIVERSE forceLightSwitch]; // Avoid lighting glitch when switching to full screen. FIXME: can we move this to MyOpenGLView so we don't need to know about Universe here?
/* Now that we've got the screen, we enter a loop in which we
alternately process input events and computer and render the next
frame of our animation. The shift here is from a model in which we
passively receive events handed to us by the AppKit to one in which
we are actively driving event processing.
*/
_stayInFullScreenMode = true;
bool pastFirstMouseDelta = false;
OODebugLog(@"display.macLegacy.state", @"Entering main full screen loop in state %@.", self.stateString);
OOLogIndentIf(@"display.macLegacy");
while (_stayInFullScreenMode)
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
// Check for and process input events.
NSEvent *event = nil;
while ((event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]))
{
switch (event.type)
{
case NSLeftMouseDown:
[gameView mouseDown:event];
break;
case NSRightMouseDown:
mouseX = mouseY = 0;
[gameView setVirtualJoystick:0.0 :0.0];
pastFirstMouseDelta = false;
break;
case NSLeftMouseUp:
[gameView mouseUp:event];
break;
case NSMouseMoved:
case NSLeftMouseDragged:
// case NSRightMouseDragged: // avoid conflict with NSRightMouseDown
case NSOtherMouseDragged:
{
int32_t mouseDx = 0, mouseDy = 0;
CGGetLastMouseDelta(&mouseDx, &mouseDy);
if (pastFirstMouseDelta)
{
mouseX += mouseDx;
mouseY += mouseDy;
}
else
{
pastFirstMouseDelta = true;
}
[gameView setVirtualJoystick:(double)mouseX/_width :(double)mouseY/_height];
[self recenterCursor];
break;
}
case NSKeyDown:
[gameView keyDown:event];
break;
case NSFlagsChanged:
[gameView flagsChanged:event];
break;
case NSKeyUp:
[gameView keyUp:event];
break;
default:
break;
}
}
// Update our stuff.
[self.delegate handleFullScreenFrameTick];
[context flushBuffer];
// Clean up any autoreleased objects that were created this time through the loop.
[pool drain];
}
OOLogOutdentIf(@"display.macLegacy");
OODebugLog(@"display.macLegacy.state", @"Exited main full screen loop in state %@.", self.stateString);
/* Clear the front and back framebuffers before switching out of full-
screen mode. (This is not strictly necessary, but avoids an untidy
flash of garbage.)
*/
OOGL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f));
OOGL(glClear(GL_COLOR_BUFFER_BIT));
[context flushBuffer];
OOGL(glClear(GL_COLOR_BUFFER_BIT));
[context flushBuffer];
// Restore the previously set swap interval.
OODebugLog(@"display.macLegacy.setSwapInterval", @"Restoring old swap interval (%i).", savedSwapInterval);
CGLSetParameter(cglContext, kCGLCPSwapInterval, &savedSwapInterval);
/* Exit full-screen mode and release our full-screen NSOpenGLContext.
Also ensure GL state is consistent.
*/
OOSetOpenGLState(kFullScreenTransitonOpenGLState);
[gameView.openGLContext makeCurrentContext];
[context clearDrawable];
self.fullScreenContext = nil;
if (!_switchRez)
{
// set screen resolution back to the original one (windowed mode).
OODebugLog(@"display.macLegacy.switch", @"Switching back to original display mode %@", self.originalDisplayMode);
err = CGDisplaySwitchToMode(kCGDirectMainDisplay, (CFDictionaryRef)self.originalDisplayMode);
if (err != CGDisplayNoErr)
{
OOLog(@"display.mode.switch.failed", @"***** Unable to change display for windowed mode.");
return;
}
// show the cursor
[self showCursor];
// Release control of the displays.
OODebugLog(@"display.macLegacy.capture", @"Releasing display capture.");
CGReleaseAllDisplays();
}
_state = kStateNominallyFullScreen;
/* Mark our view as needing drawing. (The animation has advanced while
we were in full-screen mode, so its current contents are stale.)
*/
[gameView setNeedsDisplay:YES];
if (_callSuspendAction)
{
OODebugLog(@"display.macLegacy.state", @"callSuspendAction set; calling delegate handleFullScreenSuspendedAction.");
_callSuspendAction = false;
[self.delegate handleFullScreenSuspendedAction];
}
else
{
if (_switchRez)
{
OODebugLog(@"display.macLegacy.state", @"switchRez set; calling delegate scheduleFullScreenModeRestart.");
_switchRez = false;
[self.delegate scheduleFullScreenModeRestart];
}
break;
}
}
OOLogOutdentIf(@"display.macLegacy");
OODebugLog(@"display.macLegacy.state", @"Exited outer full screen loop in state %@.", self.stateString);
_state = kStateNotFullScreen;
OODebugLog(@"display.macLegacy.state", @"%@ exiting in state %@.", NSStringFromSelector(_cmd), self.stateString);
}
- (void) recenterCursor
{
CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, (CGPoint){ _width / 2.0f, _height / 2.0f });
}
- (void) hideCursor
{
if (!_cursorHidden)
{
OODebugLog(@"display.macLegacy.cursor", @"Hiding cursor.");
CGDisplayHideCursor(kCGDirectMainDisplay);
_cursorHidden = true;
}
}
- (void) showCursor
{
if (_cursorHidden)
{
OODebugLog(@"display.macLegacy.cursor", @"Showing cursor.");
CGDisplayShowCursor(kCGDirectMainDisplay);
_cursorHidden = false;
}
}
@end
static NSComparisonResult CompareDisplayModes(id arg1, id arg2, void *context)
{
NSDictionary *mode1 = arg1;
NSDictionary *mode2 = arg2;
NSUInteger size1, size2;
// Sort first on pixel count...
size1 = [mode1 oo_unsignedIntegerForKey:kOODisplayWidth] * [mode1 oo_unsignedIntegerForKey:kOODisplayHeight];
size2 = [mode2 oo_unsignedIntegerForKey:kOODisplayWidth] * [mode2 oo_unsignedIntegerForKey:kOODisplayHeight];
// ...then on refresh rate.
if (size1 == size2)
{
size1 = [mode1 oo_unsignedIntegerForKey:kOODisplayRefreshRate];
size2 = [mode2 oo_unsignedIntegerForKey:kOODisplayRefreshRate];
}
if (size1 < size2) return NSOrderedAscending;
if (size1 > size2) return NSOrderedDescending;
return NSOrderedSame;
}
#endif

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2549</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<int key="IBDocument.SystemTarget">1060</int>
<string key="IBDocument.SystemVersion">12E55</string>
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
<string key="IBDocument.AppKitVersion">1187.39</string>
<string key="IBDocument.HIToolboxVersion">626.00</string>
<dictionary class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="com.apple.InterfaceBuilder.CocoaPlugin">2549</string>
<string key="com.apple.pdfkit.ibplugin">1460</string>
<string key="com.apple.InterfaceBuilder.CocoaPlugin">3084</string>
<string key="com.apple.pdfkit.ibplugin">2053</string>
</dictionary>
<array key="IBDocument.IntegratedClassDependencies">
<string>NSBox</string>
@ -406,7 +406,7 @@
<nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMinSize">{640, 480}</string>
<object class="NSView" key="NSWindowView" id="796882467">
<reference key="NSNextResponder"/>
<nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="NSBox" id="506709247">
@ -437,7 +437,7 @@
<reference key="NSNextKeyView" ref="67986506"/>
<bool key="NSEnabled">YES</bool>
<object class="NSImageCell" key="NSCell" id="502141629">
<int key="NSCellFlags">134348288</int>
<int key="NSCellFlags">134217728</int>
<int key="NSCellFlags2">33554432</int>
<object class="NSCustomResource" key="NSContents">
<string key="NSClassName">NSImage</string>
@ -448,6 +448,7 @@
<int key="NSStyle">0</int>
<bool key="NSAnimates">NO</bool>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<bool key="NSEditable">YES</bool>
</object>
<object class="NSTextField" id="67986506">
@ -455,10 +456,9 @@
<int key="NSvFlags">298</int>
<string key="NSFrame">{{17, 8}, {606, 17}}</string>
<reference key="NSSuperview" ref="336234777"/>
<reference key="NSNextKeyView"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="342735271">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">138412032</int>
<string key="NSContents">loading…</string>
<object class="NSFont" key="NSSupport">
@ -482,6 +482,7 @@
<bytes key="NSRGB">MC44MTU2MDgzMjI2IDAuODIwMTg5MTc4IDEAA</bytes>
</object>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
</array>
<string key="NSFrame">{{0, 30}, {640, 424}}</string>
@ -500,7 +501,7 @@
<reference key="NSNextKeyView" ref="464715030"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents"/>
<object class="NSFont" key="NSSupport">
@ -534,10 +535,9 @@
</object>
</array>
<string key="NSFrameSize">{640, 480}</string>
<reference key="NSSuperview"/>
<reference key="NSNextKeyView" ref="506709247"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
<string key="NSScreenRect">{{0, 0}, {1366, 746}}</string>
<string key="NSMinSize">{640, 502}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<string key="NSFrameAutosaveName">oolite-main-window</string>
@ -566,6 +566,7 @@
<object class="PDFView" id="18486341">
<reference key="NSNextResponder" ref="506024517"/>
<int key="NSvFlags">18</int>
<array class="NSMutableArray" key="NSSubviews"/>
<set class="NSMutableSet" key="NSDragTypes">
<string>NSFilenamesPboardType</string>
</set>
@ -580,7 +581,7 @@
</array>
<string key="NSFrameSize">{640, 480}</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
<string key="NSScreenRect">{{0, 0}, {1366, 746}}</string>
<string key="NSMinSize">{640, 422}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<string key="NSFrameAutosaveName">oolitehelp</string>
@ -616,7 +617,7 @@
</array>
<string key="NSFrameSize">{640, 480}</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
<string key="NSScreenRect">{{0, 0}, {1366, 746}}</string>
<string key="NSMinSize">{213, 129}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
@ -1630,6 +1631,17 @@
<object class="IBPartialClassDescription">
<string key="className">OOPrimaryWindow</string>
<string key="superclassName">NSWindow</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">fullScreenDelegate</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">fullScreenDelegate</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">fullScreenDelegate</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/OOPrimaryWindow.h</string>
@ -1693,15 +1705,11 @@
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<real value="1050" key="NS.object.0"/>
<real value="1060" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<real value="1070" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<real value="4200" key="NS.object.0"/>
<real value="1080" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>

View File

@ -1,7 +1,6 @@
ARCHS = i386 x86_64
SDKROOT = macosx10.7
ARCHS = x86_64
SDKROOT = macosx10.8
MACOSX_DEPLOYMENT_TARGET[arch=i386] = 10.5
MACOSX_DEPLOYMENT_TARGET = 10.6
GCC_VERSION = com.apple.compilers.llvm.clang.1_0

View File

@ -581,8 +581,6 @@ static uint16_t PersonalityForCommanderDict(NSDictionary *dict);
#if OOLITE_USE_APPKIT_LOAD_SAVE
#if OOLITE_MAC_OS_X_10_6
- (BOOL)loadPlayerWithPanel
{
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
@ -627,59 +625,6 @@ static uint16_t PersonalityForCommanderDict(NSDictionary *dict);
[self setGuiToStatusScreen];
}
#else
- (BOOL)loadPlayerWithPanel
{
int result;
NSArray *fileTypes = nil;
NSOpenPanel *oPanel = nil;
fileTypes = [NSArray arrayWithObject:@"oolite-save"];
oPanel = [NSOpenPanel openPanel];
[oPanel setAllowsMultipleSelection:NO];
result = [oPanel runModalForDirectory:nil file:nil types:fileTypes];
if (result == NSOKButton)
{
return [self loadPlayerFromFile:[oPanel filename]];
}
else
{
return NO;
}
}
- (void) savePlayerWithPanel
{
NSSavePanel *sp;
int runResult;
sp = [NSSavePanel savePanel];
[sp setRequiredFileType:@"oolite-save"];
[sp setCanSelectHiddenExtension:YES];
// display the NSSavePanel
runResult = [sp runModalForDirectory:nil file:[self commanderName]];
// if successful, save file under designated name
if (runResult == NSOKButton)
{
NSArray* path_components = [[sp filename] pathComponents];
NSString* new_name = [[path_components objectAtIndex:[path_components count]-1] stringByDeletingPathExtension];
ShipScriptEventNoCx(self, "playerWillSaveGame", OOJSSTR("STANDARD_SAVE"));
[self setCommanderName:new_name];
[self writePlayerToPath:[sp filename]];
}
[self setGuiToStatusScreen];
}
#endif
#endif

View File

@ -31,23 +31,10 @@ MA 02110-1301, USA.
#if OOLITE_MAC_OS_X // TEMP, should be used for SDL too
#if OOLITE_MAC_LEGACY_FULLSCREEN
#import "OOMacLegacyFullScreenController.h"
#import "Universe.h"
@interface GameController (OOMacLegacyFullScreenControllerDelegate) <OOMacLegacyFullScreenControllerDelegate>
@end
#else
#if OOLITE_MAC_OS_X
#import "OOMacSnowLeopardFullScreenController.h"
#import "OOMacSystemStandardFullScreenController.h"
#endif
#if OOLITE_MAC_OS_X
#import "OOPrimaryWindow.h"
@ -61,10 +48,7 @@ MA 02110-1301, USA.
- (void) setUpDisplayModes
{
#if OOLITE_MAC_LEGACY_FULLSCREEN
OOMacLegacyFullScreenController *fullScreenController = [[OOMacLegacyFullScreenController alloc] initWithGameView:gameView];
fullScreenController.delegate = self;
#elif OOLITE_MAC_OS_X
#if OOLITE_MAC_OS_X
OOFullScreenController *fullScreenController = nil;
#if OO_MAC_SUPPORT_SYSTEM_STANDARD_FULL_SCREEN
@ -123,11 +107,6 @@ MA 02110-1301, USA.
- (void) setFullScreenMode:(BOOL)value
{
#if OOLITE_MAC_LEGACY_FULLSCREEN
// HACK: the commandF flag can linger when switching between event loops.
[gameView clearCommandF];
#endif
if (value == [self inFullScreenMode]) return;
[[NSUserDefaults standardUserDefaults] setBool:value forKey:@"fullscreen"];
@ -135,20 +114,6 @@ MA 02110-1301, USA.
if (value)
{
[_fullScreenController setFullScreenMode:YES];
#if OOLITE_MAC_LEGACY_FULLSCREEN
// Mac legacy controller needs to take over the world. By which I mean the event loop.
if ([_fullScreenController inFullScreenMode])
{
[self stopAnimationTimer];
[(OOMacLegacyFullScreenController *)_fullScreenController runFullScreenModalEventLoop];
[self startAnimationTimer];
}
else
{
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"fullscreen"];
}
#endif
}
else
{
@ -204,52 +169,9 @@ MA 02110-1301, USA.
- (void) pauseFullScreenModeToPerform:(SEL)selector onTarget:(id)target
{
#if OOLITE_MAC_LEGACY_FULLSCREEN
[pauseTarget release];
pauseTarget = [target retain];
pauseSelector = selector;
[(OOMacLegacyFullScreenController *)_fullScreenController suspendFullScreen];
#else
[target performSelector:selector];
#endif
}
@end
#if OOLITE_MAC_LEGACY_FULLSCREEN
@implementation GameController (OOMacLegacyFullScreenControllerDelegate)
- (void) handleFullScreenSuspendedAction
{
[pauseTarget performSelector:pauseSelector];
DESTROY(pauseTarget);
pauseSelector = NULL;
}
- (void) handleFullScreenFrameTick
{
[self performGameTick:self];
[UNIVERSE drawUniverse];
}
- (void) scheduleFullScreenModeRestart
{
/*
We're about to fall out of full screen mode, but should change back
immediately. This happens when the user changes full screen resolution
in-game while in full screen mode. It shouldn't be necessary, but the
obvious "fix" results in windows being messed up.
*/
[self performSelector:@selector(toggleFullScreenAction:) withObject:nil afterDelay:0.0];
}
@end
#endif
#endif

View File

@ -35,10 +35,6 @@ MA 02110-1301, USA.
#import <Quartz/Quartz.h> // For PDFKit.
#endif
#if OOLITE_MAC_OS_X && !OOLITE_64_BIT
#define OOLITE_MAC_LEGACY_FULLSCREEN 1
#endif
#define MINIMUM_GAME_TICK 0.25
// * reduced from 0.5s for tgape * //
@ -168,10 +164,6 @@ MA 02110-1301, USA.
- (IBAction) toggleFullScreenAction:(id)sender;
#endif
/* NOTE: on 32-bit Mac OS X (OOLITE_MAC_LEGACY_FULLSCREEN),
setFullScreenMode:YES takes over the event loop and doesn't return until
exiting full screen mode.
*/
- (void) setFullScreenMode:(BOOL)value;
#endif

View File

@ -342,14 +342,6 @@ static GameController *sSharedController = nil;
OOLog(@"exception.backtrace",@"%@",[exception callStackSymbols]);
}
#if OOLITE_MAC_LEGACY_FULLSCREEN
if ([self inFullScreenMode])
{
// Mac legacy full screen controller makes its own arrangements for rendering.
return;
}
#endif
@try
{
[gameView display];

View File

@ -30,7 +30,7 @@ SOFTWARE.
#include <pthread.h>
#define OO_HAVE_PTHREAD_SETNAME_NP OOLITE_MAC_OS_X_10_6
#define OO_HAVE_PTHREAD_SETNAME_NP OOLITE_MAC_OS_X
@implementation NSThread (OOExtensions)

View File

@ -75,10 +75,6 @@ MA 02110-1301, USA.
#define DESTROY(x) do { id x_ = x; x = nil; [x_ release]; } while (0)
#endif
#if defined MAC_OS_X_VERSION_10_6 && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
#define OOLITE_MAC_OS_X_10_6 1
#endif
#if defined MAC_OS_X_VERSION_10_7 && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7
#define OOLITE_MAC_OS_X_10_7 1
#endif
@ -89,10 +85,6 @@ MA 02110-1301, USA.
#endif
#ifndef OOLITE_MAC_OS_X_10_6
#define OOLITE_MAC_OS_X_10_6 0
#endif
#ifndef OOLITE_MAC_OS_X_10_7
#define OOLITE_MAC_OS_X_10_7 0
#endif

View File

@ -32,11 +32,6 @@ MA 02110-1301, USA.
@class MyOpenGLView;
#if OOLITE_MAC_OS_X && !OOLITE_64_BIT
#define OOLITE_MAC_LEGACY_FULLSCREEN 1
#endif
#if OOLITE_MAC_OS_X
#define kOODisplayWidth ((NSString *)kCGDisplayWidth)
#define kOODisplayHeight ((NSString *)kCGDisplayHeight)

View File

@ -198,22 +198,6 @@ NSString *OOPlatformDescription(void)
#include <sys/sysctl.h>
#ifndef CPUFAMILY_INTEL_WESTMERE
// Copied from OS X 10.6 SDK
#define CPUFAMILY_INTEL_WESTMERE 0x573b5eec
#endif
#ifndef CPUFAMILY_INTEL_SANDYBRIDGE
// Copied from OS X 10.7 SDK
#define CPUFAMILY_INTEL_SANDYBRIDGE 0x5490b78c
#endif
#ifndef CPUFAMILY_INTEL_IVYBRIDGE
// Copied from OS X 10.8 SDK
#define CPUFAMILY_INTEL_IVYBRIDGE 0x1f65e835
#endif
static NSString *GetSysCtlString(const char *name);
static unsigned long long GetSysCtlInt(const char *name);
static NSString *GetCPUDescription(void);
@ -251,41 +235,12 @@ static NSString *GetCPUDescription(void)
{
case CPU_TYPE_POWERPC:
typeStr = @"PowerPC";
switch (sysCPUSubType)
{
case CPU_SUBTYPE_POWERPC_750:
subTypeStr = @" G3 (750)";
break;
case CPU_SUBTYPE_POWERPC_7400:
subTypeStr = @" G4 (7400)";
break;
case CPU_SUBTYPE_POWERPC_7450:
subTypeStr = @" G4 (7450)";
break;
case CPU_SUBTYPE_POWERPC_970:
subTypeStr = @" G5 (970)";
break;
default:
subTypeStr = [NSString stringWithFormat:@":%llu", sysCPUSubType];
}
break;
case CPU_TYPE_I386:
typeStr = @"x86";
switch (sysCPUFamily)
{
case CPUFAMILY_INTEL_6_13:
subTypeStr = @" (Intel 6:13)";
break;
case CPUFAMILY_INTEL_YONAH:
subTypeStr = @" (Core/Yonah)";
break;
case CPUFAMILY_INTEL_MEROM:
subTypeStr = @" (Core 2/Merom)";
break;

View File

@ -300,7 +300,6 @@ GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEVEL, DOC
// Set up speech synthesizer.
#if OOLITE_SPEECH_SYNTH
#if OOLITE_MAC_OS_X
#if OOLITE_MAC_OS_X_10_6
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0),
^{
/*
@ -316,9 +315,6 @@ GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEVEL, DOC
OOLog(@"speech.setup.end", @"Finished setting up speech synthesizer.");
speechSynthesizer = synth;
});
#else
speechSynthesizer = [[NSSpeechSynthesizer alloc] init];
#endif
#elif OOLITE_ESPEAK
espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 100, NULL, 0);
espeak_SetParameter(espeakPUNCTUATION, espeakPUNCT_NONE, 0);