Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
1ea43749
Commit
1ea43749
authored
Aug 23, 2011
by
Ryan C. Gordon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned out functions deprecated in Mac OS X 10.6 SDK.
parent
51254fce
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
197 additions
and
64 deletions
+197
-64
SDL_coreaudio.c
src/audio/coreaudio/SDL_coreaudio.c
+39
-28
SDL_cocoamodes.h
src/video/cocoa/SDL_cocoamodes.h
+1
-1
SDL_cocoamodes.m
src/video/cocoa/SDL_cocoamodes.m
+157
-35
No files found.
src/audio/coreaudio/SDL_coreaudio.c
View file @
1ea43749
...
@@ -67,16 +67,20 @@ findDevId(const char *name, AudioDeviceID devId, void *_data)
...
@@ -67,16 +67,20 @@ findDevId(const char *name, AudioDeviceID devId, void *_data)
static
void
static
void
build_device_list
(
int
iscapture
,
addDevFn
addfn
,
void
*
addfndata
)
build_device_list
(
int
iscapture
,
addDevFn
addfn
,
void
*
addfndata
)
{
{
Boolean
outWritable
=
0
;
OSStatus
result
=
noErr
;
OSStatus
result
=
noErr
;
UInt32
size
=
0
;
UInt32
size
=
0
;
AudioDeviceID
*
devs
=
NULL
;
AudioDeviceID
*
devs
=
NULL
;
UInt32
i
=
0
;
UInt32
i
=
0
;
UInt32
max
=
0
;
UInt32
max
=
0
;
result
=
AudioHardwareGetPropertyInfo
(
kAudioHardwarePropertyDevices
,
AudioObjectPropertyAddress
addr
=
{
&
size
,
&
outWritable
);
kAudioHardwarePropertyDevices
,
kAudioObjectPropertyScopeGlobal
,
kAudioObjectPropertyElementMaster
};
result
=
AudioObjectGetPropertyDataSize
(
kAudioObjectSystemObject
,
&
addr
,
0
,
NULL
,
&
size
);
if
(
result
!=
kAudioHardwareNoError
)
if
(
result
!=
kAudioHardwareNoError
)
return
;
return
;
...
@@ -84,8 +88,8 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata)
...
@@ -84,8 +88,8 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata)
if
(
devs
==
NULL
)
if
(
devs
==
NULL
)
return
;
return
;
result
=
Audio
HardwareGetProperty
(
kAudioHardwarePropertyDevices
,
result
=
Audio
ObjectGetPropertyData
(
kAudioObjectSystemObject
,
&
addr
,
&
size
,
devs
);
0
,
NULL
,
&
size
,
devs
);
if
(
result
!=
kAudioHardwareNoError
)
if
(
result
!=
kAudioHardwareNoError
)
return
;
return
;
...
@@ -98,9 +102,11 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata)
...
@@ -98,9 +102,11 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata)
int
usable
=
0
;
int
usable
=
0
;
CFIndex
len
=
0
;
CFIndex
len
=
0
;
result
=
AudioDeviceGetPropertyInfo
(
dev
,
0
,
iscapture
,
addr
.
mScope
=
iscapture
?
kAudioDevicePropertyScopeInput
:
kAudioDevicePropertyStreamConfiguration
,
kAudioDevicePropertyScopeOutput
;
&
size
,
&
outWritable
);
addr
.
mSelector
=
kAudioDevicePropertyStreamConfiguration
;
result
=
AudioObjectGetPropertyDataSize
(
dev
,
&
addr
,
0
,
NULL
,
&
size
);
if
(
result
!=
noErr
)
if
(
result
!=
noErr
)
continue
;
continue
;
...
@@ -108,8 +114,7 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata)
...
@@ -108,8 +114,7 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata)
if
(
buflist
==
NULL
)
if
(
buflist
==
NULL
)
continue
;
continue
;
result
=
AudioDeviceGetProperty
(
dev
,
0
,
iscapture
,
result
=
AudioObjectGetPropertyData
(
dev
,
&
addr
,
0
,
NULL
,
kAudioDevicePropertyStreamConfiguration
,
&
size
,
buflist
);
&
size
,
buflist
);
if
(
result
==
noErr
)
{
if
(
result
==
noErr
)
{
...
@@ -127,11 +132,9 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata)
...
@@ -127,11 +132,9 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata)
if
(
!
usable
)
if
(
!
usable
)
continue
;
continue
;
size
=
sizeof
(
CFStringRef
);
addr
.
mSelector
=
kAudioObjectPropertyName
;
result
=
AudioDeviceGetProperty
(
dev
,
0
,
iscapture
,
size
=
sizeof
(
CFStringRef
);
kAudioDevicePropertyDeviceNameCFString
,
result
=
AudioObjectGetPropertyData
(
dev
,
&
addr
,
0
,
NULL
,
&
size
,
&
cfstr
);
&
size
,
&
cfstr
);
if
(
result
!=
kAudioHardwareNoError
)
if
(
result
!=
kAudioHardwareNoError
)
continue
;
continue
;
...
@@ -183,13 +186,19 @@ find_device_by_name(_THIS, const char *devname, int iscapture)
...
@@ -183,13 +186,19 @@ find_device_by_name(_THIS, const char *devname, int iscapture)
UInt32
alive
=
0
;
UInt32
alive
=
0
;
pid_t
pid
=
0
;
pid_t
pid
=
0
;
AudioObjectPropertyAddress
addr
=
{
0
,
kAudioObjectPropertyScopeGlobal
,
kAudioObjectPropertyElementMaster
};
if
(
devname
==
NULL
)
{
if
(
devname
==
NULL
)
{
size
=
sizeof
(
AudioDeviceID
);
size
=
sizeof
(
AudioDeviceID
);
const
AudioHardwarePropertyID
propid
=
addr
.
mSelector
=
((
iscapture
)
?
kAudioHardwarePropertyDefaultInputDevice
:
((
iscapture
)
?
kAudioHardwarePropertyDefaultInputDevice
:
kAudioHardwarePropertyDefaultOutputDevice
);
kAudioHardwarePropertyDefaultOutputDevice
);
result
=
AudioObjectGetPropertyData
(
kAudioObjectSystemObject
,
&
addr
,
result
=
AudioHardwareGetProperty
(
propid
,
&
size
,
&
devid
);
0
,
NULL
,
&
size
,
&
devid
);
CHECK_RESULT
(
"AudioHardwareGetProperty (default device)"
);
CHECK_RESULT
(
"AudioHardwareGetProperty (default device)"
);
}
else
{
}
else
{
FindDevIdData
data
;
FindDevIdData
data
;
...
@@ -203,10 +212,12 @@ find_device_by_name(_THIS, const char *devname, int iscapture)
...
@@ -203,10 +212,12 @@ find_device_by_name(_THIS, const char *devname, int iscapture)
devid
=
data
.
devId
;
devid
=
data
.
devId
;
}
}
size
=
sizeof
(
alive
);
addr
.
mSelector
=
kAudioDevicePropertyDeviceIsAlive
;
result
=
AudioDeviceGetProperty
(
devid
,
0
,
iscapture
,
addr
.
mScope
=
iscapture
?
kAudioDevicePropertyScopeInput
:
kAudioDevicePropertyDeviceIsAlive
,
kAudioDevicePropertyScopeOutput
;
&
size
,
&
alive
);
size
=
sizeof
(
alive
);
result
=
AudioObjectGetPropertyData
(
devid
,
&
addr
,
0
,
NULL
,
&
size
,
&
alive
);
CHECK_RESULT
CHECK_RESULT
(
"AudioDeviceGetProperty (kAudioDevicePropertyDeviceIsAlive)"
);
(
"AudioDeviceGetProperty (kAudioDevicePropertyDeviceIsAlive)"
);
...
@@ -215,9 +226,9 @@ find_device_by_name(_THIS, const char *devname, int iscapture)
...
@@ -215,9 +226,9 @@ find_device_by_name(_THIS, const char *devname, int iscapture)
return
0
;
return
0
;
}
}
size
=
sizeof
(
pid
)
;
addr
.
mSelector
=
kAudioDevicePropertyHogMode
;
result
=
AudioDeviceGetProperty
(
devid
,
0
,
iscapture
,
size
=
sizeof
(
pid
);
kAudioDevicePropertyHogMode
,
&
size
,
&
pid
);
result
=
AudioObjectGetPropertyData
(
devid
,
&
addr
,
0
,
NULL
,
&
size
,
&
pid
);
/* some devices don't support this property, so errors are fine here. */
/* some devices don't support this property, so errors are fine here. */
if
((
result
==
noErr
)
&&
(
pid
!=
-
1
))
{
if
((
result
==
noErr
)
&&
(
pid
!=
-
1
))
{
...
...
src/video/cocoa/SDL_cocoamodes.h
View file @
1ea43749
...
@@ -30,7 +30,7 @@ typedef struct
...
@@ -30,7 +30,7 @@ typedef struct
typedef
struct
typedef
struct
{
{
CFDictionaryRef
moderef
;
const
void
*
moderef
;
}
SDL_DisplayModeData
;
}
SDL_DisplayModeData
;
extern
void
Cocoa_InitModes
(
_THIS
);
extern
void
Cocoa_InitModes
(
_THIS
);
...
...
src/video/cocoa/SDL_cocoamodes.m
View file @
1ea43749
...
@@ -22,6 +22,14 @@
...
@@ -22,6 +22,14 @@
#include "SDL_cocoavideo.h"
#include "SDL_cocoavideo.h"
/* !!! FIXME: clean out the pre-10.6 code when it makes sense to do so. */
#define FORCE_OLD_API 0 || (MAC_OS_X_VERSION_MAX_ALLOWED < 1060)
#if FORCE_OLD_API
#undef MAC_OS_X_VERSION_MIN_REQUIRED
#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_5
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
/*
/*
Add methods to get at private members of NSScreen.
Add methods to get at private members of NSScreen.
...
@@ -42,6 +50,16 @@
...
@@ -42,6 +50,16 @@
@end
@end
#endif
#endif
static
inline
BOOL
IS_SNOW_LEOPARD_OR_LATER
(
_THIS
)
{
#if FORCE_OLD_API
return
NO
;
#else
return
((((
SDL_VideoData
*
)
_this
->
driverdata
))
->
osversion
>=
0x1060
);
#endif
}
static
void
static
void
CG_SetError
(
const
char
*
prefix
,
CGDisplayErr
result
)
CG_SetError
(
const
char
*
prefix
,
CGDisplayErr
result
)
{
{
...
@@ -92,7 +110,7 @@ CG_SetError(const char *prefix, CGDisplayErr result)
...
@@ -92,7 +110,7 @@ CG_SetError(const char *prefix, CGDisplayErr result)
}
}
static
SDL_bool
static
SDL_bool
GetDisplayMode
(
CFDictionaryRef
moderef
,
SDL_DisplayMode
*
mode
)
GetDisplayMode
(
_THIS
,
const
void
*
moderef
,
SDL_DisplayMode
*
mode
)
{
{
SDL_DisplayModeData
*
data
;
SDL_DisplayModeData
*
data
;
CFNumberRef
number
;
CFNumberRef
number
;
...
@@ -104,26 +122,53 @@ GetDisplayMode(CFDictionaryRef moderef, SDL_DisplayMode *mode)
...
@@ -104,26 +122,53 @@ GetDisplayMode(CFDictionaryRef moderef, SDL_DisplayMode *mode)
}
}
data
->
moderef
=
moderef
;
data
->
moderef
=
moderef
;
number
=
CFDictionaryGetValue
(
moderef
,
kCGDisplayWidth
);
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
if
(
IS_SNOW_LEOPARD_OR_LATER
(
_this
))
{
CGDisplayModeRef
vidmode
=
(
CGDisplayModeRef
)
moderef
;
CFStringRef
fmt
=
CGDisplayModeCopyPixelEncoding
(
vidmode
);
width
=
(
long
)
CGDisplayModeGetWidth
(
vidmode
);
height
=
(
long
)
CGDisplayModeGetHeight
(
vidmode
);
refreshRate
=
(
long
)
CGDisplayModeGetRefreshRate
(
vidmode
);
if
(
CFStringCompare
(
fmt
,
CFSTR
(
IO32BitDirectPixels
),
kCFCompareCaseInsensitive
)
==
kCFCompareEqualTo
)
{
bpp
=
32
;
}
else
if
(
CFStringCompare
(
fmt
,
CFSTR
(
IO16BitDirectPixels
),
kCFCompareCaseInsensitive
)
==
kCFCompareEqualTo
)
{
bpp
=
16
;
}
else
{
bpp
=
0
;
/* ignore 8-bit and such for now. */
}
CFRelease
(
fmt
);
}
#endif
#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6)
if
(
!
IS_SNOW_LEOPARD_OR_LATER
(
_this
))
{
CFDictionaryRef
vidmode
=
(
CFDictionaryRef
)
moderef
;
number
=
CFDictionaryGetValue
(
vidmode
,
kCGDisplayWidth
);
CFNumberGetValue
(
number
,
kCFNumberLongType
,
&
width
);
CFNumberGetValue
(
number
,
kCFNumberLongType
,
&
width
);
number
=
CFDictionaryGetValue
(
moderef
,
kCGDisplayHeight
);
number
=
CFDictionaryGetValue
(
vidmode
,
kCGDisplayHeight
);
CFNumberGetValue
(
number
,
kCFNumberLongType
,
&
height
);
CFNumberGetValue
(
number
,
kCFNumberLongType
,
&
height
);
number
=
CFDictionaryGetValue
(
moderef
,
kCGDisplayBitsPerPixel
);
number
=
CFDictionaryGetValue
(
vidmode
,
kCGDisplayBitsPerPixel
);
CFNumberGetValue
(
number
,
kCFNumberLongType
,
&
bpp
);
CFNumberGetValue
(
number
,
kCFNumberLongType
,
&
bpp
);
number
=
CFDictionaryGetValue
(
moderef
,
kCGDisplayRefreshRate
);
number
=
CFDictionaryGetValue
(
vidmode
,
kCGDisplayRefreshRate
);
CFNumberGetValue
(
number
,
kCFNumberLongType
,
&
refreshRate
);
CFNumberGetValue
(
number
,
kCFNumberLongType
,
&
refreshRate
);
}
#endif
mode
->
format
=
SDL_PIXELFORMAT_UNKNOWN
;
mode
->
format
=
SDL_PIXELFORMAT_UNKNOWN
;
switch
(
bpp
)
{
switch
(
bpp
)
{
case
8
:
/* We don't support palettized modes now */
return
SDL_FALSE
;
case
16
:
case
16
:
mode
->
format
=
SDL_PIXELFORMAT_ARGB1555
;
mode
->
format
=
SDL_PIXELFORMAT_ARGB1555
;
break
;
break
;
case
32
:
case
32
:
mode
->
format
=
SDL_PIXELFORMAT_ARGB8888
;
mode
->
format
=
SDL_PIXELFORMAT_ARGB8888
;
break
;
break
;
case
8
:
/* We don't support palettized modes now */
default
:
/* Totally unrecognizable bit depth. */
return
SDL_FALSE
;
}
}
mode
->
w
=
width
;
mode
->
w
=
width
;
mode
->
h
=
height
;
mode
->
h
=
height
;
...
@@ -132,6 +177,28 @@ GetDisplayMode(CFDictionaryRef moderef, SDL_DisplayMode *mode)
...
@@ -132,6 +177,28 @@ GetDisplayMode(CFDictionaryRef moderef, SDL_DisplayMode *mode)
return
SDL_TRUE
;
return
SDL_TRUE
;
}
}
static
inline
void
Cocoa_ReleaseDisplayMode
(
_THIS
,
const
void
*
moderef
)
{
/* We don't own moderef unless we use the 10.6+ APIs. */
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
if
(
IS_SNOW_LEOPARD_OR_LATER
(
_this
))
{
CGDisplayModeRelease
((
CGDisplayModeRef
)
moderef
);
/* NULL is ok */
}
#endif
}
static
inline
void
Cocoa_ReleaseDisplayModeList
(
_THIS
,
CFArrayRef
modelist
)
{
/* We don't own modelis unless we use the 10.6+ APIs. */
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
if
(
IS_SNOW_LEOPARD_OR_LATER
(
_this
))
{
CFRelease
(
modelist
);
/* NULL is ok */
}
#endif
}
void
void
Cocoa_InitModes
(
_THIS
)
Cocoa_InitModes
(
_THIS
)
{
{
...
@@ -159,7 +226,7 @@ Cocoa_InitModes(_THIS)
...
@@ -159,7 +226,7 @@ Cocoa_InitModes(_THIS)
SDL_VideoDisplay
display
;
SDL_VideoDisplay
display
;
SDL_DisplayData
*
displaydata
;
SDL_DisplayData
*
displaydata
;
SDL_DisplayMode
mode
;
SDL_DisplayMode
mode
;
CFDictionaryRef
moderef
;
const
void
*
moderef
=
NULL
;
if
(
pass
==
0
)
{
if
(
pass
==
0
)
{
if
(
!
CGDisplayIsMain
(
displays
[
i
]))
{
if
(
!
CGDisplayIsMain
(
displays
[
i
]))
{
...
@@ -174,22 +241,37 @@ Cocoa_InitModes(_THIS)
...
@@ -174,22 +241,37 @@ Cocoa_InitModes(_THIS)
if
(
CGDisplayMirrorsDisplay
(
displays
[
i
])
!=
kCGNullDirectDisplay
)
{
if
(
CGDisplayMirrorsDisplay
(
displays
[
i
])
!=
kCGNullDirectDisplay
)
{
continue
;
continue
;
}
}
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
if
(
IS_SNOW_LEOPARD_OR_LATER
(
_this
))
{
moderef
=
CGDisplayCopyDisplayMode
(
displays
[
i
]);
}
#endif
#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6)
if
(
!
IS_SNOW_LEOPARD_OR_LATER
(
_this
))
{
moderef
=
CGDisplayCurrentMode
(
displays
[
i
]);
moderef
=
CGDisplayCurrentMode
(
displays
[
i
]);
}
#endif
if
(
!
moderef
)
{
if
(
!
moderef
)
{
continue
;
continue
;
}
}
displaydata
=
(
SDL_DisplayData
*
)
SDL_malloc
(
sizeof
(
*
displaydata
));
displaydata
=
(
SDL_DisplayData
*
)
SDL_malloc
(
sizeof
(
*
displaydata
));
if
(
!
displaydata
)
{
if
(
!
displaydata
)
{
Cocoa_ReleaseDisplayMode
(
_this
,
moderef
);
continue
;
continue
;
}
}
displaydata
->
display
=
displays
[
i
];
displaydata
->
display
=
displays
[
i
];
SDL_zero
(
display
);
SDL_zero
(
display
);
if
(
!
GetDisplayMode
(
moderef
,
&
mode
))
{
if
(
!
GetDisplayMode
(
_this
,
moderef
,
&
mode
))
{
Cocoa_ReleaseDisplayMode
(
_this
,
moderef
);
SDL_free
(
displaydata
);
SDL_free
(
displaydata
);
continue
;
continue
;
}
}
display
.
desktop_mode
=
mode
;
display
.
desktop_mode
=
mode
;
display
.
current_mode
=
mode
;
display
.
current_mode
=
mode
;
display
.
driverdata
=
displaydata
;
display
.
driverdata
=
displaydata
;
...
@@ -213,31 +295,61 @@ Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
...
@@ -213,31 +295,61 @@ Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
return
0
;
return
0
;
}
}
static
void
void
AddDisplayMode
(
const
void
*
moderef
,
void
*
context
)
Cocoa_GetDisplayModes
(
_THIS
,
SDL_VideoDisplay
*
display
)
{
{
SDL_VideoDisplay
*
display
=
(
SDL_VideoDisplay
*
)
context
;
SDL_DisplayData
*
data
=
(
SDL_DisplayData
*
)
display
->
driverdata
;
SDL_DisplayMode
mode
;
CFArrayRef
modes
=
NULL
;
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
if
(
IS_SNOW_LEOPARD_OR_LATER
(
_this
))
{
modes
=
CGDisplayCopyAllDisplayModes
(
data
->
display
,
NULL
);
}
#endif
#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6)
if
(
!
IS_SNOW_LEOPARD_OR_LATER
(
_this
))
{
modes
=
CGDisplayAvailableModes
(
data
->
display
);
}
#endif
if
(
GetDisplayMode
(
moderef
,
&
mode
))
{
if
(
modes
)
{
const
CFIndex
count
=
CFArrayGetCount
(
modes
);
CFIndex
i
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
const
void
*
moderef
=
CFArrayGetValueAtIndex
(
modes
,
i
);
SDL_DisplayMode
mode
;
if
(
GetDisplayMode
(
_this
,
moderef
,
&
mode
))
{
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
if
(
IS_SNOW_LEOPARD_OR_LATER
(
_this
))
{
CGDisplayModeRetain
((
CGDisplayModeRef
)
moderef
);
}
#endif
SDL_AddDisplayMode
(
display
,
&
mode
);
SDL_AddDisplayMode
(
display
,
&
mode
);
}
}
}
Cocoa_ReleaseDisplayModeList
(
_this
,
modes
);
}
}
}
void
static
CGError
Cocoa_
GetDisplayModes
(
_THIS
,
SDL_VideoDisplay
*
display
)
Cocoa_
SwitchMode
(
_THIS
,
CGDirectDisplayID
display
,
const
void
*
mode
)
{
{
SDL_DisplayData
*
data
=
(
SDL_DisplayData
*
)
display
->
driverdata
;
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
CFArrayRef
modes
;
if
(
IS_SNOW_LEOPARD_OR_LATER
(
_this
))
{
CFRange
range
;
return
CGDisplaySetDisplayMode
(
display
,
(
CGDisplayModeRef
)
mode
,
NULL
);
}
#endif
modes
=
CGDisplayAvailableModes
(
data
->
display
);
#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6)
if
(
!
modes
)
{
if
(
!
IS_SNOW_LEOPARD_OR_LATER
(
_this
)
)
{
return
;
return
CGDisplaySwitchToMode
(
display
,
(
CFDictionaryRef
)
mode
)
;
}
}
range
.
location
=
0
;
#endif
range
.
length
=
CFArrayGetCount
(
modes
);
CFArrayApplyFunction
(
modes
,
range
,
AddDisplayMode
,
display
)
;
return
kCGErrorFailure
;
}
}
int
int
...
@@ -255,7 +367,7 @@ Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
...
@@ -255,7 +367,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 */
C
GDisplaySwitchToMode
(
displaydata
->
display
,
data
->
moderef
);
C
ocoa_SwitchMode
(
_this
,
displaydata
->
display
,
data
->
moderef
);
if
(
CGDisplayIsMain
(
displaydata
->
display
))
{
if
(
CGDisplayIsMain
(
displaydata
->
display
))
{
CGReleaseAllDisplays
();
CGReleaseAllDisplays
();
...
@@ -280,7 +392,7 @@ Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
...
@@ -280,7 +392,7 @@ Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
}
}
/* Do the physical switch */
/* Do the physical switch */
result
=
C
GDisplaySwitchToMode
(
displaydata
->
display
,
data
->
moderef
);
result
=
C
ocoa_SwitchMode
(
_this
,
displaydata
->
display
,
data
->
moderef
);
if
(
result
!=
kCGErrorSuccess
)
{
if
(
result
!=
kCGErrorSuccess
)
{
CG_SetError
(
"CGDisplaySwitchToMode()"
,
result
);
CG_SetError
(
"CGDisplaySwitchToMode()"
,
result
);
goto
ERR_NO_SWITCH
;
goto
ERR_NO_SWITCH
;
...
@@ -314,14 +426,24 @@ ERR_NO_CAPTURE:
...
@@ -314,14 +426,24 @@ ERR_NO_CAPTURE:
void
void
Cocoa_QuitModes
(
_THIS
)
Cocoa_QuitModes
(
_THIS
)
{
{
int
i
;
int
i
,
j
;
for
(
i
=
0
;
i
<
_this
->
num_displays
;
++
i
)
{
for
(
i
=
0
;
i
<
_this
->
num_displays
;
++
i
)
{
SDL_VideoDisplay
*
display
=
&
_this
->
displays
[
i
];
SDL_VideoDisplay
*
display
=
&
_this
->
displays
[
i
];
SDL_DisplayModeData
*
mode
;
if
(
display
->
current_mode
.
driverdata
!=
display
->
desktop_mode
.
driverdata
)
{
if
(
display
->
current_mode
.
driverdata
!=
display
->
desktop_mode
.
driverdata
)
{
Cocoa_SetDisplayMode
(
_this
,
display
,
&
display
->
desktop_mode
);
Cocoa_SetDisplayMode
(
_this
,
display
,
&
display
->
desktop_mode
);
}
}
mode
=
(
SDL_DisplayModeData
*
)
display
->
desktop_mode
.
driverdata
;
Cocoa_ReleaseDisplayMode
(
_this
,
mode
->
moderef
);
for
(
j
=
0
;
j
<
display
->
num_display_modes
;
j
++
)
{
mode
=
(
SDL_DisplayModeData
*
)
display
->
display_modes
[
j
].
driverdata
;
Cocoa_ReleaseDisplayMode
(
_this
,
mode
->
moderef
);
}
}
}
ShowMenuBar
();
ShowMenuBar
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment