mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-26 04:58:29 +00:00
Define SDL_PLATFORM_* macros instead of underscored ones (#8875)
This commit is contained in:

committed by
GitHub

parent
ceccf24519
commit
31d133db40
@@ -39,11 +39,11 @@
|
||||
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
|
||||
#if defined(__WIN32__) || defined(__WINGDK__)
|
||||
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
|
||||
#include "../core/windows/SDL_windows.h"
|
||||
#endif
|
||||
|
||||
#ifdef __MACOS__
|
||||
#ifdef SDL_PLATFORM_MACOS
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <mach/mach.h>
|
||||
#include <IOKit/IOKitLib.h>
|
||||
@@ -100,7 +100,7 @@ static struct
|
||||
SDL_bool m_bCanGetNotifications;
|
||||
Uint64 m_unLastDetect;
|
||||
|
||||
#if defined(__WIN32__) || defined(__WINGDK__)
|
||||
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
|
||||
SDL_ThreadID m_nThreadID;
|
||||
WNDCLASSEXA m_wndClass;
|
||||
HWND m_hwndMsg;
|
||||
@@ -108,7 +108,7 @@ static struct
|
||||
double m_flLastWin32MessageCheck;
|
||||
#endif
|
||||
|
||||
#ifdef __MACOS__
|
||||
#ifdef SDL_PLATFORM_MACOS
|
||||
IONotificationPortRef m_notificationPort;
|
||||
mach_port_t m_notificationMach;
|
||||
#endif
|
||||
@@ -120,7 +120,7 @@ static struct
|
||||
#endif
|
||||
} SDL_HIDAPI_discovery;
|
||||
|
||||
#if defined(__WIN32__) || defined(__WINGDK__)
|
||||
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
|
||||
struct _DEV_BROADCAST_HDR
|
||||
{
|
||||
DWORD dbch_size;
|
||||
@@ -166,9 +166,9 @@ static LRESULT CALLBACK ControllerWndProc(HWND hwnd, UINT message, WPARAM wParam
|
||||
|
||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
||||
}
|
||||
#endif /* defined(__WIN32__) || defined(__WINGDK__) */
|
||||
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */
|
||||
|
||||
#ifdef __MACOS__
|
||||
#ifdef SDL_PLATFORM_MACOS
|
||||
static void CallbackIOServiceFunc(void *context, io_iterator_t portIterator)
|
||||
{
|
||||
/* Must drain the iterator, or we won't receive new notifications */
|
||||
@@ -178,7 +178,7 @@ static void CallbackIOServiceFunc(void *context, io_iterator_t portIterator)
|
||||
++SDL_HIDAPI_discovery.m_unDeviceChangeCounter;
|
||||
}
|
||||
}
|
||||
#endif /* __MACOS__ */
|
||||
#endif /* SDL_PLATFORM_MACOS */
|
||||
|
||||
#ifdef HAVE_INOTIFY
|
||||
#ifdef HAVE_INOTIFY_INIT1
|
||||
@@ -229,7 +229,7 @@ static void HIDAPI_InitializeDiscovery(void)
|
||||
SDL_HIDAPI_discovery.m_bCanGetNotifications = SDL_FALSE;
|
||||
SDL_HIDAPI_discovery.m_unLastDetect = 0;
|
||||
|
||||
#if defined(__WIN32__) || defined(__WINGDK__)
|
||||
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
|
||||
SDL_HIDAPI_discovery.m_nThreadID = SDL_GetCurrentThreadID();
|
||||
|
||||
SDL_zero(SDL_HIDAPI_discovery.m_wndClass);
|
||||
@@ -256,9 +256,9 @@ static void HIDAPI_InitializeDiscovery(void)
|
||||
SDL_HIDAPI_discovery.m_hNotify = RegisterDeviceNotification(SDL_HIDAPI_discovery.m_hwndMsg, &devBroadcast, DEVICE_NOTIFY_WINDOW_HANDLE | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES);
|
||||
SDL_HIDAPI_discovery.m_bCanGetNotifications = (SDL_HIDAPI_discovery.m_hNotify != 0);
|
||||
}
|
||||
#endif /* defined(__WIN32__) || defined(__WINGDK__) */
|
||||
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */
|
||||
|
||||
#ifdef __MACOS__
|
||||
#ifdef SDL_PLATFORM_MACOS
|
||||
SDL_HIDAPI_discovery.m_notificationPort = IONotificationPortCreate(kIOMainPortDefault);
|
||||
if (SDL_HIDAPI_discovery.m_notificationPort) {
|
||||
{
|
||||
@@ -308,7 +308,7 @@ static void HIDAPI_InitializeDiscovery(void)
|
||||
|
||||
SDL_HIDAPI_discovery.m_bCanGetNotifications = (SDL_HIDAPI_discovery.m_notificationMach != MACH_PORT_NULL);
|
||||
|
||||
#endif /* __MACOS__ */
|
||||
#endif /* SDL_PLATFORM_MACOS */
|
||||
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
if (linux_enumeration_method == ENUMERATION_LIBUDEV) {
|
||||
@@ -377,7 +377,7 @@ static void HIDAPI_UpdateDiscovery(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(__WIN32__) || defined(__WINGDK__)
|
||||
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
|
||||
#if 0 /* just let the usual SDL_PumpEvents loop dispatch these, fixing bug 4286. --ryan. */
|
||||
/* We'll only get messages on the same thread that created the window */
|
||||
if (SDL_GetCurrentThreadID() == SDL_HIDAPI_discovery.m_nThreadID) {
|
||||
@@ -390,9 +390,9 @@ static void HIDAPI_UpdateDiscovery(void)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* defined(__WIN32__) || defined(__WINGDK__) */
|
||||
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */
|
||||
|
||||
#ifdef __MACOS__
|
||||
#ifdef SDL_PLATFORM_MACOS
|
||||
if (SDL_HIDAPI_discovery.m_notificationPort) {
|
||||
struct
|
||||
{
|
||||
@@ -484,7 +484,7 @@ static void HIDAPI_ShutdownDiscovery(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(__WIN32__) || defined(__WINGDK__)
|
||||
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
|
||||
if (SDL_HIDAPI_discovery.m_hNotify) {
|
||||
UnregisterDeviceNotification(SDL_HIDAPI_discovery.m_hNotify);
|
||||
}
|
||||
@@ -496,7 +496,7 @@ static void HIDAPI_ShutdownDiscovery(void)
|
||||
UnregisterClassA(SDL_HIDAPI_discovery.m_wndClass.lpszClassName, SDL_HIDAPI_discovery.m_wndClass.hInstance);
|
||||
#endif
|
||||
|
||||
#ifdef __MACOS__
|
||||
#ifdef SDL_PLATFORM_MACOS
|
||||
if (SDL_HIDAPI_discovery.m_notificationPort) {
|
||||
IONotificationPortDestroy(SDL_HIDAPI_discovery.m_notificationPort);
|
||||
}
|
||||
@@ -571,17 +571,17 @@ typedef struct PLATFORM_hid_device_ PLATFORM_hid_device;
|
||||
#define read_thread PLATFORM_read_thread
|
||||
#define return_data PLATFORM_return_data
|
||||
|
||||
#ifdef __LINUX__
|
||||
#ifdef SDL_PLATFORM_LINUX
|
||||
#include "SDL_hidapi_linux.h"
|
||||
#elif defined(__NETBSD__)
|
||||
#elif defined(SDL_PLATFORM_NETBSD)
|
||||
#include "SDL_hidapi_netbsd.h"
|
||||
#elif defined(__MACOS__)
|
||||
#elif defined(SDL_PLATFORM_MACOS)
|
||||
#include "SDL_hidapi_mac.h"
|
||||
#elif defined(__WINDOWS__) || defined(__WINGDK__)
|
||||
#elif defined(SDL_PLATFORM_WINDOWS) || defined(SDL_PLATFORM_WINGDK)
|
||||
#include "SDL_hidapi_windows.h"
|
||||
#elif defined(__ANDROID__)
|
||||
#elif defined(SDL_PLATFORM_ANDROID)
|
||||
#include "SDL_hidapi_android.h"
|
||||
#elif defined(__IOS__) || defined(__TVOS__)
|
||||
#elif defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS)
|
||||
#include "SDL_hidapi_ios.h"
|
||||
#endif
|
||||
|
||||
@@ -1099,7 +1099,7 @@ SDL_bool SDL_HIDAPI_ShouldIgnoreDevice(int bus, Uint16 vendor_id, Uint16 product
|
||||
if (vendor_id == USB_VENDOR_VALVE) {
|
||||
/* Ignore the mouse/keyboard interface on Steam Controllers */
|
||||
if (
|
||||
#ifdef __WIN32__
|
||||
#ifdef SDL_PLATFORM_WIN32
|
||||
/* Check the usage page and usage on both USB and Bluetooth */
|
||||
#else
|
||||
/* Only check the usage page and usage on USB */
|
||||
@@ -1232,7 +1232,7 @@ int SDL_hid_init(void)
|
||||
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
++attempts;
|
||||
#ifdef __LINUX__
|
||||
#ifdef SDL_PLATFORM_LINUX
|
||||
udev_ctx = SDL_UDEV_GetUdevSyms();
|
||||
#endif /* __LINUX __ */
|
||||
if (udev_ctx && PLATFORM_hid_init() == 0) {
|
||||
@@ -1244,7 +1244,7 @@ int SDL_hid_init(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef __MACOS__
|
||||
#ifdef SDL_PLATFORM_MACOS
|
||||
hid_darwin_set_open_exclusive(0);
|
||||
#endif
|
||||
|
||||
@@ -1273,7 +1273,7 @@ int SDL_hid_exit(void)
|
||||
if (udev_ctx) {
|
||||
result |= PLATFORM_hid_exit();
|
||||
}
|
||||
#ifdef __LINUX__
|
||||
#ifdef SDL_PLATFORM_LINUX
|
||||
SDL_UDEV_ReleaseUdevSyms();
|
||||
#endif /* __LINUX __ */
|
||||
#endif /* HAVE_PLATFORM_BACKEND */
|
||||
@@ -1688,7 +1688,7 @@ int SDL_hid_get_report_descriptor(SDL_hid_device *device, unsigned char *buf, si
|
||||
|
||||
void SDL_hid_ble_scan(SDL_bool active)
|
||||
{
|
||||
#if !defined(SDL_HIDAPI_DISABLED) && (defined(__IOS__) || defined(__TVOS__))
|
||||
#if !defined(SDL_HIDAPI_DISABLED) && (defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS))
|
||||
extern void hid_ble_scan(int bStart);
|
||||
hid_ble_scan(active);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user