mirror of https://github.com/encounter/SDL.git
Removed Mac OS 10.5 support (bug #3137). Also fixed a warning about deprecated Carbon code when using SDL_audio (bug #3127, thanks Dominik!)
This commit is contained in:
parent
6255c8584a
commit
4a468739f8
|
@ -2774,7 +2774,7 @@
|
||||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||||
GCC_OPTIMIZATION_LEVEL = 3;
|
GCC_OPTIMIZATION_LEVEL = 3;
|
||||||
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.5;
|
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
STRIP_STYLE = "non-global";
|
STRIP_STYLE = "non-global";
|
||||||
};
|
};
|
||||||
|
@ -2832,7 +2832,7 @@
|
||||||
GCC_ENABLE_SSE3_EXTENSIONS = YES;
|
GCC_ENABLE_SSE3_EXTENSIONS = YES;
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.5;
|
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
STRIP_INSTALLED_PRODUCT = NO;
|
STRIP_INSTALLED_PRODUCT = NO;
|
||||||
|
|
|
@ -3934,7 +3934,7 @@
|
||||||
);
|
);
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
HEADER_SEARCH_PATHS = ../../include;
|
HEADER_SEARCH_PATHS = ../../include;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.5;
|
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
|
@ -4060,7 +4060,7 @@
|
||||||
);
|
);
|
||||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||||
HEADER_SEARCH_PATHS = ../../include;
|
HEADER_SEARCH_PATHS = ../../include;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.5;
|
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
|
|
||||||
DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
|
DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
|
||||||
|
|
||||||
# Intel 32-bit compiler flags (10.5 runtime compatibility)
|
# Intel 32-bit compiler flags (10.6 runtime compatibility)
|
||||||
GCC_COMPILE_X86="g++ -arch i386 -mmacosx-version-min=10.5 \
|
GCC_COMPILE_X86="g++ -arch i386 -mmacosx-version-min=10.6 \
|
||||||
-I/usr/local/include"
|
-I/usr/local/include"
|
||||||
|
|
||||||
GCC_LINK_X86="-mmacosx-version-min=10.5"
|
GCC_LINK_X86="-mmacosx-version-min=10.6"
|
||||||
|
|
||||||
# Intel 64-bit compiler flags (10.6 runtime compatibility)
|
# Intel 64-bit compiler flags (10.6 runtime compatibility)
|
||||||
GCC_COMPILE_X64="g++ -arch x86_64 -mmacosx-version-min=10.6 \
|
GCC_COMPILE_X64="g++ -arch x86_64 -mmacosx-version-min=10.6 \
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
|
|
||||||
DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
|
DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
|
||||||
|
|
||||||
# Intel 32-bit compiler flags (10.5 runtime compatibility)
|
# Intel 32-bit compiler flags (10.6 runtime compatibility)
|
||||||
GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.5 \
|
GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.6 \
|
||||||
-I/usr/local/include"
|
-I/usr/local/include"
|
||||||
|
|
||||||
GCC_LINK_X86="-mmacosx-version-min=10.5"
|
GCC_LINK_X86="-mmacosx-version-min=10.6"
|
||||||
|
|
||||||
# Intel 64-bit compiler flags (10.6 runtime compatibility)
|
# Intel 64-bit compiler flags (10.6 runtime compatibility)
|
||||||
GCC_COMPILE_X64="gcc -arch x86_64 -mmacosx-version-min=10.6 \
|
GCC_COMPILE_X64="gcc -arch x86_64 -mmacosx-version-min=10.6 \
|
||||||
|
|
|
@ -79,9 +79,9 @@
|
||||||
/* if not compiling for iPhone */
|
/* if not compiling for iPhone */
|
||||||
#undef __MACOSX__
|
#undef __MACOSX__
|
||||||
#define __MACOSX__ 1
|
#define __MACOSX__ 1
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
||||||
# error SDL for Mac OS X only supports deploying on 10.5 and above.
|
# error SDL for Mac OS X only supports deploying on 10.6 and above.
|
||||||
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1050 */
|
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */
|
||||||
#endif /* TARGET_OS_IPHONE */
|
#endif /* TARGET_OS_IPHONE */
|
||||||
#endif /* defined(__APPLE__) */
|
#endif /* defined(__APPLE__) */
|
||||||
|
|
||||||
|
|
|
@ -406,13 +406,7 @@ COREAUDIO_CloseDevice(_THIS)
|
||||||
AudioUnitSetProperty(this->hidden->audioUnit,
|
AudioUnitSetProperty(this->hidden->audioUnit,
|
||||||
kAudioUnitProperty_SetRenderCallback,
|
kAudioUnitProperty_SetRenderCallback,
|
||||||
scope, bus, &callback, sizeof(callback));
|
scope, bus, &callback, sizeof(callback));
|
||||||
|
|
||||||
#if MACOSX_COREAUDIO
|
|
||||||
CloseComponent(this->hidden->audioUnit);
|
|
||||||
#else
|
|
||||||
AudioComponentInstanceDispose(this->hidden->audioUnit);
|
AudioComponentInstanceDispose(this->hidden->audioUnit);
|
||||||
#endif
|
|
||||||
|
|
||||||
this->hidden->audioUnitOpened = 0;
|
this->hidden->audioUnitOpened = 0;
|
||||||
}
|
}
|
||||||
SDL_free(this->hidden->buffer);
|
SDL_free(this->hidden->buffer);
|
||||||
|
@ -482,13 +476,8 @@ prepare_audiounit(_THIS, void *handle, int iscapture,
|
||||||
{
|
{
|
||||||
OSStatus result = noErr;
|
OSStatus result = noErr;
|
||||||
AURenderCallbackStruct callback;
|
AURenderCallbackStruct callback;
|
||||||
#if MACOSX_COREAUDIO
|
|
||||||
ComponentDescription desc;
|
|
||||||
Component comp = NULL;
|
|
||||||
#else
|
|
||||||
AudioComponentDescription desc;
|
AudioComponentDescription desc;
|
||||||
AudioComponent comp = NULL;
|
AudioComponent comp = NULL;
|
||||||
#endif
|
|
||||||
const AudioUnitElement output_bus = 0;
|
const AudioUnitElement output_bus = 0;
|
||||||
const AudioUnitElement input_bus = 1;
|
const AudioUnitElement input_bus = 1;
|
||||||
const AudioUnitElement bus = ((iscapture) ? input_bus : output_bus);
|
const AudioUnitElement bus = ((iscapture) ? input_bus : output_bus);
|
||||||
|
@ -507,11 +496,10 @@ prepare_audiounit(_THIS, void *handle, int iscapture,
|
||||||
|
|
||||||
#if MACOSX_COREAUDIO
|
#if MACOSX_COREAUDIO
|
||||||
desc.componentSubType = kAudioUnitSubType_DefaultOutput;
|
desc.componentSubType = kAudioUnitSubType_DefaultOutput;
|
||||||
comp = FindNextComponent(NULL, &desc);
|
|
||||||
#else
|
#else
|
||||||
desc.componentSubType = kAudioUnitSubType_RemoteIO;
|
desc.componentSubType = kAudioUnitSubType_RemoteIO;
|
||||||
comp = AudioComponentFindNext(NULL, &desc);
|
|
||||||
#endif
|
#endif
|
||||||
|
comp = AudioComponentFindNext(NULL, &desc);
|
||||||
|
|
||||||
if (comp == NULL) {
|
if (comp == NULL) {
|
||||||
SDL_SetError("Couldn't find requested CoreAudio component");
|
SDL_SetError("Couldn't find requested CoreAudio component");
|
||||||
|
@ -519,17 +507,8 @@ prepare_audiounit(_THIS, void *handle, int iscapture,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open & initialize the audio unit */
|
/* Open & initialize the audio unit */
|
||||||
#if MACOSX_COREAUDIO
|
|
||||||
result = OpenAComponent(comp, &this->hidden->audioUnit);
|
|
||||||
CHECK_RESULT("OpenAComponent");
|
|
||||||
#else
|
|
||||||
/*
|
|
||||||
AudioComponentInstanceNew only available on iPhone OS 2.0 and Mac OS X 10.6
|
|
||||||
We can't use OpenAComponent on iPhone because it is not present
|
|
||||||
*/
|
|
||||||
result = AudioComponentInstanceNew(comp, &this->hidden->audioUnit);
|
result = AudioComponentInstanceNew(comp, &this->hidden->audioUnit);
|
||||||
CHECK_RESULT("AudioComponentInstanceNew");
|
CHECK_RESULT("AudioComponentInstanceNew");
|
||||||
#endif
|
|
||||||
|
|
||||||
this->hidden->audioUnitOpened = 1;
|
this->hidden->audioUnitOpened = 1;
|
||||||
|
|
||||||
|
|
|
@ -422,6 +422,7 @@ JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDevic
|
||||||
{
|
{
|
||||||
recDevice *device;
|
recDevice *device;
|
||||||
int device_index = 0;
|
int device_index = 0;
|
||||||
|
io_service_t ioservice;
|
||||||
|
|
||||||
if (res != kIOReturnSuccess) {
|
if (res != kIOReturnSuccess) {
|
||||||
return;
|
return;
|
||||||
|
@ -451,20 +452,11 @@ JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDevic
|
||||||
device->instance_id = ++s_joystick_instance_id;
|
device->instance_id = ++s_joystick_instance_id;
|
||||||
|
|
||||||
/* We have to do some storage of the io_service_t for SDL_HapticOpenFromJoystick */
|
/* We have to do some storage of the io_service_t for SDL_HapticOpenFromJoystick */
|
||||||
|
ioservice = IOHIDDeviceGetService(ioHIDDeviceObject);
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
|
||||||
if (IOHIDDeviceGetService != NULL) { /* weak reference: available in 10.6 and later. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const io_service_t ioservice = IOHIDDeviceGetService(ioHIDDeviceObject);
|
|
||||||
#if SDL_HAPTIC_IOKIT
|
#if SDL_HAPTIC_IOKIT
|
||||||
if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK)) {
|
if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK)) {
|
||||||
device->ffservice = ioservice;
|
device->ffservice = ioservice;
|
||||||
MacHaptic_MaybeAddDevice(ioservice);
|
MacHaptic_MaybeAddDevice(ioservice);
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -25,23 +25,13 @@
|
||||||
#include "SDL_cocoavideo.h"
|
#include "SDL_cocoavideo.h"
|
||||||
#include "../../events/SDL_clipboardevents_c.h"
|
#include "../../events/SDL_clipboardevents_c.h"
|
||||||
|
|
||||||
static NSString *
|
|
||||||
GetTextFormat(_THIS)
|
|
||||||
{
|
|
||||||
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) {
|
|
||||||
return NSPasteboardTypeString;
|
|
||||||
} else {
|
|
||||||
return NSStringPboardType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
Cocoa_SetClipboardText(_THIS, const char *text)
|
Cocoa_SetClipboardText(_THIS, const char *text)
|
||||||
{ @autoreleasepool
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
|
||||||
NSPasteboard *pasteboard;
|
NSPasteboard *pasteboard;
|
||||||
NSString *format = GetTextFormat(_this);
|
NSString *format = NSPasteboardTypeString;
|
||||||
|
|
||||||
pasteboard = [NSPasteboard generalPasteboard];
|
pasteboard = [NSPasteboard generalPasteboard];
|
||||||
data->clipboard_count = [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil];
|
data->clipboard_count = [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil];
|
||||||
|
@ -55,7 +45,7 @@ Cocoa_GetClipboardText(_THIS)
|
||||||
{ @autoreleasepool
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSPasteboard *pasteboard;
|
NSPasteboard *pasteboard;
|
||||||
NSString *format = GetTextFormat(_this);
|
NSString *format = NSPasteboardTypeString;
|
||||||
NSString *available;
|
NSString *available;
|
||||||
char *text;
|
char *text;
|
||||||
|
|
||||||
|
|
|
@ -114,28 +114,23 @@
|
||||||
*/
|
*/
|
||||||
for (NSWindow *window in [NSApp orderedWindows]) {
|
for (NSWindow *window in [NSApp orderedWindows]) {
|
||||||
if (window != win && [window canBecomeKeyWindow]) {
|
if (window != win && [window canBecomeKeyWindow]) {
|
||||||
if ([window respondsToSelector:@selector(isOnActiveSpace)]) {
|
if (![window isOnActiveSpace]) {
|
||||||
if (![window isOnActiveSpace]) {
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
[window makeKeyAndOrderFront:self];
|
[window makeKeyAndOrderFront:self];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If a window wasn't found above, iterate through all visible windows
|
/* If a window wasn't found above, iterate through all visible windows in
|
||||||
* (including the 'About' window, if it's shown) and make the first one key.
|
* the active Space in z-order (including the 'About' window, if it's shown)
|
||||||
* Note that +[NSWindow windowNumbersWithOptions:] was added in 10.6.
|
* and make the first one key.
|
||||||
*/
|
*/
|
||||||
if ([NSWindow respondsToSelector:@selector(windowNumbersWithOptions:)]) {
|
for (NSNumber *num in [NSWindow windowNumbersWithOptions:0]) {
|
||||||
/* Get all visible windows in the active Space, in z-order. */
|
NSWindow *window = [NSApp windowWithWindowNumber:[num integerValue]];
|
||||||
for (NSNumber *num in [NSWindow windowNumbersWithOptions:0]) {
|
if (window && window != win && [window canBecomeKeyWindow]) {
|
||||||
NSWindow *window = [NSApp windowWithWindowNumber:[num integerValue]];
|
[window makeKeyAndOrderFront:self];
|
||||||
if (window && window != win && [window canBecomeKeyWindow]) {
|
return;
|
||||||
[window makeKeyAndOrderFront:self];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -291,7 +286,7 @@ CreateApplicationMenus(void)
|
||||||
|
|
||||||
|
|
||||||
/* Add the fullscreen view toggle menu option, if supported */
|
/* Add the fullscreen view toggle menu option, if supported */
|
||||||
if ([NSApp respondsToSelector:@selector(setPresentationOptions:)]) {
|
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) {
|
||||||
/* Create the view menu */
|
/* Create the view menu */
|
||||||
viewMenu = [[NSMenu alloc] initWithTitle:@"View"];
|
viewMenu = [[NSMenu alloc] initWithTitle:@"View"];
|
||||||
|
|
||||||
|
@ -321,16 +316,7 @@ Cocoa_RegisterApp(void)
|
||||||
|
|
||||||
const char *hint = SDL_GetHint(SDL_HINT_MAC_BACKGROUND_APP);
|
const char *hint = SDL_GetHint(SDL_HINT_MAC_BACKGROUND_APP);
|
||||||
if (!hint || *hint == '0') {
|
if (!hint || *hint == '0') {
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||||
if ([NSApp respondsToSelector:@selector(setActivationPolicy:)]) {
|
|
||||||
#endif
|
|
||||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
|
|
||||||
} else {
|
|
||||||
ProcessSerialNumber psn = {0, kCurrentProcess};
|
|
||||||
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
[NSApp activateIgnoringOtherApps:YES];
|
[NSApp activateIgnoringOtherApps:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,14 +69,6 @@
|
||||||
SDL_SendKeyboardText(str);
|
SDL_SendKeyboardText(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)insertText:(id)insertString
|
|
||||||
{
|
|
||||||
/* This method is part of NSTextInput and not NSTextInputClient, but
|
|
||||||
* apparently it still might be called in OS X 10.5 and can cause beeps if
|
|
||||||
* the implementation is missing: http://crbug.com/47890 */
|
|
||||||
[self insertText:insertString replacementRange:NSMakeRange(0, 0)];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)doCommandBySelector:(SEL)myselector
|
- (void)doCommandBySelector:(SEL)myselector
|
||||||
{
|
{
|
||||||
/* No need to do anything since we are not using Cocoa
|
/* No need to do anything since we are not using Cocoa
|
||||||
|
@ -498,11 +490,8 @@ Cocoa_InitKeyboard(_THIS)
|
||||||
SDL_SetScancodeName(SDL_SCANCODE_RALT, "Right Option");
|
SDL_SetScancodeName(SDL_SCANCODE_RALT, "Right Option");
|
||||||
SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command");
|
SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command");
|
||||||
|
|
||||||
/* On pre-10.6, you might have the initial capslock key state wrong. */
|
data->modifierFlags = [NSEvent modifierFlags];
|
||||||
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_6) {
|
SDL_ToggleModState(KMOD_CAPS, (data->modifierFlags & NSAlphaShiftKeyMask) != 0);
|
||||||
data->modifierFlags = [NSEvent modifierFlags];
|
|
||||||
SDL_ToggleModState(KMOD_CAPS, (data->modifierFlags & NSAlphaShiftKeyMask) != 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -30,7 +30,7 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
const void *moderef;
|
CGDisplayModeRef moderef;
|
||||||
} SDL_DisplayModeData;
|
} SDL_DisplayModeData;
|
||||||
|
|
||||||
extern void Cocoa_InitModes(_THIS);
|
extern void Cocoa_InitModes(_THIS);
|
||||||
|
|
|
@ -56,25 +56,6 @@ Cocoa_ToggleMenuBar(const BOOL show)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* !!! FIXME: clean out the pre-10.6 code when it makes sense to do so. */
|
|
||||||
#define FORCE_OLD_API 0
|
|
||||||
|
|
||||||
#if FORCE_OLD_API
|
|
||||||
#undef MAC_OS_X_VERSION_MIN_REQUIRED
|
|
||||||
#define MAC_OS_X_VERSION_MIN_REQUIRED 1050
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static BOOL
|
|
||||||
IS_SNOW_LEOPARD_OR_LATER()
|
|
||||||
{
|
|
||||||
#if FORCE_OLD_API
|
|
||||||
return NO;
|
|
||||||
#else
|
|
||||||
return floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
CG_SetError(const char *prefix, CGDisplayErr result)
|
CG_SetError(const char *prefix, CGDisplayErr result)
|
||||||
{
|
{
|
||||||
|
@ -119,59 +100,40 @@ CG_SetError(const char *prefix, CGDisplayErr result)
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_bool
|
static SDL_bool
|
||||||
GetDisplayMode(_THIS, const void *moderef, CVDisplayLinkRef link, SDL_DisplayMode *mode)
|
GetDisplayMode(_THIS, CGDisplayModeRef vidmode, CVDisplayLinkRef link, SDL_DisplayMode *mode)
|
||||||
{
|
{
|
||||||
SDL_DisplayModeData *data;
|
SDL_DisplayModeData *data;
|
||||||
long width = 0;
|
long width = 0;
|
||||||
long height = 0;
|
long height = 0;
|
||||||
long bpp = 0;
|
long bpp = 0;
|
||||||
long refreshRate = 0;
|
long refreshRate = 0;
|
||||||
|
CFStringRef fmt;
|
||||||
|
|
||||||
data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data));
|
data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data));
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
data->moderef = moderef;
|
data->moderef = vidmode;
|
||||||
|
|
||||||
if (IS_SNOW_LEOPARD_OR_LATER()) {
|
fmt = CGDisplayModeCopyPixelEncoding(vidmode);
|
||||||
CGDisplayModeRef vidmode = (CGDisplayModeRef) moderef;
|
width = (long) CGDisplayModeGetWidth(vidmode);
|
||||||
CFStringRef fmt = CGDisplayModeCopyPixelEncoding(vidmode);
|
height = (long) CGDisplayModeGetHeight(vidmode);
|
||||||
width = (long) CGDisplayModeGetWidth(vidmode);
|
refreshRate = (long) (CGDisplayModeGetRefreshRate(vidmode) + 0.5);
|
||||||
height = (long) CGDisplayModeGetHeight(vidmode);
|
|
||||||
refreshRate = (long) (CGDisplayModeGetRefreshRate(vidmode) + 0.5);
|
|
||||||
|
|
||||||
if (CFStringCompare(fmt, CFSTR(IO32BitDirectPixels),
|
if (CFStringCompare(fmt, CFSTR(IO32BitDirectPixels),
|
||||||
kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
|
kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
|
||||||
bpp = 32;
|
bpp = 32;
|
||||||
} else if (CFStringCompare(fmt, CFSTR(IO16BitDirectPixels),
|
} else if (CFStringCompare(fmt, CFSTR(IO16BitDirectPixels),
|
||||||
kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
|
kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
|
||||||
bpp = 16;
|
bpp = 16;
|
||||||
} else if (CFStringCompare(fmt, CFSTR(kIO30BitDirectPixels),
|
} else if (CFStringCompare(fmt, CFSTR(kIO30BitDirectPixels),
|
||||||
kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
|
kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
|
||||||
bpp = 30;
|
bpp = 30;
|
||||||
} else {
|
} else {
|
||||||
bpp = 0; /* ignore 8-bit and such for now. */
|
bpp = 0; /* ignore 8-bit and such for now. */
|
||||||
}
|
|
||||||
|
|
||||||
CFRelease(fmt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
CFRelease(fmt);
|
||||||
if (!IS_SNOW_LEOPARD_OR_LATER()) {
|
|
||||||
CFNumberRef number;
|
|
||||||
double refresh;
|
|
||||||
CFDictionaryRef vidmode = (CFDictionaryRef) moderef;
|
|
||||||
number = CFDictionaryGetValue(vidmode, kCGDisplayWidth);
|
|
||||||
CFNumberGetValue(number, kCFNumberLongType, &width);
|
|
||||||
number = CFDictionaryGetValue(vidmode, kCGDisplayHeight);
|
|
||||||
CFNumberGetValue(number, kCFNumberLongType, &height);
|
|
||||||
number = CFDictionaryGetValue(vidmode, kCGDisplayBitsPerPixel);
|
|
||||||
CFNumberGetValue(number, kCFNumberLongType, &bpp);
|
|
||||||
number = CFDictionaryGetValue(vidmode, kCGDisplayRefreshRate);
|
|
||||||
CFNumberGetValue(number, kCFNumberDoubleType, &refresh);
|
|
||||||
refreshRate = (long) (refresh + 0.5);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* CGDisplayModeGetRefreshRate returns 0 for many non-CRT displays. */
|
/* CGDisplayModeGetRefreshRate returns 0 for many non-CRT displays. */
|
||||||
if (refreshRate == 0 && link != NULL) {
|
if (refreshRate == 0 && link != NULL) {
|
||||||
|
@ -204,22 +166,6 @@ GetDisplayMode(_THIS, const void *moderef, CVDisplayLinkRef link, SDL_DisplayMod
|
||||||
return SDL_TRUE;
|
return SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
Cocoa_ReleaseDisplayMode(_THIS, const void *moderef)
|
|
||||||
{
|
|
||||||
if (IS_SNOW_LEOPARD_OR_LATER()) {
|
|
||||||
CGDisplayModeRelease((CGDisplayModeRef) moderef); /* NULL is ok */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
Cocoa_ReleaseDisplayModeList(_THIS, CFArrayRef modelist)
|
|
||||||
{
|
|
||||||
if (IS_SNOW_LEOPARD_OR_LATER()) {
|
|
||||||
CFRelease(modelist); /* NULL is ok */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
Cocoa_GetDisplayName(CGDirectDisplayID displayID)
|
Cocoa_GetDisplayName(CGDirectDisplayID displayID)
|
||||||
{
|
{
|
||||||
|
@ -262,7 +208,7 @@ Cocoa_InitModes(_THIS)
|
||||||
SDL_VideoDisplay display;
|
SDL_VideoDisplay display;
|
||||||
SDL_DisplayData *displaydata;
|
SDL_DisplayData *displaydata;
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
const void *moderef = NULL;
|
CGDisplayModeRef moderef = NULL;
|
||||||
CVDisplayLinkRef link = NULL;
|
CVDisplayLinkRef link = NULL;
|
||||||
|
|
||||||
if (pass == 0) {
|
if (pass == 0) {
|
||||||
|
@ -279,15 +225,7 @@ Cocoa_InitModes(_THIS)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_SNOW_LEOPARD_OR_LATER()) {
|
moderef = CGDisplayCopyDisplayMode(displays[i]);
|
||||||
moderef = CGDisplayCopyDisplayMode(displays[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
|
||||||
if (!IS_SNOW_LEOPARD_OR_LATER()) {
|
|
||||||
moderef = CGDisplayCurrentMode(displays[i]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!moderef) {
|
if (!moderef) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -295,7 +233,7 @@ Cocoa_InitModes(_THIS)
|
||||||
|
|
||||||
displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata));
|
displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata));
|
||||||
if (!displaydata) {
|
if (!displaydata) {
|
||||||
Cocoa_ReleaseDisplayMode(_this, moderef);
|
CGDisplayModeRelease(moderef);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
displaydata->display = displays[i];
|
displaydata->display = displays[i];
|
||||||
|
@ -307,7 +245,7 @@ Cocoa_InitModes(_THIS)
|
||||||
display.name = (char *)Cocoa_GetDisplayName(displays[i]);
|
display.name = (char *)Cocoa_GetDisplayName(displays[i]);
|
||||||
if (!GetDisplayMode(_this, moderef, link, &mode)) {
|
if (!GetDisplayMode(_this, moderef, link, &mode)) {
|
||||||
CVDisplayLinkRelease(link);
|
CVDisplayLinkRelease(link);
|
||||||
Cocoa_ReleaseDisplayMode(_this, moderef);
|
CGDisplayModeRelease(moderef);
|
||||||
SDL_free(display.name);
|
SDL_free(display.name);
|
||||||
SDL_free(displaydata);
|
SDL_free(displaydata);
|
||||||
continue;
|
continue;
|
||||||
|
@ -396,17 +334,7 @@ void
|
||||||
Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
|
Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
|
SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
|
||||||
CFArrayRef modes = NULL;
|
CFArrayRef modes = CGDisplayCopyAllDisplayModes(data->display, NULL);
|
||||||
|
|
||||||
if (IS_SNOW_LEOPARD_OR_LATER()) {
|
|
||||||
modes = CGDisplayCopyAllDisplayModes(data->display, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
|
||||||
if (!IS_SNOW_LEOPARD_OR_LATER()) {
|
|
||||||
modes = CGDisplayAvailableModes(data->display);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (modes) {
|
if (modes) {
|
||||||
CVDisplayLinkRef link = NULL;
|
CVDisplayLinkRef link = NULL;
|
||||||
|
@ -416,37 +344,19 @@ Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
|
||||||
CVDisplayLinkCreateWithCGDisplay(data->display, &link);
|
CVDisplayLinkCreateWithCGDisplay(data->display, &link);
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
const void *moderef = CFArrayGetValueAtIndex(modes, i);
|
CGDisplayModeRef moderef = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
if (GetDisplayMode(_this, moderef, link, &mode)) {
|
if (GetDisplayMode(_this, moderef, link, &mode)) {
|
||||||
if (IS_SNOW_LEOPARD_OR_LATER()) {
|
CGDisplayModeRetain(moderef);
|
||||||
CGDisplayModeRetain((CGDisplayModeRef) moderef);
|
|
||||||
}
|
|
||||||
SDL_AddDisplayMode(display, &mode);
|
SDL_AddDisplayMode(display, &mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CVDisplayLinkRelease(link);
|
CVDisplayLinkRelease(link);
|
||||||
Cocoa_ReleaseDisplayModeList(_this, modes);
|
CFRelease(modes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static CGError
|
|
||||||
Cocoa_SwitchMode(_THIS, CGDirectDisplayID display, const void *mode)
|
|
||||||
{
|
|
||||||
if (IS_SNOW_LEOPARD_OR_LATER()) {
|
|
||||||
return CGDisplaySetDisplayMode(display, (CGDisplayModeRef) mode, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
|
||||||
if (!IS_SNOW_LEOPARD_OR_LATER()) {
|
|
||||||
return CGDisplaySwitchToMode(display, (CFDictionaryRef) mode);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return kCGErrorFailure;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
|
Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
|
||||||
{
|
{
|
||||||
|
@ -462,7 +372,7 @@ Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
|
||||||
|
|
||||||
if (data == display->desktop_mode.driverdata) {
|
if (data == display->desktop_mode.driverdata) {
|
||||||
/* Restoring desktop mode */
|
/* Restoring desktop mode */
|
||||||
Cocoa_SwitchMode(_this, displaydata->display, data->moderef);
|
CGDisplaySetDisplayMode(displaydata->display, data->moderef, NULL);
|
||||||
|
|
||||||
if (CGDisplayIsMain(displaydata->display)) {
|
if (CGDisplayIsMain(displaydata->display)) {
|
||||||
CGReleaseAllDisplays();
|
CGReleaseAllDisplays();
|
||||||
|
@ -487,7 +397,7 @@ Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do the physical switch */
|
/* Do the physical switch */
|
||||||
result = Cocoa_SwitchMode(_this, displaydata->display, data->moderef);
|
result = CGDisplaySetDisplayMode(displaydata->display, data->moderef, NULL);
|
||||||
if (result != kCGErrorSuccess) {
|
if (result != kCGErrorSuccess) {
|
||||||
CG_SetError("CGDisplaySwitchToMode()", result);
|
CG_SetError("CGDisplaySwitchToMode()", result);
|
||||||
goto ERR_NO_SWITCH;
|
goto ERR_NO_SWITCH;
|
||||||
|
@ -532,11 +442,11 @@ Cocoa_QuitModes(_THIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
mode = (SDL_DisplayModeData *) display->desktop_mode.driverdata;
|
mode = (SDL_DisplayModeData *) display->desktop_mode.driverdata;
|
||||||
Cocoa_ReleaseDisplayMode(_this, mode->moderef);
|
CGDisplayModeRelease(mode->moderef);
|
||||||
|
|
||||||
for (j = 0; j < display->num_display_modes; j++) {
|
for (j = 0; j < display->num_display_modes; j++) {
|
||||||
mode = (SDL_DisplayModeData*) display->display_modes[j].driverdata;
|
mode = (SDL_DisplayModeData*) display->display_modes[j].driverdata;
|
||||||
Cocoa_ReleaseDisplayMode(_this, mode->moderef);
|
CGDisplayModeRelease(mode->moderef);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,7 @@ Cocoa_CreateShaper(SDL_Window* window)
|
||||||
SDL_WindowData* windata = (SDL_WindowData*)window->driverdata;
|
SDL_WindowData* windata = (SDL_WindowData*)window->driverdata;
|
||||||
[windata->nswindow setOpaque:NO];
|
[windata->nswindow setOpaque:NO];
|
||||||
|
|
||||||
if ([windata->nswindow respondsToSelector:@selector(setStyleMask:)]) {
|
[windata->nswindow setStyleMask:NSBorderlessWindowMask];
|
||||||
[windata->nswindow setStyleMask:NSBorderlessWindowMask];
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_WindowShaper* result = result = malloc(sizeof(SDL_WindowShaper));
|
SDL_WindowShaper* result = result = malloc(sizeof(SDL_WindowShaper));
|
||||||
result->window = window;
|
result->window = window;
|
||||||
|
|
|
@ -138,10 +138,7 @@
|
||||||
NSURL *fileURL = [[NSURL fileURLWithPath:path] autorelease];
|
NSURL *fileURL = [[NSURL fileURLWithPath:path] autorelease];
|
||||||
NSNumber *isAlias = nil;
|
NSNumber *isAlias = nil;
|
||||||
|
|
||||||
/* Functionality for resolving URL aliases was added with OS X 10.6. */
|
[fileURL getResourceValue:&isAlias forKey:NSURLIsAliasFileKey error:nil];
|
||||||
if ([fileURL respondsToSelector:@selector(getResourceValue:forKey:error:)]) {
|
|
||||||
[fileURL getResourceValue:&isAlias forKey:NSURLIsAliasFileKey error:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If the URL is an alias, resolve it. */
|
/* If the URL is an alias, resolve it. */
|
||||||
if ([isAlias boolValue]) {
|
if ([isAlias boolValue]) {
|
||||||
|
@ -218,10 +215,10 @@ GetHintCtrlClickEmulateRightClick()
|
||||||
return hint != NULL && *hint != '0';
|
return hint != NULL && *hint != '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int
|
static NSUInteger
|
||||||
GetWindowStyle(SDL_Window * window)
|
GetWindowStyle(SDL_Window * window)
|
||||||
{
|
{
|
||||||
unsigned int style;
|
NSUInteger style = 0;
|
||||||
|
|
||||||
if (window->flags & SDL_WINDOW_FULLSCREEN) {
|
if (window->flags & SDL_WINDOW_FULLSCREEN) {
|
||||||
style = NSBorderlessWindowMask;
|
style = NSBorderlessWindowMask;
|
||||||
|
@ -239,21 +236,17 @@ GetWindowStyle(SDL_Window * window)
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_bool
|
static SDL_bool
|
||||||
SetWindowStyle(SDL_Window * window, unsigned int style)
|
SetWindowStyle(SDL_Window * window, NSUInteger style)
|
||||||
{
|
{
|
||||||
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
||||||
NSWindow *nswindow = data->nswindow;
|
NSWindow *nswindow = data->nswindow;
|
||||||
|
|
||||||
if (![nswindow respondsToSelector: @selector(setStyleMask:)]) {
|
|
||||||
return SDL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The view responder chain gets messed with during setStyleMask */
|
/* The view responder chain gets messed with during setStyleMask */
|
||||||
if ([[nswindow contentView] nextResponder] == data->listener) {
|
if ([[nswindow contentView] nextResponder] == data->listener) {
|
||||||
[[nswindow contentView] setNextResponder:nil];
|
[[nswindow contentView] setNextResponder:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
[nswindow performSelector: @selector(setStyleMask:) withObject: (id)(uintptr_t)style];
|
[nswindow setStyleMask:style];
|
||||||
|
|
||||||
/* The view responder chain gets messed with during setStyleMask */
|
/* The view responder chain gets messed with during setStyleMask */
|
||||||
if ([[nswindow contentView] nextResponder] != data->listener) {
|
if ([[nswindow contentView] nextResponder] != data->listener) {
|
||||||
|
@ -317,9 +310,7 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
|
||||||
|
|
||||||
[view setNextResponder:self];
|
[view setNextResponder:self];
|
||||||
|
|
||||||
if ([view respondsToSelector:@selector(setAcceptsTouchEvents:)]) {
|
[view setAcceptsTouchEvents:YES];
|
||||||
[view setAcceptsTouchEvents:YES];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)observeValueForKeyPath:(NSString *)keyPath
|
- (void)observeValueForKeyPath:(NSString *)keyPath
|
||||||
|
@ -604,12 +595,9 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
|
||||||
[NSMenu setMenuBarVisible:NO];
|
[NSMenu setMenuBarVisible:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* On pre-10.6, you might have the capslock key state wrong now because we can't check here. */
|
const unsigned int newflags = [NSEvent modifierFlags] & NSAlphaShiftKeyMask;
|
||||||
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_6) {
|
_data->videodata->modifierFlags = (_data->videodata->modifierFlags & ~NSAlphaShiftKeyMask) | newflags;
|
||||||
const unsigned int newflags = [NSEvent modifierFlags] & NSAlphaShiftKeyMask;
|
SDL_ToggleModState(KMOD_CAPS, newflags != 0);
|
||||||
_data->videodata->modifierFlags = (_data->videodata->modifierFlags & ~NSAlphaShiftKeyMask) | newflags;
|
|
||||||
SDL_ToggleModState(KMOD_CAPS, newflags != 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidResignKey:(NSNotification *)aNotification
|
- (void)windowDidResignKey:(NSNotification *)aNotification
|
||||||
|
@ -1483,27 +1471,6 @@ Cocoa_RestoreWindow(_THIS, SDL_Window * window)
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
static NSWindow *
|
|
||||||
Cocoa_RebuildWindow(SDL_WindowData * data, NSWindow * nswindow, unsigned style)
|
|
||||||
{
|
|
||||||
if (!data->created) {
|
|
||||||
/* Don't mess with other people's windows... */
|
|
||||||
return nswindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
[data->listener close];
|
|
||||||
data->nswindow = [[SDLWindow alloc] initWithContentRect:[[nswindow contentView] frame] styleMask:style backing:NSBackingStoreBuffered defer:NO screen:[nswindow screen]];
|
|
||||||
[data->nswindow setContentView:[nswindow contentView]];
|
|
||||||
[data->nswindow registerForDraggedTypes:[NSArray arrayWithObject:(NSString *)kUTTypeFileURL]];
|
|
||||||
/* See comment in SetupWindowData. */
|
|
||||||
[data->nswindow setOneShot:NO];
|
|
||||||
[data->listener listen:data];
|
|
||||||
|
|
||||||
[nswindow close];
|
|
||||||
|
|
||||||
return data->nswindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
|
Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
|
||||||
{ @autoreleasepool
|
{ @autoreleasepool
|
||||||
|
@ -1545,11 +1512,7 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display
|
||||||
rect.origin.y += (screenRect.size.height - rect.size.height);
|
rect.origin.y += (screenRect.size.height - rect.size.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([nswindow respondsToSelector: @selector(setStyleMask:)]) {
|
[nswindow setStyleMask:NSBorderlessWindowMask];
|
||||||
[nswindow performSelector: @selector(setStyleMask:) withObject: (id)NSBorderlessWindowMask];
|
|
||||||
} else {
|
|
||||||
nswindow = Cocoa_RebuildWindow(data, nswindow, NSBorderlessWindowMask);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
rect.origin.x = window->windowed.x;
|
rect.origin.x = window->windowed.x;
|
||||||
rect.origin.y = window->windowed.y;
|
rect.origin.y = window->windowed.y;
|
||||||
|
@ -1557,16 +1520,12 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display
|
||||||
rect.size.height = window->windowed.h;
|
rect.size.height = window->windowed.h;
|
||||||
ConvertNSRect([nswindow screen], fullscreen, &rect);
|
ConvertNSRect([nswindow screen], fullscreen, &rect);
|
||||||
|
|
||||||
if ([nswindow respondsToSelector: @selector(setStyleMask:)]) {
|
[nswindow setStyleMask:GetWindowStyle(window)];
|
||||||
[nswindow performSelector: @selector(setStyleMask:) withObject: (id)(uintptr_t)GetWindowStyle(window)];
|
|
||||||
|
|
||||||
/* Hack to restore window decorations on Mac OS X 10.10 */
|
/* Hack to restore window decorations on Mac OS X 10.10 */
|
||||||
NSRect frameRect = [nswindow frame];
|
NSRect frameRect = [nswindow frame];
|
||||||
[nswindow setFrame:NSMakeRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width + 1, frameRect.size.height) display:NO];
|
[nswindow setFrame:NSMakeRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width + 1, frameRect.size.height) display:NO];
|
||||||
[nswindow setFrame:frameRect display:NO];
|
[nswindow setFrame:frameRect display:NO];
|
||||||
} else {
|
|
||||||
nswindow = Cocoa_RebuildWindow(data, nswindow, GetWindowStyle(window));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The view responder chain gets messed with during setStyleMask */
|
/* The view responder chain gets messed with during setStyleMask */
|
||||||
|
|
Loading…
Reference in New Issue