Skip to content

Commit 58c1af3

Browse files
3URSternXD
authored andcommitted
add back winrt hints
1 parent 4a004af commit 58c1af3

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
@@ -4169,6 +4169,106 @@ extern "C" {
41694169
*/
41704170
#define SDL_HINT_WINDOWS_ERASE_BACKGROUND_MODE "SDL_WINDOWS_ERASE_BACKGROUND_MODE"
41714171

4172+
/** \brief Allows back-button-press events on Windows Phone to be marked as handled
4173+
*
4174+
* Windows Phone devices typically feature a Back button. When pressed,
4175+
* the OS will emit back-button-press events, which apps are expected to
4176+
* handle in an appropriate manner. If apps do not explicitly mark these
4177+
* events as 'Handled', then the OS will invoke its default behavior for
4178+
* unhandled back-button-press events, which on Windows Phone 8 and 8.1 is to
4179+
* terminate the app (and attempt to switch to the previous app, or to the
4180+
* device's home screen).
4181+
*
4182+
* Setting the SDL_HINT_WINRT_HANDLE_BACK_BUTTON hint to "1" will cause SDL
4183+
* to mark back-button-press events as Handled, if and when one is sent to
4184+
* the app.
4185+
*
4186+
* Internally, Windows Phone sends back button events as parameters to
4187+
* special back-button-press callback functions. Apps that need to respond
4188+
* to back-button-press events are expected to register one or more
4189+
* callback functions for such, shortly after being launched (during the
4190+
* app's initialization phase). After the back button is pressed, the OS
4191+
* will invoke these callbacks. If the app's callback(s) do not explicitly
4192+
* mark the event as handled by the time they return, or if the app never
4193+
* registers one of these callback, the OS will consider the event
4194+
* un-handled, and it will apply its default back button behavior (terminate
4195+
* the app).
4196+
*
4197+
* SDL registers its own back-button-press callback with the Windows Phone
4198+
* OS. This callback will emit a pair of SDL key-press events (SDL_KEYDOWN
4199+
* and SDL_KEYUP), each with a scancode of SDL_SCANCODE_AC_BACK, after which
4200+
* it will check the contents of the hint, SDL_HINT_WINRT_HANDLE_BACK_BUTTON.
4201+
* If the hint's value is set to "1", the back button event's Handled
4202+
* property will get set to 'true'. If the hint's value is set to something
4203+
* else, or if it is unset, SDL will leave the event's Handled property
4204+
* alone. (By default, the OS sets this property to 'false', to note.)
4205+
*
4206+
* SDL apps can either set SDL_HINT_WINRT_HANDLE_BACK_BUTTON well before a
4207+
* back button is pressed, or can set it in direct-response to a back button
4208+
* being pressed.
4209+
*
4210+
* In order to get notified when a back button is pressed, SDL apps should
4211+
* register a callback function with SDL_AddEventWatch(), and have it listen
4212+
* for SDL_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK.
4213+
* (Alternatively, SDL_KEYUP events can be listened-for. Listening for
4214+
* either event type is suitable.) Any value of SDL_HINT_WINRT_HANDLE_BACK_BUTTON
4215+
* set by such a callback, will be applied to the OS' current
4216+
* back-button-press event.
4217+
*
4218+
* More details on back button behavior in Windows Phone apps can be found
4219+
* at the following page, on Microsoft's developer site:
4220+
* http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx
4221+
*/
4222+
#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON "SDL_WINRT_HANDLE_BACK_BUTTON"
4223+
4224+
/** \brief Label text for a WinRT app's privacy policy link
4225+
*
4226+
* Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT,
4227+
* Microsoft mandates that this policy be available via the Windows Settings charm.
4228+
* SDL provides code to add a link there, with its label text being set via the
4229+
* optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
4230+
*
4231+
* Please note that a privacy policy's contents are not set via this hint. A separate
4232+
* hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the
4233+
* policy.
4234+
*
4235+
* The contents of this hint should be encoded as a UTF8 string.
4236+
*
4237+
* The default value is "Privacy Policy". This hint should only be set during app
4238+
* initialization, preferably before any calls to SDL_Init().
4239+
*
4240+
* For additional information on linking to a privacy policy, see the documentation for
4241+
* SDL_HINT_WINRT_PRIVACY_POLICY_URL.
4242+
*/
4243+
#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL "SDL_WINRT_PRIVACY_POLICY_LABEL"
4244+
4245+
/**
4246+
* \brief A URL to a WinRT app's privacy policy
4247+
*
4248+
* All network-enabled WinRT apps must make a privacy policy available to its
4249+
* users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be
4250+
* be available in the Windows Settings charm, as accessed from within the app.
4251+
* SDL provides code to add a URL-based link there, which can point to the app's
4252+
* privacy policy.
4253+
*
4254+
* To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL
4255+
* before calling any SDL_Init() functions. The contents of the hint should
4256+
* be a valid URL. For example, "http://www.example.com".
4257+
*
4258+
* The default value is "", which will prevent SDL from adding a privacy policy
4259+
* link to the Settings charm. This hint should only be set during app init.
4260+
*
4261+
* The label text of an app's "Privacy Policy" link may be customized via another
4262+
* hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
4263+
*
4264+
* Please note that on Windows Phone, Microsoft does not provide standard UI
4265+
* for displaying a privacy policy link, and as such, SDL_HINT_WINRT_PRIVACY_POLICY_URL
4266+
* will not get used on that platform. Network-enabled phone apps should display
4267+
* their privacy policy through some other, in-app means.
4268+
*/
4269+
#define SDL_HINT_WINRT_PRIVACY_POLICY_URL "SDL_WINRT_PRIVACY_POLICY_URL"
4270+
4271+
41724272
/**
41734273
* A variable controlling whether back-button-press events on Windows Phone to
41744274
* be marked as handled.

0 commit comments

Comments
 (0)