SDL  2.0
SDL_hints.h File Reference
#include "SDL_stdinc.h"
#include "begin_code.h"
#include "close_code.h"
+ Include dependency graph for SDL_hints.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SDL_HINT_FRAMEBUFFER_ACCELERATION   "SDL_FRAMEBUFFER_ACCELERATION"
 A variable controlling how 3D acceleration is used to accelerate the SDL screen surface. More...
 
#define SDL_HINT_RENDER_DRIVER   "SDL_RENDER_DRIVER"
 A variable specifying which render driver to use. More...
 
#define SDL_HINT_RENDER_OPENGL_SHADERS   "SDL_RENDER_OPENGL_SHADERS"
 A variable controlling whether the OpenGL render driver uses shaders if they are available. More...
 
#define SDL_HINT_RENDER_DIRECT3D_THREADSAFE   "SDL_RENDER_DIRECT3D_THREADSAFE"
 A variable controlling whether the Direct3D device is initialized for thread-safe operations. More...
 
#define SDL_HINT_RENDER_DIRECT3D11_DEBUG   "SDL_RENDER_DIRECT3D11_DEBUG"
 A variable controlling whether to enable Direct3D 11+'s Debug Layer. More...
 
#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE   "SDL_RENDER_LOGICAL_SIZE_MODE"
 A variable controlling the scaling policy for SDL_RenderSetLogicalSize. More...
 
#define SDL_HINT_RENDER_SCALE_QUALITY   "SDL_RENDER_SCALE_QUALITY"
 A variable controlling the scaling quality. More...
 
#define SDL_HINT_RENDER_VSYNC   "SDL_RENDER_VSYNC"
 A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing. More...
 
#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER   "SDL_VIDEO_ALLOW_SCREENSAVER"
 A variable controlling whether the screensaver is enabled. More...
 
#define SDL_HINT_VIDEO_X11_XVIDMODE   "SDL_VIDEO_X11_XVIDMODE"
 A variable controlling whether the X11 VidMode extension should be used. More...
 
#define SDL_HINT_VIDEO_X11_XINERAMA   "SDL_VIDEO_X11_XINERAMA"
 A variable controlling whether the X11 Xinerama extension should be used. More...
 
#define SDL_HINT_VIDEO_X11_XRANDR   "SDL_VIDEO_X11_XRANDR"
 A variable controlling whether the X11 XRandR extension should be used. More...
 
#define SDL_HINT_VIDEO_X11_NET_WM_PING   "SDL_VIDEO_X11_NET_WM_PING"
 A variable controlling whether the X11 _NET_WM_PING protocol should be supported. More...
 
#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR   "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"
 A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used. More...
 
#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN   "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
 A variable controlling whether the window frame and title bar are interactive when the cursor is hidden. More...
 
#define SDL_HINT_WINDOWS_INTRESOURCE_ICON   "SDL_WINDOWS_INTRESOURCE_ICON"
 A variable to specify custom icon resource id from RC file on Windows platform. More...
 
#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL   "SDL_WINDOWS_INTRESOURCE_ICON_SMALL"
 
#define SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP   "SDL_WINDOWS_ENABLE_MESSAGELOOP"
 A variable controlling whether the windows message loop is processed by SDL. More...
 
#define SDL_HINT_GRAB_KEYBOARD   "SDL_GRAB_KEYBOARD"
 A variable controlling whether grabbing input grabs the keyboard. More...
 
#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE   "SDL_MOUSE_NORMAL_SPEED_SCALE"
 A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode. More...
 
#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE   "SDL_MOUSE_RELATIVE_SPEED_SCALE"
 A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode. More...
 
#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP   "SDL_MOUSE_RELATIVE_MODE_WARP"
 A variable controlling whether relative mouse mode is implemented using mouse warping. More...
 
#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH   "SDL_MOUSE_FOCUS_CLICKTHROUGH"
 Allow mouse click events when clicking to focus an SDL window. More...
 
#define SDL_HINT_TOUCH_MOUSE_EVENTS   "SDL_TOUCH_MOUSE_EVENTS"
 A variable controlling whether touch events should generate synthetic mouse events. More...
 
#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS   "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"
 Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true. More...
 
#define SDL_HINT_IDLE_TIMER_DISABLED   "SDL_IOS_IDLE_TIMER_DISABLED"
 A variable controlling whether the idle timer is disabled on iOS. More...
 
#define SDL_HINT_ORIENTATIONS   "SDL_IOS_ORIENTATIONS"
 A variable controlling which orientations are allowed on iOS. More...
 
#define SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS   "SDL_APPLE_TV_CONTROLLER_UI_EVENTS"
 A variable controlling whether controllers used with the Apple TV generate UI events. More...
 
#define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION   "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION"
 A variable controlling whether the Apple TV remote's joystick axes will automatically match the rotation of the remote. More...
 
#define SDL_HINT_IOS_HIDE_HOME_INDICATOR   "SDL_IOS_HIDE_HOME_INDICATOR"
 A variable controlling whether the home indicator bar on iPhone X should be hidden. More...
 
#define SDL_HINT_ACCELEROMETER_AS_JOYSTICK   "SDL_ACCELEROMETER_AS_JOYSTICK"
 A variable controlling whether the Android / iOS built-in accelerometer should be listed as a joystick device. More...
 
#define SDL_HINT_TV_REMOTE_AS_JOYSTICK   "SDL_TV_REMOTE_AS_JOYSTICK"
 A variable controlling whether the Android / tvOS remotes should be listed as joystick devices, instead of sending keyboard events. More...
 
#define SDL_HINT_XINPUT_ENABLED   "SDL_XINPUT_ENABLED"
 A variable that lets you disable the detection and use of Xinput gamepad devices. More...
 
#define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING   "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
 A variable that causes SDL to use the old axis and button mapping for XInput devices. More...
 
#define SDL_HINT_GAMECONTROLLERCONFIG   "SDL_GAMECONTROLLERCONFIG"
 A variable that lets you manually hint extra gamecontroller db entries. More...
 
#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES   "SDL_GAMECONTROLLER_IGNORE_DEVICES"
 
#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT   "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"
 
#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS   "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
 A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background. More...
 
#define SDL_HINT_ALLOW_TOPMOST   "SDL_ALLOW_TOPMOST"
 If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it. This is a debugging aid for developers and not expected to be used by end users. The default is "1". More...
 
#define SDL_HINT_TIMER_RESOLUTION   "SDL_TIMER_RESOLUTION"
 A variable that controls the timer resolution, in milliseconds. More...
 
#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION   "SDL_QTWAYLAND_CONTENT_ORIENTATION"
 A variable describing the content orientation on QtWayland-based platforms. More...
 
#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS   "SDL_QTWAYLAND_WINDOW_FLAGS"
 Flags to set on QtWayland windows to integrate with the native window manager. More...
 
#define SDL_HINT_THREAD_STACK_SIZE   "SDL_THREAD_STACK_SIZE"
 A string specifying SDL's threads stack size in bytes or "0" for the backend's default size. More...
 
#define SDL_HINT_VIDEO_HIGHDPI_DISABLED   "SDL_VIDEO_HIGHDPI_DISABLED"
 If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS) More...
 
#define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK   "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK"
 A variable that determines whether ctrl+click should generate a right-click event on Mac. More...
 
#define SDL_HINT_VIDEO_WIN_D3DCOMPILER   "SDL_VIDEO_WIN_D3DCOMPILER"
 A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries. More...
 
#define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT   "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT"
 A variable that is the address of another SDL_Window* (as a hex string formatted with "%p"). More...
 
#define SDL_HINT_WINRT_PRIVACY_POLICY_URL   "SDL_WINRT_PRIVACY_POLICY_URL"
 A URL to a WinRT app's privacy policy. More...
 
#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL   "SDL_WINRT_PRIVACY_POLICY_LABEL"
 Label text for a WinRT app's privacy policy link. More...
 
#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON   "SDL_WINRT_HANDLE_BACK_BUTTON"
 Allows back-button-press events on Windows Phone to be marked as handled. More...
 
#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES   "SDL_VIDEO_MAC_FULLSCREEN_SPACES"
 A variable that dictates policy for fullscreen Spaces on Mac OS X. More...
 
#define SDL_HINT_MAC_BACKGROUND_APP   "SDL_MAC_BACKGROUND_APP"
 When set don't force the SDL app to become a foreground process. More...
 
#define SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION   "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"
 Android APK expansion main file version. Should be a string number like "1", "2" etc. More...
 
#define SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION   "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION"
 Android APK expansion patch file version. Should be a string number like "1", "2" etc. More...
 
#define SDL_HINT_IME_INTERNAL_EDITING   "SDL_IME_INTERNAL_EDITING"
 A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_TEXTEDITING events. More...
 
#define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH   "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH"
 A variable to control whether mouse and touch events are to be treated together or separately. More...
 
#define SDL_HINT_RETURN_KEY_HIDES_IME   "SDL_RETURN_KEY_HIDES_IME"
 A variable to control whether the return key on the soft keyboard should hide the soft keyboard on Android and iOS. More...
 
#define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT   "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT"
 override the binding element for keyboard inputs for Emscripten builds More...
 
#define SDL_HINT_NO_SIGNAL_HANDLERS   "SDL_NO_SIGNAL_HANDLERS"
 Tell SDL not to catch the SIGINT or SIGTERM signals. More...
 
#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4   "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"
 Tell SDL not to generate window-close events for Alt+F4 on Windows. More...
 
#define SDL_HINT_BMP_SAVE_LEGACY_FORMAT   "SDL_BMP_SAVE_LEGACY_FORMAT"
 Prevent SDL from using version 4 of the bitmap header when saving BMPs. More...
 
#define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING   "SDL_WINDOWS_DISABLE_THREAD_NAMING"
 Tell SDL not to name threads on Windows with the 0x406D1388 Exception. The 0x406D1388 Exception is a trick used to inform Visual Studio of a thread's name, but it tends to cause problems with other debuggers, and the .NET runtime. Note that SDL 2.0.6 and later will still use the (safer) SetThreadDescription API, introduced in the Windows 10 Creators Update, if available. More...
 
#define SDL_HINT_RPI_VIDEO_LAYER   "SDL_RPI_VIDEO_LAYER"
 Tell SDL which Dispmanx layer to use on a Raspberry PI. More...
 
#define SDL_HINT_VIDEO_DOUBLE_BUFFER   "SDL_VIDEO_DOUBLE_BUFFER"
 Tell the video driver that we only want a double buffer. More...
 
#define SDL_HINT_OPENGL_ES_DRIVER   "SDL_OPENGL_ES_DRIVER"
 A variable controlling what driver to use for OpenGL ES contexts. More...
 
#define SDL_HINT_AUDIO_RESAMPLING_MODE   "SDL_AUDIO_RESAMPLING_MODE"
 A variable controlling speed/quality tradeoff of audio resampling. More...
 
#define SDL_HINT_AUDIO_CATEGORY   "SDL_AUDIO_CATEGORY"
 A variable controlling the audio category on iOS and Mac OS X. More...
 

Typedefs

typedef void(* SDL_HintCallback) (void *userdata, const char *name, const char *oldValue, const char *newValue)
 type definition of the hint callback function. More...
 

Enumerations

enum  SDL_HintPriority {
  SDL_HINT_DEFAULT,
  SDL_HINT_NORMAL,
  SDL_HINT_OVERRIDE
}
 An enumeration of hint priorities. More...
 

Functions

SDL_bool SDL_SetHintWithPriority (const char *name, const char *value, SDL_HintPriority priority)
 Set a hint with a specific priority. More...
 
SDL_bool SDL_SetHint (const char *name, const char *value)
 Set a hint with normal priority. More...
 
const char * SDL_GetHint (const char *name)
 Get a hint. More...
 
SDL_bool SDL_GetHintBoolean (const char *name, SDL_bool default_value)
 Get a hint. More...
 
void SDL_AddHintCallback (const char *name, SDL_HintCallback callback, void *userdata)
 Add a function to watch a particular hint. More...
 
void SDL_DelHintCallback (const char *name, SDL_HintCallback callback, void *userdata)
 Remove a function watching a particular hint. More...
 
void SDL_ClearHints (void)
 Clear all hints. More...
 

Detailed Description

Official documentation for SDL configuration variables

This file contains functions to set and get configuration hints, as well as listing each of them alphabetically.

The convention for naming hints is SDL_HINT_X, where "SDL_X" is the environment variable that can be used to override the default.

In general these hints are just that - they may or may not be supported or applicable on any given platform, but they provide a way for an application or user to give the library a hint as to how they would like the library to work.

Definition in file SDL_hints.h.

Macro Definition Documentation

◆ SDL_HINT_ACCELEROMETER_AS_JOYSTICK

#define SDL_HINT_ACCELEROMETER_AS_JOYSTICK   "SDL_ACCELEROMETER_AS_JOYSTICK"

A variable controlling whether the Android / iOS built-in accelerometer should be listed as a joystick device.

This variable can be set to the following values: "0" - The accelerometer is not listed as a joystick "1" - The accelerometer is available as a 3 axis joystick (the default).

Definition at line 389 of file SDL_hints.h.

Referenced by main(), and SDL_SYS_JoystickInit().

◆ SDL_HINT_ALLOW_TOPMOST

#define SDL_HINT_ALLOW_TOPMOST   "SDL_ALLOW_TOPMOST"

If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it. This is a debugging aid for developers and not expected to be used by end users. The default is "1".

This variable can be set to the following values: "0" - don't allow topmost "1" - allow topmost

Definition at line 476 of file SDL_hints.h.

Referenced by SDL_ShouldAllowTopmost().

◆ SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION

#define SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION   "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"

Android APK expansion main file version. Should be a string number like "1", "2" etc.

Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION.

If both hints were set then SDL_RWFromFile() will look into expansion files after a given relative path was not found in the internal storage and assets.

By default this hint is not set and the APK expansion files are not searched.

Definition at line 717 of file SDL_hints.h.

◆ SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION

#define SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION   "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION"

Android APK expansion patch file version. Should be a string number like "1", "2" etc.

Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION.

If both hints were set then SDL_RWFromFile() will look into expansion files after a given relative path was not found in the internal storage and assets.

By default this hint is not set and the APK expansion files are not searched.

Definition at line 729 of file SDL_hints.h.

◆ SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH

#define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH   "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH"

A variable to control whether mouse and touch events are to be treated together or separately.

The variable can be set to the following values: "0" - Mouse events will be handled as touch events, and touch will raise fake mouse events. This is the behaviour of SDL <= 2.0.3. (default) "1" - Mouse events will be handled separately from pure touch events.

The value of this hint is used at runtime, so it can be changed at any time.

Definition at line 753 of file SDL_hints.h.

◆ SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS

#define SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS   "SDL_APPLE_TV_CONTROLLER_UI_EVENTS"

A variable controlling whether controllers used with the Apple TV generate UI events.

When UI events are generated by controller input, the app will be backgrounded when the Apple TV remote's menu button is pressed, and when the pause or B buttons on gamepads are pressed.

More information about properly making use of controllers for the Apple TV can be found here: https://developer.apple.com/tvos/human-interface-guidelines/remote-and-controllers/

This variable can be set to the following values: "0" - Controller input does not generate UI events (the default). "1" - Controller input generates UI events.

Definition at line 358 of file SDL_hints.h.

◆ SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION

#define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION   "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION"

A variable controlling whether the Apple TV remote's joystick axes will automatically match the rotation of the remote.

This variable can be set to the following values: "0" - Remote orientation does not affect joystick axes (the default). "1" - Joystick axes are based on the orientation of the remote.

Definition at line 368 of file SDL_hints.h.

Referenced by SDL_SYS_AddMFIJoystickDevice(), SDL_SYS_JoystickInit(), and SDL_SYS_JoystickQuit().

◆ SDL_HINT_AUDIO_CATEGORY

#define SDL_HINT_AUDIO_CATEGORY   "SDL_AUDIO_CATEGORY"

A variable controlling the audio category on iOS and Mac OS X.

This variable can be set to the following values:

"ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default) "playback" - Use the AVAudioSessionCategoryPlayback category

For more information, see Apple's documentation: https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html

Definition at line 931 of file SDL_hints.h.

◆ SDL_HINT_AUDIO_RESAMPLING_MODE

#define SDL_HINT_AUDIO_RESAMPLING_MODE   "SDL_AUDIO_RESAMPLING_MODE"

A variable controlling speed/quality tradeoff of audio resampling.

If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ ) to handle audio resampling. There are different resampling modes available that produce different levels of quality, using more CPU.

If this hint isn't specified to a valid setting, or libsamplerate isn't available, SDL will use the default, internal resampling algorithm.

Note that this is currently only applicable to resampling audio that is being written to a device for playback or audio being read from a device for capture. SDL_AudioCVT always uses the default resampler (although this might change for SDL 2.1).

This hint is currently only checked at audio subsystem initialization.

This variable can be set to the following values:

"0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast) "1" or "fast" - Use fast, slightly higher quality resampling, if available "2" or "medium" - Use medium quality resampling, if available "3" or "best" - Use high quality resampling, if available

Definition at line 918 of file SDL_hints.h.

◆ SDL_HINT_BMP_SAVE_LEGACY_FORMAT

#define SDL_HINT_BMP_SAVE_LEGACY_FORMAT   "SDL_BMP_SAVE_LEGACY_FORMAT"

Prevent SDL from using version 4 of the bitmap header when saving BMPs.

The bitmap header version 4 is required for proper alpha channel support and SDL will use it when required. Should this not be desired, this hint can force the use of the 40 byte header version which is supported everywhere.

The variable can be set to the following values: "0" - Surfaces with a colorkey or an alpha channel are saved to a 32-bit BMP file with an alpha mask. SDL will use the bitmap header version 4 and set the alpha mask accordingly. "1" - Surfaces with a colorkey or an alpha channel are saved to a 32-bit BMP file without an alpha mask. The alpha channel data will be in the file, but applications are going to ignore it.

The default value is "0".

Definition at line 819 of file SDL_hints.h.

Referenced by SDL_SaveBMP_RW().

◆ SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT

#define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT   "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT"

override the binding element for keyboard inputs for Emscripten builds

This hint only applies to the emscripten platform

The variable can be one of "#window" - The javascript window object (this is the default) "#document" - The javascript document object "#screen" - the javascript window.screen object "#canvas" - the WebGL canvas element any other string without a leading # sign applies to the element on the page with that ID.

Definition at line 779 of file SDL_hints.h.

◆ SDL_HINT_FRAMEBUFFER_ACCELERATION

#define SDL_HINT_FRAMEBUFFER_ACCELERATION   "SDL_FRAMEBUFFER_ACCELERATION"

A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.

SDL can try to accelerate the SDL screen surface by using streaming textures with a 3D rendering engine. This variable controls whether and how this is done.

This variable can be set to the following values: "0" - Disable 3D acceleration "1" - Enable 3D acceleration, using the default renderer. "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.)

By default SDL tries to make a best guess for each platform whether to use acceleration or not.

Definition at line 65 of file SDL_hints.h.

Referenced by SDL_CreateWindowTexture(), and ShouldUseTextureFramebuffer().

◆ SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES

#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES   "SDL_GAMECONTROLLER_IGNORE_DEVICES"

Definition at line 440 of file SDL_hints.h.

Referenced by SDL_GameControllerInitMappings(), and SDL_GameControllerQuitMappings().

◆ SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT

#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT   "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"

Definition at line 453 of file SDL_hints.h.

Referenced by SDL_GameControllerInitMappings(), and SDL_GameControllerQuitMappings().

◆ SDL_HINT_GAMECONTROLLERCONFIG

#define SDL_HINT_GAMECONTROLLERCONFIG   "SDL_GAMECONTROLLERCONFIG"

A variable that lets you manually hint extra gamecontroller db entries.

The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h

This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping()

Definition at line 427 of file SDL_hints.h.

Referenced by SDL_GameControllerLoadHints().

◆ SDL_HINT_GRAB_KEYBOARD

#define SDL_HINT_GRAB_KEYBOARD   "SDL_GRAB_KEYBOARD"

A variable controlling whether grabbing input grabs the keyboard.

This variable can be set to the following values: "0" - Grab will affect only the mouse "1" - Grab will affect mouse and keyboard

By default SDL will not grab the keyboard so system shortcuts still work.

Definition at line 263 of file SDL_hints.h.

◆ SDL_HINT_IDLE_TIMER_DISABLED

#define SDL_HINT_IDLE_TIMER_DISABLED   "SDL_IOS_IDLE_TIMER_DISABLED"

A variable controlling whether the idle timer is disabled on iOS.

When an iOS app does not receive touches for some time, the screen is dimmed automatically. For games where the accelerometer is the only input this is problematic. This functionality can be disabled by setting this hint.

As of SDL 2.0.4, SDL_EnableScreenSaver() and SDL_DisableScreenSaver() accomplish the same thing on iOS. They should be preferred over this hint.

This variable can be set to the following values: "0" - Enable idle timer "1" - Disable idle timer

Definition at line 329 of file SDL_hints.h.

◆ SDL_HINT_IME_INTERNAL_EDITING

#define SDL_HINT_IME_INTERNAL_EDITING   "SDL_IME_INTERNAL_EDITING"

A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_TEXTEDITING events.

The variable can be set to the following values: "0" - SDL_TEXTEDITING events are sent, and it is the application's responsibility to render the text from these events and differentiate it somehow from committed text. (default) "1" - If supported by the IME then SDL_TEXTEDITING events are not sent, and text that is being composed will be rendered in its own UI.

Definition at line 741 of file SDL_hints.h.

◆ SDL_HINT_IOS_HIDE_HOME_INDICATOR

#define SDL_HINT_IOS_HIDE_HOME_INDICATOR   "SDL_IOS_HIDE_HOME_INDICATOR"

A variable controlling whether the home indicator bar on iPhone X should be hidden.

This variable can be set to the following values: "0" - The indicator bar is not hidden (default for windowed applications) "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications) "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications)

Definition at line 379 of file SDL_hints.h.

◆ SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS

#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS   "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"

A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.

The variable can be set to the following values: "0" - Disable joystick & gamecontroller input events when the application is in the background. "1" - Enable joystick & gamecontroller input events when the application is in the background.

The default value is "0". This hint may be set at any time.

Definition at line 466 of file SDL_hints.h.

Referenced by main(), SDL_JoystickInit(), and SDL_JoystickQuit().

◆ SDL_HINT_MAC_BACKGROUND_APP

#define SDL_HINT_MAC_BACKGROUND_APP   "SDL_MAC_BACKGROUND_APP"

When set don't force the SDL app to become a foreground process.

This hint only applies to Mac OS X.

Definition at line 705 of file SDL_hints.h.

◆ SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK

#define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK   "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK"

A variable that determines whether ctrl+click should generate a right-click event on Mac.

If present, holding ctrl while left clicking will generate a right click event when on Mac.

Definition at line 544 of file SDL_hints.h.

◆ SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH

#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH   "SDL_MOUSE_FOCUS_CLICKTHROUGH"

Allow mouse click events when clicking to focus an SDL window.

This variable can be set to the following values: "0" - Ignore mouse clicks that activate a window "1" - Generate events for mouse clicks that activate a window

By default SDL will ignore mouse clicks that activate a window

Definition at line 295 of file SDL_hints.h.

◆ SDL_HINT_MOUSE_NORMAL_SPEED_SCALE

#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE   "SDL_MOUSE_NORMAL_SPEED_SCALE"

A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode.

Definition at line 268 of file SDL_hints.h.

Referenced by SDL_MouseInit(), and SDL_MouseQuit().

◆ SDL_HINT_MOUSE_RELATIVE_MODE_WARP

#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP   "SDL_MOUSE_RELATIVE_MODE_WARP"

A variable controlling whether relative mouse mode is implemented using mouse warping.

This variable can be set to the following values: "0" - Relative mouse mode uses raw input "1" - Relative mouse mode uses mouse warping

By default SDL will use raw input for relative mouse mode

Definition at line 284 of file SDL_hints.h.

Referenced by ShouldUseRelativeModeWarp().

◆ SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE

#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE   "SDL_MOUSE_RELATIVE_SPEED_SCALE"

A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode.

Definition at line 273 of file SDL_hints.h.

Referenced by SDL_MouseInit(), and SDL_MouseQuit().

◆ SDL_HINT_NO_SIGNAL_HANDLERS

#define SDL_HINT_NO_SIGNAL_HANDLERS   "SDL_NO_SIGNAL_HANDLERS"

Tell SDL not to catch the SIGINT or SIGTERM signals.

This hint only applies to Unix-like platforms.

The variable can be set to the following values: "0" - SDL will install a SIGINT and SIGTERM handler, and when it catches a signal, convert it into an SDL_QUIT event. "1" - SDL will not install a signal handler at all.

Definition at line 791 of file SDL_hints.h.

Referenced by SDL_QuitInit().

◆ SDL_HINT_OPENGL_ES_DRIVER

#define SDL_HINT_OPENGL_ES_DRIVER   "SDL_OPENGL_ES_DRIVER"

A variable controlling what driver to use for OpenGL ES contexts.

On some platforms, currently Windows and X11, OpenGL drivers may support creating contexts with an OpenGL ES profile. By default SDL uses these profiles, when available, otherwise it attempts to load an OpenGL ES library, e.g. that provided by the ANGLE project. This variable controls whether SDL follows this default behaviour or will always load an OpenGL ES library.

Circumstances where this is useful include

  • Testing an app with a particular OpenGL ES implementation, e.g ANGLE, or emulator, e.g. those from ARM, Imagination or Qualcomm.
  • Resolving OpenGL ES function addresses at link time by linking with the OpenGL ES library instead of querying them at run time with SDL_GL_GetProcAddress().

Caution: for an application to work with the default behaviour across different OpenGL drivers it must query the OpenGL ES function addresses at run time using SDL_GL_GetProcAddress().

This variable is ignored on most platforms because OpenGL ES is native or not supported.

This variable can be set to the following values: "0" - Use ES profile of OpenGL, if available. (Default when not set.) "1" - Load OpenGL ES library using the default library names.

Definition at line 892 of file SDL_hints.h.

◆ SDL_HINT_ORIENTATIONS

#define SDL_HINT_ORIENTATIONS   "SDL_IOS_ORIENTATIONS"

A variable controlling which orientations are allowed on iOS.

In some circumstances it is necessary to be able to explicitly control which UI orientations are allowed.

This variable is a space delimited list of the following values: "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown"

Definition at line 340 of file SDL_hints.h.

Referenced by WINRT_ProcessWindowSizeChange(), and WINRT_SetDisplayOrientationsPreference().

◆ SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION

#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION   "SDL_QTWAYLAND_CONTENT_ORIENTATION"

A variable describing the content orientation on QtWayland-based platforms.

On QtWayland platforms, windows are rotated client-side to allow for custom transitions. In order to correctly position overlays (e.g. volume bar) and gestures (e.g. events view, close/minimize gestures), the system needs to know in which orientation the application is currently drawing its contents.

This does not cause the window to be rotated or resized, the application needs to take care of drawing the content in the right orientation (the framebuffer is always in portrait mode).

This variable can be one of the following values: "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape"

Definition at line 510 of file SDL_hints.h.

◆ SDL_HINT_QTWAYLAND_WINDOW_FLAGS

#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS   "SDL_QTWAYLAND_WINDOW_FLAGS"

Flags to set on QtWayland windows to integrate with the native window manager.

On QtWayland platforms, this hint controls the flags to set on the windows. For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures.

This variable is a space-separated list of the following values (empty = no flags): "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager"

Definition at line 521 of file SDL_hints.h.

◆ SDL_HINT_RENDER_DIRECT3D11_DEBUG

#define SDL_HINT_RENDER_DIRECT3D11_DEBUG   "SDL_RENDER_DIRECT3D11_DEBUG"

A variable controlling whether to enable Direct3D 11+'s Debug Layer.

This variable does not have any effect on the Direct3D 9 based renderer.

This variable can be set to the following values: "0" - Disable Debug Layer use "1" - Enable Debug Layer use

By default, SDL does not use Direct3D Debug Layer.

Definition at line 120 of file SDL_hints.h.

◆ SDL_HINT_RENDER_DIRECT3D_THREADSAFE

#define SDL_HINT_RENDER_DIRECT3D_THREADSAFE   "SDL_RENDER_DIRECT3D_THREADSAFE"

A variable controlling whether the Direct3D device is initialized for thread-safe operations.

This variable can be set to the following values: "0" - Thread-safety is not enabled (faster) "1" - Thread-safety is enabled

By default the Direct3D device is created with thread-safety disabled.

Definition at line 107 of file SDL_hints.h.

◆ SDL_HINT_RENDER_DRIVER

#define SDL_HINT_RENDER_DRIVER   "SDL_RENDER_DRIVER"

A variable specifying which render driver to use.

If the application doesn't pick a specific renderer to use, this variable specifies the name of the preferred renderer. If the preferred renderer can't be initialized, the normal default renderer is used.

This variable is case insensitive and can be set to the following values: "direct3d" "opengl" "opengles2" "opengles" "metal" "software"

The default varies by platform, but it's the first one in the list that is available on the current platform.

Definition at line 85 of file SDL_hints.h.

Referenced by SDL_CreateRenderer(), and ShouldUseTextureFramebuffer().

◆ SDL_HINT_RENDER_LOGICAL_SIZE_MODE

#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE   "SDL_RENDER_LOGICAL_SIZE_MODE"

A variable controlling the scaling policy for SDL_RenderSetLogicalSize.

This variable can be set to the following values: "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen

By default letterbox is used

Definition at line 131 of file SDL_hints.h.

Referenced by UpdateLogicalSize().

◆ SDL_HINT_RENDER_OPENGL_SHADERS

#define SDL_HINT_RENDER_OPENGL_SHADERS   "SDL_RENDER_OPENGL_SHADERS"

A variable controlling whether the OpenGL render driver uses shaders if they are available.

This variable can be set to the following values: "0" - Disable shaders "1" - Enable shaders

By default shaders are used if OpenGL supports them.

Definition at line 96 of file SDL_hints.h.

◆ SDL_HINT_RENDER_SCALE_QUALITY

#define SDL_HINT_RENDER_SCALE_QUALITY   "SDL_RENDER_SCALE_QUALITY"

A variable controlling the scaling quality.

This variable can be set to the following values: "0" or "nearest" - Nearest pixel sampling "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D) "2" or "best" - Currently this is the same as "linear"

By default nearest pixel sampling is used

Definition at line 143 of file SDL_hints.h.

Referenced by GetScaleQuality().

◆ SDL_HINT_RENDER_VSYNC

#define SDL_HINT_RENDER_VSYNC   "SDL_RENDER_VSYNC"

A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing.

This variable can be set to the following values: "0" - Disable vsync "1" - Enable vsync

By default SDL does not sync screen surface updates with vertical refresh.

Definition at line 154 of file SDL_hints.h.

Referenced by SDL_CreateRenderer().

◆ SDL_HINT_RETURN_KEY_HIDES_IME

#define SDL_HINT_RETURN_KEY_HIDES_IME   "SDL_RETURN_KEY_HIDES_IME"

A variable to control whether the return key on the soft keyboard should hide the soft keyboard on Android and iOS.

The variable can be set to the following values: "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default) "1" - The return key will hide the keyboard.

The value of this hint is used at runtime, so it can be changed at any time.

Definition at line 765 of file SDL_hints.h.

◆ SDL_HINT_RPI_VIDEO_LAYER

#define SDL_HINT_RPI_VIDEO_LAYER   "SDL_RPI_VIDEO_LAYER"

Tell SDL which Dispmanx layer to use on a Raspberry PI.

Also known as Z-order. The variable can take a negative or positive value. The default is 10000.

Definition at line 843 of file SDL_hints.h.

◆ SDL_HINT_THREAD_STACK_SIZE

#define SDL_HINT_THREAD_STACK_SIZE   "SDL_THREAD_STACK_SIZE"

A string specifying SDL's threads stack size in bytes or "0" for the backend's default size.

Use this hint in case you need to set SDL's threads stack size to other than the default. This is specially useful if you build SDL against a non glibc libc library (such as musl) which provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses). Support for this hint is currently available only in the pthread, Windows, and PSP backend.

Definition at line 531 of file SDL_hints.h.

Referenced by SDL_CreateThread().

◆ SDL_HINT_TIMER_RESOLUTION

#define SDL_HINT_TIMER_RESOLUTION   "SDL_TIMER_RESOLUTION"

A variable that controls the timer resolution, in milliseconds.

The higher resolution the timer, the more frequently the CPU services timer interrupts, and the more precise delays are, but this takes up power and CPU time. This hint is only used on Windows 7 and earlier.

See this blog post for more information: http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/

If this variable is set to "0", the system timer resolution is not set.

The default value is "1". This hint may be set at any time.

Definition at line 492 of file SDL_hints.h.

◆ SDL_HINT_TOUCH_MOUSE_EVENTS

#define SDL_HINT_TOUCH_MOUSE_EVENTS   "SDL_TOUCH_MOUSE_EVENTS"

A variable controlling whether touch events should generate synthetic mouse events.

This variable can be set to the following values: "0" - Touch events will not generate mouse events "1" - Touch events will generate mouse events

By default SDL will generate mouse events for touch events

Definition at line 306 of file SDL_hints.h.

Referenced by SDL_MouseInit().

◆ SDL_HINT_TV_REMOTE_AS_JOYSTICK

#define SDL_HINT_TV_REMOTE_AS_JOYSTICK   "SDL_TV_REMOTE_AS_JOYSTICK"

A variable controlling whether the Android / tvOS remotes should be listed as joystick devices, instead of sending keyboard events.

This variable can be set to the following values: "0" - Remotes send enter/escape/arrow key events "1" - Remotes are available as 2 axis, 2 button joysticks (the default).

Definition at line 399 of file SDL_hints.h.

Referenced by SDL_SYS_AddJoystickDevice().

◆ SDL_HINT_VIDEO_ALLOW_SCREENSAVER

#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER   "SDL_VIDEO_ALLOW_SCREENSAVER"

A variable controlling whether the screensaver is enabled.

This variable can be set to the following values: "0" - Disable screensaver "1" - Enable screensaver

By default SDL will disable the screensaver.

Definition at line 165 of file SDL_hints.h.

Referenced by SDL_VideoInit().

◆ SDL_HINT_VIDEO_DOUBLE_BUFFER

#define SDL_HINT_VIDEO_DOUBLE_BUFFER   "SDL_VIDEO_DOUBLE_BUFFER"

Tell the video driver that we only want a double buffer.

By default, most lowlevel 2D APIs will use a triple buffer scheme that wastes no CPU time on waiting for vsync after issuing a flip, but introduces a frame of latency. On the other hand, using a double buffer scheme instead is recommended for cases where low latency is an important factor because we save a whole frame of latency. We do so by waiting for vsync immediately after issuing a flip, usually just after eglSwapBuffers call in the backend's *_SwapWindow function.

Since it's driver-specific, it's only supported where possible and implemented. Currently supported the following drivers:

  • KMSDRM (kmsdrm)
  • Raspberry Pi (raspberrypi)

Definition at line 861 of file SDL_hints.h.

◆ SDL_HINT_VIDEO_HIGHDPI_DISABLED

#define SDL_HINT_VIDEO_HIGHDPI_DISABLED   "SDL_VIDEO_HIGHDPI_DISABLED"

If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS)

Definition at line 536 of file SDL_hints.h.

Referenced by SDL_CreateWindow().

◆ SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES

#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES   "SDL_VIDEO_MAC_FULLSCREEN_SPACES"

A variable that dictates policy for fullscreen Spaces on Mac OS X.

This hint only applies to Mac OS X.

The variable can be set to the following values: "0" - Disable Spaces support (FULLSCREEN_DESKTOP won't use them and SDL_WINDOW_RESIZABLE windows won't offer the "fullscreen" button on their titlebars). "1" - Enable Spaces support (FULLSCREEN_DESKTOP will use them and SDL_WINDOW_RESIZABLE windows will offer the "fullscreen" button on their titlebars).

The default value is "1". Spaces are disabled regardless of this hint if the OS isn't at least Mac OS X Lion (10.7). This hint must be set before any windows are created.

Definition at line 697 of file SDL_hints.h.

◆ SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS

#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS   "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"

Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.

Definition at line 312 of file SDL_hints.h.

Referenced by ShouldMinimizeOnFocusLoss().

◆ SDL_HINT_VIDEO_WIN_D3DCOMPILER

#define SDL_HINT_VIDEO_WIN_D3DCOMPILER   "SDL_VIDEO_WIN_D3DCOMPILER"

A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries.

SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It can use two different sets of binaries, those compiled by the user from source or those provided by the Chrome browser. In the later case, these binaries require that SDL loads a DLL providing the shader compiler.

This variable can be set to the following values: "d3dcompiler_46.dll" - default, best for Vista or later. "d3dcompiler_43.dll" - for XP support. "none" - do not load any library, useful if you compiled ANGLE from source and included the compiler in your binaries.

Definition at line 560 of file SDL_hints.h.

◆ SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT

#define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT   "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT"

A variable that is the address of another SDL_Window* (as a hex string formatted with "%p").

If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly created SDL_Window:

  1. Its pixel format will be set to the same pixel format as this SDL_Window. This is needed for example when sharing an OpenGL context across multiple windows.
  2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for OpenGL rendering.

This variable can be set to the following values: The address (as a string "%p") of the SDL_Window* that new windows created with SDL_CreateWindowFrom() should share a pixel format with.

Definition at line 579 of file SDL_hints.h.

◆ SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR

#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR   "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"

A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used.

This variable can be set to the following values: "0" - Disable _NET_WM_BYPASS_COMPOSITOR "1" - Enable _NET_WM_BYPASS_COMPOSITOR

By default SDL will use _NET_WM_BYPASS_COMPOSITOR

Definition at line 224 of file SDL_hints.h.

◆ SDL_HINT_VIDEO_X11_NET_WM_PING

#define SDL_HINT_VIDEO_X11_NET_WM_PING   "SDL_VIDEO_X11_NET_WM_PING"

A variable controlling whether the X11 _NET_WM_PING protocol should be supported.

This variable can be set to the following values: "0" - Disable _NET_WM_PING "1" - Enable _NET_WM_PING

By default SDL will use _NET_WM_PING, but for applications that know they will not always be able to respond to ping requests in a timely manner they can turn it off to avoid the window manager thinking the app is hung. The hint is checked in CreateWindow.

Definition at line 212 of file SDL_hints.h.

◆ SDL_HINT_VIDEO_X11_XINERAMA

#define SDL_HINT_VIDEO_X11_XINERAMA   "SDL_VIDEO_X11_XINERAMA"

A variable controlling whether the X11 Xinerama extension should be used.

This variable can be set to the following values: "0" - Disable Xinerama "1" - Enable Xinerama

By default SDL will use Xinerama if it is available.

Definition at line 187 of file SDL_hints.h.

◆ SDL_HINT_VIDEO_X11_XRANDR

#define SDL_HINT_VIDEO_X11_XRANDR   "SDL_VIDEO_X11_XRANDR"

A variable controlling whether the X11 XRandR extension should be used.

This variable can be set to the following values: "0" - Disable XRandR "1" - Enable XRandR

By default SDL will not use XRandR because of window manager issues.

Definition at line 198 of file SDL_hints.h.

◆ SDL_HINT_VIDEO_X11_XVIDMODE

#define SDL_HINT_VIDEO_X11_XVIDMODE   "SDL_VIDEO_X11_XVIDMODE"

A variable controlling whether the X11 VidMode extension should be used.

This variable can be set to the following values: "0" - Disable XVidMode "1" - Enable XVidMode

By default SDL will use XVidMode if it is available.

Definition at line 176 of file SDL_hints.h.

◆ SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN

#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN   "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"

A variable controlling whether the window frame and title bar are interactive when the cursor is hidden.

This variable can be set to the following values: "0" - The window frame is not interactive when the cursor is hidden (no move, resize, etc) "1" - The window frame is interactive when the cursor is hidden

By default SDL will allow interaction with the window frame when the cursor is hidden

Definition at line 235 of file SDL_hints.h.

◆ SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING

#define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING   "SDL_WINDOWS_DISABLE_THREAD_NAMING"

Tell SDL not to name threads on Windows with the 0x406D1388 Exception. The 0x406D1388 Exception is a trick used to inform Visual Studio of a thread's name, but it tends to cause problems with other debuggers, and the .NET runtime. Note that SDL 2.0.6 and later will still use the (safer) SetThreadDescription API, introduced in the Windows 10 Creators Update, if available.

The variable can be set to the following values: "0" - SDL will raise the 0x406D1388 Exception to name threads. This is the default behavior of SDL <= 2.0.4. "1" - SDL will not raise this exception, and threads will be unnamed. (default) This is necessary with .NET languages or debuggers that aren't Visual Studio.

Definition at line 835 of file SDL_hints.h.

◆ SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP

#define SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP   "SDL_WINDOWS_ENABLE_MESSAGELOOP"

A variable controlling whether the windows message loop is processed by SDL.

This variable can be set to the following values: "0" - The window message loop is not run "1" - The window message loop is processed in SDL_PumpEvents()

By default SDL will process the windows message loop

Definition at line 252 of file SDL_hints.h.

◆ SDL_HINT_WINDOWS_INTRESOURCE_ICON

#define SDL_HINT_WINDOWS_INTRESOURCE_ICON   "SDL_WINDOWS_INTRESOURCE_ICON"

A variable to specify custom icon resource id from RC file on Windows platform.

Definition at line 240 of file SDL_hints.h.

◆ SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL

#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL   "SDL_WINDOWS_INTRESOURCE_ICON_SMALL"

Definition at line 241 of file SDL_hints.h.

◆ SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4

#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4   "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"

Tell SDL not to generate window-close events for Alt+F4 on Windows.

The variable can be set to the following values: "0" - SDL will generate a window-close event when it sees Alt+F4. "1" - SDL will only do normal key handling for Alt+F4.

Definition at line 800 of file SDL_hints.h.

◆ SDL_HINT_WINRT_HANDLE_BACK_BUTTON

#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON   "SDL_WINRT_HANDLE_BACK_BUTTON"

Allows 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_KEYDOWN and SDL_KEYUP), 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_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK. (Alternatively, SDL_KEYUP 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

Definition at line 678 of file SDL_hints.h.

Referenced by WINRT_OnBackButtonPressed().

◆ SDL_HINT_WINRT_PRIVACY_POLICY_LABEL

#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL   "SDL_WINRT_PRIVACY_POLICY_LABEL"

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". This hint should only be set during app initialization, preferably before any calls to SDL_Init().

For additional information on linking to a privacy policy, see the documentation for SDL_HINT_WINRT_PRIVACY_POLICY_URL.

Definition at line 626 of file SDL_hints.h.

Referenced by IsSDLWindowEventPending().

◆ SDL_HINT_WINRT_PRIVACY_POLICY_URL

#define SDL_HINT_WINRT_PRIVACY_POLICY_URL   "SDL_WINRT_PRIVACY_POLICY_URL"

A 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 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.

Definition at line 605 of file SDL_hints.h.

Referenced by IsSDLWindowEventPending().

◆ SDL_HINT_XINPUT_ENABLED

#define SDL_HINT_XINPUT_ENABLED   "SDL_XINPUT_ENABLED"

A variable that lets you disable the detection and use of Xinput gamepad devices.

The variable can be set to the following values: "0" - Disable XInput detection (only uses direct input) "1" - Enable XInput detection (the default)

Definition at line 408 of file SDL_hints.h.

◆ SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING

#define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING   "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"

A variable that causes SDL to use the old axis and button mapping for XInput devices.

This hint is for backwards compatibility only and will be removed in SDL 2.1

The default value is "0". This hint must be set before SDL_Init()

Definition at line 417 of file SDL_hints.h.

Typedef Documentation

◆ SDL_HintCallback

typedef void( * SDL_HintCallback) (void *userdata, const char *name, const char *oldValue, const char *newValue)

type definition of the hint callback function.

Definition at line 982 of file SDL_hints.h.

Enumeration Type Documentation

◆ SDL_HintPriority

An enumeration of hint priorities.

Enumerator
SDL_HINT_DEFAULT 
SDL_HINT_NORMAL 
SDL_HINT_OVERRIDE 

Definition at line 936 of file SDL_hints.h.

937 {
SDL_HintPriority
An enumeration of hint priorities.
Definition: SDL_hints.h:936

Function Documentation

◆ SDL_AddHintCallback()

void SDL_AddHintCallback ( const char *  name,
SDL_HintCallback  callback,
void userdata 
)

Add a function to watch a particular hint.

Parameters
nameThe hint to watch
callbackThe function to call when the hint value changes
userdataA pointer to pass to the callback function

Definition at line 135 of file SDL_hints.c.

References SDL_HintWatch::callback, SDL_Hint::callbacks, SDL_Hint::name, SDL_HintWatch::next, SDL_Hint::next, NULL, SDL_Hint::priority, SDL_DelHintCallback(), SDL_free, SDL_GetHint(), SDL_HINT_DEFAULT, SDL_hints, SDL_InvalidParamError, SDL_malloc, SDL_OutOfMemory, SDL_strcmp, SDL_strdup, SDL_HintWatch::userdata, and SDL_Hint::value.

136 {
137  SDL_Hint *hint;
138  SDL_HintWatch *entry;
139  const char *value;
140 
141  if (!name || !*name) {
142  SDL_InvalidParamError("name");
143  return;
144  }
145  if (!callback) {
146  SDL_InvalidParamError("callback");
147  return;
148  }
149 
150  SDL_DelHintCallback(name, callback, userdata);
151 
152  entry = (SDL_HintWatch *)SDL_malloc(sizeof(*entry));
153  if (!entry) {
154  SDL_OutOfMemory();
155  return;
156  }
157  entry->callback = callback;
158  entry->userdata = userdata;
159 
160  for (hint = SDL_hints; hint; hint = hint->next) {
161  if (SDL_strcmp(name, hint->name) == 0) {
162  break;
163  }
164  }
165  if (!hint) {
166  /* Need to add a hint entry for this watcher */
167  hint = (SDL_Hint *)SDL_malloc(sizeof(*hint));
168  if (!hint) {
169  SDL_OutOfMemory();
170  SDL_free(entry);
171  return;
172  }
173  hint->name = SDL_strdup(name);
174  hint->value = NULL;
175  hint->priority = SDL_HINT_DEFAULT;
176  hint->callbacks = NULL;
177  hint->next = SDL_hints;
178  SDL_hints = hint;
179  }
180 
181  /* Add it to the callbacks for this hint */
182  entry->next = hint->callbacks;
183  hint->callbacks = entry;
184 
185  /* Now call it with the current value */
186  value = SDL_GetHint(name);
187  callback(userdata, name, value, value);
188 }
void * userdata
Definition: SDL_hints.c:32
const char * SDL_GetHint(const char *name)
Get a hint.
Definition: SDL_hints.c:104
void SDL_DelHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
Remove a function watching a particular hint.
Definition: SDL_hints.c:191
struct SDL_Hint * next
Definition: SDL_hints.c:41
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
GLuint const GLchar * name
#define SDL_free
GLsizei const GLfloat * value
static Uint32 callback(Uint32 interval, void *param)
Definition: testtimer.c:34
SDL_HintWatch * callbacks
Definition: SDL_hints.c:40
#define NULL
Definition: begin_code.h:164
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_HintPriority priority
Definition: SDL_hints.c:39
#define SDL_strdup
#define SDL_malloc
#define SDL_strcmp
char * value
Definition: SDL_hints.c:38
SDL_HintCallback callback
Definition: SDL_hints.c:31
struct SDL_HintWatch * next
Definition: SDL_hints.c:33
char * name
Definition: SDL_hints.c:37
static SDL_Hint * SDL_hints
Definition: SDL_hints.c:44

◆ SDL_ClearHints()

void SDL_ClearHints ( void  )

Clear all hints.

This function is called during SDL_Quit() to free stored hints.

Definition at line 216 of file SDL_hints.c.

References SDL_Hint::callbacks, SDL_Hint::name, SDL_HintWatch::next, SDL_Hint::next, SDL_free, SDL_hints, and SDL_Hint::value.

217 {
218  SDL_Hint *hint;
219  SDL_HintWatch *entry;
220 
221  while (SDL_hints) {
222  hint = SDL_hints;
223  SDL_hints = hint->next;
224 
225  SDL_free(hint->name);
226  SDL_free(hint->value);
227  for (entry = hint->callbacks; entry; ) {
228  SDL_HintWatch *freeable = entry;
229  entry = entry->next;
230  SDL_free(freeable);
231  }
232  SDL_free(hint);
233  }
234 }
struct SDL_Hint * next
Definition: SDL_hints.c:41
#define SDL_free
SDL_HintWatch * callbacks
Definition: SDL_hints.c:40
char * value
Definition: SDL_hints.c:38
struct SDL_HintWatch * next
Definition: SDL_hints.c:33
char * name
Definition: SDL_hints.c:37
static SDL_Hint * SDL_hints
Definition: SDL_hints.c:44

◆ SDL_DelHintCallback()

void SDL_DelHintCallback ( const char *  name,
SDL_HintCallback  callback,
void userdata 
)

Remove a function watching a particular hint.

Parameters
nameThe hint being watched
callbackThe function being called when the hint value changes
userdataA pointer being passed to the callback function

Definition at line 191 of file SDL_hints.c.

References SDL_HintWatch::callback, SDL_Hint::callbacks, SDL_Hint::name, SDL_HintWatch::next, SDL_Hint::next, NULL, SDL_free, SDL_strcmp, and SDL_HintWatch::userdata.

Referenced by SDL_AddHintCallback().

192 {
193  SDL_Hint *hint;
194  SDL_HintWatch *entry, *prev;
195 
196  for (hint = SDL_hints; hint; hint = hint->next) {
197  if (SDL_strcmp(name, hint->name) == 0) {
198  prev = NULL;
199  for (entry = hint->callbacks; entry; entry = entry->next) {
200  if (callback == entry->callback && userdata == entry->userdata) {
201  if (prev) {
202  prev->next = entry->next;
203  } else {
204  hint->callbacks = entry->next;
205  }
206  SDL_free(entry);
207  break;
208  }
209  prev = entry;
210  }
211  return;
212  }
213  }
214 }
void * userdata
Definition: SDL_hints.c:32
struct SDL_Hint * next
Definition: SDL_hints.c:41
GLuint const GLchar * name
#define SDL_free
static Uint32 callback(Uint32 interval, void *param)
Definition: testtimer.c:34
SDL_HintWatch * callbacks
Definition: SDL_hints.c:40
#define NULL
Definition: begin_code.h:164
#define SDL_strcmp
SDL_HintCallback callback
Definition: SDL_hints.c:31
struct SDL_HintWatch * next
Definition: SDL_hints.c:33
char * name
Definition: SDL_hints.c:37
static SDL_Hint * SDL_hints
Definition: SDL_hints.c:44

◆ SDL_GetHint()

const char* SDL_GetHint ( const char *  name)

Get a hint.

Returns
The string value of a hint variable.

Definition at line 104 of file SDL_hints.c.

References SDL_Hint::name, SDL_Hint::next, SDL_Hint::priority, SDL_getenv, SDL_HINT_OVERRIDE, SDL_strcmp, and SDL_Hint::value.

Referenced by SDL_AddHintCallback(), and SDL_GetHintBoolean().

105 {
106  const char *env;
107  SDL_Hint *hint;
108 
109  env = SDL_getenv(name);
110  for (hint = SDL_hints; hint; hint = hint->next) {
111  if (SDL_strcmp(name, hint->name) == 0) {
112  if (!env || hint->priority == SDL_HINT_OVERRIDE) {
113  return hint->value;
114  }
115  break;
116  }
117  }
118  return env;
119 }
struct SDL_Hint * next
Definition: SDL_hints.c:41
GLuint const GLchar * name
#define SDL_getenv
SDL_HintPriority priority
Definition: SDL_hints.c:39
#define SDL_strcmp
char * value
Definition: SDL_hints.c:38
char * name
Definition: SDL_hints.c:37
static SDL_Hint * SDL_hints
Definition: SDL_hints.c:44

◆ SDL_GetHintBoolean()

SDL_bool SDL_GetHintBoolean ( const char *  name,
SDL_bool  default_value 
)

Get a hint.

Returns
The boolean value of a hint variable.

Definition at line 122 of file SDL_hints.c.

References SDL_FALSE, SDL_GetHint(), SDL_strcasecmp, and SDL_TRUE.

123 {
124  const char *hint = SDL_GetHint(name);
125  if (!hint || !*hint) {
126  return default_value;
127  }
128  if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) {
129  return SDL_FALSE;
130  }
131  return SDL_TRUE;
132 }
const char * SDL_GetHint(const char *name)
Get a hint.
Definition: SDL_hints.c:104
#define SDL_strcasecmp
GLuint const GLchar * name

◆ SDL_SetHint()

SDL_bool SDL_SetHint ( const char *  name,
const char *  value 
)

Set a hint with normal priority.

Returns
SDL_TRUE if the hint was set, SDL_FALSE otherwise

Definition at line 98 of file SDL_hints.c.

References SDL_HINT_NORMAL, and SDL_SetHintWithPriority().

99 {
101 }
SDL_bool SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriority priority)
Set a hint with a specific priority.
Definition: SDL_hints.c:47
GLuint const GLchar * name
GLsizei const GLfloat * value

◆ SDL_SetHintWithPriority()

SDL_bool SDL_SetHintWithPriority ( const char *  name,
const char *  value,
SDL_HintPriority  priority 
)

Set a hint with a specific priority.

The priority controls the behavior when setting a hint that already has a value. Hints will replace existing hints of their priority and lower. Environment variables are considered to have override priority.

Returns
SDL_TRUE if the hint was set, SDL_FALSE otherwise

Definition at line 47 of file SDL_hints.c.

References SDL_HintWatch::callback, SDL_Hint::callbacks, SDL_Hint::name, SDL_HintWatch::next, SDL_Hint::next, NULL, SDL_Hint::priority, SDL_FALSE, SDL_free, SDL_getenv, SDL_HINT_OVERRIDE, SDL_hints, SDL_malloc, SDL_strcmp, SDL_strdup, SDL_TRUE, SDL_HintWatch::userdata, and SDL_Hint::value.

Referenced by SDL_SetHint().

49 {
50  const char *env;
51  SDL_Hint *hint;
52  SDL_HintWatch *entry;
53 
54  if (!name || !value) {
55  return SDL_FALSE;
56  }
57 
58  env = SDL_getenv(name);
59  if (env && priority < SDL_HINT_OVERRIDE) {
60  return SDL_FALSE;
61  }
62 
63  for (hint = SDL_hints; hint; hint = hint->next) {
64  if (SDL_strcmp(name, hint->name) == 0) {
65  if (priority < hint->priority) {
66  return SDL_FALSE;
67  }
68  if (!hint->value || !value || SDL_strcmp(hint->value, value) != 0) {
69  for (entry = hint->callbacks; entry; ) {
70  /* Save the next entry in case this one is deleted */
71  SDL_HintWatch *next = entry->next;
72  entry->callback(entry->userdata, name, hint->value, value);
73  entry = next;
74  }
75  SDL_free(hint->value);
76  hint->value = value ? SDL_strdup(value) : NULL;
77  }
78  hint->priority = priority;
79  return SDL_TRUE;
80  }
81  }
82 
83  /* Couldn't find the hint, add a new one */
84  hint = (SDL_Hint *)SDL_malloc(sizeof(*hint));
85  if (!hint) {
86  return SDL_FALSE;
87  }
88  hint->name = SDL_strdup(name);
89  hint->value = value ? SDL_strdup(value) : NULL;
90  hint->priority = priority;
91  hint->callbacks = NULL;
92  hint->next = SDL_hints;
93  SDL_hints = hint;
94  return SDL_TRUE;
95 }
void * userdata
Definition: SDL_hints.c:32
const struct SDL_AssertData * next
Definition: SDL_assert.h:119
struct SDL_Hint * next
Definition: SDL_hints.c:41
GLuint const GLchar * name
#define SDL_free
GLsizei const GLfloat * value
SDL_HintWatch * callbacks
Definition: SDL_hints.c:40
#define SDL_getenv
#define NULL
Definition: begin_code.h:164
SDL_HintPriority priority
Definition: SDL_hints.c:39
#define SDL_strdup
#define SDL_malloc
#define SDL_strcmp
char * value
Definition: SDL_hints.c:38
SDL_HintCallback callback
Definition: SDL_hints.c:31
struct SDL_HintWatch * next
Definition: SDL_hints.c:33
char * name
Definition: SDL_hints.c:37
static SDL_Hint * SDL_hints
Definition: SDL_hints.c:44