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

Go to the source code of this file.

Data Structures

struct  SDL_DisplayMode
 The structure that defines a display mode. More...
 

Macros

#define SDL_WINDOWPOS_UNDEFINED_MASK   0x1FFF0000u
 Used to indicate that you don't care what the window position is. More...
 
#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X)   (SDL_WINDOWPOS_UNDEFINED_MASK|(X))
 
#define SDL_WINDOWPOS_UNDEFINED   SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
 
#define SDL_WINDOWPOS_ISUNDEFINED(X)   (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
 
#define SDL_WINDOWPOS_CENTERED_MASK   0x2FFF0000u
 Used to indicate that the window position should be centered. More...
 
#define SDL_WINDOWPOS_CENTERED_DISPLAY(X)   (SDL_WINDOWPOS_CENTERED_MASK|(X))
 
#define SDL_WINDOWPOS_CENTERED   SDL_WINDOWPOS_CENTERED_DISPLAY(0)
 
#define SDL_WINDOWPOS_ISCENTERED(X)   (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
 

Typedefs

typedef voidSDL_GLContext
 An opaque handle to an OpenGL context. More...
 
typedef SDL_HitTestResult(* SDL_HitTest) (SDL_Window *win, const SDL_Point *area, void *data)
 Callback used for hit-testing. More...
 

Enumerations

enum  SDL_WindowFlags {
  SDL_WINDOW_FULLSCREEN = 0x00000001,
  SDL_WINDOW_OPENGL = 0x00000002,
  SDL_WINDOW_SHOWN = 0x00000004,
  SDL_WINDOW_HIDDEN = 0x00000008,
  SDL_WINDOW_BORDERLESS = 0x00000010,
  SDL_WINDOW_RESIZABLE = 0x00000020,
  SDL_WINDOW_MINIMIZED = 0x00000040,
  SDL_WINDOW_MAXIMIZED = 0x00000080,
  SDL_WINDOW_INPUT_GRABBED = 0x00000100,
  SDL_WINDOW_INPUT_FOCUS = 0x00000200,
  SDL_WINDOW_MOUSE_FOCUS = 0x00000400,
  SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
  SDL_WINDOW_FOREIGN = 0x00000800,
  SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000,
  SDL_WINDOW_MOUSE_CAPTURE = 0x00004000,
  SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000,
  SDL_WINDOW_SKIP_TASKBAR = 0x00010000,
  SDL_WINDOW_UTILITY = 0x00020000,
  SDL_WINDOW_TOOLTIP = 0x00040000,
  SDL_WINDOW_POPUP_MENU = 0x00080000,
  SDL_WINDOW_VULKAN = 0x10000000
}
 The flags on a window. More...
 
enum  SDL_WindowEventID {
  SDL_WINDOWEVENT_NONE,
  SDL_WINDOWEVENT_SHOWN,
  SDL_WINDOWEVENT_HIDDEN,
  SDL_WINDOWEVENT_EXPOSED,
  SDL_WINDOWEVENT_MOVED,
  SDL_WINDOWEVENT_RESIZED,
  SDL_WINDOWEVENT_SIZE_CHANGED,
  SDL_WINDOWEVENT_MINIMIZED,
  SDL_WINDOWEVENT_MAXIMIZED,
  SDL_WINDOWEVENT_RESTORED,
  SDL_WINDOWEVENT_ENTER,
  SDL_WINDOWEVENT_LEAVE,
  SDL_WINDOWEVENT_FOCUS_GAINED,
  SDL_WINDOWEVENT_FOCUS_LOST,
  SDL_WINDOWEVENT_CLOSE,
  SDL_WINDOWEVENT_TAKE_FOCUS,
  SDL_WINDOWEVENT_HIT_TEST
}
 Event subtype for window events. More...
 
enum  SDL_DisplayEventID {
  SDL_DISPLAYEVENT_NONE,
  SDL_DISPLAYEVENT_ORIENTATION
}
 Event subtype for display events. More...
 
enum  SDL_DisplayOrientation {
  SDL_ORIENTATION_UNKNOWN,
  SDL_ORIENTATION_LANDSCAPE,
  SDL_ORIENTATION_LANDSCAPE_FLIPPED,
  SDL_ORIENTATION_PORTRAIT,
  SDL_ORIENTATION_PORTRAIT_FLIPPED
}
 
enum  SDL_GLattr {
  SDL_GL_RED_SIZE,
  SDL_GL_GREEN_SIZE,
  SDL_GL_BLUE_SIZE,
  SDL_GL_ALPHA_SIZE,
  SDL_GL_BUFFER_SIZE,
  SDL_GL_DOUBLEBUFFER,
  SDL_GL_DEPTH_SIZE,
  SDL_GL_STENCIL_SIZE,
  SDL_GL_ACCUM_RED_SIZE,
  SDL_GL_ACCUM_GREEN_SIZE,
  SDL_GL_ACCUM_BLUE_SIZE,
  SDL_GL_ACCUM_ALPHA_SIZE,
  SDL_GL_STEREO,
  SDL_GL_MULTISAMPLEBUFFERS,
  SDL_GL_MULTISAMPLESAMPLES,
  SDL_GL_ACCELERATED_VISUAL,
  SDL_GL_RETAINED_BACKING,
  SDL_GL_CONTEXT_MAJOR_VERSION,
  SDL_GL_CONTEXT_MINOR_VERSION,
  SDL_GL_CONTEXT_EGL,
  SDL_GL_CONTEXT_FLAGS,
  SDL_GL_CONTEXT_PROFILE_MASK,
  SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
  SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
  SDL_GL_CONTEXT_RELEASE_BEHAVIOR,
  SDL_GL_CONTEXT_RESET_NOTIFICATION,
  SDL_GL_CONTEXT_NO_ERROR
}
 OpenGL configuration attributes. More...
 
enum  SDL_GLprofile {
  SDL_GL_CONTEXT_PROFILE_CORE = 0x0001,
  SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002,
  SDL_GL_CONTEXT_PROFILE_ES = 0x0004
}
 
enum  SDL_GLcontextFlag {
  SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001,
  SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002,
  SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004,
  SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008
}
 
enum  SDL_GLcontextReleaseFlag {
  SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000,
  SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001
}
 
enum  SDL_GLContextResetNotification {
  SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000,
  SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001
}
 
enum  SDL_HitTestResult {
  SDL_HITTEST_NORMAL,
  SDL_HITTEST_DRAGGABLE,
  SDL_HITTEST_RESIZE_TOPLEFT,
  SDL_HITTEST_RESIZE_TOP,
  SDL_HITTEST_RESIZE_TOPRIGHT,
  SDL_HITTEST_RESIZE_RIGHT,
  SDL_HITTEST_RESIZE_BOTTOMRIGHT,
  SDL_HITTEST_RESIZE_BOTTOM,
  SDL_HITTEST_RESIZE_BOTTOMLEFT,
  SDL_HITTEST_RESIZE_LEFT
}
 Possible return values from the SDL_HitTest callback. More...
 

Functions

int SDL_GetNumVideoDrivers (void)
 Get the number of video drivers compiled into SDL. More...
 
const char * SDL_GetVideoDriver (int index)
 Get the name of a built in video driver. More...
 
int SDL_VideoInit (const char *driver_name)
 Initialize the video subsystem, optionally specifying a video driver. More...
 
void SDL_VideoQuit (void)
 Shuts down the video subsystem. More...
 
const char * SDL_GetCurrentVideoDriver (void)
 Returns the name of the currently initialized video driver. More...
 
int SDL_GetNumVideoDisplays (void)
 Returns the number of available video displays. More...
 
const char * SDL_GetDisplayName (int displayIndex)
 Get the name of a display in UTF-8 encoding. More...
 
int SDL_GetDisplayBounds (int displayIndex, SDL_Rect *rect)
 Get the desktop area represented by a display, with the primary display located at 0,0. More...
 
int SDL_GetDisplayUsableBounds (int displayIndex, SDL_Rect *rect)
 Get the usable desktop area represented by a display, with the primary display located at 0,0. More...
 
int SDL_GetDisplayDPI (int displayIndex, float *ddpi, float *hdpi, float *vdpi)
 Get the dots/pixels-per-inch for a display. More...
 
SDL_DisplayOrientation SDL_GetDisplayOrientation (int displayIndex)
 Get the orientation of a display. More...
 
int SDL_GetNumDisplayModes (int displayIndex)
 Returns the number of available display modes. More...
 
int SDL_GetDisplayMode (int displayIndex, int modeIndex, SDL_DisplayMode *mode)
 Fill in information about a specific display mode. More...
 
int SDL_GetDesktopDisplayMode (int displayIndex, SDL_DisplayMode *mode)
 Fill in information about the desktop display mode. More...
 
int SDL_GetCurrentDisplayMode (int displayIndex, SDL_DisplayMode *mode)
 Fill in information about the current display mode. More...
 
SDL_DisplayModeSDL_GetClosestDisplayMode (int displayIndex, const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
 Get the closest match to the requested display mode. More...
 
int SDL_GetWindowDisplayIndex (SDL_Window *window)
 Get the display index associated with a window. More...
 
int SDL_SetWindowDisplayMode (SDL_Window *window, const SDL_DisplayMode *mode)
 Set the display mode used when a fullscreen window is visible. More...
 
int SDL_GetWindowDisplayMode (SDL_Window *window, SDL_DisplayMode *mode)
 Fill in information about the display mode used when a fullscreen window is visible. More...
 
Uint32 SDL_GetWindowPixelFormat (SDL_Window *window)
 Get the pixel format associated with the window. More...
 
SDL_WindowSDL_CreateWindow (const char *title, int x, int y, int w, int h, Uint32 flags)
 Create a window with the specified position, dimensions, and flags. More...
 
SDL_WindowSDL_CreateWindowFrom (const void *data)
 Create an SDL window from an existing native window. More...
 
Uint32 SDL_GetWindowID (SDL_Window *window)
 Get the numeric ID of a window, for logging purposes. More...
 
SDL_WindowSDL_GetWindowFromID (Uint32 id)
 Get a window from a stored ID, or NULL if it doesn't exist. More...
 
Uint32 SDL_GetWindowFlags (SDL_Window *window)
 Get the window flags. More...
 
void SDL_SetWindowTitle (SDL_Window *window, const char *title)
 Set the title of a window, in UTF-8 format. More...
 
const char * SDL_GetWindowTitle (SDL_Window *window)
 Get the title of a window, in UTF-8 format. More...
 
void SDL_SetWindowIcon (SDL_Window *window, SDL_Surface *icon)
 Set the icon for a window. More...
 
voidSDL_SetWindowData (SDL_Window *window, const char *name, void *userdata)
 Associate an arbitrary named pointer with a window. More...
 
voidSDL_GetWindowData (SDL_Window *window, const char *name)
 Retrieve the data pointer associated with a window. More...
 
void SDL_SetWindowPosition (SDL_Window *window, int x, int y)
 Set the position of a window. More...
 
void SDL_GetWindowPosition (SDL_Window *window, int *x, int *y)
 Get the position of a window. More...
 
void SDL_SetWindowSize (SDL_Window *window, int w, int h)
 Set the size of a window's client area. More...
 
void SDL_GetWindowSize (SDL_Window *window, int *w, int *h)
 Get the size of a window's client area. More...
 
int SDL_GetWindowBordersSize (SDL_Window *window, int *top, int *left, int *bottom, int *right)
 Get the size of a window's borders (decorations) around the client area. More...
 
void SDL_SetWindowMinimumSize (SDL_Window *window, int min_w, int min_h)
 Set the minimum size of a window's client area. More...
 
void SDL_GetWindowMinimumSize (SDL_Window *window, int *w, int *h)
 Get the minimum size of a window's client area. More...
 
void SDL_SetWindowMaximumSize (SDL_Window *window, int max_w, int max_h)
 Set the maximum size of a window's client area. More...
 
void SDL_GetWindowMaximumSize (SDL_Window *window, int *w, int *h)
 Get the maximum size of a window's client area. More...
 
void SDL_SetWindowBordered (SDL_Window *window, SDL_bool bordered)
 Set the border state of a window. More...
 
void SDL_SetWindowResizable (SDL_Window *window, SDL_bool resizable)
 Set the user-resizable state of a window. More...
 
void SDL_ShowWindow (SDL_Window *window)
 Show a window. More...
 
void SDL_HideWindow (SDL_Window *window)
 Hide a window. More...
 
void SDL_RaiseWindow (SDL_Window *window)
 Raise a window above other windows and set the input focus. More...
 
void SDL_MaximizeWindow (SDL_Window *window)
 Make a window as large as possible. More...
 
void SDL_MinimizeWindow (SDL_Window *window)
 Minimize a window to an iconic representation. More...
 
void SDL_RestoreWindow (SDL_Window *window)
 Restore the size and position of a minimized or maximized window. More...
 
int SDL_SetWindowFullscreen (SDL_Window *window, Uint32 flags)
 Set a window's fullscreen state. More...
 
SDL_SurfaceSDL_GetWindowSurface (SDL_Window *window)
 Get the SDL surface associated with the window. More...
 
int SDL_UpdateWindowSurface (SDL_Window *window)
 Copy the window surface to the screen. More...
 
int SDL_UpdateWindowSurfaceRects (SDL_Window *window, const SDL_Rect *rects, int numrects)
 Copy a number of rectangles on the window surface to the screen. More...
 
void SDL_SetWindowGrab (SDL_Window *window, SDL_bool grabbed)
 Set a window's input grab mode. More...
 
SDL_bool SDL_GetWindowGrab (SDL_Window *window)
 Get a window's input grab mode. More...
 
SDL_WindowSDL_GetGrabbedWindow (void)
 Get the window that currently has an input grab enabled. More...
 
int SDL_SetWindowBrightness (SDL_Window *window, float brightness)
 Set the brightness (gamma correction) for a window. More...
 
float SDL_GetWindowBrightness (SDL_Window *window)
 Get the brightness (gamma correction) for a window. More...
 
int SDL_SetWindowOpacity (SDL_Window *window, float opacity)
 Set the opacity for a window. More...
 
int SDL_GetWindowOpacity (SDL_Window *window, float *out_opacity)
 Get the opacity of a window. More...
 
int SDL_SetWindowModalFor (SDL_Window *modal_window, SDL_Window *parent_window)
 Sets the window as a modal for another window (TODO: reconsider this function and/or its name) More...
 
int SDL_SetWindowInputFocus (SDL_Window *window)
 Explicitly sets input focus to the window. More...
 
int SDL_SetWindowGammaRamp (SDL_Window *window, const Uint16 *red, const Uint16 *green, const Uint16 *blue)
 Set the gamma ramp for a window. More...
 
int SDL_GetWindowGammaRamp (SDL_Window *window, Uint16 *red, Uint16 *green, Uint16 *blue)
 Get the gamma ramp for a window. More...
 
int SDL_SetWindowHitTest (SDL_Window *window, SDL_HitTest callback, void *callback_data)
 Provide a callback that decides if a window region has special properties. More...
 
void SDL_DestroyWindow (SDL_Window *window)
 Destroy a window. More...
 
SDL_bool SDL_IsScreenSaverEnabled (void)
 Returns whether the screensaver is currently enabled (default off). More...
 
void SDL_EnableScreenSaver (void)
 Allow the screen to be blanked by a screensaver. More...
 
void SDL_DisableScreenSaver (void)
 Prevent the screen from being blanked by a screensaver. More...
 
OpenGL support functions
int SDL_GL_LoadLibrary (const char *path)
 Dynamically load an OpenGL library. More...
 
voidSDL_GL_GetProcAddress (const char *proc)
 Get the address of an OpenGL function. More...
 
void SDL_GL_UnloadLibrary (void)
 Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). More...
 
SDL_bool SDL_GL_ExtensionSupported (const char *extension)
 Return true if an OpenGL extension is supported for the current context. More...
 
void SDL_GL_ResetAttributes (void)
 Reset all previously set OpenGL context attributes to their default values. More...
 
int SDL_GL_SetAttribute (SDL_GLattr attr, int value)
 Set an OpenGL window attribute before window creation. More...
 
int SDL_GL_GetAttribute (SDL_GLattr attr, int *value)
 Get the actual value for an attribute from the current context. More...
 
SDL_GLContext SDL_GL_CreateContext (SDL_Window *window)
 Create an OpenGL context for use with an OpenGL window, and make it current. More...
 
int SDL_GL_MakeCurrent (SDL_Window *window, SDL_GLContext context)
 Set up an OpenGL context for rendering into an OpenGL window. More...
 
SDL_WindowSDL_GL_GetCurrentWindow (void)
 Get the currently active OpenGL window. More...
 
SDL_GLContext SDL_GL_GetCurrentContext (void)
 Get the currently active OpenGL context. More...
 
void SDL_GL_GetDrawableSize (SDL_Window *window, int *w, int *h)
 Get the size of a window's underlying drawable in pixels (for use with glViewport). More...
 
int SDL_GL_SetSwapInterval (int interval)
 Set the swap interval for the current OpenGL context. More...
 
int SDL_GL_GetSwapInterval (void)
 Get the swap interval for the current OpenGL context. More...
 
void SDL_GL_SwapWindow (SDL_Window *window)
 Swap the OpenGL buffers for a window, if double-buffering is supported. More...
 
void SDL_GL_DeleteContext (SDL_GLContext context)
 Delete an OpenGL context. More...
 

Detailed Description

Header file for SDL video functions.

Definition in file SDL_video.h.

Macro Definition Documentation

◆ SDL_WINDOWPOS_CENTERED

#define SDL_WINDOWPOS_CENTERED   SDL_WINDOWPOS_CENTERED_DISPLAY(0)

Definition at line 139 of file SDL_video.h.

◆ SDL_WINDOWPOS_CENTERED_DISPLAY

#define SDL_WINDOWPOS_CENTERED_DISPLAY (   X)    (SDL_WINDOWPOS_CENTERED_MASK|(X))

Definition at line 138 of file SDL_video.h.

◆ SDL_WINDOWPOS_CENTERED_MASK

#define SDL_WINDOWPOS_CENTERED_MASK   0x2FFF0000u

Used to indicate that the window position should be centered.

Definition at line 137 of file SDL_video.h.

◆ SDL_WINDOWPOS_ISCENTERED

#define SDL_WINDOWPOS_ISCENTERED (   X)    (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)

Definition at line 140 of file SDL_video.h.

◆ SDL_WINDOWPOS_ISUNDEFINED

#define SDL_WINDOWPOS_ISUNDEFINED (   X)    (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)

Definition at line 131 of file SDL_video.h.

◆ SDL_WINDOWPOS_UNDEFINED

#define SDL_WINDOWPOS_UNDEFINED   SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)

Definition at line 130 of file SDL_video.h.

◆ SDL_WINDOWPOS_UNDEFINED_DISPLAY

#define SDL_WINDOWPOS_UNDEFINED_DISPLAY (   X)    (SDL_WINDOWPOS_UNDEFINED_MASK|(X))

Definition at line 129 of file SDL_video.h.

◆ SDL_WINDOWPOS_UNDEFINED_MASK

#define SDL_WINDOWPOS_UNDEFINED_MASK   0x1FFF0000u

Used to indicate that you don't care what the window position is.

Definition at line 128 of file SDL_video.h.

Typedef Documentation

◆ SDL_GLContext

SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) SDL_DYNAPI_PROC int return int return int size_t return size_t return const wchar_t return const wchar_t size_t return const char size_t return const char size_t return char return char return const char int return int char int return long char int return Sint64 char int return const char return const char char int return const char char int return const char char return const char const char size_t return const char const char size_t return double return double return double return double return double return double return double int return float return const char const char return SDL_iconv_t const char size_t char size_t return Uint32 int int int Uint32 Uint32 Uint32 Uint32 return SDL_Surface SDL_Surface return SDL_RWops int return SDL_Surface int return SDL_Surface Uint32 return SDL_Surface Uint8 Uint8 Uint8 return SDL_Surface Uint8 return SDL_Surface SDL_BlendMode return SDL_Surface SDL_Rect SDL_Surface Uint32 Uint32 return SDL_Surface const SDL_Rect Uint32 return SDL_Surface const SDL_Rect SDL_Surface SDL_Rect return SDL_Surface const SDL_Rect SDL_Surface const SDL_Rect return SDL_Surface SDL_Rect SDL_Surface SDL_Rect return SDL_Thread return SDL_Thread return SDL_Thread int return SDL_TLSID const void void(*) return return Uint32 SDL_TimerID return int return SDL_TouchID int return return return const char return return int return int return int SDL_DisplayMode return int const SDL_DisplayMode SDL_DisplayMode return SDL_Window const SDL_DisplayMode return SDL_Window return const void return Uint32 return SDL_Window const char SDL_Window SDL_Surface SDL_Window const char return SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window SDL_Window SDL_Window SDL_Window Uint32 return SDL_Window return SDL_Window SDL_bool SDL_Window float return SDL_Window const Uint16 const Uint16 const Uint16 return SDL_Window const char return SDL_GLattr int return SDL_Window return return SDL_Window int int return SDL_GLContext(int, SDL_vsscanf,(const char *a, const char *b, va_list c),(a, b, c), return) SDL_DYNAPI_PROC(int

An opaque handle to an OpenGL context.

Definition at line 192 of file SDL_video.h.

◆ SDL_HitTest

typedef SDL_HitTestResult( * SDL_HitTest) (SDL_Window *win, const SDL_Point *area, void *data)

Callback used for hit-testing.

See also
SDL_SetWindowHitTest

Definition at line 1038 of file SDL_video.h.

Enumeration Type Documentation

◆ SDL_DisplayEventID

Event subtype for display events.

Enumerator
SDL_DISPLAYEVENT_NONE 

Never used

SDL_DISPLAYEVENT_ORIENTATION 

Display orientation has changed to data1

Definition at line 174 of file SDL_video.h.

175 {
176  SDL_DISPLAYEVENT_NONE, /**< Never used */
177  SDL_DISPLAYEVENT_ORIENTATION /**< Display orientation has changed to data1 */

◆ SDL_DisplayOrientation

Enumerator
SDL_ORIENTATION_UNKNOWN 

The display orientation can't be determined

SDL_ORIENTATION_LANDSCAPE 

The display is in landscape mode, with the right side up, relative to portrait mode

SDL_ORIENTATION_LANDSCAPE_FLIPPED 

The display is in landscape mode, with the left side up, relative to portrait mode

SDL_ORIENTATION_PORTRAIT 

The display is in portrait mode

SDL_ORIENTATION_PORTRAIT_FLIPPED 

The display is in portrait mode, upside down

Definition at line 180 of file SDL_video.h.

181 {
182  SDL_ORIENTATION_UNKNOWN, /**< The display orientation can't be determined */
183  SDL_ORIENTATION_LANDSCAPE, /**< The display is in landscape mode, with the right side up, relative to portrait mode */
184  SDL_ORIENTATION_LANDSCAPE_FLIPPED, /**< The display is in landscape mode, with the left side up, relative to portrait mode */
185  SDL_ORIENTATION_PORTRAIT, /**< The display is in portrait mode */
186  SDL_ORIENTATION_PORTRAIT_FLIPPED /**< The display is in portrait mode, upside down */

◆ SDL_GLattr

enum SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) a int return int return int size_t return size_t return const wchar_t return const wchar_t size_t return const char size_t return const char size_t return char return char return const char int return int char int return long char int return Sint64 char int return const char return const char char int return const char char int return const char char return const char const char size_t return const char const char size_t return double return double return double return double return double return double return double int return float return const char const char return SDL_iconv_t const char size_t char size_t return Uint32 int int int Uint32 Uint32 Uint32 Uint32 return SDL_Surface SDL_Surface return SDL_RWops int return SDL_Surface int return SDL_Surface Uint32 return SDL_Surface Uint8 Uint8 Uint8 return SDL_Surface Uint8 return SDL_Surface SDL_BlendMode return SDL_Surface SDL_Rect SDL_Surface Uint32 Uint32 return SDL_Surface const SDL_Rect Uint32 return SDL_Surface const SDL_Rect SDL_Surface SDL_Rect return SDL_Surface const SDL_Rect SDL_Surface const SDL_Rect return SDL_Surface SDL_Rect SDL_Surface SDL_Rect return SDL_Thread return SDL_Thread return SDL_Thread int return SDL_TLSID const void void(*) return return Uint32 SDL_TimerID return int return SDL_TouchID int return return return const char return return int return int return int SDL_DisplayMode return int const SDL_DisplayMode SDL_DisplayMode return SDL_Window const SDL_DisplayMode return SDL_Window return const void return Uint32 return SDL_Window const char SDL_Window SDL_Surface SDL_Window const char return SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window SDL_Window SDL_Window SDL_Window Uint32 return SDL_Window return SDL_Window SDL_bool SDL_Window float return SDL_Window const Uint16 const Uint16 const Uint16 return SDL_Window const char return SDL_GLattr

OpenGL configuration attributes.

Enumerator
SDL_GL_RED_SIZE 
SDL_GL_GREEN_SIZE 
SDL_GL_BLUE_SIZE 
SDL_GL_ALPHA_SIZE 
SDL_GL_BUFFER_SIZE 
SDL_GL_DOUBLEBUFFER 
SDL_GL_DEPTH_SIZE 
SDL_GL_STENCIL_SIZE 
SDL_GL_ACCUM_RED_SIZE 
SDL_GL_ACCUM_GREEN_SIZE 
SDL_GL_ACCUM_BLUE_SIZE 
SDL_GL_ACCUM_ALPHA_SIZE 
SDL_GL_STEREO 
SDL_GL_MULTISAMPLEBUFFERS 
SDL_GL_MULTISAMPLESAMPLES 
SDL_GL_ACCELERATED_VISUAL 
SDL_GL_RETAINED_BACKING 
SDL_GL_CONTEXT_MAJOR_VERSION 
SDL_GL_CONTEXT_MINOR_VERSION 
SDL_GL_CONTEXT_EGL 
SDL_GL_CONTEXT_FLAGS 
SDL_GL_CONTEXT_PROFILE_MASK 
SDL_GL_SHARE_WITH_CURRENT_CONTEXT 
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE 
SDL_GL_CONTEXT_RELEASE_BEHAVIOR 
SDL_GL_CONTEXT_RESET_NOTIFICATION 
SDL_GL_CONTEXT_NO_ERROR 

Definition at line 197 of file SDL_video.h.

◆ SDL_GLcontextFlag

Enumerator
SDL_GL_CONTEXT_DEBUG_FLAG 
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG 
SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG 
SDL_GL_CONTEXT_RESET_ISOLATION_FLAG 

Definition at line 235 of file SDL_video.h.

◆ SDL_GLcontextReleaseFlag

Enumerator
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE 
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 

Definition at line 243 of file SDL_video.h.

◆ SDL_GLContextResetNotification

Enumerator
SDL_GL_CONTEXT_RESET_NO_NOTIFICATION 
SDL_GL_CONTEXT_RESET_LOSE_CONTEXT 

Definition at line 249 of file SDL_video.h.

◆ SDL_GLprofile

Enumerator
SDL_GL_CONTEXT_PROFILE_CORE 
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY 
SDL_GL_CONTEXT_PROFILE_ES 

GLX_CONTEXT_ES2_PROFILE_BIT_EXT

Definition at line 228 of file SDL_video.h.

229 {
232  SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
233 } SDL_GLprofile;

◆ SDL_HitTestResult

Possible return values from the SDL_HitTest callback.

See also
SDL_HitTest
Enumerator
SDL_HITTEST_NORMAL 

Region is normal. No special properties.

SDL_HITTEST_DRAGGABLE 

Region can drag entire window.

SDL_HITTEST_RESIZE_TOPLEFT 
SDL_HITTEST_RESIZE_TOP 
SDL_HITTEST_RESIZE_TOPRIGHT 
SDL_HITTEST_RESIZE_RIGHT 
SDL_HITTEST_RESIZE_BOTTOMRIGHT 
SDL_HITTEST_RESIZE_BOTTOM 
SDL_HITTEST_RESIZE_BOTTOMLEFT 
SDL_HITTEST_RESIZE_LEFT 

Definition at line 1019 of file SDL_video.h.

1020 {
1021  SDL_HITTEST_NORMAL, /**< Region is normal. No special properties. */
1022  SDL_HITTEST_DRAGGABLE, /**< Region can drag entire window. */

◆ SDL_WindowEventID

Event subtype for window events.

Enumerator
SDL_WINDOWEVENT_NONE 

Never used

SDL_WINDOWEVENT_SHOWN 

Window has been shown

SDL_WINDOWEVENT_HIDDEN 

Window has been hidden

SDL_WINDOWEVENT_EXPOSED 

Window has been exposed and should be redrawn

SDL_WINDOWEVENT_MOVED 

Window has been moved to data1, data2

SDL_WINDOWEVENT_RESIZED 

Window has been resized to data1xdata2

SDL_WINDOWEVENT_SIZE_CHANGED 

The window size has changed, either as a result of an API call or through the system or user changing the window size.

SDL_WINDOWEVENT_MINIMIZED 

Window has been minimized

SDL_WINDOWEVENT_MAXIMIZED 

Window has been maximized

SDL_WINDOWEVENT_RESTORED 

Window has been restored to normal size and position

SDL_WINDOWEVENT_ENTER 

Window has gained mouse focus

SDL_WINDOWEVENT_LEAVE 

Window has lost mouse focus

SDL_WINDOWEVENT_FOCUS_GAINED 

Window has gained keyboard focus

SDL_WINDOWEVENT_FOCUS_LOST 

Window has lost keyboard focus

SDL_WINDOWEVENT_CLOSE 

The window manager requests that the window be closed

SDL_WINDOWEVENT_TAKE_FOCUS 

Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore)

SDL_WINDOWEVENT_HIT_TEST 

Window had a hit test that wasn't SDL_HITTEST_NORMAL.

Definition at line 145 of file SDL_video.h.

146 {
147  SDL_WINDOWEVENT_NONE, /**< Never used */
148  SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */
149  SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */
150  SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be
151  redrawn */
152  SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2
153  */
154  SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */
155  SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as
156  a result of an API call or through the
157  system or user changing the window size. */
158  SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */
159  SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */
160  SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size
161  and position */
162  SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */
163  SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */
164  SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */
165  SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */
166  SDL_WINDOWEVENT_CLOSE, /**< The window manager requests that the window be closed */
167  SDL_WINDOWEVENT_TAKE_FOCUS, /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */
168  SDL_WINDOWEVENT_HIT_TEST /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */

◆ SDL_WindowFlags

The flags on a window.

See also
SDL_GetWindowFlags()
Enumerator
SDL_WINDOW_FULLSCREEN 

fullscreen window

SDL_WINDOW_OPENGL 

window usable with OpenGL context

SDL_WINDOW_SHOWN 

window is visible

SDL_WINDOW_HIDDEN 

window is not visible

SDL_WINDOW_BORDERLESS 

no window decoration

SDL_WINDOW_RESIZABLE 

window can be resized

SDL_WINDOW_MINIMIZED 

window is minimized

SDL_WINDOW_MAXIMIZED 

window is maximized

SDL_WINDOW_INPUT_GRABBED 

window has grabbed input focus

SDL_WINDOW_INPUT_FOCUS 

window has input focus

SDL_WINDOW_MOUSE_FOCUS 

window has mouse focus

SDL_WINDOW_FULLSCREEN_DESKTOP 
SDL_WINDOW_FOREIGN 

window not created by SDL

SDL_WINDOW_ALLOW_HIGHDPI 

window should be created in high-DPI mode if supported. On macOS NSHighResolutionCapable must be set true in the application's Info.plist for this to have any effect.

SDL_WINDOW_MOUSE_CAPTURE 

window has mouse captured (unrelated to INPUT_GRABBED)

SDL_WINDOW_ALWAYS_ON_TOP 

window should always be above others

SDL_WINDOW_SKIP_TASKBAR 

window should not be added to the taskbar

SDL_WINDOW_UTILITY 

window should be treated as a utility window

SDL_WINDOW_TOOLTIP 

window should be treated as a tooltip

SDL_WINDOW_POPUP_MENU 

window should be treated as a popup menu

SDL_WINDOW_VULKAN 

window usable for Vulkan surface

Definition at line 97 of file SDL_video.h.

98 {
99  SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */
100  SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */
101  SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */
102  SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */
103  SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */
104  SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */
105  SDL_WINDOW_MINIMIZED = 0x00000040, /**< window is minimized */
106  SDL_WINDOW_MAXIMIZED = 0x00000080, /**< window is maximized */
107  SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */
108  SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */
109  SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */
111  SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */
112  SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported.
113  On macOS NSHighResolutionCapable must be set true in the
114  application's Info.plist for this to have any effect. */
115  SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */
116  SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */
117  SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */
118  SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */
119  SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
120  SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */
121  SDL_WINDOW_VULKAN = 0x10000000 /**< window usable for Vulkan surface */

Function Documentation

◆ SDL_CreateWindow()

SDL_Window* SDL_CreateWindow ( const char *  title,
int  x,
int  y,
int  w,
int  h,
Uint32  flags 
)

Create a window with the specified position, dimensions, and flags.

Parameters
titleThe title of the window, in UTF-8 encoding.
xThe x position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED.
yThe y position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED.
wThe width of the window, in screen coordinates.
hThe height of the window, in screen coordinates.
flagsThe flags for the window, a mask of any of the following: SDL_WINDOW_FULLSCREEN, SDL_WINDOW_OPENGL, SDL_WINDOW_HIDDEN, SDL_WINDOW_BORDERLESS, SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED, SDL_WINDOW_MINIMIZED, SDL_WINDOW_INPUT_GRABBED, SDL_WINDOW_ALLOW_HIGHDPI, SDL_WINDOW_VULKAN.
Returns
The created window, or NULL if window creation failed.

If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size in pixels may differ from its size in screen coordinates on platforms with high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(), SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the drawable size in pixels.

If the window is created with any of the SDL_WINDOW_OPENGL or SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the corresponding UnloadLibrary function is called by SDL_DestroyWindow().

If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver, SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail.

Note
On non-Apple devices, SDL requires you to either not link to the Vulkan loader or link to a dynamic library version. This limitation may be removed in a future version of SDL.
See also
SDL_DestroyWindow()
SDL_GL_LoadLibrary()
SDL_Vulkan_LoadLibrary()

Definition at line 1426 of file SDL_video.c.

1427 {
1428  SDL_Window *window;
1429 
1430  if (!_this) {
1431  /* Initialize the video system if needed */
1432  if (SDL_VideoInit(NULL) < 0) {
1433  return NULL;
1434  }
1435  }
1436 
1437  if ((((flags & SDL_WINDOW_UTILITY) != 0) + ((flags & SDL_WINDOW_TOOLTIP) != 0) + ((flags & SDL_WINDOW_POPUP_MENU) != 0)) > 1) {
1438  SDL_SetError("Conflicting window flags specified");
1439  return NULL;
1440  }
1441 
1442  /* Some platforms can't create zero-sized windows */
1443  if (w < 1) {
1444  w = 1;
1445  }
1446  if (h < 1) {
1447  h = 1;
1448  }
1449 
1450  /* Some platforms blow up if the windows are too large. Raise it later? */
1451  if ((w > 16384) || (h > 16384)) {
1452  SDL_SetError("Window is too large.");
1453  return NULL;
1454  }
1455 
1456  /* Some platforms have OpenGL enabled by default */
1457 #if (SDL_VIDEO_OPENGL && __MACOSX__) || __IPHONEOS__ || __ANDROID__ || __NACL__
1460  }
1461 #endif
1462  if (flags & SDL_WINDOW_OPENGL) {
1463  if (!_this->GL_CreateContext) {
1464  SDL_SetError("OpenGL support is either not configured in SDL "
1465  "or not available in current SDL video driver "
1466  "(%s) or platform", _this->name);
1467  return NULL;
1468  }
1469  if (SDL_GL_LoadLibrary(NULL) < 0) {
1470  return NULL;
1471  }
1472  }
1473 
1474  if (flags & SDL_WINDOW_VULKAN) {
1475  if (!_this->Vulkan_CreateSurface) {
1476  SDL_SetError("Vulkan support is either not configured in SDL "
1477  "or not available in current SDL video driver "
1478  "(%s) or platform", _this->name);
1479  return NULL;
1480  }
1481  if (flags & SDL_WINDOW_OPENGL) {
1482  SDL_SetError("Vulkan and OpenGL not supported on same window");
1483  return NULL;
1484  }
1485  if (SDL_Vulkan_LoadLibrary(NULL) < 0) {
1486  return NULL;
1487  }
1488  }
1489 
1490  /* Unless the user has specified the high-DPI disabling hint, respect the
1491  * SDL_WINDOW_ALLOW_HIGHDPI flag.
1492  */
1496  }
1497  }
1498 
1499  window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
1500  if (!window) {
1501  SDL_OutOfMemory();
1502  return NULL;
1503  }
1504  window->magic = &_this->window_magic;
1505  window->id = _this->next_object_id++;
1506  window->x = x;
1507  window->y = y;
1508  window->w = w;
1509  window->h = h;
1513  int displayIndex;
1514  SDL_Rect bounds;
1515 
1516  displayIndex = SDL_GetIndexOfDisplay(display);
1517  SDL_GetDisplayBounds(displayIndex, &bounds);
1519  window->x = bounds.x + (bounds.w - w) / 2;
1520  }
1522  window->y = bounds.y + (bounds.h - h) / 2;
1523  }
1524  }
1525  window->windowed.x = window->x;
1526  window->windowed.y = window->y;
1527  window->windowed.w = window->w;
1528  window->windowed.h = window->h;
1529 
1530  if (flags & SDL_WINDOW_FULLSCREEN) {
1532  int displayIndex;
1533  SDL_Rect bounds;
1534 
1535  displayIndex = SDL_GetIndexOfDisplay(display);
1536  SDL_GetDisplayBounds(displayIndex, &bounds);
1537 
1538  window->x = bounds.x;
1539  window->y = bounds.y;
1540  window->w = bounds.w;
1541  window->h = bounds.h;
1542  }
1543 
1544  window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
1545  window->last_fullscreen_flags = window->flags;
1546  window->opacity = 1.0f;
1547  window->brightness = 1.0f;
1548  window->next = _this->windows;
1550 
1551  if (_this->windows) {
1552  _this->windows->prev = window;
1553  }
1554  _this->windows = window;
1555 
1558  return NULL;
1559  }
1560 
1561  /* Clear minimized if not on windows, only windows handles it at create rather than FinishWindowCreation,
1562  * but it's important or window focus will get broken on windows!
1563  */
1564 #if !defined(__WIN32__)
1565  if (window->flags & SDL_WINDOW_MINIMIZED) {
1566  window->flags &= ~SDL_WINDOW_MINIMIZED;
1567  }
1568 #endif
1569 
1570 #if __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
1571  /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen
1572  or not. The user can choose this, via OS-provided UI, but this can't
1573  be set programmatically.
1574 
1575  Just look at what SDL's WinRT video backend code detected with regards
1576  to fullscreen (being active, or not), and figure out a return/error code
1577  from that.
1578  */
1579  flags = window->flags;
1580 #endif
1581 
1582  if (title) {
1583  SDL_SetWindowTitle(window, title);
1584  }
1586 
1587  /* If the window was created fullscreen, make sure the mode code matches */
1589 
1590  return window;
1591 }

References _this, CREATE_FLAGS, SDL_VideoDevice::CreateSDLWindow, FULLSCREEN_VISIBLE, SDL_VideoDevice::GL_CreateContext, SDL_Rect::h, SDL_Window::is_destroying, SDL_VideoDevice::is_dummy, SDL_VideoDevice::name, SDL_VideoDevice::next_object_id, NULL, SDL_Window::prev, SDL_calloc, SDL_DestroyWindow(), SDL_FALSE, SDL_FinishWindowCreation(), SDL_GetDisplayBounds(), SDL_GetDisplayForWindow(), SDL_GetHintBoolean, SDL_GetIndexOfDisplay(), SDL_GL_LoadLibrary(), SDL_HINT_VIDEO_HIGHDPI_DISABLED, SDL_IsVideoContextExternal(), SDL_OutOfMemory, SDL_SetError, SDL_SetWindowTitle(), SDL_UpdateFullscreenMode(), SDL_VideoInit(), SDL_Vulkan_LoadLibrary(), SDL_WINDOW_ALLOW_HIGHDPI, SDL_WINDOW_FULLSCREEN, SDL_WINDOW_HIDDEN, SDL_WINDOW_MINIMIZED, SDL_WINDOW_OPENGL, SDL_WINDOW_POPUP_MENU, SDL_WINDOW_TOOLTIP, SDL_WINDOW_UTILITY, SDL_WINDOW_VULKAN, SDL_WINDOWPOS_ISCENTERED, SDL_WINDOWPOS_ISUNDEFINED, SDL_VideoDevice::Vulkan_CreateSurface, SDL_Rect::w, SDL_VideoDevice::window_magic, SDL_VideoDevice::windows, SDL_Rect::x, and SDL_Rect::y.

Referenced by ShouldUseTextureFramebuffer().

◆ SDL_CreateWindowFrom()

SDL_Window* SDL_CreateWindowFrom ( const void data)

Create an SDL window from an existing native window.

Parameters
dataA pointer to driver-dependent window creation data
Returns
The created window, or NULL if window creation failed.
See also
SDL_DestroyWindow()

Definition at line 1594 of file SDL_video.c.

1595 {
1596  SDL_Window *window;
1597 
1598  if (!_this) {
1600  return NULL;
1601  }
1602  if (!_this->CreateSDLWindowFrom) {
1603  SDL_Unsupported();
1604  return NULL;
1605  }
1606  window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
1607  if (!window) {
1608  SDL_OutOfMemory();
1609  return NULL;
1610  }
1611  window->magic = &_this->window_magic;
1612  window->id = _this->next_object_id++;
1613  window->flags = SDL_WINDOW_FOREIGN;
1614  window->last_fullscreen_flags = window->flags;
1615  window->is_destroying = SDL_FALSE;
1616  window->opacity = 1.0f;
1617  window->brightness = 1.0f;
1618  window->next = _this->windows;
1619  if (_this->windows) {
1620  _this->windows->prev = window;
1621  }
1622  _this->windows = window;
1623 
1624  if (_this->CreateSDLWindowFrom(_this, window, data) < 0) {
1626  return NULL;
1627  }
1628 
1630 
1631  return window;
1632 }

References _this, SDL_VideoDevice::CreateSDLWindowFrom, SDL_VideoDevice::next_object_id, NULL, PrepareDragAndDropSupport(), SDL_Window::prev, SDL_calloc, SDL_DestroyWindow(), SDL_FALSE, SDL_OutOfMemory, SDL_UninitializedVideo(), SDL_Unsupported, SDL_WINDOW_FOREIGN, SDL_VideoDevice::window_magic, and SDL_VideoDevice::windows.

◆ SDL_DestroyWindow()

void SDL_DestroyWindow ( SDL_Window window)

Destroy a window.

Definition at line 2733 of file SDL_video.c.

2734 {
2735  SDL_VideoDisplay *display;
2736 
2738 
2739  window->is_destroying = SDL_TRUE;
2740 
2741  /* Restore video mode, etc. */
2743 
2744  /* Make sure this window no longer has focus */
2745  if (SDL_GetKeyboardFocus() == window) {
2747  }
2748  if (SDL_GetMouseFocus() == window) {
2750  }
2751 
2752  /* make no context current if this is the current context window. */
2753  if (window->flags & SDL_WINDOW_OPENGL) {
2754  if (_this->current_glwin == window) {
2756  }
2757  }
2758 
2759  if (window->surface) {
2760  window->surface->flags &= ~SDL_DONTFREE;
2761  SDL_FreeSurface(window->surface);
2762  }
2765  }
2766  if (_this->DestroyWindow) {
2768  }
2769  if (window->flags & SDL_WINDOW_OPENGL) {
2771  }
2772  if (window->flags & SDL_WINDOW_VULKAN) {
2774  }
2775 
2776  display = SDL_GetDisplayForWindow(window);
2777  if (display->fullscreen_window == window) {
2778  display->fullscreen_window = NULL;
2779  }
2780 
2781  /* Now invalidate magic */
2782  window->magic = NULL;
2783 
2784  /* Free memory associated with the window */
2785  SDL_free(window->title);
2786  SDL_FreeSurface(window->icon);
2787  SDL_free(window->gamma);
2788  while (window->data) {
2790 
2791  window->data = data->next;
2792  SDL_free(data->name);
2793  SDL_free(data);
2794  }
2795 
2796  /* Unlink the window from the list */
2797  if (window->next) {
2798  window->next->prev = window->prev;
2799  }
2800  if (window->prev) {
2801  window->prev->next = window->next;
2802  } else {
2803  _this->windows = window->next;
2804  }
2805 
2806  SDL_free(window);
2807 }

References _this, CHECK_WINDOW_MAGIC, SDL_VideoDevice::current_glwin, SDL_WindowUserData::data, SDL_VideoDevice::DestroyWindow, SDL_VideoDevice::DestroyWindowFramebuffer, SDL_VideoDisplay::fullscreen_window, SDL_Window::next, NULL, SDL_DONTFREE, SDL_free, SDL_FreeSurface, SDL_GetDisplayForWindow(), SDL_GetKeyboardFocus, SDL_GetMouseFocus, SDL_GL_MakeCurrent(), SDL_GL_UnloadLibrary(), SDL_HideWindow(), SDL_SetKeyboardFocus(), SDL_SetMouseFocus(), SDL_TRUE, SDL_Vulkan_UnloadLibrary(), SDL_WINDOW_OPENGL, SDL_WINDOW_VULKAN, and SDL_VideoDevice::windows.

Referenced by SDL_CreateWindow(), SDL_CreateWindowFrom(), SDL_VideoQuit(), and ShouldUseTextureFramebuffer().

◆ SDL_DisableScreenSaver()

void SDL_DisableScreenSaver ( void  )

Prevent the screen from being blanked by a screensaver.

See also
SDL_IsScreenSaverEnabled()
SDL_EnableScreenSaver()

Definition at line 2834 of file SDL_video.c.

2835 {
2836  if (!_this) {
2837  return;
2838  }
2839  if (_this->suspend_screensaver) {
2840  return;
2841  }
2843  if (_this->SuspendScreenSaver) {
2845  }
2846 }

References _this, SDL_TRUE, SDL_VideoDevice::suspend_screensaver, and SDL_VideoDevice::SuspendScreenSaver.

Referenced by SDL_VideoInit().

◆ SDL_EnableScreenSaver()

void SDL_EnableScreenSaver ( void  )

Allow the screen to be blanked by a screensaver.

See also
SDL_IsScreenSaverEnabled()
SDL_DisableScreenSaver()

Definition at line 579 of file SDL_dynapi_procs.h.

References _this, SDL_FALSE, SDL_VideoDevice::suspend_screensaver, and SDL_VideoDevice::SuspendScreenSaver.

Referenced by SDL_VideoQuit().

◆ SDL_GetClosestDisplayMode()

SDL_DisplayMode* SDL_GetClosestDisplayMode ( int  displayIndex,
const SDL_DisplayMode mode,
SDL_DisplayMode closest 
)

Get the closest match to the requested display mode.

Parameters
displayIndexThe index of display from which mode should be queried.
modeThe desired display mode
closestA pointer to a display mode to be filled in with the closest match of the available display modes.
Returns
The passed in value closest, or NULL if no matching video mode was available.

The available display modes are scanned, and closest is filled in with the closest mode matching the requested mode and returned. The mode format and refresh_rate default to the desktop mode if they are 0. The modes are scanned with size being first priority, format being second priority, and finally checking the refresh_rate. If all the available modes are too small, then NULL is returned.

See also
SDL_GetNumDisplayModes()
SDL_GetDisplayMode()

Definition at line 980 of file SDL_video.c.

983 {
984  SDL_VideoDisplay *display;
985 
986  CHECK_DISPLAY_INDEX(displayIndex, NULL);
987 
988  display = &_this->displays[displayIndex];
989  return SDL_GetClosestDisplayModeForDisplay(display, mode, closest);
990 }

References _this, CHECK_DISPLAY_INDEX, SDL_VideoDevice::displays, NULL, and SDL_GetClosestDisplayModeForDisplay().

◆ SDL_GetCurrentDisplayMode()

int SDL_GetCurrentDisplayMode ( int  displayIndex,
SDL_DisplayMode mode 
)

Fill in information about the current display mode.

Definition at line 859 of file SDL_video.c.

860 {
861  SDL_VideoDisplay *display;
862 
863  CHECK_DISPLAY_INDEX(displayIndex, -1);
864 
865  display = &_this->displays[displayIndex];
866  if (mode) {
867  *mode = display->current_mode;
868  }
869  return 0;
870 }

References _this, CHECK_DISPLAY_INDEX, SDL_VideoDisplay::current_mode, and SDL_VideoDevice::displays.

◆ SDL_GetCurrentVideoDriver()

const char* SDL_GetCurrentVideoDriver ( void  )

Returns the name of the currently initialized video driver.

Returns
The name of the current video driver or NULL if no driver has been initialized
See also
SDL_GetNumVideoDrivers()
SDL_GetVideoDriver()

Definition at line 529 of file SDL_dynapi_procs.h.

References _this, SDL_VideoDevice::name, NULL, and SDL_UninitializedVideo().

◆ SDL_GetDesktopDisplayMode()

int SDL_GetDesktopDisplayMode ( int  displayIndex,
SDL_DisplayMode mode 
)

Fill in information about the desktop display mode.

Definition at line 845 of file SDL_video.c.

846 {
847  SDL_VideoDisplay *display;
848 
849  CHECK_DISPLAY_INDEX(displayIndex, -1);
850 
851  display = &_this->displays[displayIndex];
852  if (mode) {
853  *mode = display->desktop_mode;
854  }
855  return 0;
856 }

References _this, CHECK_DISPLAY_INDEX, SDL_VideoDisplay::desktop_mode, and SDL_VideoDevice::displays.

◆ SDL_GetDisplayBounds()

int SDL_GetDisplayBounds ( int  displayIndex,
SDL_Rect rect 
)

Get the desktop area represented by a display, with the primary display located at 0,0.

Returns
0 on success, or -1 if the index is out of range.
See also
SDL_GetNumVideoDisplays()

Definition at line 682 of file SDL_video.c.

683 {
684  CHECK_DISPLAY_INDEX(displayIndex, -1);
685 
686  if (rect) {
687  SDL_VideoDisplay *display = &_this->displays[displayIndex];
688 
689  if (_this->GetDisplayBounds) {
690  if (_this->GetDisplayBounds(_this, display, rect) == 0) {
691  return 0;
692  }
693  }
694 
695  /* Assume that the displays are left to right */
696  if (displayIndex == 0) {
697  rect->x = 0;
698  rect->y = 0;
699  } else {
700  SDL_GetDisplayBounds(displayIndex-1, rect);
701  rect->x += rect->w;
702  }
703  rect->w = display->current_mode.w;
704  rect->h = display->current_mode.h;
705  }
706  return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */
707 }

References _this, CHECK_DISPLAY_INDEX, SDL_VideoDisplay::current_mode, SDL_VideoDevice::displays, SDL_VideoDevice::GetDisplayBounds, SDL_DisplayMode::h, SDL_Rect::h, rect, SDL_DisplayMode::w, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

Referenced by SDL_CreateWindow(), SDL_GetDisplayUsableBounds(), SDL_GetWindowDisplayIndex(), SDL_GetWindowPosition(), and SDL_SetWindowPosition().

◆ SDL_GetDisplayDPI()

int SDL_GetDisplayDPI ( int  displayIndex,
float *  ddpi,
float *  hdpi,
float *  vdpi 
)

Get the dots/pixels-per-inch for a display.

Note
Diagonal, horizontal and vertical DPI can all be optionally returned if the parameter is non-NULL.
Returns
0 on success, or -1 if no DPI information is available or the index is out of range.
See also
SDL_GetNumVideoDisplays()

Definition at line 741 of file SDL_video.c.

742 {
743  SDL_VideoDisplay *display;
744 
745  CHECK_DISPLAY_INDEX(displayIndex, -1);
746 
747  display = &_this->displays[displayIndex];
748 
749  if (_this->GetDisplayDPI) {
750  if (_this->GetDisplayDPI(_this, display, ddpi, hdpi, vdpi) == 0) {
751  return 0;
752  }
753  } else {
754  return SDL_Unsupported();
755  }
756 
757  return -1;
758 }

References _this, CHECK_DISPLAY_INDEX, SDL_VideoDevice::displays, SDL_VideoDevice::GetDisplayDPI, and SDL_Unsupported.

◆ SDL_GetDisplayMode()

int SDL_GetDisplayMode ( int  displayIndex,
int  modeIndex,
SDL_DisplayMode mode 
)

Fill in information about a specific display mode.

Note
The display modes are sorted in this priority:
  • bits per pixel -> more colors to fewer colors
  • width -> largest to smallest
  • height -> largest to smallest
  • refresh rate -> highest to lowest
See also
SDL_GetNumDisplayModes()

Definition at line 827 of file SDL_video.c.

828 {
829  SDL_VideoDisplay *display;
830 
831  CHECK_DISPLAY_INDEX(displayIndex, -1);
832 
833  display = &_this->displays[displayIndex];
835  return SDL_SetError("index must be in the range of 0 - %d",
836  SDL_GetNumDisplayModesForDisplay(display) - 1);
837  }
838  if (mode) {
839  *mode = display->display_modes[index];
840  }
841  return 0;
842 }

References _this, CHECK_DISPLAY_INDEX, SDL_VideoDisplay::display_modes, SDL_VideoDevice::displays, SDL_GetNumDisplayModesForDisplay(), and SDL_SetError.

◆ SDL_GetDisplayName()

const char* SDL_GetDisplayName ( int  displayIndex)

Get the name of a display in UTF-8 encoding.

Returns
The name of a display, or NULL for an invalid display index.
See also
SDL_GetNumVideoDisplays()

Definition at line 674 of file SDL_video.c.

675 {
676  CHECK_DISPLAY_INDEX(displayIndex, NULL);
677 
678  return _this->displays[displayIndex].name;
679 }

References _this, CHECK_DISPLAY_INDEX, SDL_VideoDevice::displays, SDL_VideoDisplay::name, and NULL.

◆ SDL_GetDisplayOrientation()

SDL_DisplayOrientation SDL_GetDisplayOrientation ( int  displayIndex)

Get the orientation of a display.

Returns
The orientation of the display, or SDL_ORIENTATION_UNKNOWN if it isn't available.
See also
SDL_GetNumVideoDisplays()

Definition at line 761 of file SDL_video.c.

762 {
763  SDL_VideoDisplay *display;
764 
766 
767  display = &_this->displays[displayIndex];
768  return display->orientation;
769 }

References _this, CHECK_DISPLAY_INDEX, SDL_VideoDevice::displays, SDL_VideoDisplay::orientation, and SDL_ORIENTATION_UNKNOWN.

◆ SDL_GetDisplayUsableBounds()

int SDL_GetDisplayUsableBounds ( int  displayIndex,
SDL_Rect rect 
)

Get the usable desktop area represented by a display, with the primary display located at 0,0.

This is the same area as SDL_GetDisplayBounds() reports, but with portions reserved by the system removed. For example, on Mac OS X, this subtracts the area occupied by the menu bar and dock.

Setting a window to be fullscreen generally bypasses these unusable areas, so these are good guidelines for the maximum space available to a non-fullscreen window.

Returns
0 on success, or -1 if the index is out of range.
See also
SDL_GetDisplayBounds()
SDL_GetNumVideoDisplays()

Definition at line 717 of file SDL_video.c.

718 {
719  CHECK_DISPLAY_INDEX(displayIndex, -1);
720 
721  if (rect) {
722  SDL_VideoDisplay *display = &_this->displays[displayIndex];
723 
724  if ((displayIndex == 0) && ParseDisplayUsableBoundsHint(rect)) {
725  return 0;
726  }
727 
729  if (_this->GetDisplayUsableBounds(_this, display, rect) == 0) {
730  return 0;
731  }
732  }
733 
734  /* Oh well, just give the entire display bounds. */
735  return SDL_GetDisplayBounds(displayIndex, rect);
736  }
737  return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */
738 }

References _this, CHECK_DISPLAY_INDEX, SDL_VideoDevice::displays, SDL_VideoDevice::GetDisplayUsableBounds, ParseDisplayUsableBoundsHint(), rect, and SDL_GetDisplayBounds().

◆ SDL_GetGrabbedWindow()

SDL_Window* SDL_GetGrabbedWindow ( void  )

Get the window that currently has an input grab enabled.

Returns
This returns the window if input is grabbed, and NULL otherwise.
See also
SDL_SetWindowGrab()

Definition at line 2596 of file SDL_video.c.

2597 {
2599  return _this->grabbed_window;
2600 }

References _this, SDL_Window::flags, SDL_VideoDevice::grabbed_window, SDL_assert, and SDL_WINDOW_INPUT_GRABBED.

◆ SDL_GetNumDisplayModes()

int SDL_GetNumDisplayModes ( int  displayIndex)

Returns the number of available display modes.

See also
SDL_GetDisplayMode()

Definition at line 819 of file SDL_video.c.

820 {
821  CHECK_DISPLAY_INDEX(displayIndex, -1);
822 
823  return SDL_GetNumDisplayModesForDisplay(&_this->displays[displayIndex]);
824 }

References _this, CHECK_DISPLAY_INDEX, SDL_VideoDevice::displays, and SDL_GetNumDisplayModesForDisplay().

◆ SDL_GetNumVideoDisplays()

int SDL_GetNumVideoDisplays ( void  )

Returns the number of available video displays.

See also
SDL_GetDisplayBounds()

Definition at line 635 of file SDL_video.c.

636 {
637  if (!_this) {
639  return 0;
640  }
641  return _this->num_displays;
642 }

References _this, SDL_VideoDevice::num_displays, and SDL_UninitializedVideo().

◆ SDL_GetNumVideoDrivers()

int SDL_GetNumVideoDrivers ( void  )

Get the number of video drivers compiled into SDL.

See also
SDL_GetVideoDriver()

Definition at line 525 of file SDL_dynapi_procs.h.

References bootstrap, and SDL_arraysize.

Referenced by SDL_GetVideoDriver().

◆ SDL_GetVideoDriver()

const char* SDL_GetVideoDriver ( int  index)

Get the name of a built in video driver.

Note
The video drivers are presented in the order in which they are normally checked during initialization.
See also
SDL_GetNumVideoDrivers()

Definition at line 452 of file SDL_video.c.

453 {
454  if (index >= 0 && index < SDL_GetNumVideoDrivers()) {
455  return bootstrap[index]->name;
456  }
457  return NULL;
458 }

References bootstrap, VideoBootStrap::name, NULL, and SDL_GetNumVideoDrivers().

◆ SDL_GetWindowBordersSize()

int SDL_GetWindowBordersSize ( SDL_Window window,
int *  top,
int *  left,
int *  bottom,
int *  right 
)

Get the size of a window's borders (decorations) around the client area.

Parameters
windowThe window to query.
topPointer to variable for storing the size of the top border. NULL is permitted.
leftPointer to variable for storing the size of the left border. NULL is permitted.
bottomPointer to variable for storing the size of the bottom border. NULL is permitted.
rightPointer to variable for storing the size of the right border. NULL is permitted.
Returns
0 on success, or -1 if getting this information is not supported.
Note
if this function fails (returns -1), the size values will be initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as if the window in question was borderless.

Definition at line 2067 of file SDL_video.c.

2068 {
2069  int dummy = 0;
2070 
2071  if (!top) { top = &dummy; }
2072  if (!left) { left = &dummy; }
2073  if (!right) { right = &dummy; }
2074  if (!bottom) { bottom = &dummy; }
2075 
2076  /* Always initialize, so applications don't have to care */
2077  *top = *left = *bottom = *right = 0;
2078 
2080 
2081  if (!_this->GetWindowBordersSize) {
2082  return SDL_Unsupported();
2083  }
2084 
2086 }

References _this, CHECK_WINDOW_MAGIC, SDL_VideoDevice::GetWindowBordersSize, and SDL_Unsupported.

◆ SDL_GetWindowBrightness()

float SDL_GetWindowBrightness ( SDL_Window window)

Get the brightness (gamma correction) for a window.

Returns
The last brightness value passed to SDL_SetWindowBrightness()
See also
SDL_SetWindowBrightness()

Definition at line 2392 of file SDL_video.c.

2393 {
2395 
2396  return window->brightness;
2397 }

References CHECK_WINDOW_MAGIC.

◆ SDL_GetWindowData()

void* SDL_GetWindowData ( SDL_Window window,
const char *  name 
)

Retrieve the data pointer associated with a window.

Parameters
windowThe window to query.
nameThe name of the pointer.
Returns
The value associated with 'name'
See also
SDL_SetWindowData()

Definition at line 1864 of file SDL_video.c.

1865 {
1867 
1869 
1870  /* Input validation */
1871  if (name == NULL || name[0] == '\0') {
1872  SDL_InvalidParamError("name");
1873  return NULL;
1874  }
1875 
1876  for (data = window->data; data; data = data->next) {
1877  if (data->name && SDL_strcmp(data->name, name) == 0) {
1878  return data->data;
1879  }
1880  }
1881  return NULL;
1882 }

References CHECK_WINDOW_MAGIC, NULL, SDL_InvalidParamError, and SDL_strcmp.

Referenced by SDL_CreateWindowTexture(), and SDL_UpdateWindowTexture().

◆ SDL_GetWindowDisplayIndex()

int SDL_GetWindowDisplayIndex ( SDL_Window window)

Get the display index associated with a window.

Returns
the display index of the display containing the center of the window, or -1 on error.

Definition at line 1050 of file SDL_video.c.

1051 {
1052  int displayIndex;
1053  int i, dist;
1054  int closest = -1;
1055  int closest_dist = 0x7FFFFFFF;
1056  SDL_Point center;
1057  SDL_Point delta;
1058  SDL_Rect rect;
1059 
1061 
1064  displayIndex = (window->x & 0xFFFF);
1065  if (displayIndex >= _this->num_displays) {
1066  displayIndex = 0;
1067  }
1068  return displayIndex;
1069  }
1072  displayIndex = (window->y & 0xFFFF);
1073  if (displayIndex >= _this->num_displays) {
1074  displayIndex = 0;
1075  }
1076  return displayIndex;
1077  }
1078 
1079  /* Find the display containing the window */
1080  for (i = 0; i < _this->num_displays; ++i) {
1081  SDL_VideoDisplay *display = &_this->displays[i];
1082 
1083  if (display->fullscreen_window == window) {
1084  return i;
1085  }
1086  }
1087  center.x = window->x + window->w / 2;
1088  center.y = window->y + window->h / 2;
1089  for (i = 0; i < _this->num_displays; ++i) {
1091  if (SDL_EnclosePoints(&center, 1, &rect, NULL)) {
1092  return i;
1093  }
1094 
1095  delta.x = center.x - (rect.x + rect.w / 2);
1096  delta.y = center.y - (rect.y + rect.h / 2);
1097  dist = (delta.x*delta.x + delta.y*delta.y);
1098  if (dist < closest_dist) {
1099  closest = i;
1100  closest_dist = dist;
1101  }
1102  }
1103  if (closest < 0) {
1104  SDL_SetError("Couldn't find any displays");
1105  }
1106  return closest;
1107 }

References _this, CHECK_WINDOW_MAGIC, SDL_VideoDevice::displays, SDL_VideoDisplay::fullscreen_window, SDL_Rect::h, i, NULL, SDL_VideoDevice::num_displays, rect, SDL_EnclosePoints, SDL_GetDisplayBounds(), SDL_SetError, SDL_WINDOWPOS_ISCENTERED, SDL_WINDOWPOS_ISUNDEFINED, SDL_Rect::w, SDL_Point::x, SDL_Rect::x, SDL_Point::y, and SDL_Rect::y.

Referenced by SDL_GetDisplayForWindow(), and SDL_GetWindowPosition().

◆ SDL_GetWindowDisplayMode()

int SDL_GetWindowDisplayMode ( SDL_Window window,
SDL_DisplayMode mode 
)

Fill in information about the display mode used when a fullscreen window is visible.

See also
SDL_SetWindowDisplayMode()
SDL_SetWindowFullscreen()

Definition at line 1141 of file SDL_video.c.

1142 {
1143  SDL_DisplayMode fullscreen_mode;
1144  SDL_VideoDisplay *display;
1145 
1147 
1148  if (!mode) {
1149  return SDL_InvalidParamError("mode");
1150  }
1151 
1152  fullscreen_mode = window->fullscreen_mode;
1153  if (!fullscreen_mode.w) {
1154  fullscreen_mode.w = window->windowed.w;
1155  }
1156  if (!fullscreen_mode.h) {
1157  fullscreen_mode.h = window->windowed.h;
1158  }
1159 
1160  display = SDL_GetDisplayForWindow(window);
1161 
1162  /* if in desktop size mode, just return the size of the desktop */
1164  fullscreen_mode = display->desktop_mode;
1166  &fullscreen_mode,
1167  &fullscreen_mode)) {
1168  return SDL_SetError("Couldn't find display mode match");
1169  }
1170 
1171  if (mode) {
1172  *mode = fullscreen_mode;
1173  }
1174  return 0;
1175 }

References CHECK_WINDOW_MAGIC, SDL_VideoDisplay::desktop_mode, SDL_DisplayMode::h, SDL_GetClosestDisplayModeForDisplay(), SDL_GetDisplayForWindow(), SDL_InvalidParamError, SDL_SetError, SDL_WINDOW_FULLSCREEN_DESKTOP, and SDL_DisplayMode::w.

Referenced by SDL_SetWindowDisplayMode(), and SDL_UpdateFullscreenMode().

◆ SDL_GetWindowFlags()

Uint32 SDL_GetWindowFlags ( SDL_Window window)

Get the window flags.

Definition at line 1762 of file SDL_video.c.

1763 {
1765 
1766  return window->flags;
1767 }

References CHECK_WINDOW_MAGIC.

Referenced by SDL_ShowMessageBox().

◆ SDL_GetWindowFromID()

SDL_Window* SDL_GetWindowFromID ( Uint32  id)

Get a window from a stored ID, or NULL if it doesn't exist.

Definition at line 1746 of file SDL_video.c.

1747 {
1748  SDL_Window *window;
1749 
1750  if (!_this) {
1751  return NULL;
1752  }
1753  for (window = _this->windows; window; window = window->next) {
1754  if (window->id == id) {
1755  return window;
1756  }
1757  }
1758  return NULL;
1759 }

References _this, SDL_Window::next, NULL, and SDL_VideoDevice::windows.

◆ SDL_GetWindowGammaRamp()

int SDL_GetWindowGammaRamp ( SDL_Window window,
Uint16 red,
Uint16 green,
Uint16 blue 
)

Get the gamma ramp for a window.

Parameters
windowThe window from which the gamma ramp should be queried.
redA pointer to a 256 element array of 16-bit quantities to hold the translation table for the red channel, or NULL.
greenA pointer to a 256 element array of 16-bit quantities to hold the translation table for the green channel, or NULL.
blueA pointer to a 256 element array of 16-bit quantities to hold the translation table for the blue channel, or NULL.
Returns
0 on success, or -1 if gamma ramps are unsupported.
See also
SDL_SetWindowGammaRamp()

Definition at line 2496 of file SDL_video.c.

2499 {
2501 
2502  if (!window->gamma) {
2503  int i;
2504 
2505  window->gamma = (Uint16 *)SDL_malloc(256*6*sizeof(Uint16));
2506  if (!window->gamma) {
2507  return SDL_OutOfMemory();
2508  }
2509  window->saved_gamma = window->gamma + 3*256;
2510 
2511  if (_this->GetWindowGammaRamp) {
2512  if (_this->GetWindowGammaRamp(_this, window, window->gamma) < 0) {
2513  return -1;
2514  }
2515  } else {
2516  /* Create an identity gamma ramp */
2517  for (i = 0; i < 256; ++i) {
2518  Uint16 value = (Uint16)((i << 8) | i);
2519 
2520  window->gamma[0*256+i] = value;
2521  window->gamma[1*256+i] = value;
2522  window->gamma[2*256+i] = value;
2523  }
2524  }
2525  SDL_memcpy(window->saved_gamma, window->gamma, 3*256*sizeof(Uint16));
2526  }
2527 
2528  if (red) {
2529  SDL_memcpy(red, &window->gamma[0*256], 256*sizeof(Uint16));
2530  }
2531  if (green) {
2532  SDL_memcpy(green, &window->gamma[1*256], 256*sizeof(Uint16));
2533  }
2534  if (blue) {
2535  SDL_memcpy(blue, &window->gamma[2*256], 256*sizeof(Uint16));
2536  }
2537  return 0;
2538 }

References _this, CHECK_WINDOW_MAGIC, SDL_VideoDevice::GetWindowGammaRamp, i, red, SDL_malloc, SDL_memcpy, and SDL_OutOfMemory.

Referenced by SDL_SetWindowGammaRamp().

◆ SDL_GetWindowGrab()

SDL_bool SDL_GetWindowGrab ( SDL_Window window)

Get a window's input grab mode.

Returns
This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.
See also
SDL_SetWindowGrab()

Definition at line 2588 of file SDL_video.c.

References _this, CHECK_WINDOW_MAGIC, SDL_Window::flags, SDL_VideoDevice::grabbed_window, SDL_assert, SDL_FALSE, and SDL_WINDOW_INPUT_GRABBED.

◆ SDL_GetWindowID()

Uint32 SDL_GetWindowID ( SDL_Window window)

Get the numeric ID of a window, for logging purposes.

Definition at line 1738 of file SDL_video.c.

1739 {
1741 
1742  return window->id;
1743 }

References CHECK_WINDOW_MAGIC.

◆ SDL_GetWindowMaximumSize()

void SDL_GetWindowMaximumSize ( SDL_Window window,
int *  w,
int *  h 
)

Get the maximum size of a window's client area.

Parameters
windowThe window to query.
wPointer to variable for storing the maximum width, may be NULL
hPointer to variable for storing the maximum height, may be NULL
See also
SDL_GetWindowMinimumSize()
SDL_SetWindowMaximumSize()

Definition at line 2162 of file SDL_video.c.

2163 {
2165  if (max_w) {
2166  *max_w = window->max_w;
2167  }
2168  if (max_h) {
2169  *max_h = window->max_h;
2170  }
2171 }

References CHECK_WINDOW_MAGIC.

◆ SDL_GetWindowMinimumSize()

void SDL_GetWindowMinimumSize ( SDL_Window window,
int *  w,
int *  h 
)

Get the minimum size of a window's client area.

Parameters
windowThe window to query.
wPointer to variable for storing the minimum width, may be NULL
hPointer to variable for storing the minimum height, may be NULL
See also
SDL_GetWindowMaximumSize()
SDL_SetWindowMinimumSize()

Definition at line 2120 of file SDL_video.c.

2121 {
2123  if (min_w) {
2124  *min_w = window->min_w;
2125  }
2126  if (min_h) {
2127  *min_h = window->min_h;
2128  }
2129 }

References CHECK_WINDOW_MAGIC.

◆ SDL_GetWindowOpacity()

int SDL_GetWindowOpacity ( SDL_Window window,
float *  out_opacity 
)

Get the opacity of a window.

If transparency isn't supported on this platform, opacity will be reported as 1.0f without error.

Parameters
windowThe window in question.
out_opacityOpacity (0.0f - transparent, 1.0f - opaque)
Returns
0 on success, or -1 on error (invalid window, etc).
See also
SDL_SetWindowOpacity()

Definition at line 2424 of file SDL_video.c.

2425 {
2427 
2428  if (out_opacity) {
2429  *out_opacity = window->opacity;
2430  }
2431 
2432  return 0;
2433 }

References CHECK_WINDOW_MAGIC.

◆ SDL_GetWindowPixelFormat()

Uint32 SDL_GetWindowPixelFormat ( SDL_Window window)

Get the pixel format associated with the window.

Definition at line 1178 of file SDL_video.c.

1179 {
1180  SDL_VideoDisplay *display;
1181 
1183 
1184  display = SDL_GetDisplayForWindow(window);
1185  return display->current_mode.format;
1186 }

References CHECK_WINDOW_MAGIC, SDL_VideoDisplay::current_mode, SDL_DisplayMode::format, SDL_GetDisplayForWindow(), and SDL_PIXELFORMAT_UNKNOWN.

◆ SDL_GetWindowPosition()

void SDL_GetWindowPosition ( SDL_Window window,
int *  x,
int *  y 
)

Get the position of a window.

Parameters
windowThe window to query.
xPointer to variable for storing the x position, in screen coordinates. May be NULL.
yPointer to variable for storing the y position, in screen coordinates. May be NULL.
See also
SDL_SetWindowPosition()

Definition at line 1929 of file SDL_video.c.

1930 {
1932 
1933  /* Fullscreen windows are always at their display's origin */
1934  if (window->flags & SDL_WINDOW_FULLSCREEN) {
1935  int displayIndex;
1936 
1937  if (x) {
1938  *x = 0;
1939  }
1940  if (y) {
1941  *y = 0;
1942  }
1943 
1944  /* Find the window's monitor and update to the
1945  monitor offset. */
1946  displayIndex = SDL_GetWindowDisplayIndex(window);
1947  if (displayIndex >= 0) {
1948  SDL_Rect bounds;
1949 
1950  SDL_zero(bounds);
1951 
1952  SDL_GetDisplayBounds(displayIndex, &bounds);
1953  if (x) {
1954  *x = bounds.x;
1955  }
1956  if (y) {
1957  *y = bounds.y;
1958  }
1959  }
1960  } else {
1961  if (x) {
1962  *x = window->x;
1963  }
1964  if (y) {
1965  *y = window->y;
1966  }
1967  }
1968 }

References CHECK_WINDOW_MAGIC, SDL_GetDisplayBounds(), SDL_GetWindowDisplayIndex(), SDL_WINDOW_FULLSCREEN, SDL_zero, SDL_Rect::x, and SDL_Rect::y.

◆ SDL_GetWindowSize()

void SDL_GetWindowSize ( SDL_Window window,
int *  w,
int *  h 
)

Get the size of a window's client area.

Parameters
windowThe window to query.
wPointer to variable for storing the width, in screen coordinates. May be NULL.
hPointer to variable for storing the height, in screen coordinates. May be NULL.

The window size in screen coordinates may differ from the size in pixels, if the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() to get the real client area size in pixels.

See also
SDL_SetWindowSize()

Definition at line 2055 of file SDL_video.c.

2056 {
2058  if (w) {
2059  *w = window->w;
2060  }
2061  if (h) {
2062  *h = window->h;
2063  }
2064 }

References CHECK_WINDOW_MAGIC.

Referenced by SDL_GL_GetDrawableSize(), and SDL_Vulkan_GetDrawableSize().

◆ SDL_GetWindowSurface()

SDL_Surface* SDL_GetWindowSurface ( SDL_Window window)

Get the SDL surface associated with the window.

Returns
The window's framebuffer surface, or NULL on error.

A new surface will be created with the optimal format for the window, if necessary. This surface will be freed when the window is destroyed.

Note
You may not combine this with 3D or the rendering API on this window.
See also
SDL_UpdateWindowSurface()
SDL_UpdateWindowSurfaceRects()

Definition at line 2330 of file SDL_video.c.

2331 {
2333 
2334  if (!window->surface_valid) {
2335  if (window->surface) {
2336  window->surface->flags &= ~SDL_DONTFREE;
2337  SDL_FreeSurface(window->surface);
2338  }
2340  if (window->surface) {
2341  window->surface_valid = SDL_TRUE;
2342  window->surface->flags |= SDL_DONTFREE;
2343  }
2344  }
2345  return window->surface;
2346 }

References CHECK_WINDOW_MAGIC, NULL, SDL_CreateWindowFramebuffer(), SDL_DONTFREE, SDL_FreeSurface, and SDL_TRUE.

◆ SDL_GetWindowTitle()

const char* SDL_GetWindowTitle ( SDL_Window window)

Get the title of a window, in UTF-8 format.

See also
SDL_SetWindowTitle()

Definition at line 1787 of file SDL_video.c.

1788 {
1790 
1791  return window->title ? window->title : "";
1792 }

References CHECK_WINDOW_MAGIC.

◆ SDL_GL_CreateContext()

SDL_GLContext SDL_GL_CreateContext ( SDL_Window window)

Create an OpenGL context for use with an OpenGL window, and make it current.

See also
SDL_GL_DeleteContext()

Definition at line 3514 of file SDL_video.c.

3515 {
3518 
3519  if (!(window->flags & SDL_WINDOW_OPENGL)) {
3520  SDL_SetError("The specified window isn't an OpenGL window");
3521  return NULL;
3522  }
3523 
3525 
3526  /* Creating a context is assumed to make it current in the SDL driver. */
3527  if (ctx) {
3529  _this->current_glctx = ctx;
3532  }
3533  return ctx;
3534 }

References _this, CHECK_WINDOW_MAGIC, SDL_VideoDevice::current_glctx, SDL_VideoDevice::current_glctx_tls, SDL_VideoDevice::current_glwin, SDL_VideoDevice::current_glwin_tls, SDL_VideoDevice::GL_CreateContext, NULL, SDL_SetError, SDL_TLSSet, and SDL_WINDOW_OPENGL.

Referenced by ShouldUseTextureFramebuffer().

◆ SDL_GL_DeleteContext()

void SDL_GL_DeleteContext ( SDL_GLContext  context)

Delete an OpenGL context.

See also
SDL_GL_CreateContext()

Definition at line 3645 of file SDL_video.c.

3646 {
3647  if (!_this || !context) {
3648  return;
3649  }
3650 
3651  if (SDL_GL_GetCurrentContext() == context) {
3653  }
3654 
3656 }

References _this, context, SDL_VideoDevice::GL_DeleteContext, NULL, SDL_GL_GetCurrentContext(), and SDL_GL_MakeCurrent().

Referenced by ShouldUseTextureFramebuffer().

◆ SDL_GL_ExtensionSupported()

SDL_bool SDL_GL_ExtensionSupported ( const char *  extension)

Return true if an OpenGL extension is supported for the current context.

Definition at line 2975 of file SDL_video.c.

2976 {
2977 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
2978  const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
2979  const char *extensions;
2980  const char *start;
2981  const char *where, *terminator;
2982 
2983  /* Extension names should not have spaces. */
2984  where = SDL_strchr(extension, ' ');
2985  if (where || *extension == '\0') {
2986  return SDL_FALSE;
2987  }
2988  /* See if there's an environment variable override */
2989  start = SDL_getenv(extension);
2990  if (start && *start == '0') {
2991  return SDL_FALSE;
2992  }
2993 
2994  /* Lookup the available extensions */
2995 
2996  glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
2997  if (!glGetStringFunc) {
2998  return SDL_FALSE;
2999  }
3000 
3001  if (isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) {
3002  const GLubyte *(APIENTRY * glGetStringiFunc) (GLenum, GLuint);
3003  void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params);
3004  GLint num_exts = 0;
3005  GLint i;
3006 
3007  glGetStringiFunc = SDL_GL_GetProcAddress("glGetStringi");
3008  glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
3009  if ((!glGetStringiFunc) || (!glGetIntegervFunc)) {
3010  return SDL_FALSE;
3011  }
3012 
3013  #ifndef GL_NUM_EXTENSIONS
3014  #define GL_NUM_EXTENSIONS 0x821D
3015  #endif
3016  glGetIntegervFunc(GL_NUM_EXTENSIONS, &num_exts);
3017  for (i = 0; i < num_exts; i++) {
3018  const char *thisext = (const char *) glGetStringiFunc(GL_EXTENSIONS, i);
3019  if (SDL_strcmp(thisext, extension) == 0) {
3020  return SDL_TRUE;
3021  }
3022  }
3023 
3024  return SDL_FALSE;
3025  }
3026 
3027  /* Try the old way with glGetString(GL_EXTENSIONS) ... */
3028 
3029  extensions = (const char *) glGetStringFunc(GL_EXTENSIONS);
3030  if (!extensions) {
3031  return SDL_FALSE;
3032  }
3033  /*
3034  * It takes a bit of care to be fool-proof about parsing the OpenGL
3035  * extensions string. Don't be fooled by sub-strings, etc.
3036  */
3037 
3038  start = extensions;
3039 
3040  for (;;) {
3041  where = SDL_strstr(start, extension);
3042  if (!where)
3043  break;
3044 
3045  terminator = where + SDL_strlen(extension);
3046  if (where == extensions || *(where - 1) == ' ')
3047  if (*terminator == ' ' || *terminator == '\0')
3048  return SDL_TRUE;
3049 
3050  start = terminator;
3051  }
3052  return SDL_FALSE;
3053 #else
3054  return SDL_FALSE;
3055 #endif
3056 }

References APIENTRY, GL_EXTENSIONS, GL_NUM_EXTENSIONS, GL_VERSION, i, isAtLeastGL3(), SDL_FALSE, SDL_getenv, SDL_GL_GetProcAddress(), SDL_strchr, SDL_strcmp, SDL_strlen, SDL_strstr, SDL_TRUE, and void.

Referenced by SDL_GL_DeduceMaxSupportedESProfile().

◆ SDL_GL_GetAttribute()

int SDL_GL_GetAttribute ( SDL_GLattr  attr,
int *  value 
)

Get the actual value for an attribute from the current context.

Returns
0 on success, or -1 if the attribute could not be retrieved. The integer at value will be modified in either case.

Definition at line 3265 of file SDL_video.c.

3266 {
3267 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
3268  GLenum (APIENTRY *glGetErrorFunc) (void);
3269  GLenum attrib = 0;
3270  GLenum error = 0;
3271 
3272  /*
3273  * Some queries in Core Profile desktop OpenGL 3+ contexts require
3274  * glGetFramebufferAttachmentParameteriv instead of glGetIntegerv. Note that
3275  * the enums we use for the former function don't exist in OpenGL ES 2, and
3276  * the function itself doesn't exist prior to OpenGL 3 and OpenGL ES 2.
3277  */
3278 #if SDL_VIDEO_OPENGL
3279  const GLubyte *(APIENTRY *glGetStringFunc) (GLenum name);
3280  void (APIENTRY *glGetFramebufferAttachmentParameterivFunc) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
3282  GLenum attachmentattrib = 0;
3283 #endif
3284 
3285  if (!value) {
3286  return SDL_InvalidParamError("value");
3287  }
3288 
3289  /* Clear value in any case */
3290  *value = 0;
3291 
3292  if (!_this) {
3293  return SDL_UninitializedVideo();
3294  }
3295 
3296  switch (attr) {
3297  case SDL_GL_RED_SIZE:
3298 #if SDL_VIDEO_OPENGL
3299  attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE;
3300 #endif
3301  attrib = GL_RED_BITS;
3302  break;
3303  case SDL_GL_BLUE_SIZE:
3304 #if SDL_VIDEO_OPENGL
3305  attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE;
3306 #endif
3307  attrib = GL_BLUE_BITS;
3308  break;
3309  case SDL_GL_GREEN_SIZE:
3310 #if SDL_VIDEO_OPENGL
3311  attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE;
3312 #endif
3313  attrib = GL_GREEN_BITS;
3314  break;
3315  case SDL_GL_ALPHA_SIZE:
3316 #if SDL_VIDEO_OPENGL
3317  attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE;
3318 #endif
3319  attrib = GL_ALPHA_BITS;
3320  break;
3321  case SDL_GL_DOUBLEBUFFER:
3322 #if SDL_VIDEO_OPENGL
3323  attrib = GL_DOUBLEBUFFER;
3324  break;
3325 #else
3326  /* OpenGL ES 1.0 and above specifications have EGL_SINGLE_BUFFER */
3327  /* parameter which switches double buffer to single buffer. OpenGL ES */
3328  /* SDL driver must set proper value after initialization */
3330  return 0;
3331 #endif
3332  case SDL_GL_DEPTH_SIZE:
3333 #if SDL_VIDEO_OPENGL
3334  attachment = GL_DEPTH;
3335  attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE;
3336 #endif
3337  attrib = GL_DEPTH_BITS;
3338  break;
3339  case SDL_GL_STENCIL_SIZE:
3340 #if SDL_VIDEO_OPENGL
3342  attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE;
3343 #endif
3344  attrib = GL_STENCIL_BITS;
3345  break;
3346 #if SDL_VIDEO_OPENGL
3347  case SDL_GL_ACCUM_RED_SIZE:
3348  attrib = GL_ACCUM_RED_BITS;
3349  break;
3351  attrib = GL_ACCUM_GREEN_BITS;
3352  break;
3354  attrib = GL_ACCUM_BLUE_BITS;
3355  break;
3357  attrib = GL_ACCUM_ALPHA_BITS;
3358  break;
3359  case SDL_GL_STEREO:
3360  attrib = GL_STEREO;
3361  break;
3362 #else
3363  case SDL_GL_ACCUM_RED_SIZE:
3367  case SDL_GL_STEREO:
3368  /* none of these are supported in OpenGL ES */
3369  *value = 0;
3370  return 0;
3371 #endif
3373  attrib = GL_SAMPLE_BUFFERS;
3374  break;
3376  attrib = GL_SAMPLES;
3377  break;
3379 #if SDL_VIDEO_OPENGL
3380  attrib = GL_CONTEXT_RELEASE_BEHAVIOR;
3381 #else
3383 #endif
3384  break;
3385  case SDL_GL_BUFFER_SIZE:
3386  {
3387  int rsize = 0, gsize = 0, bsize = 0, asize = 0;
3388 
3389  /* There doesn't seem to be a single flag in OpenGL for this! */
3390  if (SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &rsize) < 0) {
3391  return -1;
3392  }
3393  if (SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &gsize) < 0) {
3394  return -1;
3395  }
3396  if (SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &bsize) < 0) {
3397  return -1;
3398  }
3399  if (SDL_GL_GetAttribute(SDL_GL_ALPHA_SIZE, &asize) < 0) {
3400  return -1;
3401  }
3402 
3403  *value = rsize + gsize + bsize + asize;
3404  return 0;
3405  }
3407  {
3408  /* FIXME: How do we get this information? */
3409  *value = (_this->gl_config.accelerated != 0);
3410  return 0;
3411  }
3413  {
3415  return 0;
3416  }
3418  {
3420  return 0;
3421  }
3423  {
3425  return 0;
3426  }
3427  case SDL_GL_CONTEXT_EGL:
3428  /* FIXME: SDL_GL_CONTEXT_EGL to be deprecated in SDL 2.1 */
3429  {
3431  *value = 1;
3432  }
3433  else {
3434  *value = 0;
3435  }
3436  return 0;
3437  }
3438  case SDL_GL_CONTEXT_FLAGS:
3439  {
3440  *value = _this->gl_config.flags;
3441  return 0;
3442  }
3444  {
3446  return 0;
3447  }
3449  {
3451  return 0;
3452  }
3454  {
3456  return 0;
3457  }
3459  {
3461  return 0;
3462  }
3463  default:
3464  return SDL_SetError("Unknown OpenGL attribute");
3465  }
3466 
3467 #if SDL_VIDEO_OPENGL
3468  glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
3469  if (!glGetStringFunc) {
3470  return -1;
3471  }
3472 
3473  if (attachmentattrib && isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) {
3474  glGetFramebufferAttachmentParameterivFunc = SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameteriv");
3475 
3476  if (glGetFramebufferAttachmentParameterivFunc) {
3477  glGetFramebufferAttachmentParameterivFunc(GL_FRAMEBUFFER, attachment, attachmentattrib, (GLint *) value);
3478  } else {
3479  return -1;
3480  }
3481  } else
3482 #endif
3483  {
3484  void (APIENTRY *glGetIntegervFunc) (GLenum pname, GLint * params);
3485  glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
3486  if (glGetIntegervFunc) {
3487  glGetIntegervFunc(attrib, (GLint *) value);
3488  } else {
3489  return -1;
3490  }
3491  }
3492 
3493  glGetErrorFunc = SDL_GL_GetProcAddress("glGetError");
3494  if (!glGetErrorFunc) {
3495  return -1;
3496  }
3497 
3498  error = glGetErrorFunc();
3499  if (error != GL_NO_ERROR) {
3500  if (error == GL_INVALID_ENUM) {
3501  return SDL_SetError("OpenGL error: GL_INVALID_ENUM");
3502  } else if (error == GL_INVALID_VALUE) {
3503  return SDL_SetError("OpenGL error: GL_INVALID_VALUE");
3504  }
3505  return SDL_SetError("OpenGL error: %08X", error);
3506  }
3507  return 0;
3508 #else
3509  return SDL_Unsupported();
3510 #endif /* SDL_VIDEO_OPENGL */
3511 }

References _this, SDL_VideoDevice::accelerated, APIENTRY, SDL_VideoDevice::double_buffer, SDL_VideoDevice::flags, SDL_VideoDevice::framebuffer_srgb_capable, GL_ACCUM_ALPHA_BITS, GL_ACCUM_BLUE_BITS, GL_ACCUM_GREEN_BITS, GL_ACCUM_RED_BITS, GL_ALPHA_BITS, GL_BACK_LEFT, GL_BLUE_BITS, SDL_VideoDevice::gl_config, GL_CONTEXT_RELEASE_BEHAVIOR, GL_CONTEXT_RELEASE_BEHAVIOR_KHR, GL_DEPTH, GL_DEPTH_BITS, GL_DOUBLEBUFFER, GL_FRAMEBUFFER, GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, GL_GREEN_BITS, GL_INVALID_ENUM, GL_INVALID_VALUE, GL_NO_ERROR, GL_RED_BITS, GL_SAMPLE_BUFFERS, GL_SAMPLES, GL_STENCIL, GL_STENCIL_BITS, GL_STEREO, GL_VERSION, isAtLeastGL3(), SDL_VideoDevice::major_version, SDL_VideoDevice::minor_version, SDL_VideoDevice::no_error, SDL_VideoDevice::profile_mask, SDL_VideoDevice::retained_backing, SDL_GL_ACCELERATED_VISUAL, SDL_GL_ACCUM_ALPHA_SIZE, SDL_GL_ACCUM_BLUE_SIZE, SDL_GL_ACCUM_GREEN_SIZE, SDL_GL_ACCUM_RED_SIZE, SDL_GL_ALPHA_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_CONTEXT_EGL, SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION, SDL_GL_CONTEXT_NO_ERROR, SDL_GL_CONTEXT_PROFILE_ES, SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_RELEASE_BEHAVIOR, SDL_GL_DEPTH_SIZE, SDL_GL_DOUBLEBUFFER, SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, SDL_GL_GetProcAddress(), SDL_GL_GREEN_SIZE, SDL_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLESAMPLES, SDL_GL_RED_SIZE, SDL_GL_RETAINED_BACKING, SDL_GL_SHARE_WITH_CURRENT_CONTEXT, SDL_GL_STENCIL_SIZE, SDL_GL_STEREO, SDL_InvalidParamError, SDL_SetError, SDL_UninitializedVideo(), SDL_Unsupported, SDL_VideoDevice::share_with_current_context, and void.

◆ SDL_GL_GetCurrentContext()

SDL_GLContext SDL_GL_GetCurrentContext ( void  )

Get the currently active OpenGL context.

Definition at line 3578 of file SDL_video.c.

3579 {
3580  if (!_this) {
3582  return NULL;
3583  }
3585 }

References _this, SDL_VideoDevice::current_glctx_tls, NULL, SDL_TLSGet, and SDL_UninitializedVideo().

Referenced by SDL_GL_DeleteContext(), SDL_GL_GetSwapInterval(), SDL_GL_MakeCurrent(), and SDL_GL_SetSwapInterval().

◆ SDL_GL_GetCurrentWindow()

SDL_Window* SDL_GL_GetCurrentWindow ( void  )

Get the currently active OpenGL window.

Definition at line 589 of file SDL_dynapi_procs.h.

References _this, SDL_VideoDevice::current_glwin_tls, NULL, SDL_TLSGet, and SDL_UninitializedVideo().

Referenced by SDL_GL_MakeCurrent(), and SDL_GL_SwapWindow().

◆ SDL_GL_GetDrawableSize()

void SDL_GL_GetDrawableSize ( SDL_Window window,
int *  w,
int *  h 
)

Get the size of a window's underlying drawable in pixels (for use with glViewport).

Parameters
windowWindow from which the drawable size should be queried
wPointer to variable for storing the width in pixels, may be NULL
hPointer to variable for storing the height in pixels, may be NULL

This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with high-DPI support (Apple calls this "Retina"), and not disabled by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.

See also
SDL_GetWindowSize()
SDL_CreateWindow()

Definition at line 3587 of file SDL_video.c.

3588 {
3590 
3591  if (_this->GL_GetDrawableSize) {
3593  } else {
3595  }
3596 }

References _this, CHECK_WINDOW_MAGIC, SDL_VideoDevice::GL_GetDrawableSize, and SDL_GetWindowSize().

◆ SDL_GL_GetProcAddress()

void* SDL_GL_GetProcAddress ( const char *  proc)

Get the address of an OpenGL function.

Definition at line 2928 of file SDL_video.c.

2929 {
2930  void *func;
2931 
2932  if (!_this) {
2934  return NULL;
2935  }
2936  func = NULL;
2937  if (_this->GL_GetProcAddress) {
2938  if (_this->gl_config.driver_loaded) {
2939  func = _this->GL_GetProcAddress(_this, proc);
2940  } else {
2941  SDL_SetError("No GL driver has been loaded");
2942  }
2943  } else {
2944  SDL_SetError("No dynamic GL support in current SDL video driver (%s)", _this->name);
2945  }
2946  return func;
2947 }

References _this, SDL_VideoDevice::driver_loaded, SDL_VideoDevice::gl_config, SDL_VideoDevice::GL_GetProcAddress, SDL_VideoDevice::name, NULL, SDL_SetError, and SDL_UninitializedVideo().

Referenced by SDL_GL_ExtensionSupported(), SDL_GL_GetAttribute(), and ShouldUseTextureFramebuffer().

◆ SDL_GL_GetSwapInterval()

int SDL_GL_GetSwapInterval ( void  )

Get the swap interval for the current OpenGL context.

Returns
0 if there is no vertical retrace synchronization, 1 if the buffer swap is synchronized with the vertical retrace, and -1 if late swaps happen immediately instead of waiting for the next retrace. If the system can't determine the swap interval, or there isn't a valid current context, this will return 0 as a safe default.
See also
SDL_GL_SetSwapInterval()

Definition at line 593 of file SDL_dynapi_procs.h.

References _this, SDL_VideoDevice::GL_GetSwapInterval, NULL, and SDL_GL_GetCurrentContext().

◆ SDL_GL_LoadLibrary()

int SDL_GL_LoadLibrary ( const char *  path)

Dynamically load an OpenGL library.

Parameters
pathThe platform dependent OpenGL library name, or NULL to open the default OpenGL library.
Returns
0 on success, or -1 if the library couldn't be loaded.

This should be done after initializing the video driver, but before creating any OpenGL windows. If no OpenGL library is loaded, the default library will be loaded upon creation of the first OpenGL window.

Note
If you do this, you need to retrieve all of the GL functions used in your program from the dynamic library using SDL_GL_GetProcAddress().
See also
SDL_GL_GetProcAddress()
SDL_GL_UnloadLibrary()

Definition at line 2899 of file SDL_video.c.

2900 {
2901  int retval;
2902 
2903  if (!_this) {
2904  return SDL_UninitializedVideo();
2905  }
2906  if (_this->gl_config.driver_loaded) {
2907  if (path && SDL_strcmp(path, _this->gl_config.driver_path) != 0) {
2908  return SDL_SetError("OpenGL library already loaded");
2909  }
2910  retval = 0;
2911  } else {
2912  if (!_this->GL_LoadLibrary) {
2913  return SDL_SetError("No dynamic GL support in current SDL video driver (%s)", _this->name);
2914  }
2916  }
2917  if (retval == 0) {
2919  } else {
2920  if (_this->GL_UnloadLibrary) {
2922  }
2923  }
2924  return (retval);
2925 }

References _this, SDL_VideoDevice::driver_loaded, SDL_VideoDevice::driver_path, SDL_VideoDevice::gl_config, SDL_VideoDevice::GL_LoadLibrary, SDL_VideoDevice::GL_UnloadLibrary, SDL_VideoDevice::name, retval, SDL_SetError, SDL_strcmp, and SDL_UninitializedVideo().

Referenced by SDL_CreateWindow(), and SDL_RecreateWindow().

◆ SDL_GL_MakeCurrent()

int SDL_GL_MakeCurrent ( SDL_Window window,
SDL_GLContext  context 
)

Set up an OpenGL context for rendering into an OpenGL window.

Note
The context must have been created with a compatible window.

Definition at line 3537 of file SDL_video.c.

3538 {
3539  int retval;
3540 
3541  if (window == SDL_GL_GetCurrentWindow() &&
3543  /* We're already current. */
3544  return 0;
3545  }
3546 
3547  if (!ctx) {
3548  window = NULL;
3549  } else {
3551 
3552  if (!(window->flags & SDL_WINDOW_OPENGL)) {
3553  return SDL_SetError("The specified window isn't an OpenGL window");
3554  }
3555  }
3556 
3558  if (retval == 0) {
3560  _this->current_glctx = ctx;
3563  }
3564  return retval;
3565 }

References _this, CHECK_WINDOW_MAGIC, SDL_VideoDevice::current_glctx, SDL_VideoDevice::current_glctx_tls, SDL_VideoDevice::current_glwin, SDL_VideoDevice::current_glwin_tls, SDL_VideoDevice::GL_MakeCurrent, NULL, retval, SDL_GL_GetCurrentContext(), SDL_GL_GetCurrentWindow(), SDL_SetError, SDL_TLSSet, and SDL_WINDOW_OPENGL.

Referenced by SDL_DestroyWindow(), and SDL_GL_DeleteContext().

◆ SDL_GL_ResetAttributes()

void SDL_GL_ResetAttributes ( void  )

Reset all previously set OpenGL context attributes to their default values.

Definition at line 3090 of file SDL_video.c.

3091 {
3092  if (!_this) {
3093  return;
3094  }
3095 
3096  _this->gl_config.red_size = 3;
3097  _this->gl_config.green_size = 3;
3098  _this->gl_config.blue_size = 2;
3099  _this->gl_config.alpha_size = 0;
3101  _this->gl_config.depth_size = 16;
3108  _this->gl_config.stereo = 0;
3112  _this->gl_config.accelerated = -1; /* accelerated or not, both are fine */
3113 
3118  } else {
3119 #if SDL_VIDEO_OPENGL
3123 #elif SDL_VIDEO_OPENGL_ES2
3127 #elif SDL_VIDEO_OPENGL_ES
3131 #endif
3132  }
3133 
3134  _this->gl_config.flags = 0;
3136  _this->gl_config.no_error = 0;
3139 
3141 }

References _this, SDL_VideoDevice::accelerated, SDL_VideoDevice::accum_alpha_size, SDL_VideoDevice::accum_blue_size, SDL_VideoDevice::accum_green_size, SDL_VideoDevice::accum_red_size, SDL_VideoDevice::alpha_size, SDL_VideoDevice::blue_size, SDL_VideoDevice::buffer_size, SDL_VideoDevice::depth_size, SDL_VideoDevice::double_buffer, SDL_VideoDevice::flags, SDL_VideoDevice::framebuffer_srgb_capable, SDL_VideoDevice::gl_config, SDL_VideoDevice::GL_DefaultProfileConfig, SDL_VideoDevice::green_size, SDL_VideoDevice::major_version, SDL_VideoDevice::minor_version, SDL_VideoDevice::multisamplebuffers, SDL_VideoDevice::multisamplesamples, SDL_VideoDevice::no_error, SDL_VideoDevice::profile_mask, SDL_VideoDevice::red_size, SDL_VideoDevice::release_behavior, SDL_VideoDevice::reset_notification, SDL_VideoDevice::retained_backing, SDL_GL_CONTEXT_PROFILE_ES, SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH, SDL_GL_CONTEXT_RESET_NO_NOTIFICATION, SDL_VideoDevice::share_with_current_context, SDL_VideoDevice::stencil_size, and SDL_VideoDevice::stereo.

Referenced by SDL_VideoInit().

◆ SDL_GL_SetAttribute()

int SDL_GL_SetAttribute ( SDL_GLattr  attr,
int  value 
)

Set an OpenGL window attribute before window creation.

Returns
0 on success, or -1 if the attribute could not be set.

Definition at line 3144 of file SDL_video.c.

3145 {
3146 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
3147  int retval;
3148 
3149  if (!_this) {
3150  return SDL_UninitializedVideo();
3151  }
3152  retval = 0;
3153  switch (attr) {
3154  case SDL_GL_RED_SIZE:
3156  break;
3157  case SDL_GL_GREEN_SIZE:
3159  break;
3160  case SDL_GL_BLUE_SIZE:
3162  break;
3163  case SDL_GL_ALPHA_SIZE:
3165  break;
3166  case SDL_GL_DOUBLEBUFFER:
3168  break;
3169  case SDL_GL_BUFFER_SIZE:
3171  break;
3172  case SDL_GL_DEPTH_SIZE:
3174  break;
3175  case SDL_GL_STENCIL_SIZE:
3177  break;
3178  case SDL_GL_ACCUM_RED_SIZE:
3180  break;
3183  break;
3186  break;
3189  break;
3190  case SDL_GL_STEREO:
3192  break;
3195  break;
3198  break;
3201  break;
3204  break;
3207  break;
3210  break;
3211  case SDL_GL_CONTEXT_EGL:
3212  /* FIXME: SDL_GL_CONTEXT_EGL to be deprecated in SDL 2.1 */
3213  if (value != 0) {
3215  } else {
3217  };
3218  break;
3219  case SDL_GL_CONTEXT_FLAGS:
3224  retval = SDL_SetError("Unknown OpenGL context flag %d", value);
3225  break;
3226  }
3228  break;
3230  if (value != 0 &&
3234  retval = SDL_SetError("Unknown OpenGL context profile %d", value);
3235  break;
3236  }
3238  break;
3241  break;
3244  break;
3247  break;
3250  break;
3253  break;
3254  default:
3255  retval = SDL_SetError("Unknown OpenGL attribute");
3256  break;
3257  }
3258  return retval;
3259 #else
3260  return SDL_Unsupported();
3261 #endif /* SDL_VIDEO_OPENGL */
3262 }

References _this, SDL_VideoDevice::accelerated, SDL_VideoDevice::accum_alpha_size, SDL_VideoDevice::accum_blue_size, SDL_VideoDevice::accum_green_size, SDL_VideoDevice::accum_red_size, SDL_VideoDevice::alpha_size, SDL_VideoDevice::blue_size, SDL_VideoDevice::buffer_size, SDL_VideoDevice::depth_size, SDL_VideoDevice::double_buffer, SDL_VideoDevice::flags, SDL_VideoDevice::framebuffer_srgb_capable, SDL_VideoDevice::gl_config, SDL_VideoDevice::green_size, SDL_VideoDevice::major_version, SDL_VideoDevice::minor_version, SDL_VideoDevice::multisamplebuffers, SDL_VideoDevice::multisamplesamples, SDL_VideoDevice::no_error, SDL_VideoDevice::profile_mask, SDL_VideoDevice::red_size, SDL_VideoDevice::release_behavior, SDL_VideoDevice::reset_notification, SDL_VideoDevice::retained_backing, retval, SDL_GL_ACCELERATED_VISUAL, SDL_GL_ACCUM_ALPHA_SIZE, SDL_GL_ACCUM_BLUE_SIZE, SDL_GL_ACCUM_GREEN_SIZE, SDL_GL_ACCUM_RED_SIZE, SDL_GL_ALPHA_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_CONTEXT_DEBUG_FLAG, SDL_GL_CONTEXT_EGL, SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG, SDL_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION, SDL_GL_CONTEXT_NO_ERROR, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY, SDL_GL_CONTEXT_PROFILE_CORE, SDL_GL_CONTEXT_PROFILE_ES, SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_RELEASE_BEHAVIOR, SDL_GL_CONTEXT_RESET_ISOLATION_FLAG, SDL_GL_CONTEXT_RESET_NOTIFICATION, SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG, SDL_GL_DEPTH_SIZE, SDL_GL_DOUBLEBUFFER, SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, SDL_GL_GREEN_SIZE, SDL_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLESAMPLES, SDL_GL_RED_SIZE, SDL_GL_RETAINED_BACKING, SDL_GL_SHARE_WITH_CURRENT_CONTEXT, SDL_GL_STENCIL_SIZE, SDL_GL_STEREO, SDL_SetError, SDL_UninitializedVideo(), SDL_Unsupported, SDL_VideoDevice::share_with_current_context, SDL_VideoDevice::stencil_size, and SDL_VideoDevice::stereo.

◆ SDL_GL_SetSwapInterval()

int SDL_GL_SetSwapInterval ( int  interval)

Set the swap interval for the current OpenGL context.

Parameters
interval0 for immediate updates, 1 for updates synchronized with the vertical retrace. If the system supports it, you may specify -1 to allow late swaps to happen immediately instead of waiting for the next retrace.
Returns
0 on success, or -1 if setting the swap interval is not supported.
See also
SDL_GL_GetSwapInterval()

Definition at line 3599 of file SDL_video.c.

3600 {
3601  if (!_this) {
3602  return SDL_UninitializedVideo();
3603  } else if (SDL_GL_GetCurrentContext() == NULL) {
3604  return SDL_SetError("No OpenGL context has been made current");
3605  } else if (_this->GL_SetSwapInterval) {
3606  return _this->GL_SetSwapInterval(_this, interval);
3607  } else {
3608  return SDL_SetError("Setting the swap interval is not supported");
3609  }
3610 }

References _this, SDL_VideoDevice::GL_SetSwapInterval, NULL, SDL_GL_GetCurrentContext(), SDL_SetError, and SDL_UninitializedVideo().

◆ SDL_GL_SwapWindow()

void SDL_GL_SwapWindow ( SDL_Window window)

Swap the OpenGL buffers for a window, if double-buffering is supported.

Definition at line 3627 of file SDL_video.c.

3628 {
3630 
3631  if (!(window->flags & SDL_WINDOW_OPENGL)) {
3632  SDL_SetError("The specified window isn't an OpenGL window");
3633  return;
3634  }
3635 
3636  if (SDL_GL_GetCurrentWindow() != window) {
3637  SDL_SetError("The specified window has not been made current");
3638  return;
3639  }
3640 
3642 }

References _this, CHECK_WINDOW_MAGIC, SDL_VideoDevice::GL_SwapWindow, SDL_GL_GetCurrentWindow(), SDL_SetError, and SDL_WINDOW_OPENGL.

◆ SDL_GL_UnloadLibrary()

void SDL_GL_UnloadLibrary ( void  )

◆ SDL_HideWindow()

void SDL_HideWindow ( SDL_Window window)

Hide a window.

See also
SDL_ShowWindow()

Definition at line 2189 of file SDL_video.c.

2190 {
2192 
2193  if (!(window->flags & SDL_WINDOW_SHOWN)) {
2194  return;
2195  }
2196 
2197  window->is_hiding = SDL_TRUE;
2199 
2200  if (_this->HideWindow) {
2202  }
2203  window->is_hiding = SDL_FALSE;
2205 }

References _this, CHECK_WINDOW_MAGIC, SDL_VideoDevice::HideWindow, SDL_FALSE, SDL_SendWindowEvent(), SDL_TRUE, SDL_UpdateFullscreenMode(), SDL_WINDOW_SHOWN, and SDL_WINDOWEVENT_HIDDEN.

Referenced by SDL_DestroyWindow(), and SDL_RecreateWindow().

◆ SDL_IsScreenSaverEnabled()

SDL_bool SDL_IsScreenSaverEnabled ( void  )

Returns whether the screensaver is currently enabled (default off).

See also
SDL_EnableScreenSaver()
SDL_DisableScreenSaver()

Definition at line 2810 of file SDL_video.c.

2811 {
2812  if (!_this) {
2813  return SDL_TRUE;
2814  }
2816 }

References _this, SDL_FALSE, SDL_TRUE, and SDL_VideoDevice::suspend_screensaver.

◆ SDL_MaximizeWindow()

void SDL_MaximizeWindow ( SDL_Window window)

Make a window as large as possible.

See also
SDL_RestoreWindow()

Definition at line 2221 of file SDL_video.c.

2222 {
2224 
2225  if (window->flags & SDL_WINDOW_MAXIMIZED) {
2226  return;
2227  }
2228 
2229  /* !!! FIXME: should this check if the window is resizable? */
2230 
2231  if (_this->MaximizeWindow) {
2233  }
2234 }

References _this, CHECK_WINDOW_MAGIC, SDL_VideoDevice::MaximizeWindow, and SDL_WINDOW_MAXIMIZED.

Referenced by SDL_FinishWindowCreation().

◆ SDL_MinimizeWindow()

void SDL_MinimizeWindow ( SDL_Window window)

Minimize a window to an iconic representation.

See also
SDL_RestoreWindow()

Definition at line 2246 of file SDL_video.c.

2247 {
2249 
2250  if (window->flags & SDL_WINDOW_MINIMIZED) {
2251  return;
2252  }
2253 
2254  if (!CanMinimizeWindow(window)) {
2255  return;
2256  }
2257 
2259 
2260  if (_this->MinimizeWindow) {
2262  }
2263 }

References _this, CanMinimizeWindow(), CHECK_WINDOW_MAGIC, SDL_VideoDevice::MinimizeWindow, SDL_FALSE, SDL_UpdateFullscreenMode(), and SDL_WINDOW_MINIMIZED.

Referenced by SDL_FinishWindowCreation(), SDL_OnWindowFocusLost(), and SDL_UpdateFullscreenMode().

◆ SDL_RaiseWindow()

void SDL_RaiseWindow ( SDL_Window window)

Raise a window above other windows and set the input focus.

Definition at line 2208 of file SDL_video.c.

2209 {
2211 
2212  if (!(window->flags & SDL_WINDOW_SHOWN)) {
2213  return;
2214  }
2215  if (_this->RaiseWindow) {
2217  }
2218 }

References _this, CHECK_WINDOW_MAGIC, SDL_VideoDevice::RaiseWindow, and SDL_WINDOW_SHOWN.

Referenced by SDL_ShowMessageBox().

◆ SDL_RestoreWindow()

void SDL_RestoreWindow ( SDL_Window window)

Restore the size and position of a minimized or maximized window.

See also
SDL_MaximizeWindow()
SDL_MinimizeWindow()

Definition at line 2266 of file SDL_video.c.

2267 {
2269 
2270  if (!(window->flags & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED))) {
2271  return;
2272  }
2273 
2274  if (_this->RestoreWindow) {
2276  }
2277 }

References _this, CHECK_WINDOW_MAGIC, SDL_VideoDevice::RestoreWindow, SDL_WINDOW_MAXIMIZED, and SDL_WINDOW_MINIMIZED.

◆ SDL_SetWindowBordered()

void SDL_SetWindowBordered ( SDL_Window window,
SDL_bool  bordered 
)

Set the border state of a window.

This will add or remove the window's SDL_WINDOW_BORDERLESS flag and add or remove the border from the actual window. This is a no-op if the window's border already matches the requested state.

Parameters
windowThe window of which to change the border state.
borderedSDL_FALSE to remove border, SDL_TRUE to add border.
Note
You can't change the border state of a fullscreen window.
See also
SDL_GetWindowFlags()

Definition at line 1971 of file SDL_video.c.

1972 {
1974  if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
1975  const int want = (bordered != SDL_FALSE); /* normalize the flag. */
1976  const int have = ((window->flags & SDL_WINDOW_BORDERLESS) == 0);
1977  if ((want != have) && (_this->SetWindowBordered)) {
1978  if (want) {
1979  window->flags &= ~SDL_WINDOW_BORDERLESS;
1980  } else {
1981  window->flags |= SDL_WINDOW_BORDERLESS;
1982  }
1984  }
1985  }
1986 }

References _this, CHECK_WINDOW_MAGIC, SDL_FALSE, SDL_WINDOW_BORDERLESS, SDL_WINDOW_FULLSCREEN, and SDL_VideoDevice::SetWindowBordered.

◆ SDL_SetWindowBrightness()

int SDL_SetWindowBrightness ( SDL_Window window,
float  brightness 
)

Set the brightness (gamma correction) for a window.

Returns
0 on success, or -1 if setting the brightness isn't supported.
See also
SDL_GetWindowBrightness()
SDL_SetWindowGammaRamp()

Definition at line 2376 of file SDL_video.c.

2377 {
2378  Uint16 ramp[256];
2379  int status;
2380 
2382 
2383  SDL_CalculateGammaRamp(brightness, ramp);
2384  status = SDL_SetWindowGammaRamp(window, ramp, ramp, ramp);
2385  if (status == 0) {
2386  window->brightness = brightness;
2387  }
2388  return status;
2389 }

References CHECK_WINDOW_MAGIC, SDL_CalculateGammaRamp, and SDL_SetWindowGammaRamp().

◆ SDL_SetWindowData()

void* SDL_SetWindowData ( SDL_Window window,
const char *  name,
void userdata 
)

Associate an arbitrary named pointer with a window.

Parameters
windowThe window to associate with the pointer.
nameThe name of the pointer.
userdataThe associated pointer.
Returns
The previous value associated with 'name'
Note
The name is case-sensitive.
See also
SDL_GetWindowData()

Definition at line 1817 of file SDL_video.c.

1818 {
1819  SDL_WindowUserData *prev, *data;
1820 
1822 
1823  /* Input validation */
1824  if (name == NULL || name[0] == '\0') {
1825  SDL_InvalidParamError("name");
1826  return NULL;
1827  }
1828 
1829  /* See if the named data already exists */
1830  prev = NULL;
1831  for (data = window->data; data; prev = data, data = data->next) {
1832  if (data->name && SDL_strcmp(data->name, name) == 0) {
1833  void *last_value = data->data;
1834 
1835  if (userdata) {
1836  /* Set the new value */
1837  data->data = userdata;
1838  } else {
1839  /* Delete this value */
1840  if (prev) {
1841  prev->next = data->next;
1842  } else {
1843  window->data = data->next;
1844  }
1845  SDL_free(data->name);
1846  SDL_free(data);
1847  }
1848  return last_value;
1849  }
1850  }
1851 
1852  /* Add new data to the window */
1853  if (userdata) {
1854  data = (SDL_WindowUserData *)SDL_malloc(sizeof(*data));
1855  data->name = SDL_strdup(name);
1856  data->data = userdata;
1857  data->next = window->data;
1858  window->data = data;
1859  }
1860  return NULL;
1861 }

References CHECK_WINDOW_MAGIC, SDL_WindowUserData::data, SDL_WindowUserData::next, NULL, SDL_free, SDL_InvalidParamError, SDL_malloc, SDL_strcmp, and SDL_strdup.

Referenced by SDL_CreateWindowTexture(), and SDL_DestroyWindowTexture().

◆ SDL_SetWindowDisplayMode()

int SDL_SetWindowDisplayMode ( SDL_Window window,
const SDL_DisplayMode mode 
)

Set the display mode used when a fullscreen window is visible.

By default the window's dimensions and the desktop format and refresh rate are used.

Parameters
windowThe window for which the display mode should be set.
modeThe mode to use, or NULL for the default mode.
Returns
0 on success, or -1 if setting the display mode failed.
See also
SDL_GetWindowDisplayMode()
SDL_SetWindowFullscreen()

Definition at line 1121 of file SDL_video.c.

1122 {
1124 
1125  if (mode) {
1126  window->fullscreen_mode = *mode;
1127  } else {
1128  SDL_zero(window->fullscreen_mode);
1129  }
1130 
1132  SDL_DisplayMode fullscreen_mode;
1133  if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) {
1135  }
1136  }
1137  return 0;
1138 }

References CHECK_WINDOW_MAGIC, FULLSCREEN_VISIBLE, SDL_GetDisplayForWindow(), SDL_GetWindowDisplayMode(), SDL_SetDisplayModeForDisplay(), SDL_WINDOW_FULLSCREEN_DESKTOP, and SDL_zero.

◆ SDL_SetWindowFullscreen()

int SDL_SetWindowFullscreen ( SDL_Window window,
Uint32  flags 
)

Set a window's fullscreen state.

Returns
0 on success, or -1 if setting the display mode failed.
See also
SDL_SetWindowDisplayMode()
SDL_GetWindowDisplayMode()

Definition at line 2280 of file SDL_video.c.

2281 {
2282  Uint32 oldflags;
2284 
2286 
2287  if (flags == (window->flags & FULLSCREEN_MASK)) {
2288  return 0;
2289  }
2290 
2291  /* clear the previous flags and OR in the new ones */
2292  oldflags = window->flags & FULLSCREEN_MASK;
2293  window->flags &= ~FULLSCREEN_MASK;
2294  window->flags |= flags;
2295 
2297  return 0;
2298  }
2299 
2300  window->flags &= ~FULLSCREEN_MASK;
2301  window->flags |= oldflags;
2302  return -1;
2303 }

References CHECK_WINDOW_MAGIC, FULLSCREEN_MASK, FULLSCREEN_VISIBLE, and SDL_UpdateFullscreenMode().

Referenced by SDL_FinishWindowCreation().

◆ SDL_SetWindowGammaRamp()

int SDL_SetWindowGammaRamp ( SDL_Window window,
const Uint16 red,
const Uint16 green,
const Uint16 blue 
)

Set the gamma ramp for a window.

Parameters
windowThe window for which the gamma ramp should be set.
redThe translation table for the red channel, or NULL.
greenThe translation table for the green channel, or NULL.
blueThe translation table for the blue channel, or NULL.
Returns
0 on success, or -1 if gamma ramps are unsupported.

Set the gamma translation table for the red, green, and blue channels of the video hardware. Each table is an array of 256 16-bit quantities, representing a mapping between the input and output for that channel. The input is the index into the array, and the output is the 16-bit gamma value at that index, scaled to the output color precision.

See also
SDL_GetWindowGammaRamp()

Definition at line 2462 of file SDL_video.c.

2465 {
2467 
2468  if (!_this->SetWindowGammaRamp) {
2469  return SDL_Unsupported();
2470  }
2471 
2472  if (!window->gamma) {
2473  if (SDL_GetWindowGammaRamp(window, NULL, NULL, NULL) < 0) {
2474  return -1;
2475  }
2476  SDL_assert(window->gamma != NULL);
2477  }
2478 
2479  if (red) {
2480  SDL_memcpy(&window->gamma[0*256], red, 256*sizeof(Uint16));
2481  }
2482  if (green) {
2483  SDL_memcpy(&window->gamma[1*256], green, 256*sizeof(Uint16));
2484  }
2485  if (blue) {
2486  SDL_memcpy(&window->gamma[2*256], blue, 256*sizeof(Uint16));
2487  }
2488  if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
2489  return _this->SetWindowGammaRamp(_this, window, window->gamma);
2490  } else {
2491  return 0;
2492  }
2493 }

References _this, CHECK_WINDOW_MAGIC, NULL, red, SDL_assert, SDL_GetWindowGammaRamp(), SDL_memcpy, SDL_Unsupported, SDL_WINDOW_INPUT_FOCUS, and SDL_VideoDevice::SetWindowGammaRamp.

Referenced by SDL_SetWindowBrightness().

◆ SDL_SetWindowGrab()

void SDL_SetWindowGrab ( SDL_Window window,
SDL_bool  grabbed 
)

Set a window's input grab mode.

Parameters
windowThe window for which the input grab mode should be set.
grabbedThis is SDL_TRUE to grab input, and SDL_FALSE to release input.

If the caller enables a grab while another window is currently grabbed, the other window loses its grab in favor of the caller's window.

See also
SDL_GetWindowGrab()

Definition at line 2572 of file SDL_video.c.

2573 {
2575 
2576  if (!!grabbed == !!(window->flags & SDL_WINDOW_INPUT_GRABBED)) {
2577  return;
2578  }
2579  if (grabbed) {
2580  window->flags |= SDL_WINDOW_INPUT_GRABBED;
2581  } else {
2582  window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
2583  }
2585 }

References CHECK_WINDOW_MAGIC, SDL_UpdateWindowGrab(), and SDL_WINDOW_INPUT_GRABBED.

Referenced by SDL_FinishWindowCreation().

◆ SDL_SetWindowHitTest()

int SDL_SetWindowHitTest ( SDL_Window window,
SDL_HitTest  callback,
void callback_data 
)

Provide a callback that decides if a window region has special properties.

Normally windows are dragged and resized by decorations provided by the system window manager (a title bar, borders, etc), but for some apps, it makes sense to drag them from somewhere else inside the window itself; for example, one might have a borderless window that wants to be draggable from any part, or simulate its own title bar, etc.

This function lets the app provide a callback that designates pieces of a given window as special. This callback is run during event processing if we need to tell the OS to treat a region of the window specially; the use of this callback is known as "hit testing."

Mouse input may not be delivered to your application if it is within a special area; the OS will often apply that input to moving the window or resizing the window and not deliver it to the application.

Specifying NULL for a callback disables hit-testing. Hit-testing is disabled by default.

Platforms that don't support this functionality will return -1 unconditionally, even if you're attempting to disable hit-testing.

Your callback may fire at any time, and its firing does not indicate any specific behavior (for example, on Windows, this certainly might fire when the OS is deciding whether to drag your window, but it fires for lots of other reasons, too, some unrelated to anything you probably care about and when the mouse isn't actually at the location it is testing). Since this can fire at any time, you should try to keep your callback efficient, devoid of allocations, etc.

Parameters
windowThe window to set hit-testing on.
callbackThe callback to call when doing a hit-test.
callback_dataAn app-defined void pointer passed to the callback.
Returns
0 on success, -1 on error (including unsupported).

Definition at line 4029 of file SDL_video.c.

4030 {
4032 
4033  if (!_this->SetWindowHitTest) {
4034  return SDL_Unsupported();
4035  } else if (_this->SetWindowHitTest(window, callback != NULL) == -1) {
4036  return -1;
4037  }
4038 
4039  window->hit_test = callback;
4040  window->hit_test_data = userdata;
4041 
4042  return 0;
4043 }

References _this, callback(), CHECK_WINDOW_MAGIC, NULL, SDL_Unsupported, and SDL_VideoDevice::SetWindowHitTest.

◆ SDL_SetWindowIcon()

void SDL_SetWindowIcon ( SDL_Window window,
SDL_Surface icon 
)

Set the icon for a window.

Parameters
windowThe window for which the icon should be set.
iconThe icon for the window.

Definition at line 1795 of file SDL_video.c.

1796 {
1798 
1799  if (!icon) {
1800  return;
1801  }
1802 
1803  SDL_FreeSurface(window->icon);
1804 
1805  /* Convert the icon into ARGB8888 */
1807  if (!window->icon) {
1808  return;
1809  }
1810 
1811  if (_this->SetWindowIcon) {
1813  }
1814 }

References _this, CHECK_WINDOW_MAGIC, SDL_ConvertSurfaceFormat, SDL_FreeSurface, SDL_PIXELFORMAT_ARGB8888, and SDL_VideoDevice::SetWindowIcon.

◆ SDL_SetWindowInputFocus()

int SDL_SetWindowInputFocus ( SDL_Window window)

Explicitly sets input focus to the window.

You almost certainly want SDL_RaiseWindow() instead of this function. Use this with caution, as you might give focus to a window that's completely obscured by other windows.

Parameters
windowThe window that should get the input focus
Returns
0 on success, or -1 otherwise.
See also
SDL_RaiseWindow()

Definition at line 2449 of file SDL_video.c.

2450 {
2452 
2453  if (!_this->SetWindowInputFocus) {
2454  return SDL_Unsupported();
2455  }
2456 
2458 }

References _this, CHECK_WINDOW_MAGIC, SDL_Unsupported, and SDL_VideoDevice::SetWindowInputFocus.

◆ SDL_SetWindowMaximumSize()

void SDL_SetWindowMaximumSize ( SDL_Window window,
int  max_w,
int  max_h 
)

Set the maximum size of a window's client area.

Parameters
windowThe window to set a new maximum size.
max_wThe maximum width of the window, must be >0
max_hThe maximum height of the window, must be >0
Note
You can't change the maximum size of a fullscreen window, it automatically matches the size of the display mode.
See also
SDL_GetWindowMaximumSize()
SDL_SetWindowMinimumSize()

Definition at line 2132 of file SDL_video.c.

2133 {
2135  if (max_w <= 0) {
2136  SDL_InvalidParamError("max_w");
2137  return;
2138  }
2139  if (max_h <= 0) {
2140  SDL_InvalidParamError("max_h");
2141  return;
2142  }
2143 
2144  if (max_w <= window->min_w || max_h <= window->min_h) {
2145  SDL_SetError("SDL_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size");
2146  return;
2147  }
2148 
2149  window->max_w = max_w;
2150  window->max_h = max_h;
2151 
2152  if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
2153  if (_this->SetWindowMaximumSize) {
2155  }
2156  /* Ensure that window is not larger than maximal size */
2157  SDL_SetWindowSize(window, SDL_min(window->w, window->max_w), SDL_min(window->h, window->max_h));
2158  }
2159 }

References _this, CHECK_WINDOW_MAGIC, SDL_InvalidParamError, SDL_min, SDL_SetError, SDL_SetWindowSize(), SDL_WINDOW_FULLSCREEN, and SDL_VideoDevice::SetWindowMaximumSize.

◆ SDL_SetWindowMinimumSize()

void SDL_SetWindowMinimumSize ( SDL_Window window,
int  min_w,
int  min_h 
)

Set the minimum size of a window's client area.

Parameters
windowThe window to set a new minimum size.
min_wThe minimum width of the window, must be >0
min_hThe minimum height of the window, must be >0
Note
You can't change the minimum size of a fullscreen window, it automatically matches the size of the display mode.
See also
SDL_GetWindowMinimumSize()
SDL_SetWindowMaximumSize()

Definition at line 2089 of file SDL_video.c.

2090 {
2092  if (min_w <= 0) {
2093  SDL_InvalidParamError("min_w");
2094  return;
2095  }
2096  if (min_h <= 0) {
2097  SDL_InvalidParamError("min_h");
2098  return;
2099  }
2100 
2101  if ((window->max_w && min_w >= window->max_w) ||
2102  (window->max_h && min_h >= window->max_h)) {
2103  SDL_SetError("SDL_SetWindowMinimumSize(): Tried to set minimum size larger than maximum size");
2104  return;
2105  }
2106 
2107  window->min_w = min_w;
2108  window->min_h = min_h;
2109 
2110  if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
2111  if (_this->SetWindowMinimumSize) {
2113  }
2114  /* Ensure that window is not smaller than minimal size */
2115  SDL_SetWindowSize(window, SDL_max(window->w, window->min_w), SDL_max(window->h, window->min_h));
2116  }
2117 }

References _this, CHECK_WINDOW_MAGIC, SDL_InvalidParamError, SDL_max, SDL_SetError, SDL_SetWindowSize(), SDL_WINDOW_FULLSCREEN, and SDL_VideoDevice::SetWindowMinimumSize.

◆ SDL_SetWindowModalFor()

int SDL_SetWindowModalFor ( SDL_Window modal_window,
SDL_Window parent_window 
)

Sets the window as a modal for another window (TODO: reconsider this function and/or its name)

Parameters
modal_windowThe window that should be modal
parent_windowThe parent window
Returns
0 on success, or -1 otherwise.

Definition at line 2436 of file SDL_video.c.

2437 {
2438  CHECK_WINDOW_MAGIC(modal_window, -1);
2439  CHECK_WINDOW_MAGIC(parent_window, -1);
2440 
2441  if (!_this->SetWindowModalFor) {
2442  return SDL_Unsupported();
2443  }
2444 
2445  return _this->SetWindowModalFor(_this, modal_window, parent_window);
2446 }

References _this, CHECK_WINDOW_MAGIC, SDL_Unsupported, and SDL_VideoDevice::SetWindowModalFor.

◆ SDL_SetWindowOpacity()

int SDL_SetWindowOpacity ( SDL_Window window,
float  opacity 
)

Set the opacity for a window.

Parameters
windowThe window which will be made transparent or opaque
opacityOpacity (0.0f - transparent, 1.0f - opaque) This will be clamped internally between 0.0f and 1.0f.
Returns
0 on success, or -1 if setting the opacity isn't supported.
See also
SDL_GetWindowOpacity()

Definition at line 2400 of file SDL_video.c.

2401 {
2402  int retval;
2404 
2405  if (!_this->SetWindowOpacity) {
2406  return SDL_Unsupported();
2407  }
2408 
2409  if (opacity < 0.0f) {
2410  opacity = 0.0f;
2411  } else if (opacity > 1.0f) {
2412  opacity = 1.0f;
2413  }
2414 
2415  retval = _this->SetWindowOpacity(_this, window, opacity);
2416  if (retval == 0) {
2417  window->opacity = opacity;
2418  }
2419 
2420  return retval;
2421 }

References _this, CHECK_WINDOW_MAGIC, retval, SDL_Unsupported, and SDL_VideoDevice::SetWindowOpacity.

◆ SDL_SetWindowPosition()

void SDL_SetWindowPosition ( SDL_Window window,
int  x,
int  y 
)

Set the position of a window.

Parameters
windowThe window to reposition.
xThe x coordinate of the window in screen coordinates, or SDL_WINDOWPOS_CENTERED or SDL_WINDOWPOS_UNDEFINED.
yThe y coordinate of the window in screen coordinates, or SDL_WINDOWPOS_CENTERED or SDL_WINDOWPOS_UNDEFINED.
Note
The window coordinate origin is the upper left of the display.
See also
SDL_GetWindowPosition()

Definition at line 1885 of file SDL_video.c.

1886 {
1888 
1890  int displayIndex = (x & 0xFFFF);
1891  SDL_Rect bounds;
1892  if (displayIndex >= _this->num_displays) {
1893  displayIndex = 0;
1894  }
1895 
1896  SDL_zero(bounds);
1897 
1898  SDL_GetDisplayBounds(displayIndex, &bounds);
1899  if (SDL_WINDOWPOS_ISCENTERED(x)) {
1900  x = bounds.x + (bounds.w - window->w) / 2;
1901  }
1902  if (SDL_WINDOWPOS_ISCENTERED(y)) {
1903  y = bounds.y + (bounds.h - window->h) / 2;
1904  }
1905  }
1906 
1907  if ((window->flags & SDL_WINDOW_FULLSCREEN)) {
1908  if (!SDL_WINDOWPOS_ISUNDEFINED(x)) {
1909  window->windowed.x = x;
1910  }
1911  if (!SDL_WINDOWPOS_ISUNDEFINED(y)) {
1912  window->windowed.y = y;
1913  }
1914  } else {
1915  if (!SDL_WINDOWPOS_ISUNDEFINED(x)) {
1916  window->x = x;
1917  }
1918  if (!SDL_WINDOWPOS_ISUNDEFINED(y)) {
1919  window->y = y;
1920  }
1921 
1922  if (_this->SetWindowPosition) {
1924  }
1925  }
1926 }

References _this, CHECK_WINDOW_MAGIC, SDL_Rect::h, SDL_VideoDevice::num_displays, SDL_GetDisplayBounds(), SDL_WINDOW_FULLSCREEN, SDL_WINDOWPOS_ISCENTERED, SDL_WINDOWPOS_ISUNDEFINED, SDL_zero, SDL_VideoDevice::SetWindowPosition, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

◆ SDL_SetWindowResizable()

void SDL_SetWindowResizable ( SDL_Window window,
SDL_bool  resizable 
)

Set the user-resizable state of a window.

This will add or remove the window's SDL_WINDOW_RESIZABLE flag and allow/disallow user resizing of the window. This is a no-op if the window's resizable state already matches the requested state.

Parameters
windowThe window of which to change the resizable state.
resizableSDL_TRUE to allow resizing, SDL_FALSE to disallow.
Note
You can't change the resizable state of a fullscreen window.
See also
SDL_GetWindowFlags()

Definition at line 1989 of file SDL_video.c.

1990 {
1992  if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
1993  const int want = (resizable != SDL_FALSE); /* normalize the flag. */
1994  const int have = ((window->flags & SDL_WINDOW_RESIZABLE) != 0);
1995  if ((want != have) && (_this->SetWindowResizable)) {
1996  if (want) {
1997  window->flags |= SDL_WINDOW_RESIZABLE;
1998  } else {
1999  window->flags &= ~SDL_WINDOW_RESIZABLE;
2000  }
2002  }
2003  }
2004 }

References _this, CHECK_WINDOW_MAGIC, SDL_FALSE, SDL_WINDOW_FULLSCREEN, SDL_WINDOW_RESIZABLE, and SDL_VideoDevice::SetWindowResizable.

◆ SDL_SetWindowSize()

void SDL_SetWindowSize ( SDL_Window window,
int  w,
int  h 
)

Set the size of a window's client area.

Parameters
windowThe window to resize.
wThe width of the window, in screen coordinates. Must be >0.
hThe height of the window, in screen coordinates. Must be >0.
Note
Fullscreen windows automatically match the size of the display mode, and you should use SDL_SetWindowDisplayMode() to change their size.

The window size in screen coordinates may differ from the size in pixels, if the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() to get the real client area size in pixels.

See also
SDL_GetWindowSize()
SDL_SetWindowDisplayMode()

Definition at line 2007 of file SDL_video.c.

2008 {
2010  if (w <= 0) {
2011  SDL_InvalidParamError("w");
2012  return;
2013  }
2014  if (h <= 0) {
2015  SDL_InvalidParamError("h");
2016  return;
2017  }
2018 
2019  /* Make sure we don't exceed any window size limits */
2020  if (window->min_w && w < window->min_w) {
2021  w = window->min_w;
2022  }
2023  if (window->max_w && w > window->max_w) {
2024  w = window->max_w;
2025  }
2026  if (window->min_h && h < window->min_h) {
2027  h = window->min_h;
2028  }
2029  if (window->max_h && h > window->max_h) {
2030  h = window->max_h;
2031  }
2032 
2033  window->windowed.w = w;
2034  window->windowed.h = h;
2035 
2036  if (window->flags & SDL_WINDOW_FULLSCREEN) {
2038  window->last_fullscreen_flags = 0;
2040  }
2041  } else {
2042  window->w = w;
2043  window->h = h;
2044  if (_this->SetWindowSize) {
2046  }
2047  if (window->w == w && window->h == h) {
2048  /* We didn't get a SDL_WINDOWEVENT_RESIZED event (by design) */
2050  }
2051  }
2052 }

References _this, CHECK_WINDOW_MAGIC, FULLSCREEN_VISIBLE, SDL_InvalidParamError, SDL_OnWindowResized(), SDL_TRUE, SDL_UpdateFullscreenMode(), SDL_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN_DESKTOP, and SDL_VideoDevice::SetWindowSize.

Referenced by SDL_SetWindowMaximumSize(), and SDL_SetWindowMinimumSize().

◆ SDL_SetWindowTitle()

void SDL_SetWindowTitle ( SDL_Window window,
const char *  title 
)

Set the title of a window, in UTF-8 format.

See also
SDL_GetWindowTitle()

Definition at line 1770 of file SDL_video.c.

1771 {
1773 
1774  if (title == window->title) {
1775  return;
1776  }
1777  SDL_free(window->title);
1778 
1779  window->title = SDL_strdup(title ? title : "");
1780 
1781  if (_this->SetWindowTitle) {
1783  }
1784 }

References _this, CHECK_WINDOW_MAGIC, SDL_free, SDL_strdup, and SDL_VideoDevice::SetWindowTitle.

Referenced by SDL_CreateWindow().

◆ SDL_ShowWindow()

void SDL_ShowWindow ( SDL_Window window)

Show a window.

See also
SDL_HideWindow()

Definition at line 2174 of file SDL_video.c.

2175 {
2177 
2178  if (window->flags & SDL_WINDOW_SHOWN) {
2179  return;
2180  }
2181 
2182  if (_this->ShowWindow) {
2184  }
2186 }

References _this, CHECK_WINDOW_MAGIC, SDL_SendWindowEvent(), SDL_WINDOW_SHOWN, SDL_WINDOWEVENT_SHOWN, and SDL_VideoDevice::ShowWindow.

Referenced by SDL_FinishWindowCreation().

◆ SDL_UpdateWindowSurface()

int SDL_UpdateWindowSurface ( SDL_Window window)

Copy the window surface to the screen.

Returns
0 on success, or -1 on error.
See also
SDL_GetWindowSurface()
SDL_UpdateWindowSurfaceRects()

Definition at line 2349 of file SDL_video.c.

2350 {
2351  SDL_Rect full_rect;
2352 
2354 
2355  full_rect.x = 0;
2356  full_rect.y = 0;
2357  full_rect.w = window->w;
2358  full_rect.h = window->h;
2359  return SDL_UpdateWindowSurfaceRects(window, &full_rect, 1);
2360 }

References CHECK_WINDOW_MAGIC, SDL_Rect::h, SDL_UpdateWindowSurfaceRects(), SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

◆ SDL_UpdateWindowSurfaceRects()

int SDL_UpdateWindowSurfaceRects ( SDL_Window window,
const SDL_Rect rects,
int  numrects 
)

Copy a number of rectangles on the window surface to the screen.

Returns
0 on success, or -1 on error.
See also
SDL_GetWindowSurface()
SDL_UpdateWindowSurface()

Definition at line 2363 of file SDL_video.c.

2365 {
2367 
2368  if (!window->surface_valid) {
2369  return SDL_SetError("Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface");
2370  }
2371 
2372  return _this->UpdateWindowFramebuffer(_this, window, rects, numrects);
2373 }

References _this, CHECK_WINDOW_MAGIC, SDL_SetError, and SDL_VideoDevice::UpdateWindowFramebuffer.

Referenced by SDL_UpdateWindowSurface().

◆ SDL_VideoInit()

int SDL_VideoInit ( const char *  driver_name)

Initialize the video subsystem, optionally specifying a video driver.

Parameters
driver_nameInitialize a specific driver by name, or NULL for the default video driver.
Returns
0 on success, -1 on error

This function initializes the video subsystem; setting up a connection to the window manager, etc, and determines the available display modes and pixel formats, but does not initialize a window or graphics mode.

See also
SDL_VideoQuit()

Definition at line 464 of file SDL_video.c.

465 {
466  SDL_VideoDevice *video;
467  int index;
468  int i;
469 
470  /* Check to make sure we don't overwrite '_this' */
471  if (_this != NULL) {
472  SDL_VideoQuit();
473  }
474 
475 #if !SDL_TIMERS_DISABLED
476  SDL_TicksInit();
477 #endif
478 
479  /* Start the event loop */
481  SDL_KeyboardInit() < 0 ||
482  SDL_MouseInit() < 0 ||
483  SDL_TouchInit() < 0) {
484  return -1;
485  }
486 
487  /* Select the proper video driver */
488  index = 0;
489  video = NULL;
490  if (driver_name == NULL) {
491  driver_name = SDL_getenv("SDL_VIDEODRIVER");
492  }
493  if (driver_name != NULL) {
494  for (i = 0; bootstrap[i]; ++i) {
495  if (SDL_strncasecmp(bootstrap[i]->name, driver_name, SDL_strlen(driver_name)) == 0) {
496  if (bootstrap[i]->available()) {
497  video = bootstrap[i]->create(index);
498  break;
499  }
500  }
501  }
502  } else {
503  for (i = 0; bootstrap[i]; ++i) {
504  if (bootstrap[i]->available()) {
505  video = bootstrap[i]->create(index);
506  if (video != NULL) {
507  break;
508  }
509  }
510  }
511  }
512  if (video == NULL) {
513  if (driver_name) {
514  return SDL_SetError("%s not available", driver_name);
515  }
516  return SDL_SetError("No available video device");
517  }
518  _this = video;
519  _this->name = bootstrap[i]->name;
520  _this->next_object_id = 1;
521 
522 
523  /* Set some very sane GL defaults */
527 
530 
531  /* Initialize the video subsystem */
532  if (_this->VideoInit(_this) < 0) {
533  SDL_VideoQuit();
534  return -1;
535  }
536 
537  /* Make sure some displays were added */
538  if (_this->num_displays == 0) {
539  SDL_VideoQuit();
540  return SDL_SetError("The video driver did not add any displays");
541  }
542 
543  /* Add the renderer framebuffer emulation if desired */
548  }
549 
550  /* Disable the screen saver by default. This is a change from <= 2.0.1,
551  but most things using SDL are games or media players; you wouldn't
552  want a screensaver to trigger if you're playing exclusively with a
553  joystick, or passively watching a movie. Things that use SDL but
554  function more like a normal desktop app should explicitly reenable the
555  screensaver. */
558  }
559 
560  /* If we don't use a screen keyboard, turn on text input by default,
561  otherwise programs that expect to get text events without enabling
562  UNICODE input won't get any events.
563 
564  Actually, come to think of it, you needed to call SDL_EnableUNICODE(1)
565  in SDL 1.2 before you got text input events. Hmm...
566  */
569  }
570 
571  /* We're ready to go! */
572  return 0;
573 }

References _this, available(), bootstrap, VideoBootStrap::create, SDL_VideoDevice::CreateWindowFramebuffer, SDL_VideoDevice::current_glctx_tls, SDL_VideoDevice::current_glwin_tls, SDL_VideoDevice::DestroyWindowFramebuffer, SDL_VideoDevice::dll_handle, SDL_VideoDevice::driver_loaded, SDL_VideoDevice::gl_config, i, SDL_VideoDevice::name, VideoBootStrap::name, SDL_VideoDevice::next_object_id, NULL, SDL_VideoDevice::num_displays, SDL_CreateWindowTexture(), SDL_DestroyWindowTexture(), SDL_DisableScreenSaver(), SDL_FALSE, SDL_getenv, SDL_GetHintBoolean, SDL_GL_ResetAttributes(), SDL_HasScreenKeyboardSupport(), SDL_HINT_VIDEO_ALLOW_SCREENSAVER, SDL_INIT_EVENTS, SDL_InitSubSystem, SDL_KeyboardInit(), SDL_MouseInit(), SDL_SetError, SDL_StartTextInput(), SDL_strlen, SDL_strncasecmp, SDL_TicksInit(), SDL_TLSCreate, SDL_TouchInit(), SDL_UpdateWindowTexture(), SDL_VideoQuit(), ShouldUseTextureFramebuffer(), SDL_VideoDevice::UpdateWindowFramebuffer, and SDL_VideoDevice::VideoInit.

Referenced by SDL_CreateWindow().

◆ SDL_VideoQuit()

void SDL_VideoQuit ( void  )

Shuts down the video subsystem.

This function closes all windows, and restores the original video mode.

See also
SDL_VideoInit()

Definition at line 2849 of file SDL_video.c.

2850 {
2851  int i, j;
2852 
2853  if (!_this) {
2854  return;
2855  }
2856 
2857  /* Halt event processing before doing anything else */
2858  SDL_TouchQuit();
2859  SDL_MouseQuit();
2860  SDL_KeyboardQuit();
2862 
2864 
2865  /* Clean up the system video */
2866  while (_this->windows) {
2868  }
2869  _this->VideoQuit(_this);
2870 
2871  for (i = 0; i < _this->num_displays; ++i) {
2872  SDL_VideoDisplay *display = &_this->displays[i];
2873  for (j = display->num_display_modes; j--;) {
2874  SDL_free(display->display_modes[j].driverdata);
2875  display->display_modes[j].driverdata = NULL;
2876  }
2877  SDL_free(display->display_modes);
2878  display->display_modes = NULL;
2879  SDL_free(display->desktop_mode.driverdata);
2880  display->desktop_mode.driverdata = NULL;
2881  SDL_free(display->driverdata);
2882  display->driverdata = NULL;
2883  }
2884  if (_this->displays) {
2885  for (i = 0; i < _this->num_displays; ++i) {
2887  }
2889  _this->displays = NULL;
2890  _this->num_displays = 0;
2891  }
2894  _this->free(_this);
2895  _this = NULL;
2896 }

References _this, SDL_VideoDevice::clipboard_text, SDL_VideoDisplay::desktop_mode, SDL_VideoDisplay::display_modes, SDL_VideoDevice::displays, SDL_DisplayMode::driverdata, SDL_VideoDisplay::driverdata, SDL_VideoDevice::free, i, j, SDL_VideoDisplay::name, NULL, SDL_VideoDisplay::num_display_modes, SDL_VideoDevice::num_displays, SDL_DestroyWindow(), SDL_EnableScreenSaver(), SDL_free, SDL_INIT_EVENTS, SDL_KeyboardQuit(), SDL_MouseQuit(), SDL_QuitSubSystem, SDL_TouchQuit(), SDL_VideoDevice::VideoQuit, and SDL_VideoDevice::windows.

Referenced by SDL_VideoInit().

SDL_HITTEST_DRAGGABLE
@ SDL_HITTEST_DRAGGABLE
Definition: SDL_video.h:1022
SDL_VideoDevice::CreateSDLWindow
int(* CreateSDLWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:212
SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:418
SDL_WINDOW_MOUSE_CAPTURE
@ SDL_WINDOW_MOUSE_CAPTURE
Definition: SDL_video.h:115
SDL_WindowFlags
SDL_WindowFlags
The flags on a window.
Definition: SDL_video.h:98
SDL_Point::x
int x
Definition: SDL_rect.h:50
GL_BLUE_BITS
#define GL_BLUE_BITS
Definition: SDL_opengl.h:515
SDL_CreateWindowFramebuffer
static SDL_Surface * SDL_CreateWindowFramebuffer(SDL_Window *window)
Definition: SDL_video.c:2306
GL_EXTENSIONS
#define GL_EXTENSIONS
Definition: SDL_opengl.h:716
SDL_VideoDevice::SetWindowPosition
void(* SetWindowPosition)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:216
SDL_VideoDisplay::display_modes
SDL_DisplayMode * display_modes
Definition: SDL_sysvideo.h:131
SDL_DisableScreenSaver
void SDL_DisableScreenSaver()
Prevent the screen from being blanked by a screensaver.
Definition: SDL_video.c:2834
SDL_DisplayMode::format
Uint32 format
Definition: SDL_video.h:55
SDL_WINDOW_ALLOW_HIGHDPI
@ SDL_WINDOW_ALLOW_HIGHDPI
Definition: SDL_video.h:112
SDL_TLSSet
#define SDL_TLSSet
Definition: SDL_dynapi_overrides.h:482
GL_STENCIL_BITS
#define GL_STENCIL_BITS
Definition: SDL_opengl.h:474
SDL_GL_ResetAttributes
void SDL_GL_ResetAttributes()
Reset all previously set OpenGL context attributes to their default values.
Definition: SDL_video.c:3090
SDL_VideoDevice::clipboard_text
char * clipboard_text
Definition: SDL_sysvideo.h:329
SDL_VideoDevice::SuspendScreenSaver
void(* SuspendScreenSaver)(_THIS)
Definition: SDL_sysvideo.h:292
right
GLdouble GLdouble right
Definition: SDL_opengl_glext.h:6106
SDL_VideoDisplay::name
char * name
Definition: SDL_sysvideo.h:128
SDL_GL_MULTISAMPLESAMPLES
@ SDL_GL_MULTISAMPLESAMPLES
Definition: SDL_video.h:213
target
GLenum target
Definition: SDL_opengl_glext.h:1554
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:191
SDL_GL_CONTEXT_EGL
@ SDL_GL_CONTEXT_EGL
Definition: SDL_video.h:218
SDL_ConvertSurfaceFormat
#define SDL_ConvertSurfaceFormat
Definition: SDL_dynapi_overrides.h:464
SDL_VideoDevice::current_glwin_tls
SDL_TLSID current_glwin_tls
Definition: SDL_sysvideo.h:373
SDL_DISPLAYEVENT_ORIENTATION
@ SDL_DISPLAYEVENT_ORIENTATION
Definition: SDL_video.h:177
SDL_WINDOW_ALWAYS_ON_TOP
@ SDL_WINDOW_ALWAYS_ON_TOP
Definition: SDL_video.h:116
SDL_WINDOW_MINIMIZED
@ SDL_WINDOW_MINIMIZED
Definition: SDL_video.h:105
SDL_VideoDevice::SetWindowModalFor
int(* SetWindowModalFor)(_THIS, SDL_Window *modal_window, SDL_Window *parent_window)
Definition: SDL_sysvideo.h:222
SDL_VideoQuit
void SDL_VideoQuit(void)
Shuts down the video subsystem.
Definition: SDL_video.c:2849
SDL_VideoDevice::retained_backing
int retained_backing
Definition: SDL_sysvideo.h:360
GL_ALPHA_BITS
#define GL_ALPHA_BITS
Definition: SDL_opengl.h:512
VideoBootStrap::name
const char * name
Definition: SDL_sysvideo.h:407
NULL
#define NULL
Definition: begin_code.h:167
SDL_WindowUserData::data
void * data
Definition: SDL_sysvideo.h:69
SDL_VideoDevice::buffer_size
int buffer_size
Definition: SDL_sysvideo.h:340
SDL_GL_LoadLibrary
int SDL_GL_LoadLibrary(const char *path)
Dynamically load an OpenGL library.
Definition: SDL_video.c:2899
SDL_VideoDevice::multisamplesamples
int multisamplesamples
Definition: SDL_sysvideo.h:349
SDL_HINT_VIDEO_HIGHDPI_DISABLED
#define SDL_HINT_VIDEO_HIGHDPI_DISABLED
If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS)
Definition: SDL_hints.h:736
SDL_GL_DEPTH_SIZE
@ SDL_GL_DEPTH_SIZE
Definition: SDL_video.h:205
SDL_WINDOWEVENT_FOCUS_LOST
@ SDL_WINDOWEVENT_FOCUS_LOST
Definition: SDL_video.h:165
SDL_HINT_VIDEO_ALLOW_SCREENSAVER
#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER
A variable controlling whether the screensaver is enabled.
Definition: SDL_hints.h:165
ParseDisplayUsableBoundsHint
static int ParseDisplayUsableBoundsHint(SDL_Rect *rect)
Definition: SDL_video.c:710
SDL_VideoDevice::blue_size
int blue_size
Definition: SDL_sysvideo.h:337
SDL_WINDOWEVENT_CLOSE
@ SDL_WINDOWEVENT_CLOSE
Definition: SDL_video.h:166
mode
GLenum mode
Definition: SDL_opengl_glext.h:1125
GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE
Definition: SDL_opengl_glext.h:1000
SDL_SetWindowSize
void SDL_SetWindowSize(SDL_Window *window, int w, int h)
Set the size of a window's client area.
Definition: SDL_video.c:2007
SDL_WindowUserData
Definition: SDL_sysvideo.h:67
SDL_VideoDevice::accum_alpha_size
int accum_alpha_size
Definition: SDL_sysvideo.h:346
SDL_GLcontextFlag
SDL_GLcontextFlag
Definition: SDL_video.h:236
SDL_INIT_EVENTS
#define SDL_INIT_EVENTS
Definition: SDL.h:84
SDL_WINDOWEVENT_ENTER
@ SDL_WINDOWEVENT_ENTER
Definition: SDL_video.h:162
SDL_VideoDevice::accum_green_size
int accum_green_size
Definition: SDL_sysvideo.h:344
GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE
Definition: SDL_opengl_glext.h:998
SDL_VideoDevice::grabbed_window
SDL_Window * grabbed_window
Definition: SDL_sysvideo.h:326
attachment
GLenum attachment
Definition: SDL_opengl_glext.h:1181
GL_BACK_LEFT
#define GL_BACK_LEFT
Definition: SDL_opengl.h:499
GL_DEPTH_BITS
#define GL_DEPTH_BITS
Definition: SDL_opengl.h:328
SDL_TicksInit
void SDL_TicksInit(void)
SDL_VideoDevice::driver_path
char driver_path[256]
Definition: SDL_sysvideo.h:362
SDL_VideoDevice::current_glctx_tls
SDL_TLSID current_glctx_tls
Definition: SDL_sysvideo.h:374
SDL_VideoDevice::major_version
int major_version
Definition: SDL_sysvideo.h:351
SDL_WINDOW_FULLSCREEN
@ SDL_WINDOW_FULLSCREEN
Definition: SDL_video.h:99
SDL_VideoDevice::SetWindowTitle
void(* SetWindowTitle)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:214
SDL_GL_BUFFER_SIZE
@ SDL_GL_BUFFER_SIZE
Definition: SDL_video.h:203
SDL_VideoDevice::UpdateWindowFramebuffer
int(* UpdateWindowFramebuffer)(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
Definition: SDL_sysvideo.h:238
SDL_WINDOW_OPENGL
@ SDL_WINDOW_OPENGL
Definition: SDL_video.h:100
SDL_VideoDevice::accum_blue_size
int accum_blue_size
Definition: SDL_sysvideo.h:345
GL_DOUBLEBUFFER
#define GL_DOUBLEBUFFER
Definition: SDL_opengl.h:521
SDL_WINDOWEVENT_RESIZED
@ SDL_WINDOWEVENT_RESIZED
Definition: SDL_video.h:154
top
GLdouble GLdouble GLdouble GLdouble top
Definition: SDL_opengl_glext.h:6106
SDL_InvalidParamError
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
GL_STENCIL
#define GL_STENCIL
Definition: SDL_opengl.h:526
SDL_HideWindow
void SDL_HideWindow(SDL_Window *window)
Hide a window.
Definition: SDL_video.c:2189
SDL_VideoDevice::window_magic
Uint8 window_magic
Definition: SDL_sysvideo.h:327
SDL_QuitSubSystem
#define SDL_QuitSubSystem
Definition: SDL_dynapi_overrides.h:56
SDL_Window::is_destroying
SDL_bool is_destroying
Definition: SDL_sysvideo.h:102
SDL_GL_CONTEXT_PROFILE_CORE
@ SDL_GL_CONTEXT_PROFILE_CORE
Definition: SDL_video.h:230
red
const GLubyte GLuint red
Definition: SDL_glfuncs.h:80
SDL_WINDOW_FULLSCREEN_DESKTOP
@ SDL_WINDOW_FULLSCREEN_DESKTOP
Definition: SDL_video.h:110
SDL_GL_RETAINED_BACKING
@ SDL_GL_RETAINED_BACKING
Definition: SDL_video.h:215
params
const GLfloat * params
Definition: SDL_opengl_glext.h:374
SDL_DONTFREE
#define SDL_DONTFREE
Definition: SDL_surface.h:55
pname
GLenum pname
Definition: SDL_opengl_glext.h:533
SDL_SetKeyboardFocus
void SDL_SetKeyboardFocus(SDL_Window *window)
Definition: SDL_keyboard.c:630
GL_FRAMEBUFFER
#define GL_FRAMEBUFFER
Definition: SDL_opengl_glext.h:1054
SDL_GL_CONTEXT_PROFILE_MASK
@ SDL_GL_CONTEXT_PROFILE_MASK
Definition: SDL_video.h:220
GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE
Definition: SDL_opengl_glext.h:997
SDL_WINDOW_FOREIGN
@ SDL_WINDOW_FOREIGN
Definition: SDL_video.h:111
callback
static Uint32 callback(Uint32 interval, void *param)
Definition: testtimer.c:34
SDL_UpdateWindowSurfaceRects
int SDL_UpdateWindowSurfaceRects(SDL_Window *window, const SDL_Rect *rects, int numrects)
Copy a number of rectangles on the window surface to the screen.
Definition: SDL_video.c:2363
SDL_VideoDevice::GetWindowBordersSize
int(* GetWindowBordersSize)(_THIS, SDL_Window *window, int *top, int *left, int *bottom, int *right)
Definition: SDL_sysvideo.h:220
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
SDL_VideoDevice::profile_mask
int profile_mask
Definition: SDL_sysvideo.h:354
SDL_HITTEST_RESIZE_TOPLEFT
@ SDL_HITTEST_RESIZE_TOPLEFT
Definition: SDL_video.h:1023
SDL_GL_ALPHA_SIZE
@ SDL_GL_ALPHA_SIZE
Definition: SDL_video.h:202
SDL_WINDOWPOS_ISCENTERED
#define SDL_WINDOWPOS_ISCENTERED(X)
Definition: SDL_video.h:139
path
GLsizei const GLchar *const * path
Definition: SDL_opengl_glext.h:3733
SDL_WINDOW_MAXIMIZED
@ SDL_WINDOW_MAXIMIZED
Definition: SDL_video.h:106
SDL_SetWindowTitle
void SDL_SetWindowTitle(SDL_Window *window, const char *title)
Set the title of a window, in UTF-8 format.
Definition: SDL_video.c:1770
bottom
GLint GLint bottom
Definition: SDL_opengl_glext.h:1952
SDL_GL_CONTEXT_RESET_NO_NOTIFICATION
@ SDL_GL_CONTEXT_RESET_NO_NOTIFICATION
Definition: SDL_video.h:251
SDL_VideoDisplay::desktop_mode
SDL_DisplayMode desktop_mode
Definition: SDL_sysvideo.h:132
SDL_VideoDevice::depth_size
int depth_size
Definition: SDL_sysvideo.h:339
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
@ SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
Definition: SDL_video.h:246
SDL_WINDOWEVENT_MOVED
@ SDL_WINDOWEVENT_MOVED
Definition: SDL_video.h:152
index
GLuint index
Definition: SDL_opengl_glext.h:663
SDL_VideoDevice::is_dummy
SDL_bool is_dummy
Definition: SDL_sysvideo.h:321
SDL_GL_CONTEXT_RESET_ISOLATION_FLAG
@ SDL_GL_CONTEXT_RESET_ISOLATION_FLAG
Definition: SDL_video.h:240
func
GLenum func
Definition: SDL_opengl_glext.h:660
GLubyte
unsigned char GLubyte
Definition: SDL_opengl.h:183
SDL_InitSubSystem
#define SDL_InitSubSystem
Definition: SDL_dynapi_overrides.h:55
SDL_GL_CONTEXT_NO_ERROR
@ SDL_GL_CONTEXT_NO_ERROR
Definition: SDL_video.h:225
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1949
SDL_KeyboardQuit
void SDL_KeyboardQuit(void)
Definition: SDL_keyboard.c:832
SDL_Rect::x
int x
Definition: SDL_rect.h:79
SDL_SetMouseFocus
void SDL_SetMouseFocus(SDL_Window *window)
Definition: SDL_mouse.c:203
ctx
EGLContext ctx
Definition: eglext.h:208
SDL_WINDOW_INPUT_FOCUS
@ SDL_WINDOW_INPUT_FOCUS
Definition: SDL_video.h:108
SDL_VideoDevice::HideWindow
void(* HideWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:225
SDL_WINDOW_RESIZABLE
@ SDL_WINDOW_RESIZABLE
Definition: SDL_video.h:104
SDL_DisplayMode::h
int h
Definition: SDL_video.h:57
SDL_GLattr
SDL_GLattr
OpenGL configuration attributes.
Definition: SDL_video.h:198
GL_STEREO
#define GL_STEREO
Definition: SDL_opengl.h:522
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
SDL_Rect::w
int w
Definition: SDL_rect.h:80
SDL_VideoDevice::red_size
int red_size
Definition: SDL_sysvideo.h:335
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:75
SDL_VideoDevice::SetWindowIcon
void(* SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon)
Definition: SDL_sysvideo.h:215
SDL_DisplayMode
The structure that defines a display mode.
Definition: SDL_video.h:54
SDL_GetKeyboardFocus
#define SDL_GetKeyboardFocus
Definition: SDL_dynapi_overrides.h:216
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE
@ SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE
Definition: SDL_video.h:245
GL_VERSION
#define GL_VERSION
Definition: SDL_opengl.h:715
SDL_VideoDevice::Vulkan_CreateSurface
SDL_bool(* Vulkan_CreateSurface)(_THIS, SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface)
Definition: SDL_sysvideo.h:275
SDL_MouseQuit
void SDL_MouseQuit(void)
Definition: SDL_mouse.c:654
CREATE_FLAGS
#define CREATE_FLAGS
Definition: SDL_video.c:1368
SDL_strncasecmp
#define SDL_strncasecmp
Definition: SDL_dynapi_overrides.h:420
SDL_WINDOWEVENT_SHOWN
@ SDL_WINDOWEVENT_SHOWN
Definition: SDL_video.h:148
GL_NUM_EXTENSIONS
#define GL_NUM_EXTENSIONS
SDL_VideoDevice::accum_red_size
int accum_red_size
Definition: SDL_sysvideo.h:343
GL_SAMPLE_BUFFERS
#define GL_SAMPLE_BUFFERS
Definition: SDL_opengl.h:1839
SDL_VideoDevice::GetDisplayUsableBounds
int(* GetDisplayUsableBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
Definition: SDL_sysvideo.h:188
SDL_GLContext
void * SDL_GLContext
An opaque handle to an OpenGL context.
Definition: SDL_video.h:192
SDL_VideoDevice::gl_config
struct SDL_VideoDevice::@255 gl_config
SDL_GetWindowDisplayMode
int SDL_GetWindowDisplayMode(SDL_Window *window, SDL_DisplayMode *mode)
Fill in information about the display mode used when a fullscreen window is visible.
Definition: SDL_video.c:1141
SDL_GL_DOUBLEBUFFER
@ SDL_GL_DOUBLEBUFFER
Definition: SDL_video.h:204
SDL_GL_CONTEXT_DEBUG_FLAG
@ SDL_GL_CONTEXT_DEBUG_FLAG
Definition: SDL_video.h:237
SDL_MouseInit
int SDL_MouseInit(void)
Definition: SDL_mouse.c:127
SDL_HITTEST_RESIZE_BOTTOMRIGHT
@ SDL_HITTEST_RESIZE_BOTTOMRIGHT
Definition: SDL_video.h:1027
SDL_WINDOW_POPUP_MENU
@ SDL_WINDOW_POPUP_MENU
Definition: SDL_video.h:120
SDL_memcpy
#define SDL_memcpy
Definition: SDL_dynapi_overrides.h:387
SDL_GetHintBoolean
#define SDL_GetHintBoolean
Definition: SDL_dynapi_overrides.h:608
context
static screen_context_t context
Definition: video.c:25
SDL_strchr
#define SDL_strchr
Definition: SDL_dynapi_overrides.h:401
SDL_GL_GREEN_SIZE
@ SDL_GL_GREEN_SIZE
Definition: SDL_video.h:200
SDL_HITTEST_RESIZE_TOPRIGHT
@ SDL_HITTEST_RESIZE_TOPRIGHT
Definition: SDL_video.h:1025
SDL_UpdateWindowTexture
static int SDL_UpdateWindowTexture(SDL_VideoDevice *unused, SDL_Window *window, const SDL_Rect *rects, int numrects)
Definition: SDL_video.c:369
SDL_VideoDevice::SetWindowGammaRamp
int(* SetWindowGammaRamp)(_THIS, SDL_Window *window, const Uint16 *ramp)
Definition: SDL_sysvideo.h:233
SDL_GetIndexOfDisplay
int SDL_GetIndexOfDisplay(SDL_VideoDisplay *display)
Definition: SDL_video.c:645
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
SDL_HitTestResult
SDL_HitTestResult
Possible return values from the SDL_HitTest callback.
Definition: SDL_video.h:1020
SDL_VideoDevice::num_displays
int num_displays
Definition: SDL_sysvideo.h:323
retval
SDL_bool retval
Definition: testgamecontroller.c:65
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
SDL_GL_SHARE_WITH_CURRENT_CONTEXT
@ SDL_GL_SHARE_WITH_CURRENT_CONTEXT
Definition: SDL_video.h:221
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE
@ SDL_GL_FRAMEBUFFER_SRGB_CAPABLE
Definition: SDL_video.h:222
window
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
SDL_ORIENTATION_LANDSCAPE
@ SDL_ORIENTATION_LANDSCAPE
Definition: SDL_video.h:183
CanMinimizeWindow
static SDL_bool CanMinimizeWindow(SDL_Window *window)
Definition: SDL_video.c:2237
SDL_Rect::y
int y
Definition: SDL_rect.h:79
GL_NO_ERROR
#define GL_NO_ERROR
Definition: SDL_opengl.h:719
SDL_Rect::h
int h
Definition: SDL_rect.h:80
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
SDL_DisplayOrientation
SDL_DisplayOrientation
Definition: SDL_video.h:181
SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG
@ SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG
Definition: SDL_video.h:239
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
SDL_HITTEST_RESIZE_BOTTOM
@ SDL_HITTEST_RESIZE_BOTTOM
Definition: SDL_video.h:1028
SDL_DestroyWindow
void SDL_DestroyWindow(SDL_Window *window)
Destroy a window.
Definition: SDL_video.c:2733
SDL_max
#define SDL_max(x, y)
Definition: SDL_stdinc.h:407
SDL_UpdateWindowGrab
void SDL_UpdateWindowGrab(SDL_Window *window)
Definition: SDL_video.c:2541
SDL_VideoDevice::driver_loaded
int driver_loaded
Definition: SDL_sysvideo.h:361
SDL_WindowEventID
SDL_WindowEventID
Event subtype for window events.
Definition: SDL_video.h:146
isAtLeastGL3
static SDL_INLINE SDL_bool isAtLeastGL3(const char *verstr)
Definition: SDL_video.c:2968
SDL_GL_MakeCurrent
int SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext ctx)
Set up an OpenGL context for rendering into an OpenGL window.
Definition: SDL_video.c:3537
SDL_VideoDevice::GL_GetDrawableSize
void(* GL_GetDrawableSize)(_THIS, SDL_Window *window, int *w, int *h)
Definition: SDL_sysvideo.h:261
SDL_GLprofile
SDL_GLprofile
Definition: SDL_video.h:229
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:663
SDL_GLContextResetNotification
SDL_GLContextResetNotification
Definition: SDL_video.h:250
SDL_VideoDevice::displays
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:324
SDL_GetWindowSize
void SDL_GetWindowSize(SDL_Window *window, int *w, int *h)
Get the size of a window's client area.
Definition: SDL_video.c:2055
SDL_GetDisplayForWindow
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
Definition: SDL_video.c:1110
SDL_HITTEST_RESIZE_LEFT
@ SDL_HITTEST_RESIZE_LEFT
Definition: SDL_video.h:1030
GL_ACCUM_RED_BITS
#define GL_ACCUM_RED_BITS
Definition: SDL_opengl.h:380
rect
SDL_Rect rect
Definition: testrelative.c:27
SDL_GL_ACCELERATED_VISUAL
@ SDL_GL_ACCELERATED_VISUAL
Definition: SDL_video.h:214
SDL_WINDOWEVENT_EXPOSED
@ SDL_WINDOWEVENT_EXPOSED
Definition: SDL_video.h:150
SDL_FreeSurface
#define SDL_FreeSurface
Definition: SDL_dynapi_overrides.h:446
SDL_VideoDevice::multisamplebuffers
int multisamplebuffers
Definition: SDL_sysvideo.h:348
SDL_VideoDevice::VideoInit
int(* VideoInit)(_THIS)
Definition: SDL_sysvideo.h:162
SDL_GL_CONTEXT_PROFILE_ES
@ SDL_GL_CONTEXT_PROFILE_ES
Definition: SDL_video.h:232
SDL_WINDOW_TOOLTIP
@ SDL_WINDOW_TOOLTIP
Definition: SDL_video.h:119
SDL_VideoDevice::share_with_current_context
int share_with_current_context
Definition: SDL_sysvideo.h:355
SDL_VideoDevice::green_size
int green_size
Definition: SDL_sysvideo.h:336
SDL_GetDisplayBounds
int SDL_GetDisplayBounds(int displayIndex, SDL_Rect *rect)
Get the desktop area represented by a display, with the primary display located at 0,...
Definition: SDL_video.c:682
SDL_min
#define SDL_min(x, y)
Definition: SDL_stdinc.h:406
SDL_VideoDevice::RaiseWindow
void(* RaiseWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:226
SDL_WINDOWEVENT_HIT_TEST
@ SDL_WINDOWEVENT_HIT_TEST
Definition: SDL_video.h:168
SDL_VideoDevice::VideoQuit
void(* VideoQuit)(_THIS)
Definition: SDL_sysvideo.h:168
SDL_DestroyWindowTexture
static void SDL_DestroyWindowTexture(SDL_VideoDevice *unused, SDL_Window *window)
Definition: SDL_video.c:399
SDL_VideoDevice::SetWindowMinimumSize
void(* SetWindowMinimumSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:218
SDL_WINDOW_INPUT_GRABBED
@ SDL_WINDOW_INPUT_GRABBED
Definition: SDL_video.h:107
SDL_CreateWindowTexture
static int SDL_CreateWindowTexture(SDL_VideoDevice *unused, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
Definition: SDL_video.c:259
SDL_VideoDevice::no_error
int no_error
Definition: SDL_sysvideo.h:359
SDL_SetDisplayModeForDisplay
static int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
Definition: SDL_video.c:993
SDL_WINDOWEVENT_SIZE_CHANGED
@ SDL_WINDOWEVENT_SIZE_CHANGED
Definition: SDL_video.h:155
SDL_GL_ACCUM_ALPHA_SIZE
@ SDL_GL_ACCUM_ALPHA_SIZE
Definition: SDL_video.h:210
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
SDL_VideoDevice::MinimizeWindow
void(* MinimizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:228
SDL_PIXELFORMAT_ARGB8888
@ SDL_PIXELFORMAT_ARGB8888
Definition: SDL_pixels.h:251
SDL_DisplayMode::w
int w
Definition: SDL_video.h:56
SDL_GL_UnloadLibrary
void SDL_GL_UnloadLibrary(void)
Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
Definition: SDL_video.c:2950
SDL_GL_CONTEXT_RESET_LOSE_CONTEXT
@ SDL_GL_CONTEXT_RESET_LOSE_CONTEXT
Definition: SDL_video.h:252
blue
GLbyte GLbyte blue
Definition: SDL_opengl_glext.h:382
green
GLbyte green
Definition: SDL_opengl_glext.h:382
SDL_VideoDevice::SetWindowHitTest
int(* SetWindowHitTest)(SDL_Window *window, SDL_bool enabled)
Definition: SDL_sysvideo.h:314
SDL_assert
#define SDL_assert(condition)
Definition: SDL_assert.h:169
SDL_VideoDevice::SetWindowMaximumSize
void(* SetWindowMaximumSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:219
SDL_TLSGet
#define SDL_TLSGet
Definition: SDL_dynapi_overrides.h:481
SDL_VideoDevice::dll_handle
void * dll_handle
Definition: SDL_sysvideo.h:363
SDL_GL_ACCUM_BLUE_SIZE
@ SDL_GL_ACCUM_BLUE_SIZE
Definition: SDL_video.h:209
SDL_WINDOWEVENT_MINIMIZED
@ SDL_WINDOWEVENT_MINIMIZED
Definition: SDL_video.h:158
SDL_WINDOW_SHOWN
@ SDL_WINDOW_SHOWN
Definition: SDL_video.h:101
SDL_WINDOWEVENT_TAKE_FOCUS
@ SDL_WINDOWEVENT_TAKE_FOCUS
Definition: SDL_video.h:167
SDL_VideoDisplay::driverdata
void * driverdata
Definition: SDL_sysvideo.h:140
start
GLuint start
Definition: SDL_opengl.h:1571
SDL_VideoDevice::double_buffer
int double_buffer
Definition: SDL_sysvideo.h:342
SDL_TLSCreate
#define SDL_TLSCreate
Definition: SDL_dynapi_overrides.h:480
SDL_VideoDevice::release_behavior
int release_behavior
Definition: SDL_sysvideo.h:356
SDL_VideoDevice
Definition: SDL_sysvideo.h:150
APIENTRY
#define APIENTRY
Definition: SDL_opengl.h:139
SDL_OutOfMemory
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_VideoDevice::flags
int flags
Definition: SDL_sysvideo.h:353
SDL_SetWindowGammaRamp
int SDL_SetWindowGammaRamp(SDL_Window *window, const Uint16 *red, const Uint16 *green, const Uint16 *blue)
Set the gamma ramp for a window.
Definition: SDL_video.c:2462
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
SDL_HITTEST_NORMAL
@ SDL_HITTEST_NORMAL
Definition: SDL_video.h:1021
GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE
Definition: SDL_opengl_glext.h:999
SDL_GL_BLUE_SIZE
@ SDL_GL_BLUE_SIZE
Definition: SDL_video.h:201
SDL_VideoDevice::DestroyWindow
void(* DestroyWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:236
SDL_WINDOW_UTILITY
@ SDL_WINDOW_UTILITY
Definition: SDL_video.h:118
SDL_UpdateFullscreenMode
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
Definition: SDL_video.c:1204
available
static int available()
Definition: video.c:356
SDL_VideoDevice::SetWindowBordered
void(* SetWindowBordered)(_THIS, SDL_Window *window, SDL_bool bordered)
Definition: SDL_sysvideo.h:230
SDL_HITTEST_RESIZE_RIGHT
@ SDL_HITTEST_RESIZE_RIGHT
Definition: SDL_video.h:1026
SDL_calloc
#define SDL_calloc
Definition: SDL_dynapi_overrides.h:375
SDL_StartTextInput
void SDL_StartTextInput(void)
Start accepting Unicode text input events. This function will show the on-screen keyboard if supporte...
Definition: SDL_video.c:3776
FULLSCREEN_VISIBLE
#define FULLSCREEN_VISIBLE(W)
Definition: SDL_sysvideo.h:117
GL_ACCUM_BLUE_BITS
#define GL_ACCUM_BLUE_BITS
Definition: SDL_opengl.h:382
SDL_VideoDevice::GL_SetSwapInterval
int(* GL_SetSwapInterval)(_THIS, int interval)
Definition: SDL_sysvideo.h:262
SDL_VideoDevice::SetWindowResizable
void(* SetWindowResizable)(_THIS, SDL_Window *window, SDL_bool resizable)
Definition: SDL_sysvideo.h:231
SDL_VideoDevice::reset_notification
int reset_notification
Definition: SDL_sysvideo.h:357
SDL_VideoDisplay::num_display_modes
int num_display_modes
Definition: SDL_sysvideo.h:130
SDL_VideoDevice::DestroyWindowFramebuffer
void(* DestroyWindowFramebuffer)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:239
SDL_VideoDevice::CreateSDLWindowFrom
int(* CreateSDLWindowFrom)(_THIS, SDL_Window *window, const void *data)
Definition: SDL_sysvideo.h:213
SDL_VideoDevice::stereo
int stereo
Definition: SDL_sysvideo.h:347
SDL_getenv
#define SDL_getenv
Definition: SDL_dynapi_overrides.h:378
SDL_WINDOW_HIDDEN
@ SDL_WINDOW_HIDDEN
Definition: SDL_video.h:102
SDL_GL_SetAttribute
int SDL_GL_SetAttribute(SDL_GLattr attr, int value)
Set an OpenGL window attribute before window creation.
Definition: SDL_video.c:3144
SDL_GL_GetCurrentContext
SDL_GLContext SDL_GL_GetCurrentContext(void)
Get the currently active OpenGL context.
Definition: SDL_video.c:3578
SDL_VideoDevice::free
void(* free)(_THIS)
Definition: SDL_sysvideo.h:402
GL_ACCUM_ALPHA_BITS
#define GL_ACCUM_ALPHA_BITS
Definition: SDL_opengl.h:383
SDL_KeyboardInit
int SDL_KeyboardInit(void)
Definition: SDL_keyboard.c:562
SDL_Point
The structure that defines a point (integer)
Definition: SDL_rect.h:49
SDL_ORIENTATION_PORTRAIT
@ SDL_ORIENTATION_PORTRAIT
Definition: SDL_video.h:185
SDL_Window::next
SDL_Window * next
Definition: SDL_sysvideo.h:115
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:701
SDL_VideoDisplay
Definition: SDL_sysvideo.h:127
SDL_GL_STENCIL_SIZE
@ SDL_GL_STENCIL_SIZE
Definition: SDL_video.h:206
SDL_WINDOWEVENT_NONE
@ SDL_WINDOWEVENT_NONE
Definition: SDL_video.h:147
bootstrap
static VideoBootStrap * bootstrap[]
Definition: SDL_video.c:60
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:30
SDL_GL_CONTEXT_MINOR_VERSION
@ SDL_GL_CONTEXT_MINOR_VERSION
Definition: SDL_video.h:217
SDL_VideoDevice::SetWindowInputFocus
int(* SetWindowInputFocus)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:223
SDL_VideoDevice::GL_MakeCurrent
int(* GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context)
Definition: SDL_sysvideo.h:260
SDL_VideoDevice::GL_LoadLibrary
int(* GL_LoadLibrary)(_THIS, const char *path)
Definition: SDL_sysvideo.h:256
SDL_Rect
A rectangle, with the origin at the upper left (integer).
Definition: SDL_rect.h:78
SDL_GetMouseFocus
#define SDL_GetMouseFocus
Definition: SDL_dynapi_overrides.h:245
SDL_GL_MULTISAMPLEBUFFERS
@ SDL_GL_MULTISAMPLEBUFFERS
Definition: SDL_video.h:212
GL_ACCUM_GREEN_BITS
#define GL_ACCUM_GREEN_BITS
Definition: SDL_opengl.h:381
SDL_VideoDevice::GL_UnloadLibrary
void(* GL_UnloadLibrary)(_THIS)
Definition: SDL_sysvideo.h:258
SDL_VideoDevice::GL_CreateContext
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:259
SDL_DisplayEventID
SDL_DisplayEventID
Event subtype for display events.
Definition: SDL_video.h:175
SDL_VideoDevice::GetDisplayBounds
int(* GetDisplayBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
Definition: SDL_sysvideo.h:183
SDL_VideoDevice::GetDisplayDPI
int(* GetDisplayDPI)(_THIS, SDL_VideoDisplay *display, float *ddpi, float *hdpi, float *vdpi)
Definition: SDL_sysvideo.h:193
SDL_GL_GetAttribute
int SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
Get the actual value for an attribute from the current context.
Definition: SDL_video.c:3265
SDL_WindowUserData::next
struct SDL_WindowUserData * next
Definition: SDL_sysvideo.h:70
left
GLint left
Definition: SDL_opengl_glext.h:1952
ShouldUseTextureFramebuffer
static SDL_bool ShouldUseTextureFramebuffer()
Definition: SDL_video.c:169
VideoBootStrap::create
SDL_VideoDevice *(* create)(int devindex)
Definition: SDL_sysvideo.h:410
GLenum
unsigned int GLenum
Definition: SDL_opengl.h:176
SDL_PIXELFORMAT_UNKNOWN
@ SDL_PIXELFORMAT_UNKNOWN
Definition: SDL_pixels.h:173
SDL_VideoInit
int SDL_VideoInit(const char *driver_name)
Initialize the video subsystem, optionally specifying a video driver.
Definition: SDL_video.c:464
SDL_VideoDevice::name
const char * name
Definition: SDL_sysvideo.h:153
GL_RED_BITS
#define GL_RED_BITS
Definition: SDL_opengl.h:513
SDL_Vulkan_UnloadLibrary
void SDL_Vulkan_UnloadLibrary(void)
Unload the Vulkan loader library previously loaded by SDL_Vulkan_LoadLibrary().
Definition: SDL_video.c:4146
SDL_VideoDevice::framebuffer_srgb_capable
int framebuffer_srgb_capable
Definition: SDL_sysvideo.h:358
SDL_SendWindowEvent
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
Definition: SDL_windowevents.c:74
SDL_VideoDevice::next_object_id
Uint32 next_object_id
Definition: SDL_sysvideo.h:328
SDL_Vulkan_LoadLibrary
int SDL_Vulkan_LoadLibrary(const char *path)
Dynamically load a Vulkan loader library.
Definition: SDL_video.c:4107
CHECK_DISPLAY_INDEX
#define CHECK_DISPLAY_INDEX(displayIndex, retval)
Definition: SDL_video.c:134
PrepareDragAndDropSupport
static SDL_INLINE void PrepareDragAndDropSupport(SDL_Window *window)
Definition: SDL_video.c:1383
SDL_strdup
#define SDL_strdup
Definition: SDL_dynapi_overrides.h:397
SDL_EnclosePoints
#define SDL_EnclosePoints
Definition: SDL_dynapi_overrides.h:296
SDL_VideoDevice::current_glwin
SDL_Window * current_glwin
Definition: SDL_sysvideo.h:371
SDL_VideoDevice::alpha_size
int alpha_size
Definition: SDL_sysvideo.h:338
SDL_strlen
#define SDL_strlen
Definition: SDL_dynapi_overrides.h:393
SDL_ORIENTATION_UNKNOWN
@ SDL_ORIENTATION_UNKNOWN
Definition: SDL_video.h:182
GL_INVALID_VALUE
#define GL_INVALID_VALUE
Definition: SDL_opengl.h:721
SDL_GL_ACCUM_RED_SIZE
@ SDL_GL_ACCUM_RED_SIZE
Definition: SDL_video.h:207
SDL_GL_CONTEXT_RELEASE_BEHAVIOR
@ SDL_GL_CONTEXT_RELEASE_BEHAVIOR
Definition: SDL_video.h:223
SDL_FinishWindowCreation
static void SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
Definition: SDL_video.c:1404
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:162
SDL_VideoDevice::GL_SwapWindow
int(* GL_SwapWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:264
SDL_WINDOW_MOUSE_FOCUS
@ SDL_WINDOW_MOUSE_FOCUS
Definition: SDL_video.h:109
SDL_VideoDevice::MaximizeWindow
void(* MaximizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:227
GL_DEPTH
#define GL_DEPTH
Definition: SDL_opengl.h:525
SDL_VideoDevice::SetWindowSize
void(* SetWindowSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:217
SDL_WINDOWEVENT_HIDDEN
@ SDL_WINDOWEVENT_HIDDEN
Definition: SDL_video.h:149
SDL_ORIENTATION_PORTRAIT_FLIPPED
@ SDL_ORIENTATION_PORTRAIT_FLIPPED
Definition: SDL_video.h:186
SDL_VideoDevice::GL_DefaultProfileConfig
void(* GL_DefaultProfileConfig)(_THIS, int *mask, int *major, int *minor)
Definition: SDL_sysvideo.h:266
j
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)
Definition: SDL_x11sym.h:50
SDL_UninitializedVideo
static int SDL_UninitializedVideo()
Definition: SDL_video.c:440
SDL_VideoDevice::SetWindowOpacity
int(* SetWindowOpacity)(_THIS, SDL_Window *window, float opacity)
Definition: SDL_sysvideo.h:221
SDL_IsVideoContextExternal
SDL_bool SDL_IsVideoContextExternal(void)
Definition: SDL_video.c:668
GL_GREEN_BITS
#define GL_GREEN_BITS
Definition: SDL_opengl.h:514
SDL_VideoDevice::GetWindowGammaRamp
int(* GetWindowGammaRamp)(_THIS, SDL_Window *window, Uint16 *ramp)
Definition: SDL_sysvideo.h:234
SDL_DisplayMode::driverdata
void * driverdata
Definition: SDL_video.h:59
SDL_WINDOWEVENT_RESTORED
@ SDL_WINDOWEVENT_RESTORED
Definition: SDL_video.h:160
SDL_GL_STEREO
@ SDL_GL_STEREO
Definition: SDL_video.h:211
SDL_FALSE
@ SDL_FALSE
Definition: SDL_stdinc.h:163
SDL_Unsupported
#define SDL_Unsupported()
Definition: SDL_error.h:53
GLuint
unsigned int GLuint
Definition: SDL_opengl.h:185
SDL_CalculateGammaRamp
#define SDL_CalculateGammaRamp
Definition: SDL_dynapi_overrides.h:290
SDL_VideoDevice::accelerated
int accelerated
Definition: SDL_sysvideo.h:350
SDL_VideoDevice::ShowWindow
void(* ShowWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:224
GL_CONTEXT_RELEASE_BEHAVIOR
#define GL_CONTEXT_RELEASE_BEHAVIOR
Definition: SDL_opengl_glext.h:2995
SDL_VideoDevice::CreateWindowFramebuffer
int(* CreateWindowFramebuffer)(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
Definition: SDL_sysvideo.h:237
SDL_GL_GetProcAddress
void * SDL_GL_GetProcAddress(const char *proc)
Get the address of an OpenGL function.
Definition: SDL_video.c:2928
SDL_GL_RED_SIZE
@ SDL_GL_RED_SIZE
Definition: SDL_video.h:199
SDL_VideoDisplay::current_mode
SDL_DisplayMode current_mode
Definition: SDL_sysvideo.h:133
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:374
SDL_VideoDevice::GL_GetProcAddress
void *(* GL_GetProcAddress)(_THIS, const char *proc)
Definition: SDL_sysvideo.h:257
SDL_GetWindowGammaRamp
int SDL_GetWindowGammaRamp(SDL_Window *window, Uint16 *red, Uint16 *green, Uint16 *blue)
Get the gamma ramp for a window.
Definition: SDL_video.c:2496
SDL_VideoDevice::stencil_size
int stencil_size
Definition: SDL_sysvideo.h:341
SDL_HasScreenKeyboardSupport
SDL_bool SDL_HasScreenKeyboardSupport(void)
Returns whether the platform has some screen keyboard support.
Definition: SDL_video.c:3832
SDL_TouchQuit
void SDL_TouchQuit(void)
Definition: SDL_touch.c:465
SDL_strcmp
#define SDL_strcmp
Definition: SDL_dynapi_overrides.h:417
void
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
Definition: SDL_dynapi_procs.h:89
SDL_GL_CONTEXT_FLAGS
@ SDL_GL_CONTEXT_FLAGS
Definition: SDL_video.h:219
SDL_OnWindowResized
void SDL_OnWindowResized(SDL_Window *window)
Definition: SDL_video.c:2615
flags
GLbitfield flags
Definition: SDL_opengl_glext.h:1483
SDL_GL_CONTEXT_RESET_NOTIFICATION
@ SDL_GL_CONTEXT_RESET_NOTIFICATION
Definition: SDL_video.h:224
FULLSCREEN_MASK
#define FULLSCREEN_MASK
Definition: SDL_video.c:147
SDL_GetClosestDisplayModeForDisplay
static SDL_DisplayMode * SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay *display, const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
Definition: SDL_video.c:873
SDL_strstr
#define SDL_strstr
Definition: SDL_dynapi_overrides.h:403
SDL_WINDOWEVENT_FOCUS_GAINED
@ SDL_WINDOWEVENT_FOCUS_GAINED
Definition: SDL_video.h:164
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
@ SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
Definition: SDL_video.h:238
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:123
SDL_VideoDevice::minor_version
int minor_version
Definition: SDL_sysvideo.h:352
GL_INVALID_ENUM
#define GL_INVALID_ENUM
Definition: SDL_opengl.h:720
SDL_Window::prev
SDL_Window * prev
Definition: SDL_sysvideo.h:114
SDL_VideoDevice::current_glctx
SDL_GLContext current_glctx
Definition: SDL_sysvideo.h:372
SDL_VideoDevice::RestoreWindow
void(* RestoreWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:229
rects
EGLSurface EGLint * rects
Definition: eglext.h:282
SDL_TouchInit
int SDL_TouchInit(void)
Definition: SDL_touch.c:46
SDL_WINDOW_SKIP_TASKBAR
@ SDL_WINDOW_SKIP_TASKBAR
Definition: SDL_video.h:117
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:84
SDL_VideoDevice::GL_DeleteContext
void(* GL_DeleteContext)(_THIS, SDL_GLContext context)
Definition: SDL_sysvideo.h:265
SDL_HITTEST_RESIZE_TOP
@ SDL_HITTEST_RESIZE_TOP
Definition: SDL_video.h:1024
SDL_DISPLAYEVENT_NONE
@ SDL_DISPLAYEVENT_NONE
Definition: SDL_video.h:176
SDL_VideoDisplay::orientation
SDL_DisplayOrientation orientation
Definition: SDL_sysvideo.h:134
GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE
Definition: SDL_opengl_glext.h:1002
SDL_GetNumDisplayModesForDisplay
static int SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay *display)
Definition: SDL_video.c:808
SDL_VideoDevice::suspend_screensaver
SDL_bool suspend_screensaver
Definition: SDL_sysvideo.h:322
SDL_ORIENTATION_LANDSCAPE_FLIPPED
@ SDL_ORIENTATION_LANDSCAPE_FLIPPED
Definition: SDL_video.h:184
SDL_GLcontextReleaseFlag
SDL_GLcontextReleaseFlag
Definition: SDL_video.h:244
SDL_GL_GetCurrentWindow
SDL_Window * SDL_GL_GetCurrentWindow(void)
Get the currently active OpenGL window.
Definition: SDL_video.c:3568
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY
@ SDL_GL_CONTEXT_PROFILE_COMPATIBILITY
Definition: SDL_video.h:231
GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE
Definition: SDL_opengl_glext.h:1001
SDL_GetWindowDisplayIndex
int SDL_GetWindowDisplayIndex(SDL_Window *window)
Get the display index associated with a window.
Definition: SDL_video.c:1050
SDL_EnableScreenSaver
void SDL_EnableScreenSaver()
Allow the screen to be blanked by a screensaver.
Definition: SDL_video.c:2819
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
GLint
int GLint
Definition: SDL_opengl.h:182
SDL_WINDOWPOS_ISUNDEFINED
#define SDL_WINDOWPOS_ISUNDEFINED(X)
Definition: SDL_video.h:130
SDL_VideoDisplay::fullscreen_window
SDL_Window * fullscreen_window
Definition: SDL_sysvideo.h:136
SDL_HITTEST_RESIZE_BOTTOMLEFT
@ SDL_HITTEST_RESIZE_BOTTOMLEFT
Definition: SDL_video.h:1029
SDL_Point::y
int y
Definition: SDL_rect.h:51
SDL_WINDOWEVENT_MAXIMIZED
@ SDL_WINDOWEVENT_MAXIMIZED
Definition: SDL_video.h:159
SDL_WINDOWEVENT_LEAVE
@ SDL_WINDOWEVENT_LEAVE
Definition: SDL_video.h:163
SDL_GL_CONTEXT_MAJOR_VERSION
@ SDL_GL_CONTEXT_MAJOR_VERSION
Definition: SDL_video.h:216
SDL_GetNumVideoDrivers
int SDL_GetNumVideoDrivers(void)
Get the number of video drivers compiled into SDL.
Definition: SDL_video.c:446
SDL_WINDOW_BORDERLESS
@ SDL_WINDOW_BORDERLESS
Definition: SDL_video.h:103
SDL_VideoDevice::windows
SDL_Window * windows
Definition: SDL_sysvideo.h:325
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:734
GL_SAMPLES
#define GL_SAMPLES
Definition: SDL_opengl.h:1840
SDL_GL_ACCUM_GREEN_SIZE
@ SDL_GL_ACCUM_GREEN_SIZE
Definition: SDL_video.h:208
SDL_WINDOW_VULKAN
@ SDL_WINDOW_VULKAN
Definition: SDL_video.h:121
GL_CONTEXT_RELEASE_BEHAVIOR_KHR
#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR
Definition: gl2ext.h:83