winrt: Removed WinRT/Windows Phone/UWP support.

Fixes #10724.
This commit is contained in:
Ryan C. Gordon
2024-09-05 23:36:16 -04:00
parent 6d7c211faf
commit 154452a726
126 changed files with 150 additions and 9582 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_WINRT) || defined(SDL_PLATFORM_CYGWIN) || defined(SDL_PLATFORM_GDK)
# if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_CYGWIN) || defined(SDL_PLATFORM_GDK)
# 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_WINRT) || defined(SDL_PLATFORM_GDK)) && !defined(__GNUC__)
#if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) && !defined(__GNUC__)
#define SDLCALL __cdecl
#else
#define SDLCALL

View File

@@ -143,19 +143,19 @@ extern SDL_DECLSPEC char * SDLCALL SDL_GetPrefPath(const char *org, const char *
*
* The folders supported per platform are:
*
* | | Windows | WinRT/UWP |macOS/iOS | tvOS | Unix (XDG) | Haiku | Emscripten |
* | ----------- | ------- | --------- |--------- | ---- | ---------- | ----- | ---------- |
* | HOME | X | X | X | | X | X | X |
* | DESKTOP | X | X | X | | X | X | |
* | DOCUMENTS | X | X | X | | X | | |
* | DOWNLOADS | Vista+ | X | X | | X | | |
* | MUSIC | X | X | X | | X | | |
* | PICTURES | X | X | X | | X | | |
* | PUBLICSHARE | | | X | | X | | |
* | SAVEDGAMES | Vista+ | | | | | | |
* | SCREENSHOTS | Vista+ | X | | | | | |
* | TEMPLATES | X | X | X | | X | | |
* | VIDEOS | X | X | X* | | X | | |
* | | Windows | macOS/iOS | tvOS | Unix (XDG) | Haiku | Emscripten |
* | ----------- | ------- | --------- | ---- | ---------- | ----- | ---------- |
* | HOME | X | X | | X | X | X |
* | DESKTOP | X | X | | X | X | |
* | DOCUMENTS | X | X | | X | | |
* | DOWNLOADS | Vista+ | X | | X | | |
* | MUSIC | X | X | | X | | |
* | PICTURES | X | X | | X | | |
* | PUBLICSHARE | | X | | X | | |
* | SAVEDGAMES | Vista+ | | | | | |
* | SCREENSHOTS | Vista+ | | | | | |
* | TEMPLATES | X | X | | X | | |
* | VIDEOS | X | X* | | X | | |
*
* Note that on macOS/iOS, the Videos folder is called "Movies".
*

View File

@@ -3938,119 +3938,6 @@ extern "C" {
*/
#define SDL_HINT_WINDOWS_ERASE_BACKGROUND_MODE "SDL_WINDOWS_ERASE_BACKGROUND_MODE"
/**
* A variable controlling whether back-button-press events on Windows Phone to
* be marked as handled.
*
* Windows Phone devices typically feature a Back button. When pressed, the OS
* will emit back-button-press events, which apps are expected to handle in an
* appropriate manner. If apps do not explicitly mark these events as
* 'Handled', then the OS will invoke its default behavior for unhandled
* back-button-press events, which on Windows Phone 8 and 8.1 is to terminate
* the app (and attempt to switch to the previous app, or to the device's home
* screen).
*
* Setting the SDL_HINT_WINRT_HANDLE_BACK_BUTTON hint to "1" will cause SDL to
* mark back-button-press events as Handled, if and when one is sent to the
* app.
*
* Internally, Windows Phone sends back button events as parameters to special
* back-button-press callback functions. Apps that need to respond to
* back-button-press events are expected to register one or more callback
* functions for such, shortly after being launched (during the app's
* initialization phase). After the back button is pressed, the OS will invoke
* these callbacks. If the app's callback(s) do not explicitly mark the event
* as handled by the time they return, or if the app never registers one of
* these callback, the OS will consider the event un-handled, and it will
* apply its default back button behavior (terminate the app).
*
* SDL registers its own back-button-press callback with the Windows Phone OS.
* This callback will emit a pair of SDL key-press events (SDL_EVENT_KEY_DOWN
* and SDL_EVENT_KEY_UP), each with a scancode of SDL_SCANCODE_AC_BACK, after
* which it will check the contents of the hint,
* SDL_HINT_WINRT_HANDLE_BACK_BUTTON. If the hint's value is set to "1", the
* back button event's Handled property will get set to 'true'. If the hint's
* value is set to something else, or if it is unset, SDL will leave the
* event's Handled property alone. (By default, the OS sets this property to
* 'false', to note.)
*
* SDL apps can either set SDL_HINT_WINRT_HANDLE_BACK_BUTTON well before a
* back button is pressed, or can set it in direct-response to a back button
* being pressed.
*
* In order to get notified when a back button is pressed, SDL apps should
* register a callback function with SDL_AddEventWatch(), and have it listen
* for SDL_EVENT_KEY_DOWN events that have a scancode of SDL_SCANCODE_AC_BACK.
* (Alternatively, SDL_EVENT_KEY_UP events can be listened-for. Listening for
* either event type is suitable.) Any value of
* SDL_HINT_WINRT_HANDLE_BACK_BUTTON set by such a callback, will be applied
* to the OS' current back-button-press event.
*
* More details on back button behavior in Windows Phone apps can be found at
* the following page, on Microsoft's developer site:
* http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx
*
* \since This hint is available since SDL 3.0.0.
*/
#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON "SDL_WINRT_HANDLE_BACK_BUTTON"
/**
* A variable specifying the label text for a WinRT app's privacy policy link.
*
* Network-enabled WinRT apps must include a privacy policy. On Windows 8,
* 8.1, and RT, Microsoft mandates that this policy be available via the
* Windows Settings charm. SDL provides code to add a link there, with its
* label text being set via the optional hint,
* SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
*
* Please note that a privacy policy's contents are not set via this hint. A
* separate hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the
* actual text of the policy.
*
* The contents of this hint should be encoded as a UTF8 string.
*
* The default value is "Privacy Policy".
*
* For additional information on linking to a privacy policy, see the
* documentation for SDL_HINT_WINRT_PRIVACY_POLICY_URL.
*
* This hint should be set before SDL is initialized.
*
* \since This hint is available since SDL 3.0.0.
*/
#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL "SDL_WINRT_PRIVACY_POLICY_LABEL"
/**
* A variable specifying the URL to a WinRT app's privacy policy.
*
* All network-enabled WinRT apps must make a privacy policy available to its
* users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be
* available in the Windows Settings charm, as accessed from within the app.
* SDL provides code to add a URL-based link there, which can point to the
* app's privacy policy.
*
* To setup a URL to an app's privacy policy, set
* SDL_HINT_WINRT_PRIVACY_POLICY_URL before calling any SDL_Init() functions.
* The contents of the hint should be a valid URL. For example,
* "http://www.example.com".
*
* The default value is "", which will prevent SDL from adding a privacy
* policy link to the Settings charm. This hint should only be set during app
* init.
*
* The label text of an app's "Privacy Policy" link may be customized via
* another hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
*
* Please note that on Windows Phone, Microsoft does not provide standard UI
* for displaying a privacy policy link, and as such,
* SDL_HINT_WINRT_PRIVACY_POLICY_URL will not get used on that platform.
* Network-enabled phone apps should display their privacy policy through some
* other, in-app means.
*
* \since This hint is available since SDL 3.0.0.
*/
#define SDL_HINT_WINRT_PRIVACY_POLICY_URL "SDL_WINRT_PRIVACY_POLICY_URL"
/**
* A variable controlling whether X11 windows are marked as override-redirect.
*

View File

@@ -48,20 +48,6 @@
*/
#define SDL_MAIN_AVAILABLE
#elif defined(SDL_PLATFORM_WINRT)
/* On WinRT, SDL provides a main function that initializes CoreApplication,
creating an instance of IFrameworkView in the process.
Ideally, #include'ing SDL_main.h is enough to get a main() function working.
However, that requires the source file your main() is in to be compiled
as C++ *and* with the /ZW compiler flag. If that's not feasible, add an
otherwise empty .cpp file that only contains `#include <SDL3/SDL_main.h>`
and build that with /ZW (still include SDL_main.h in your other file with main()!).
In XAML apps, instead the function SDL_RunApp() must be called with a pointer
to the Direct3D-hosted XAML control passed in as the "reserved" argument.
*/
#define SDL_MAIN_NEEDED
#elif defined(SDL_PLATFORM_GDK)
/* On GDK, SDL provides a main function that initializes the game runtime.
@@ -591,7 +577,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
/* platforms which main (-equivalent) can be implemented in plain C */
#include <SDL3/SDL_main_impl.h>
#elif defined(SDL_PLATFORM_WINRT) /* C++ platforms */
#elif 0 /* C++ platforms (currently none, this used to be here for WinRT, but is left for future platforms that might arrive. */
#ifdef __cplusplus
#include <SDL3/SDL_main_impl.h>
#else
@@ -605,7 +591,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
#endif /* __GNUC__ */
#endif /* __cplusplus */
#endif /* C++ platforms like SDL_PLATFORM_WINRT etc */
#endif /* C++ platforms */
#endif
#endif /* SDL_main_h_ */

View File

@@ -126,70 +126,6 @@
/* end of SDL_PLATFORM_WIN32 and SDL_PLATFORM_GDK impls */
#elif defined(SDL_PLATFORM_WINRT)
/* WinRT main based on SDL_winrt_main_NonXAML.cpp, placed in the public domain by David Ludwig 3/13/14 */
#include <wrl.h>
/* At least one file in any SDL/WinRT app appears to require compilation
with C++/CX, otherwise a Windows Metadata file won't get created, and
an APPX0702 build error can appear shortly after linking.
The following set of preprocessor code forces this file to be compiled
as C++/CX, which appears to cause Visual C++ 2012's build tools to
create this .winmd file, and will help allow builds of SDL/WinRT apps
to proceed without error.
If other files in an app's project enable C++/CX compilation, then it might
be possible for the .cpp file including SDL_main.h to be compiled without /ZW,
for Visual C++'s build tools to create a winmd file, and for the app to
build without APPX0702 errors. In this case, if
SDL_WINRT_METADATA_FILE_AVAILABLE is defined as a C/C++ macro, then
the #error (to force C++/CX compilation) will be disabled.
Please note that /ZW can be specified on a file-by-file basis. To do this,
right click on the file in Visual C++, click Properties, then change the
setting through the dialog that comes up.
*/
#ifndef SDL_WINRT_METADATA_FILE_AVAILABLE
#if !defined(__cplusplus) || (!defined(__cplusplus_winrt) && _MSVC_LANG < 202002L)
#error The C++ file that includes SDL_main.h must be compiled as C++ code with /ZW, otherwise build errors due to missing .winmd files can occur.
#endif
#endif
/* Prevent MSVC++ from warning about threading models when defining our
custom WinMain. The threading model will instead be set via a direct
call to Windows::Foundation::Initialize (rather than via an attributed
function).
To note, this warning (C4447) does not seem to come up unless this file
is compiled with C++/CX enabled (via the /ZW compiler flag).
*/
#ifdef _MSC_VER
#pragma warning(disable : 4447)
/* Make sure the function to initialize the Windows Runtime gets linked in. */
#pragma comment(lib, "runtimeobject.lib")
#endif
#ifdef __cplusplus
extern "C" {
#endif
int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
return SDL_RunApp(0, NULL, SDL_main, NULL);
}
#if _MSVC_LANG >= 202002L
int main(int argc, char** argv) {
return SDL_RunApp(argc, argv, SDL_main, NULL);
}
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
/* end of WinRT impl */
#elif defined(SDL_PLATFORM_NGAGE)
/* same typedef as in ngage SDKs e32def.h */
typedef signed int TInt;

View File

@@ -625,8 +625,6 @@
#define SDL_LinuxSetThreadPriorityAndPolicy SDL_SetLinuxThreadPriorityAndPolicy
#define SDL_OnApplicationDidBecomeActive SDL_OnApplicationDidEnterForeground
#define SDL_OnApplicationWillResignActive SDL_OnApplicationWillEnterBackground
#define SDL_WinRTGetDeviceFamily SDL_GetWinRTDeviceFamily
#define SDL_GetWinRTFSPathUTF8 SDL_GetWinRTFSPath
#define SDL_iOSSetAnimationCallback SDL_SetiOSAnimationCallback
#define SDL_iOSSetEventPump SDL_SetiOSEventPump
#define SDL_iPhoneSetAnimationCallback SDL_SetiOSAnimationCallback
@@ -1251,8 +1249,6 @@
#define SDL_LinuxSetThreadPriorityAndPolicy SDL_LinuxSetThreadPriorityAndPolicy_renamed_SDL_SetLinuxThreadPriorityAndPolicy
#define SDL_OnApplicationDidBecomeActive SDL_OnApplicationDidBecomeActive_renamed_SDL_OnApplicationDidEnterForeground
#define SDL_OnApplicationWillResignActive SDL_OnApplicationWillResignActive_renamed_SDL_OnApplicationWillEnterBackground
#define SDL_WinRTGetDeviceFamily SDL_WinRTGetDeviceFamily_renamed_SDL_GetWinRTDeviceFamily
#define SDL_GetWinRTFSPathUTF8 SDL_GetWinRTFSPathUTF8_renamed_SDL_GetWinRTFSPath
#define SDL_iOSSetAnimationCallback SDL_iOSSetAnimationCallback_renamed_SDL_SetiOSAnimationCallback
#define SDL_iOSSetEventPump SDL_iOSSetEventPump_renamed_SDL_SetiOSEventPump
#define SDL_iPhoneSetAnimationCallback SDL_iPhoneSetAnimationCallback_renamed_SDL_iOSSetAnimationCallback

View File

@@ -173,7 +173,7 @@
#endif
#if WINAPI_FAMILY_WINRT
#define SDL_PLATFORM_WINRT 1
#error Windows RT/UWP is no longer supported in SDL
#elif defined(_GAMING_DESKTOP) /* GDK project configuration always defines _GAMING_XXX */
#define SDL_PLATFORM_WINGDK 1
#elif defined(_GAMING_XBOX_XBOXONE)

View File

@@ -559,90 +559,6 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SendAndroidMessage(Uint32 command, int
#endif /* SDL_PLATFORM_ANDROID */
/*
* Platform specific functions for WinRT
*/
#ifdef SDL_PLATFORM_WINRT
/**
* WinRT / Windows Phone path types
*
* \since This enum is available since SDL 3.0.0.
*/
typedef enum SDL_WinRT_Path
{
/** The installed app's root directory.
Files here are likely to be read-only. */
SDL_WINRT_PATH_INSTALLED_LOCATION,
/** The app's local data store. Files may be written here */
SDL_WINRT_PATH_LOCAL_FOLDER,
/** The app's roaming data store. Unsupported on Windows Phone.
Files written here may be copied to other machines via a network
connection.
*/
SDL_WINRT_PATH_ROAMING_FOLDER,
/** The app's temporary data store. Unsupported on Windows Phone.
Files written here may be deleted at any time. */
SDL_WINRT_PATH_TEMP_FOLDER
} SDL_WinRT_Path;
/**
* WinRT Device Family
*
* \since This enum is available since SDL 3.0.0.
*/
typedef enum SDL_WinRT_DeviceFamily
{
/** Unknown family */
SDL_WINRT_DEVICEFAMILY_UNKNOWN,
/** Desktop family*/
SDL_WINRT_DEVICEFAMILY_DESKTOP,
/** Mobile family (for example smartphone) */
SDL_WINRT_DEVICEFAMILY_MOBILE,
/** XBox family */
SDL_WINRT_DEVICEFAMILY_XBOX,
} SDL_WinRT_DeviceFamily;
/**
* Retrieve a WinRT defined path on the local file system.
*
* Not all paths are available on all versions of Windows. This is especially
* true on Windows Phone. Check the documentation for the given SDL_WinRT_Path
* for more information on which path types are supported where.
*
* Documentation on most app-specific path types on WinRT can be found on
* MSDN, at the URL:
*
* https://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
*
* \param pathType the type of path to retrieve, one of SDL_WinRT_Path.
* \returns a UTF-8 string (8-bit, multi-byte) containing the path, or NULL if
* the path is not available for any reason; call SDL_GetError() for
* more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC const char * SDLCALL SDL_GetWinRTFSPath(SDL_WinRT_Path pathType);
/**
* Detects the device family of WinRT platform at runtime.
*
* \returns a value from the SDL_WinRT_DeviceFamily enum.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_GetWinRTDeviceFamily();
#endif /* SDL_PLATFORM_WINRT */
/**
* Query if the current device is a tablet.
*

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)) && !defined(SDL_PLATFORM_WINRT)
#if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK))
#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)) && !defined(SDL_PLATFORM_WINRT)
# if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK))
# ifndef SDL_BeginThreadFunction
# define SDL_BeginThreadFunction _beginthreadex
# endif

View File

@@ -1215,11 +1215,6 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetWindowParent(SDL_Window *window)
* - `SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER`: the EGLSurface associated with
* the window
*
* On UWP:
*
* - `SDL_PROP_WINDOW_WINRT_WINDOW_POINTER`: the IInspectable CoreWindow
* associated with the window
*
* On Windows:
*
* - `SDL_PROP_WINDOW_WIN32_HWND_POINTER`: the HWND associated with the window
@@ -1286,7 +1281,6 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetWindowProperties(SDL_Window
#define SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER "SDL.window.vivante.display"
#define SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER "SDL.window.vivante.window"
#define SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER "SDL.window.vivante.surface"
#define SDL_PROP_WINDOW_WINRT_WINDOW_POINTER "SDL.window.winrt.window"
#define SDL_PROP_WINDOW_WIN32_HWND_POINTER "SDL.window.win32.hwnd"
#define SDL_PROP_WINDOW_WIN32_HDC_POINTER "SDL.window.win32.hdc"
#define SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER "SDL.window.win32.instance"