windows: Clean out things that should be using defined(SDL_PLATFORM_WINDOWS).

This commit is contained in:
Ryan C. Gordon 2024-09-05 23:59:23 -04:00
parent 154452a726
commit ac08dde1b2
23 changed files with 47 additions and 54 deletions

View file

@ -53,7 +53,7 @@
/* Some compilers use a special export keyword */
#ifndef SDL_DECLSPEC
# if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_CYGWIN) || defined(SDL_PLATFORM_GDK)
# if defined(SDL_PLATFORM_WINDOWS)
# ifdef DLL_EXPORT
# define SDL_DECLSPEC __declspec(dllexport)
# else
@ -70,7 +70,7 @@
/* By default SDL uses the C calling convention */
#ifndef SDLCALL
#if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) && !defined(__GNUC__)
#if defined(SDL_PLATFORM_WINDOWS) && !defined(__GNUC__)
#define SDLCALL __cdecl
#else
#define SDLCALL

View file

@ -503,7 +503,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_RunApp(int argc, char *argv[], SDL_main_func
extern SDL_DECLSPEC int SDLCALL SDL_EnterAppMainCallbacks(int argc, char *argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit);
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
/**
* Register a win32 window class for SDL's use.
@ -548,7 +548,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RegisterApp(const char *name, Uint32 st
*/
extern SDL_DECLSPEC void SDLCALL SDL_UnregisterApp(void);
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) */
#endif /* defined(SDL_PLATFORM_WINDOWS) */
#ifdef SDL_PLATFORM_GDK
@ -570,7 +570,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
#if !defined(SDL_MAIN_HANDLED) && !defined(SDL_MAIN_NOIMPL)
/* include header-only SDL_main implementations */
#if defined(SDL_MAIN_USE_CALLBACKS) \
|| defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) \
|| defined(SDL_PLATFORM_WINDOWS) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) \
|| defined(SDL_PLATFORM_3DS) || defined(SDL_PLATFORM_NGAGE) || defined(SDL_PLATFORM_PS2) || defined(SDL_PLATFORM_PSP) \
|| defined(SDL_PLATFORM_EMSCRIPTEN)

View file

@ -67,7 +67,7 @@
/* set up the usual SDL_main stuff if we're not using callbacks or if we are but need the normal entry point. */
#if !defined(SDL_MAIN_USE_CALLBACKS) || defined(SDL_MAIN_CALLBACK_STANDARD)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
/* these defines/typedefs are needed for the WinMain() definition */
#ifndef WINAPI
@ -124,7 +124,7 @@
} /* extern "C" */
#endif
/* end of SDL_PLATFORM_WIN32 and SDL_PLATFORM_GDK impls */
/* end of SDL_PLATFORM_WINDOWS impls */
#elif defined(SDL_PLATFORM_NGAGE)
/* same typedef as in ngage SDKs e32def.h */

View file

@ -336,7 +336,7 @@ typedef Sint64 SDL_Time;
* <stdint.h> should define these but this is not true all platforms.
* (for example win32) */
#ifndef SDL_PRIs64
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
#define SDL_PRIs64 "I64d"
#elif defined(PRIs64)
#define SDL_PRIs64 PRIs64
@ -347,7 +347,7 @@ typedef Sint64 SDL_Time;
#endif
#endif
#ifndef SDL_PRIu64
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
#define SDL_PRIu64 "I64u"
#elif defined(PRIu64)
#define SDL_PRIu64 PRIu64
@ -358,7 +358,7 @@ typedef Sint64 SDL_Time;
#endif
#endif
#ifndef SDL_PRIx64
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
#define SDL_PRIx64 "I64x"
#elif defined(PRIx64)
#define SDL_PRIx64 PRIx64
@ -369,7 +369,7 @@ typedef Sint64 SDL_Time;
#endif
#endif
#ifndef SDL_PRIX64
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
#define SDL_PRIX64 "I64X"
#elif defined(PRIX64)
#define SDL_PRIX64 PRIX64

View file

@ -44,7 +44,7 @@ extern "C" {
/*
* Platform specific functions for Windows
*/
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
typedef struct tagMSG MSG;
@ -90,7 +90,7 @@ typedef SDL_bool (SDLCALL *SDL_WindowsMessageHook)(void *userdata, MSG *msg);
*/
extern SDL_DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata);
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) */
#endif /* defined(SDL_PLATFORM_WINDOWS) */
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
@ -108,10 +108,6 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHoo
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displayID);
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
/**
* Get the DXGI Adapter and Output indices for the specified display.
*
@ -131,6 +127,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetDXGIOutputInfo(SDL_DisplayID display
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */
/*
* Platform specific functions for UNIX
*/

View file

@ -36,7 +36,7 @@
#include <SDL3/SDL_atomic.h>
#include <SDL3/SDL_mutex.h>
#if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK))
#if defined(SDL_PLATFORM_WINDOWS)
#include <process.h> /* _beginthreadex() and _endthreadex() */
#endif
@ -263,7 +263,7 @@ extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadWithProperties(SDL_Prop
/* The real implementation, hidden from the wiki, so it can show this as real functions that don't have macro magic. */
#ifndef SDL_WIKI_DOCUMENTATION_SECTION
# if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK))
# if defined(SDL_PLATFORM_WINDOWS)
# ifndef SDL_BeginThreadFunction
# define SDL_BeginThreadFunction _beginthreadex
# endif

View file

@ -21,7 +21,7 @@
#include "SDL_internal.h"
#include "SDL3/SDL_revision.h"
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
#include "core/windows/SDL_windows.h"
#else
#include <unistd.h> // _exit(), etc.
@ -86,7 +86,7 @@ SDL_COMPILE_TIME_ASSERT(SDL_MICRO_VERSION_max, SDL_MICRO_VERSION <= 999);
extern SDL_NORETURN void SDL_ExitProcess(int exitcode);
SDL_NORETURN void SDL_ExitProcess(int exitcode)
{
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
/* "if you do not know the state of all threads in your process, it is
better to call TerminateProcess than ExitProcess"
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682658(v=vs.85).aspx */
@ -752,4 +752,4 @@ BOOL APIENTRY MINGW32_FORCEALIGN _DllMainCRTStartup(HANDLE hModule, DWORD ul_rea
}
#endif // Building DLL
#endif // defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#endif // defined(SDL_PLATFORM_WIN32)

View file

@ -20,14 +20,14 @@
*/
#include "SDL_internal.h"
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
#include "core/windows/SDL_windows.h"
#endif
#include "SDL_assert_c.h"
#include "video/SDL_sysvideo.h"
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
#ifndef WS_OVERLAPPEDWINDOW
#define WS_OVERLAPPEDWINDOW 0
#endif
@ -86,7 +86,7 @@ static void SDL_AddAssertionToReport(SDL_AssertData *data)
}
}
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
#define ENDLINE "\r\n"
#else
#define ENDLINE "\n"

View file

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
#include "core/windows/SDL_windows.h"
#endif
@ -526,7 +526,7 @@ static HANDLE stderrHandle = NULL;
static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
const char *message)
{
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
// Way too many allocations here, urgh
// Note: One can't call SDL_SetError here, since that function itself logs.
{

View file

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
#include "../core/windows/SDL_windows.h"
#endif

View file

@ -76,7 +76,7 @@ void SDL_GDKResumeGPU(SDL_GPUDevice *device)
#endif
#if !(defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK))
#if !defined(SDL_PLATFORM_WINDOWS)
SDL_DECLSPEC SDL_bool SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst);
SDL_bool SDL_RegisterApp(const char *name, Uint32 style, void *hInst)

View file

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) && defined(HAVE_MMDEVICEAPI_H)
#if defined(SDL_PLATFORM_WINDOWS) && defined(HAVE_MMDEVICEAPI_H)
#include "SDL_windows.h"
#include "SDL_immdevice.h"
@ -431,4 +431,4 @@ void SDL_IMMDevice_EnumerateEndpoints(SDL_AudioDevice **default_playback, SDL_Au
IMMDeviceEnumerator_RegisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *)&notification_client);
}
#endif // (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) && defined(HAVE_MMDEVICEAPI_H)
#endif // defined(SDL_PLATFORM_WINDOWS) && defined(HAVE_MMDEVICEAPI_H)

View file

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
#include "SDL_windows.h"
@ -372,4 +372,4 @@ int WIN_WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWCH lpWideCharStr,
return WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, lpMultiByteStr, cbMultiByte, lpDefaultChar, lpUsedDefaultChar);
}
#endif // defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#endif // defined(SDL_PLATFORM_WINDOWS)

View file

@ -23,7 +23,7 @@
#include "SDL_cpuinfo_c.h"
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
#include "../core/windows/SDL_windows.h"
#endif
@ -636,7 +636,7 @@ int SDL_GetCPUCount(void)
sysctlbyname("hw.ncpu", &SDL_CPUCount, &size, NULL, 0);
}
#endif
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
if (SDL_CPUCount <= 0) {
SYSTEM_INFO info;
GetSystemInfo(&info);
@ -1138,7 +1138,7 @@ int SDL_GetSystemRAM(void)
}
}
#endif
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
if (SDL_SystemRAM <= 0) {
MEMORYSTATUSEX stat;
stat.dwLength = sizeof(stat);

View file

@ -23,7 +23,7 @@
#define SDL_dynapi_unsupported_h_
#if !(defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK))
#if !defined(SDL_PLATFORM_WINDOWS)
typedef struct ID3D12Device ID3D12Device;
typedef void *SDL_WindowsMessageHook;
#endif

View file

@ -26,7 +26,7 @@
#include "../video/SDL_sysvideo.h"
#include "SDL_events_c.h"
#include "SDL_mouse_c.h"
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
#include "../core/windows/SDL_windows.h" // For GetDoubleClickTime()
#endif

View file

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
#include "../core/windows/SDL_windows.h"
#endif
@ -54,7 +54,7 @@ struct SDL_IOStream
#include "../core/android/SDL_android.h"
#endif
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
typedef struct IOStreamWindowsData
{
@ -276,9 +276,9 @@ static SDL_bool SDLCALL windows_file_close(void *userdata)
SDL_free(iodata);
return true;
}
#endif // defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#endif // defined(SDL_PLATFORM_WINDOWS)
#if defined(HAVE_STDIO_H) && !(defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK))
#if defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINDOWS)
// Functions to read/write stdio file pointers. Not used for windows.
@ -429,7 +429,7 @@ static SDL_IOStream *SDL_IOFromFP(FILE *fp, bool autoclose)
return iostr;
}
#endif // !HAVE_STDIO_H && !(SDL_PLATFORM_WIN32 || SDL_PLATFORM_GDK)
#endif // !HAVE_STDIO_H && !defined(SDL_PLATFORM_WINDOWS)
// Functions to read/write memory pointers
@ -604,7 +604,7 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode)
}
}
#elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#elif defined(SDL_PLATFORM_WINDOWS)
IOStreamWindowsData *iodata = (IOStreamWindowsData *) SDL_malloc(sizeof (*iodata));
if (!iodata) {
return NULL;

View file

@ -787,16 +787,12 @@ done:
return result;
}
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
static DXGI_MODE_ROTATION D3D11_GetCurrentRotation(void)
{
// FIXME
return DXGI_MODE_ROTATION_IDENTITY;
}
#endif // defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
static BOOL D3D11_IsDisplayRotated90Degrees(DXGI_MODE_ROTATION rotation)
{
switch (rotation) {

View file

@ -32,7 +32,7 @@ Andreas Schiffler -- aschiffler at ferzkopp dot net
#ifdef SDL_VIDEO_RENDER_SW
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
#include "../../core/windows/SDL_windows.h"
#endif

View file

@ -126,7 +126,7 @@ static struct
{ "US-ASCII", ENCODING_ASCII },
{ "8859-1", ENCODING_LATIN1 },
{ "ISO-8859-1", ENCODING_LATIN1 },
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_OS2) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS) || defined(SDL_PLATFORM_OS2)
{ "WCHAR_T", ENCODING_UTF16LE },
#else
{ "WCHAR_T", ENCODING_UCS4NATIVE },

View file

@ -340,7 +340,7 @@ SDL_Thread *SDL_CreateThreadWithPropertiesRuntime(SDL_PropertiesID props,
SDL_FunctionPointer pfnEndThread)
{
// rather than check this in every backend, just make sure it's correct upfront. Only allow non-NULL if Windows, or Microsoft GDK.
#if (!defined(SDL_PLATFORM_WIN32) && !defined(SDL_PLATFORM_GDK))
#if !defined(SDL_PLATFORM_WINDOWS)
if (pfnBeginThread || pfnEndThread) {
SDL_SetError("_beginthreadex/_endthreadex not supported on this platform");
return NULL;

View file

@ -2411,7 +2411,7 @@ SDL_Window *SDL_CreateWindowWithProperties(SDL_PropertiesID props)
/* Clear minimized if not on windows, only windows handles it at create rather than FinishWindowCreation,
* but it's important or window focus will get broken on windows!
*/
#if !defined(SDL_PLATFORM_WIN32) && !defined(SDL_PLATFORM_GDK)
#if !defined(SDL_PLATFORM_WINDOWS)
if (window->flags & SDL_WINDOW_MINIMIZED) {
window->flags &= ~SDL_WINDOW_MINIMIZED;
}

View file

@ -22,7 +22,7 @@
#ifndef SDL_VIDEO_DRIVER_WINDOWS
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#if defined(SDL_PLATFORM_WINDOWS)
SDL_bool SDL_RegisterApp(const char *name, Uint32 style, void *hInst)
{
@ -40,7 +40,7 @@ void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata)
{
}
#endif // SDL_PLATFORM_WIN32 || SDL_PLATFORM_GDK
#endif // defined(SDL_PLATFORM_WINDOWS)
SDL_DECLSPEC SDL_bool SDLCALL SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex);
SDL_bool SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex)