Merge pull request #95854 from akien-mga/xcode-warnings
macOS/iOS: Fix various warnings when targeting newer SDKs
This commit is contained in:
commit
826de7976a
5 changed files with 38 additions and 16 deletions
|
@ -66,6 +66,11 @@ OSStatus AudioDriverCoreAudio::output_device_address_cb(AudioObjectID inObjectID
|
||||||
|
|
||||||
return noErr;
|
return noErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Switch to kAudioObjectPropertyElementMain everywhere to remove deprecated warnings.
|
||||||
|
#if (TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED < 120000) || (TARGET_OS_IOS && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000)
|
||||||
|
#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Error AudioDriverCoreAudio::init() {
|
Error AudioDriverCoreAudio::init() {
|
||||||
|
@ -89,7 +94,7 @@ Error AudioDriverCoreAudio::init() {
|
||||||
AudioObjectPropertyAddress prop;
|
AudioObjectPropertyAddress prop;
|
||||||
prop.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
|
prop.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
|
||||||
prop.mScope = kAudioObjectPropertyScopeGlobal;
|
prop.mScope = kAudioObjectPropertyScopeGlobal;
|
||||||
prop.mElement = kAudioObjectPropertyElementMaster;
|
prop.mElement = kAudioObjectPropertyElementMain;
|
||||||
|
|
||||||
result = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &prop, &output_device_address_cb, this);
|
result = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &prop, &output_device_address_cb, this);
|
||||||
ERR_FAIL_COND_V(result != noErr, FAILED);
|
ERR_FAIL_COND_V(result != noErr, FAILED);
|
||||||
|
@ -319,7 +324,7 @@ void AudioDriverCoreAudio::finish() {
|
||||||
AudioObjectPropertyAddress prop;
|
AudioObjectPropertyAddress prop;
|
||||||
prop.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
|
prop.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
|
||||||
prop.mScope = kAudioObjectPropertyScopeGlobal;
|
prop.mScope = kAudioObjectPropertyScopeGlobal;
|
||||||
prop.mElement = kAudioObjectPropertyElementMaster;
|
prop.mElement = kAudioObjectPropertyElementMain;
|
||||||
|
|
||||||
result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &prop, &output_device_address_cb, this);
|
result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &prop, &output_device_address_cb, this);
|
||||||
if (result != noErr) {
|
if (result != noErr) {
|
||||||
|
@ -358,7 +363,7 @@ Error AudioDriverCoreAudio::init_input_device() {
|
||||||
AudioObjectPropertyAddress prop;
|
AudioObjectPropertyAddress prop;
|
||||||
prop.mSelector = kAudioHardwarePropertyDefaultInputDevice;
|
prop.mSelector = kAudioHardwarePropertyDefaultInputDevice;
|
||||||
prop.mScope = kAudioObjectPropertyScopeGlobal;
|
prop.mScope = kAudioObjectPropertyScopeGlobal;
|
||||||
prop.mElement = kAudioObjectPropertyElementMaster;
|
prop.mElement = kAudioObjectPropertyElementMain;
|
||||||
|
|
||||||
result = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &prop, &input_device_address_cb, this);
|
result = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &prop, &input_device_address_cb, this);
|
||||||
ERR_FAIL_COND_V(result != noErr, FAILED);
|
ERR_FAIL_COND_V(result != noErr, FAILED);
|
||||||
|
@ -375,7 +380,7 @@ Error AudioDriverCoreAudio::init_input_device() {
|
||||||
#ifdef MACOS_ENABLED
|
#ifdef MACOS_ENABLED
|
||||||
AudioDeviceID deviceId;
|
AudioDeviceID deviceId;
|
||||||
size = sizeof(AudioDeviceID);
|
size = sizeof(AudioDeviceID);
|
||||||
AudioObjectPropertyAddress property = { kAudioHardwarePropertyDefaultInputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
|
AudioObjectPropertyAddress property = { kAudioHardwarePropertyDefaultInputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMain };
|
||||||
|
|
||||||
result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &property, 0, nullptr, &size, &deviceId);
|
result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &property, 0, nullptr, &size, &deviceId);
|
||||||
ERR_FAIL_COND_V(result != noErr, FAILED);
|
ERR_FAIL_COND_V(result != noErr, FAILED);
|
||||||
|
@ -453,7 +458,7 @@ void AudioDriverCoreAudio::finish_input_device() {
|
||||||
AudioObjectPropertyAddress prop;
|
AudioObjectPropertyAddress prop;
|
||||||
prop.mSelector = kAudioHardwarePropertyDefaultInputDevice;
|
prop.mSelector = kAudioHardwarePropertyDefaultInputDevice;
|
||||||
prop.mScope = kAudioObjectPropertyScopeGlobal;
|
prop.mScope = kAudioObjectPropertyScopeGlobal;
|
||||||
prop.mElement = kAudioObjectPropertyElementMaster;
|
prop.mElement = kAudioObjectPropertyElementMain;
|
||||||
|
|
||||||
result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &prop, &input_device_address_cb, this);
|
result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &prop, &input_device_address_cb, this);
|
||||||
if (result != noErr) {
|
if (result != noErr) {
|
||||||
|
@ -504,7 +509,7 @@ PackedStringArray AudioDriverCoreAudio::_get_device_list(bool input) {
|
||||||
|
|
||||||
prop.mSelector = kAudioHardwarePropertyDevices;
|
prop.mSelector = kAudioHardwarePropertyDevices;
|
||||||
prop.mScope = kAudioObjectPropertyScopeGlobal;
|
prop.mScope = kAudioObjectPropertyScopeGlobal;
|
||||||
prop.mElement = kAudioObjectPropertyElementMaster;
|
prop.mElement = kAudioObjectPropertyElementMain;
|
||||||
|
|
||||||
UInt32 size = 0;
|
UInt32 size = 0;
|
||||||
AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &prop, 0, nullptr, &size);
|
AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &prop, 0, nullptr, &size);
|
||||||
|
@ -563,7 +568,7 @@ void AudioDriverCoreAudio::_set_device(const String &output_device, bool input)
|
||||||
|
|
||||||
prop.mSelector = kAudioHardwarePropertyDevices;
|
prop.mSelector = kAudioHardwarePropertyDevices;
|
||||||
prop.mScope = kAudioObjectPropertyScopeGlobal;
|
prop.mScope = kAudioObjectPropertyScopeGlobal;
|
||||||
prop.mElement = kAudioObjectPropertyElementMaster;
|
prop.mElement = kAudioObjectPropertyElementMain;
|
||||||
|
|
||||||
UInt32 size = 0;
|
UInt32 size = 0;
|
||||||
AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &prop, 0, nullptr, &size);
|
AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &prop, 0, nullptr, &size);
|
||||||
|
@ -619,7 +624,7 @@ void AudioDriverCoreAudio::_set_device(const String &output_device, bool input)
|
||||||
// If we haven't found the desired device get the system default one
|
// If we haven't found the desired device get the system default one
|
||||||
UInt32 size = sizeof(AudioDeviceID);
|
UInt32 size = sizeof(AudioDeviceID);
|
||||||
UInt32 elem = input ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice;
|
UInt32 elem = input ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice;
|
||||||
AudioObjectPropertyAddress property = { elem, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
|
AudioObjectPropertyAddress property = { elem, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMain };
|
||||||
|
|
||||||
OSStatus result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &property, 0, nullptr, &size, &deviceId);
|
OSStatus result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &property, 0, nullptr, &size, &deviceId);
|
||||||
ERR_FAIL_COND(result != noErr);
|
ERR_FAIL_COND(result != noErr);
|
||||||
|
|
13
misc/dist/macos_tools.app/Contents/Info.plist
vendored
13
misc/dist/macos_tools.app/Contents/Info.plist
vendored
|
@ -19,7 +19,7 @@
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>4.4</string>
|
<string>4.4</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>godot</string>
|
<string>GODO</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>4.4</string>
|
<string>4.4</string>
|
||||||
<key>NSMicrophoneUsageDescription</key>
|
<key>NSMicrophoneUsageDescription</key>
|
||||||
|
@ -28,6 +28,8 @@
|
||||||
<string>Camera access is required to capture video.</string>
|
<string>Camera access is required to capture video.</string>
|
||||||
<key>NSRequiresAquaSystemAppearance</key>
|
<key>NSRequiresAquaSystemAppearance</key>
|
||||||
<false/>
|
<false/>
|
||||||
|
<key>NSCameraUseContinuityCameraDeviceType</key>
|
||||||
|
<true/>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>© 2007-present Juan Linietsky, Ariel Manzur & Godot Engine contributors</string>
|
<string>© 2007-present Juan Linietsky, Ariel Manzur & Godot Engine contributors</string>
|
||||||
<key>CFBundleSupportedPlatforms</key>
|
<key>CFBundleSupportedPlatforms</key>
|
||||||
|
@ -38,10 +40,15 @@
|
||||||
<string>NSApplication</string>
|
<string>NSApplication</string>
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
<string>public.app-category.developer-tools</string>
|
<string>public.app-category.developer-tools</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSArchitecturePriority</key>
|
||||||
<string>10.12</string>
|
<array>
|
||||||
|
<string>arm64</string>
|
||||||
|
<string>x86_64</string>
|
||||||
|
</array>
|
||||||
<key>LSMinimumSystemVersionByArchitecture</key>
|
<key>LSMinimumSystemVersionByArchitecture</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>arm64</key>
|
||||||
|
<string>11.0</string>
|
||||||
<key>x86_64</key>
|
<key>x86_64</key>
|
||||||
<string>10.12</string>
|
<string>10.12</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
|
@ -307,11 +307,17 @@ MyDeviceNotifications *device_notifications = nil;
|
||||||
// CameraMacOS - Subclass for our camera server on macOS
|
// CameraMacOS - Subclass for our camera server on macOS
|
||||||
|
|
||||||
void CameraMacOS::update_feeds() {
|
void CameraMacOS::update_feeds() {
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
|
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
|
||||||
AVCaptureDeviceDiscoverySession *session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:[NSArray arrayWithObjects:AVCaptureDeviceTypeExternalUnknown, AVCaptureDeviceTypeBuiltInWideAngleCamera, nil] mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified];
|
AVCaptureDeviceDiscoverySession *session;
|
||||||
NSArray *devices = session.devices;
|
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000
|
||||||
|
// Avoid deprecated warning if the minimum SDK is 14.0.
|
||||||
|
session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:[NSArray arrayWithObjects:AVCaptureDeviceTypeExternal, AVCaptureDeviceTypeBuiltInWideAngleCamera, nil] mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified];
|
||||||
#else
|
#else
|
||||||
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
|
session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:[NSArray arrayWithObjects:AVCaptureDeviceTypeExternalUnknown, AVCaptureDeviceTypeBuiltInWideAngleCamera, nil] mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified];
|
||||||
|
#endif
|
||||||
|
NSArray<AVCaptureDevice *> *devices = session.devices;
|
||||||
|
#else
|
||||||
|
NSArray<AVCaptureDevice *> *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// remove devices that are gone..
|
// remove devices that are gone..
|
||||||
|
|
|
@ -441,6 +441,9 @@ static const float earth_gravity = 9.80665;
|
||||||
|
|
||||||
UIInterfaceOrientation interfaceOrientation = UIInterfaceOrientationUnknown;
|
UIInterfaceOrientation interfaceOrientation = UIInterfaceOrientationUnknown;
|
||||||
|
|
||||||
|
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 140000
|
||||||
|
interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
|
||||||
|
#else
|
||||||
if (@available(iOS 13, *)) {
|
if (@available(iOS 13, *)) {
|
||||||
interfaceOrientation = [UIApplication sharedApplication].delegate.window.windowScene.interfaceOrientation;
|
interfaceOrientation = [UIApplication sharedApplication].delegate.window.windowScene.interfaceOrientation;
|
||||||
#if !defined(TARGET_OS_SIMULATOR) || !TARGET_OS_SIMULATOR
|
#if !defined(TARGET_OS_SIMULATOR) || !TARGET_OS_SIMULATOR
|
||||||
|
@ -448,6 +451,7 @@ static const float earth_gravity = 9.80665;
|
||||||
interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
|
interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (interfaceOrientation) {
|
switch (interfaceOrientation) {
|
||||||
case UIInterfaceOrientationLandscapeLeft: {
|
case UIInterfaceOrientationLandscapeLeft: {
|
||||||
|
|
|
@ -2332,7 +2332,7 @@ void DisplayServerMacOS::window_set_window_buttons_offset(const Vector2i &p_offs
|
||||||
wd.wb_offset = p_offset / scale;
|
wd.wb_offset = p_offset / scale;
|
||||||
wd.wb_offset = wd.wb_offset.maxi(12);
|
wd.wb_offset = wd.wb_offset.maxi(12);
|
||||||
if (wd.window_button_view) {
|
if (wd.window_button_view) {
|
||||||
[wd.window_button_view setOffset:NSMakePoint(wd.wb_offset.x, wd.wb_offset.y)];
|
[(GodotButtonView *)wd.window_button_view setOffset:NSMakePoint(wd.wb_offset.x, wd.wb_offset.y)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue