Skip to content

Commit

Permalink
mac: Fix handling of deprecated symbol.
Browse files Browse the repository at this point in the history
This needs to check what our deployment target is, not what SDK
is available, since this is a linker symbol and not an enum
value or whatever.

Also removed a copy/paste error that mentioned CoreAudio in
the haptic subsystem.

Fixes #6534.
  • Loading branch information
icculus committed Nov 17, 2022
1 parent 913e403 commit bb0b8ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/haptic/darwin/SDL_syshaptic_c.h
Expand Up @@ -20,12 +20,10 @@
*/

/* Things named "Master" were renamed to "Main" in macOS 12.0's SDK. */
#if MACOSX_COREAUDIO
#include <AvailabilityMacros.h>
#ifndef MAC_OS_VERSION_12_0
#if MAC_OS_X_VERSION_MIN_REQUIRED < 120000
#define kIOMainPortDefault kIOMasterPortDefault
#endif
#endif

extern int MacHaptic_MaybeAddDevice( io_object_t device );
extern int MacHaptic_MaybeRemoveDevice( io_object_t device );
Expand Down
7 changes: 6 additions & 1 deletion src/hidapi/SDL_hidapi.c
Expand Up @@ -47,6 +47,11 @@
#include <IOKit/IOKitLib.h>
#include <IOKit/hid/IOHIDDevice.h>
#include <IOKit/usb/USBSpec.h>
#include <AvailabilityMacros.h>
/* Things named "Master" were renamed to "Main" in macOS 12.0's SDK. */
#if MAC_OS_X_VERSION_MIN_REQUIRED < 120000
#define kIOMainPortDefault kIOMasterPortDefault
#endif
#endif

#include "../core/linux/SDL_udev.h"
Expand Down Expand Up @@ -250,7 +255,7 @@ HIDAPI_InitializeDiscovery()
#endif /* defined(__WIN32__) || defined(__WINGDK__) */

#if defined(__MACOSX__)
SDL_HIDAPI_discovery.m_notificationPort = IONotificationPortCreate(kIOMasterPortDefault);
SDL_HIDAPI_discovery.m_notificationPort = IONotificationPortCreate(kIOMainPortDefault);
if (SDL_HIDAPI_discovery.m_notificationPort) {
{
io_iterator_t portIterator = 0;
Expand Down

2 comments on commit bb0b8ad

@sezero
Copy link
Contributor

@sezero sezero commented on bb0b8ad Nov 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

audio/coreaudio/SDL_coreaudio.h and video/cocoa/SDL_cocoamouse.m need similar changes.

@sezero
Copy link
Contributor

@sezero sezero commented on bb0b8ad Nov 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

audio/coreaudio/SDL_coreaudio.h and video/cocoa/SDL_cocoamouse.m need similar changes.

Bah, never mind. Those in there are enum values, not extern data. Sorry for the noise.

Please sign in to comment.