Skip to content

Commit 80335b8

Browse files
3URSternXD
authored andcommitted
add back winrt hints
1 parent 0ad8bc3 commit 80335b8

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

include/SDL3/SDL_hints.h

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4376,6 +4376,106 @@ extern "C" {
43764376
*/
43774377
#define SDL_HINT_WINDOWS_ERASE_BACKGROUND_MODE "SDL_WINDOWS_ERASE_BACKGROUND_MODE"
43784378

4379+
/** \brief Allows back-button-press events on Windows Phone to be marked as handled
4380+
*
4381+
* Windows Phone devices typically feature a Back button. When pressed,
4382+
* the OS will emit back-button-press events, which apps are expected to
4383+
* handle in an appropriate manner. If apps do not explicitly mark these
4384+
* events as 'Handled', then the OS will invoke its default behavior for
4385+
* unhandled back-button-press events, which on Windows Phone 8 and 8.1 is to
4386+
* terminate the app (and attempt to switch to the previous app, or to the
4387+
* device's home screen).
4388+
*
4389+
* Setting the SDL_HINT_WINRT_HANDLE_BACK_BUTTON hint to "1" will cause SDL
4390+
* to mark back-button-press events as Handled, if and when one is sent to
4391+
* the app.
4392+
*
4393+
* Internally, Windows Phone sends back button events as parameters to
4394+
* special back-button-press callback functions. Apps that need to respond
4395+
* to back-button-press events are expected to register one or more
4396+
* callback functions for such, shortly after being launched (during the
4397+
* app's initialization phase). After the back button is pressed, the OS
4398+
* will invoke these callbacks. If the app's callback(s) do not explicitly
4399+
* mark the event as handled by the time they return, or if the app never
4400+
* registers one of these callback, the OS will consider the event
4401+
* un-handled, and it will apply its default back button behavior (terminate
4402+
* the app).
4403+
*
4404+
* SDL registers its own back-button-press callback with the Windows Phone
4405+
* OS. This callback will emit a pair of SDL key-press events (SDL_KEYDOWN
4406+
* and SDL_KEYUP), each with a scancode of SDL_SCANCODE_AC_BACK, after which
4407+
* it will check the contents of the hint, SDL_HINT_WINRT_HANDLE_BACK_BUTTON.
4408+
* If the hint's value is set to "1", the back button event's Handled
4409+
* property will get set to 'true'. If the hint's value is set to something
4410+
* else, or if it is unset, SDL will leave the event's Handled property
4411+
* alone. (By default, the OS sets this property to 'false', to note.)
4412+
*
4413+
* SDL apps can either set SDL_HINT_WINRT_HANDLE_BACK_BUTTON well before a
4414+
* back button is pressed, or can set it in direct-response to a back button
4415+
* being pressed.
4416+
*
4417+
* In order to get notified when a back button is pressed, SDL apps should
4418+
* register a callback function with SDL_AddEventWatch(), and have it listen
4419+
* for SDL_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK.
4420+
* (Alternatively, SDL_KEYUP events can be listened-for. Listening for
4421+
* either event type is suitable.) Any value of SDL_HINT_WINRT_HANDLE_BACK_BUTTON
4422+
* set by such a callback, will be applied to the OS' current
4423+
* back-button-press event.
4424+
*
4425+
* More details on back button behavior in Windows Phone apps can be found
4426+
* at the following page, on Microsoft's developer site:
4427+
* http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx
4428+
*/
4429+
#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON "SDL_WINRT_HANDLE_BACK_BUTTON"
4430+
4431+
/** \brief Label text for a WinRT app's privacy policy link
4432+
*
4433+
* Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT,
4434+
* Microsoft mandates that this policy be available via the Windows Settings charm.
4435+
* SDL provides code to add a link there, with its label text being set via the
4436+
* optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
4437+
*
4438+
* Please note that a privacy policy's contents are not set via this hint. A separate
4439+
* hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the
4440+
* policy.
4441+
*
4442+
* The contents of this hint should be encoded as a UTF8 string.
4443+
*
4444+
* The default value is "Privacy Policy". This hint should only be set during app
4445+
* initialization, preferably before any calls to SDL_Init().
4446+
*
4447+
* For additional information on linking to a privacy policy, see the documentation for
4448+
* SDL_HINT_WINRT_PRIVACY_POLICY_URL.
4449+
*/
4450+
#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL "SDL_WINRT_PRIVACY_POLICY_LABEL"
4451+
4452+
/**
4453+
* \brief A URL to a WinRT app's privacy policy
4454+
*
4455+
* All network-enabled WinRT apps must make a privacy policy available to its
4456+
* users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be
4457+
* be available in the Windows Settings charm, as accessed from within the app.
4458+
* SDL provides code to add a URL-based link there, which can point to the app's
4459+
* privacy policy.
4460+
*
4461+
* To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL
4462+
* before calling any SDL_Init() functions. The contents of the hint should
4463+
* be a valid URL. For example, "http://www.example.com".
4464+
*
4465+
* The default value is "", which will prevent SDL from adding a privacy policy
4466+
* link to the Settings charm. This hint should only be set during app init.
4467+
*
4468+
* The label text of an app's "Privacy Policy" link may be customized via another
4469+
* hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
4470+
*
4471+
* Please note that on Windows Phone, Microsoft does not provide standard UI
4472+
* for displaying a privacy policy link, and as such, SDL_HINT_WINRT_PRIVACY_POLICY_URL
4473+
* will not get used on that platform. Network-enabled phone apps should display
4474+
* their privacy policy through some other, in-app means.
4475+
*/
4476+
#define SDL_HINT_WINRT_PRIVACY_POLICY_URL "SDL_WINRT_PRIVACY_POLICY_URL"
4477+
4478+
43794479
/**
43804480
* A variable controlling whether back-button-press events on Windows Phone to
43814481
* be marked as handled.

0 commit comments

Comments
 (0)