SDL  2.0
SDL_video.c File Reference
#include "../SDL_internal.h"
#include "SDL.h"
#include "SDL_video.h"
#include "SDL_sysvideo.h"
#include "SDL_blit.h"
#include "SDL_pixels_c.h"
#include "SDL_rect_c.h"
#include "../events/SDL_events_c.h"
#include "../timer/SDL_timer_c.h"
#include "SDL_syswm.h"
#include "SDL_opengles2.h"
#include "x11/SDL_x11messagebox.h"
+ Include dependency graph for SDL_video.c:

Go to the source code of this file.

Data Structures

struct  SDL_WindowTextureData
 

Macros

#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR   0x82FB
 
#define CHECK_WINDOW_MAGIC(window, retval)
 
#define CHECK_DISPLAY_INDEX(displayIndex, retval)
 
#define FULLSCREEN_MASK   (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN)
 
#define SDL_WINDOWTEXTUREDATA   "_SDL_WindowTextureData"
 
#define CREATE_FLAGS   (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED)
 
#define GL_NUM_EXTENSIONS   0x821D
 
#define NOT_A_VULKAN_WINDOW   "The specified window isn't a Vulkan window"
 

Functions

static SDL_bool ShouldUseTextureFramebuffer ()
 
static int SDL_CreateWindowTexture (SDL_VideoDevice *unused, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
 
static int SDL_UpdateWindowTexture (SDL_VideoDevice *unused, SDL_Window *window, const SDL_Rect *rects, int numrects)
 
static void SDL_DestroyWindowTexture (SDL_VideoDevice *unused, SDL_Window *window)
 
static int cmpmodes (const void *A, const void *B)
 
static int SDL_UninitializedVideo ()
 
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...
 
const char * SDL_GetCurrentVideoDriver ()
 Returns the name of the currently initialized video driver. More...
 
SDL_VideoDeviceSDL_GetVideoDevice (void)
 
int SDL_AddBasicVideoDisplay (const SDL_DisplayMode *desktop_mode)
 
int SDL_AddVideoDisplay (const SDL_VideoDisplay *display)
 
int SDL_GetNumVideoDisplays (void)
 Returns the number of available video displays. More...
 
int SDL_GetIndexOfDisplay (SDL_VideoDisplay *display)
 
voidSDL_GetDisplayDriverData (int displayIndex)
 
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...
 
SDL_bool SDL_AddDisplayMode (SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
 
static int SDL_GetNumDisplayModesForDisplay (SDL_VideoDisplay *display)
 
int SDL_GetNumDisplayModes (int displayIndex)
 Returns the number of available display modes. More...
 
int SDL_GetDisplayMode (int displayIndex, int index, 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...
 
static SDL_DisplayModeSDL_GetClosestDisplayModeForDisplay (SDL_VideoDisplay *display, const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
 
SDL_DisplayModeSDL_GetClosestDisplayMode (int displayIndex, const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
 Get the closest match to the requested display mode. More...
 
static int SDL_SetDisplayModeForDisplay (SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
 
SDL_VideoDisplaySDL_GetDisplay (int displayIndex)
 
int SDL_GetWindowDisplayIndex (SDL_Window *window)
 Get the display index associated with a window. More...
 
SDL_VideoDisplaySDL_GetDisplayForWindow (SDL_Window *window)
 
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...
 
static void SDL_RestoreMousePosition (SDL_Window *window)
 
static int SDL_UpdateFullscreenMode (SDL_Window *window, SDL_bool fullscreen)
 
static SDL_INLINE SDL_bool IsAcceptingDragAndDrop (void)
 
static SDL_INLINE void PrepareDragAndDropSupport (SDL_Window *window)
 
void SDL_ToggleDragAndDropSupport (void)
 
static void SDL_FinishWindowCreation (SDL_Window *window, Uint32 flags)
 
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...
 
int SDL_RecreateWindow (SDL_Window *window, Uint32 flags)
 
SDL_bool SDL_HasWindows (void)
 
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_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_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 *min_w, int *min_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 *max_w, int *max_h)
 Get the maximum size of a window's client area. 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...
 
static SDL_bool CanMinimizeWindow (SDL_Window *window)
 
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...
 
static SDL_SurfaceSDL_CreateWindowFramebuffer (SDL_Window *window)
 
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...
 
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...
 
void SDL_UpdateWindowGrab (SDL_Window *window)
 
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...
 
void SDL_OnWindowShown (SDL_Window *window)
 
void SDL_OnWindowHidden (SDL_Window *window)
 
void SDL_OnWindowResized (SDL_Window *window)
 
void SDL_OnWindowMinimized (SDL_Window *window)
 
void SDL_OnWindowRestored (SDL_Window *window)
 
void SDL_OnWindowEnter (SDL_Window *window)
 
void SDL_OnWindowLeave (SDL_Window *window)
 
void SDL_OnWindowFocusGained (SDL_Window *window)
 
static SDL_bool ShouldMinimizeOnFocusLoss (SDL_Window *window)
 
void SDL_OnWindowFocusLost (SDL_Window *window)
 
SDL_WindowSDL_GetFocusWindow (void)
 
void SDL_DestroyWindow (SDL_Window *window)
 Destroy a window. More...
 
SDL_bool SDL_IsScreenSaverEnabled ()
 Returns whether the screensaver is currently enabled (default off). More...
 
void SDL_EnableScreenSaver ()
 Allow the screen to be blanked by a screensaver. More...
 
void SDL_DisableScreenSaver ()
 Prevent the screen from being blanked by a screensaver. More...
 
void SDL_VideoQuit (void)
 Shuts down the video subsystem. More...
 
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...
 
static SDL_INLINE SDL_bool isAtLeastGL3 (const char *verstr)
 
SDL_bool SDL_GL_ExtensionSupported (const char *extension)
 Return true if an OpenGL extension is supported for the current context. More...
 
void SDL_GL_DeduceMaxSupportedESProfile (int *major, int *minor)
 
void SDL_GL_ResetAttributes ()
 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 ctx)
 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...
 
SDL_bool SDL_GetWindowWMInfo (SDL_Window *window, struct SDL_SysWMinfo *info)
 This function allows access to driver-dependent window information. More...
 
void SDL_StartTextInput (void)
 Start accepting Unicode text input events. This function will show the on-screen keyboard if supported. More...
 
SDL_bool SDL_IsTextInputActive (void)
 Return whether or not Unicode text input events are enabled. More...
 
void SDL_StopTextInput (void)
 Stop receiving any text input events. This function will hide the on-screen keyboard if supported. More...
 
void SDL_SetTextInputRect (SDL_Rect *rect)
 Set the rectangle used to type Unicode text inputs. This is used as a hint for IME and on-screen keyboard placement. More...
 
SDL_bool SDL_HasScreenKeyboardSupport (void)
 Returns whether the platform has some screen keyboard support. More...
 
SDL_bool SDL_IsScreenKeyboardShown (SDL_Window *window)
 Returns whether the screen keyboard is shown for given window. More...
 
static SDL_bool SDL_MessageboxValidForDriver (const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
 
int SDL_ShowMessageBox (const SDL_MessageBoxData *messageboxdata, int *buttonid)
 Create a modal message box. More...
 
int SDL_ShowSimpleMessageBox (Uint32 flags, const char *title, const char *message, SDL_Window *window)
 Create a simple modal message box. More...
 
SDL_bool SDL_ShouldAllowTopmost (void)
 
int SDL_SetWindowHitTest (SDL_Window *window, SDL_HitTest callback, void *userdata)
 Provide a callback that decides if a window region has special properties. More...
 
float SDL_ComputeDiagonalDPI (int hpix, int vpix, float hinches, float vinches)
 
void SDL_OnApplicationWillTerminate (void)
 
void SDL_OnApplicationDidReceiveMemoryWarning (void)
 
void SDL_OnApplicationWillResignActive (void)
 
void SDL_OnApplicationDidEnterBackground (void)
 
void SDL_OnApplicationWillEnterForeground (void)
 
void SDL_OnApplicationDidBecomeActive (void)
 
int SDL_Vulkan_LoadLibrary (const char *path)
 Dynamically load a Vulkan loader library. More...
 
voidSDL_Vulkan_GetVkGetInstanceProcAddr (void)
 Get the address of the vkGetInstanceProcAddr function. More...
 
void SDL_Vulkan_UnloadLibrary (void)
 Unload the Vulkan loader library previously loaded by SDL_Vulkan_LoadLibrary(). More...
 
SDL_bool SDL_Vulkan_GetInstanceExtensions (SDL_Window *window, unsigned *count, const char **names)
 
SDL_bool SDL_Vulkan_CreateSurface (SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface)
 Create a Vulkan rendering surface for a window. More...
 
void SDL_Vulkan_GetDrawableSize (SDL_Window *window, int *w, int *h)
 Get the size of a window's underlying drawable in pixels (for use with setting viewport, scissor & etc). More...
 

Variables

static VideoBootStrapbootstrap []
 
static SDL_VideoDevice_this = NULL
 

Macro Definition Documentation

◆ CHECK_DISPLAY_INDEX

#define CHECK_DISPLAY_INDEX (   displayIndex,
  retval 
)
Value:
if (!_this) { \
SDL_UninitializedVideo(); \
return retval; \
} \
SDL_assert(_this->displays != NULL); \
SDL_assert(displayIndex >= 0 && displayIndex < _this->num_displays); \
if (displayIndex < 0 || displayIndex >= _this->num_displays) { \
SDL_SetError("displayIndex must be in the range 0 - %d", \
return retval; \
}

Definition at line 134 of file SDL_video.c.

◆ CHECK_WINDOW_MAGIC

#define CHECK_WINDOW_MAGIC (   window,
  retval 
)
Value:
if (!_this) { \
SDL_UninitializedVideo(); \
return retval; \
} \
SDL_assert(window && window->magic == &_this->window_magic); \
if (!window || window->magic != &_this->window_magic) { \
SDL_SetError("Invalid window"); \
return retval; \
}

Definition at line 123 of file SDL_video.c.

◆ CREATE_FLAGS

◆ FULLSCREEN_MASK

#define FULLSCREEN_MASK   (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN)

Definition at line 147 of file SDL_video.c.

◆ GL_CONTEXT_RELEASE_BEHAVIOR_KHR

#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR   0x82FB

Definition at line 51 of file SDL_video.c.

◆ GL_NUM_EXTENSIONS

#define GL_NUM_EXTENSIONS   0x821D

◆ NOT_A_VULKAN_WINDOW

#define NOT_A_VULKAN_WINDOW   "The specified window isn't a Vulkan window"

Definition at line 4077 of file SDL_video.c.

◆ SDL_WINDOWTEXTUREDATA

#define SDL_WINDOWTEXTUREDATA   "_SDL_WindowTextureData"

Definition at line 158 of file SDL_video.c.

Function Documentation

◆ CanMinimizeWindow()

static SDL_bool CanMinimizeWindow ( SDL_Window window)
static

Definition at line 2219 of file SDL_video.c.

2220 {
2221  if (!_this->MinimizeWindow) {
2222  return SDL_FALSE;
2223  }
2224  return SDL_TRUE;
2225 }

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

Referenced by SDL_MinimizeWindow().

◆ cmpmodes()

static int cmpmodes ( const void A,
const void B 
)
static

Definition at line 419 of file SDL_video.c.

420 {
421  const SDL_DisplayMode *a = (const SDL_DisplayMode *) A;
422  const SDL_DisplayMode *b = (const SDL_DisplayMode *) B;
423  if (a == b) {
424  return 0;
425  } else if (a->w != b->w) {
426  return b->w - a->w;
427  } else if (a->h != b->h) {
428  return b->h - a->h;
429  } else if (SDL_BITSPERPIXEL(a->format) != SDL_BITSPERPIXEL(b->format)) {
430  return SDL_BITSPERPIXEL(b->format) - SDL_BITSPERPIXEL(a->format);
431  } else if (SDL_PIXELLAYOUT(a->format) != SDL_PIXELLAYOUT(b->format)) {
432  return SDL_PIXELLAYOUT(b->format) - SDL_PIXELLAYOUT(a->format);
433  } else if (a->refresh_rate != b->refresh_rate) {
434  return b->refresh_rate - a->refresh_rate;
435  }
436  return 0;
437 }

References SDL_BITSPERPIXEL, SDL_PIXELLAYOUT, and SDL_DisplayMode::w.

Referenced by SDL_AddDisplayMode(), and SDL_GetNumDisplayModesForDisplay().

◆ IsAcceptingDragAndDrop()

static SDL_INLINE SDL_bool IsAcceptingDragAndDrop ( void  )
static

Definition at line 1354 of file SDL_video.c.

1355 {
1358  return SDL_TRUE;
1359  }
1360  return SDL_FALSE;
1361 }

References SDL_DROPFILE, SDL_DROPTEXT, SDL_ENABLE, SDL_FALSE, SDL_GetEventState, and SDL_TRUE.

Referenced by PrepareDragAndDropSupport(), and SDL_ToggleDragAndDropSupport().

◆ isAtLeastGL3()

static SDL_INLINE SDL_bool isAtLeastGL3 ( const char *  verstr)
static

Definition at line 2950 of file SDL_video.c.

2951 {
2952  return (verstr && (SDL_atoi(verstr) >= 3));
2953 }

References SDL_atoi.

Referenced by SDL_GL_ExtensionSupported(), and SDL_GL_GetAttribute().

◆ PrepareDragAndDropSupport()

static SDL_INLINE void PrepareDragAndDropSupport ( SDL_Window window)
static

Definition at line 1365 of file SDL_video.c.

1366 {
1367  if (_this->AcceptDragAndDrop) {
1369  }
1370 }

References _this, SDL_VideoDevice::AcceptDragAndDrop, and IsAcceptingDragAndDrop().

Referenced by SDL_CreateWindowFrom(), and SDL_FinishWindowCreation().

◆ SDL_AddBasicVideoDisplay()

int SDL_AddBasicVideoDisplay ( const SDL_DisplayMode desktop_mode)

Definition at line 592 of file SDL_video.c.

593 {
594  SDL_VideoDisplay display;
595 
596  SDL_zero(display);
597  if (desktop_mode) {
598  display.desktop_mode = *desktop_mode;
599  }
600  display.current_mode = display.desktop_mode;
601 
602  return SDL_AddVideoDisplay(&display);
603 }

References SDL_VideoDisplay::current_mode, SDL_VideoDisplay::desktop_mode, SDL_AddVideoDisplay(), and SDL_zero.

◆ SDL_AddDisplayMode()

SDL_bool SDL_AddDisplayMode ( SDL_VideoDisplay display,
const SDL_DisplayMode mode 
)

Definition at line 754 of file SDL_video.c.

755 {
756  SDL_DisplayMode *modes;
757  int i, nmodes;
758 
759  /* Make sure we don't already have the mode in the list */
760  modes = display->display_modes;
761  nmodes = display->num_display_modes;
762  for (i = 0; i < nmodes; ++i) {
763  if (cmpmodes(mode, &modes[i]) == 0) {
764  return SDL_FALSE;
765  }
766  }
767 
768  /* Go ahead and add the new mode */
769  if (nmodes == display->max_display_modes) {
770  modes =
771  SDL_realloc(modes,
772  (display->max_display_modes + 32) * sizeof(*modes));
773  if (!modes) {
774  return SDL_FALSE;
775  }
776  display->display_modes = modes;
777  display->max_display_modes += 32;
778  }
779  modes[nmodes] = *mode;
780  display->num_display_modes++;
781 
782  /* Re-sort video modes */
783  SDL_qsort(display->display_modes, display->num_display_modes,
784  sizeof(SDL_DisplayMode), cmpmodes);
785 
786  return SDL_TRUE;
787 }

References cmpmodes(), SDL_VideoDisplay::display_modes, i, SDL_VideoDisplay::max_display_modes, SDL_VideoDisplay::num_display_modes, SDL_FALSE, SDL_qsort, SDL_realloc, and SDL_TRUE.

◆ SDL_AddVideoDisplay()

int SDL_AddVideoDisplay ( const SDL_VideoDisplay display)

Definition at line 606 of file SDL_video.c.

607 {
608  SDL_VideoDisplay *displays;
609  int index = -1;
610 
611  displays =
613  (_this->num_displays + 1) * sizeof(*displays));
614  if (displays) {
615  index = _this->num_displays++;
616  displays[index] = *display;
617  displays[index].device = _this;
618  _this->displays = displays;
619 
620  if (display->name) {
621  displays[index].name = SDL_strdup(display->name);
622  } else {
623  char name[32];
624 
625  SDL_itoa(index, name, 10);
626  displays[index].name = SDL_strdup(name);
627  }
628  } else {
629  SDL_OutOfMemory();
630  }
631  return index;
632 }

References _this, SDL_VideoDisplay::device, SDL_VideoDevice::displays, SDL_VideoDisplay::name, SDL_VideoDevice::num_displays, SDL_itoa, SDL_OutOfMemory, SDL_realloc, and SDL_strdup.

Referenced by SDL_AddBasicVideoDisplay(), and videoInit().

◆ SDL_ComputeDiagonalDPI()

float SDL_ComputeDiagonalDPI ( int  hpix,
int  vpix,
float  hinches,
float  vinches 
)

Definition at line 4018 of file SDL_video.c.

4019 {
4020  float den2 = hinches * hinches + vinches * vinches;
4021  if (den2 <= 0.0f) {
4022  return 0.0f;
4023  }
4024 
4025  return (float)(SDL_sqrt((double)hpix * (double)hpix + (double)vpix * (double)vpix) /
4026  SDL_sqrt((double)den2));
4027 }

References SDL_sqrt.

◆ 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 1408 of file SDL_video.c.

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

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_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_CreateWindowFramebuffer()

static SDL_Surface* SDL_CreateWindowFramebuffer ( SDL_Window window)
static

Definition at line 2288 of file SDL_video.c.

2289 {
2290  Uint32 format;
2291  void *pixels;
2292  int pitch;
2293  int bpp;
2294  Uint32 Rmask, Gmask, Bmask, Amask;
2295 
2297  return NULL;
2298  }
2299 
2300  if (_this->CreateWindowFramebuffer(_this, window, &format, &pixels, &pitch) < 0) {
2301  return NULL;
2302  }
2303 
2304  if (!SDL_PixelFormatEnumToMasks(format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
2305  return NULL;
2306  }
2307 
2308  return SDL_CreateRGBSurfaceFrom(pixels, window->w, window->h, bpp, pitch, Rmask, Gmask, Bmask, Amask);
2309 }

References _this, SDL_VideoDevice::CreateWindowFramebuffer, NULL, SDL_CreateRGBSurfaceFrom, SDL_PixelFormatEnumToMasks, and SDL_VideoDevice::UpdateWindowFramebuffer.

Referenced by SDL_GetWindowSurface().

◆ 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 1576 of file SDL_video.c.

1577 {
1578  SDL_Window *window;
1579 
1580  if (!_this) {
1582  return NULL;
1583  }
1584  if (!_this->CreateSDLWindowFrom) {
1585  SDL_Unsupported();
1586  return NULL;
1587  }
1588  window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
1589  if (!window) {
1590  SDL_OutOfMemory();
1591  return NULL;
1592  }
1593  window->magic = &_this->window_magic;
1594  window->id = _this->next_object_id++;
1595  window->flags = SDL_WINDOW_FOREIGN;
1596  window->last_fullscreen_flags = window->flags;
1597  window->is_destroying = SDL_FALSE;
1598  window->opacity = 1.0f;
1599  window->brightness = 1.0f;
1600  window->next = _this->windows;
1601  if (_this->windows) {
1602  _this->windows->prev = window;
1603  }
1604  _this->windows = window;
1605 
1606  if (_this->CreateSDLWindowFrom(_this, window, data) < 0) {
1608  return NULL;
1609  }
1610 
1612 
1613  return window;
1614 }

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_CreateWindowTexture()

static int SDL_CreateWindowTexture ( SDL_VideoDevice unused,
SDL_Window window,
Uint32 format,
void **  pixels,
int *  pitch 
)
static

Definition at line 259 of file SDL_video.c.

260 {
262 
264  if (!data) {
266  int i;
268 
269  /* Check to see if there's a specific driver requested */
270  if (hint && *hint != '0' && *hint != '1' &&
271  SDL_strcasecmp(hint, "true") != 0 &&
272  SDL_strcasecmp(hint, "false") != 0 &&
273  SDL_strcasecmp(hint, "software") != 0) {
274  for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
275  SDL_RendererInfo info;
276  SDL_GetRenderDriverInfo(i, &info);
277  if (SDL_strcasecmp(info.name, hint) == 0) {
279  break;
280  }
281  }
282  }
283 
284  if (!renderer) {
285  for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
286  SDL_RendererInfo info;
287  SDL_GetRenderDriverInfo(i, &info);
288  if (SDL_strcmp(info.name, "software") != 0) {
290  if (renderer) {
291  break;
292  }
293  }
294  }
295  }
296  if (!renderer) {
297  return SDL_SetError("No hardware accelerated renderers available");
298  }
299 
300  /* Create the data after we successfully create the renderer (bug #1116) */
301  data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(*data));
302  if (!data) {
304  return SDL_OutOfMemory();
305  }
307 
308  data->renderer = renderer;
309  }
310 
311  /* Free any old texture and pixel data */
312  if (data->texture) {
313  SDL_DestroyTexture(data->texture);
314  data->texture = NULL;
315  }
316  SDL_free(data->pixels);
317  data->pixels = NULL;
318 
319  {
320  SDL_RendererInfo info;
321  Uint32 i;
322 
323  if (SDL_GetRendererInfo(data->renderer, &info) < 0) {
324  return -1;
325  }
326 
327  /* Find the first format without an alpha channel */
328  *format = info.texture_formats[0];
329 
330  for (i = 0; i < info.num_texture_formats; ++i) {
333  *format = info.texture_formats[i];
334  break;
335  }
336  }
337  }
338 
339  data->texture = SDL_CreateTexture(data->renderer, *format,
341  window->w, window->h);
342  if (!data->texture) {
343  return -1;
344  }
345 
346  /* Create framebuffer data */
347  data->bytes_per_pixel = SDL_BYTESPERPIXEL(*format);
348  data->pitch = (((window->w * data->bytes_per_pixel) + 3) & ~3);
349 
350  {
351  /* Make static analysis happy about potential malloc(0) calls. */
352  const size_t allocsize = window->h * data->pitch;
353  data->pixels = SDL_malloc((allocsize > 0) ? allocsize : 1);
354  if (!data->pixels) {
355  return SDL_OutOfMemory();
356  }
357  }
358 
359  *pixels = data->pixels;
360  *pitch = data->pitch;
361 
362  /* Make sure we're not double-scaling the viewport */
363  SDL_RenderSetViewport(data->renderer, NULL);
364 
365  return 0;
366 }

References i, SDL_RendererInfo::name, NULL, SDL_RendererInfo::num_texture_formats, renderer, SDL_BYTESPERPIXEL, SDL_calloc, SDL_CreateRenderer, SDL_CreateTexture, SDL_DestroyRenderer, SDL_DestroyTexture, SDL_free, SDL_GetHint, SDL_GetNumRenderDrivers, SDL_GetRenderDriverInfo, SDL_GetRendererInfo, SDL_GetWindowData(), SDL_HINT_FRAMEBUFFER_ACCELERATION, SDL_ISPIXELFORMAT_ALPHA, SDL_ISPIXELFORMAT_FOURCC, SDL_malloc, SDL_OutOfMemory, SDL_RenderSetViewport, SDL_SetError, SDL_SetWindowData(), SDL_strcasecmp, SDL_strcmp, SDL_TEXTUREACCESS_STREAMING, SDL_WINDOWTEXTUREDATA, and SDL_RendererInfo::texture_formats.

Referenced by SDL_VideoInit().

◆ SDL_DestroyWindow()

void SDL_DestroyWindow ( SDL_Window window)

Destroy a window.

Definition at line 2715 of file SDL_video.c.

2716 {
2717  SDL_VideoDisplay *display;
2718 
2720 
2721  window->is_destroying = SDL_TRUE;
2722 
2723  /* Restore video mode, etc. */
2725 
2726  /* Make sure this window no longer has focus */
2727  if (SDL_GetKeyboardFocus() == window) {
2729  }
2730  if (SDL_GetMouseFocus() == window) {
2732  }
2733 
2734  /* make no context current if this is the current context window. */
2735  if (window->flags & SDL_WINDOW_OPENGL) {
2736  if (_this->current_glwin == window) {
2738  }
2739  }
2740 
2741  if (window->surface) {
2742  window->surface->flags &= ~SDL_DONTFREE;
2743  SDL_FreeSurface(window->surface);
2744  }
2747  }
2748  if (_this->DestroyWindow) {
2750  }
2751  if (window->flags & SDL_WINDOW_OPENGL) {
2753  }
2754  if (window->flags & SDL_WINDOW_VULKAN) {
2756  }
2757 
2758  display = SDL_GetDisplayForWindow(window);
2759  if (display->fullscreen_window == window) {
2760  display->fullscreen_window = NULL;
2761  }
2762 
2763  /* Now invalidate magic */
2764  window->magic = NULL;
2765 
2766  /* Free memory associated with the window */
2767  SDL_free(window->title);
2768  SDL_FreeSurface(window->icon);
2769  SDL_free(window->gamma);
2770  while (window->data) {
2772 
2773  window->data = data->next;
2774  SDL_free(data->name);
2775  SDL_free(data);
2776  }
2777 
2778  /* Unlink the window from the list */
2779  if (window->next) {
2780  window->next->prev = window->prev;
2781  }
2782  if (window->prev) {
2783  window->prev->next = window->next;
2784  } else {
2785  _this->windows = window->next;
2786  }
2787 
2788  SDL_free(window);
2789 }

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_DestroyWindowTexture()

static void SDL_DestroyWindowTexture ( SDL_VideoDevice unused,
SDL_Window window 
)
static

Definition at line 399 of file SDL_video.c.

400 {
402 
404  if (!data) {
405  return;
406  }
407  if (data->texture) {
408  SDL_DestroyTexture(data->texture);
409  }
410  if (data->renderer) {
411  SDL_DestroyRenderer(data->renderer);
412  }
413  SDL_free(data->pixels);
414  SDL_free(data);
415 }

References NULL, SDL_DestroyRenderer, SDL_DestroyTexture, SDL_free, SDL_SetWindowData(), and SDL_WINDOWTEXTUREDATA.

Referenced by SDL_VideoInit().

◆ SDL_DisableScreenSaver()

void SDL_DisableScreenSaver ( void  )

Prevent the screen from being blanked by a screensaver.

See also
SDL_IsScreenSaverEnabled()
SDL_EnableScreenSaver()

Definition at line 2816 of file SDL_video.c.

2817 {
2818  if (!_this) {
2819  return;
2820  }
2821  if (_this->suspend_screensaver) {
2822  return;
2823  }
2825  if (_this->SuspendScreenSaver) {
2827  }
2828 }

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 2801 of file SDL_video.c.

2802 {
2803  if (!_this) {
2804  return;
2805  }
2806  if (!_this->suspend_screensaver) {
2807  return;
2808  }
2810  if (_this->SuspendScreenSaver) {
2812  }
2813 }

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

Referenced by SDL_VideoQuit().

◆ SDL_FinishWindowCreation()

◆ 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 962 of file SDL_video.c.

965 {
966  SDL_VideoDisplay *display;
967 
968  CHECK_DISPLAY_INDEX(displayIndex, NULL);
969 
970  display = &_this->displays[displayIndex];
971  return SDL_GetClosestDisplayModeForDisplay(display, mode, closest);
972 }

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

◆ SDL_GetClosestDisplayModeForDisplay()

static SDL_DisplayMode* SDL_GetClosestDisplayModeForDisplay ( SDL_VideoDisplay display,
const SDL_DisplayMode mode,
SDL_DisplayMode closest 
)
static

Definition at line 855 of file SDL_video.c.

858 {
859  Uint32 target_format;
860  int target_refresh_rate;
861  int i;
862  SDL_DisplayMode *current, *match;
863 
864  if (!mode || !closest) {
865  SDL_SetError("Missing desired mode or closest mode parameter");
866  return NULL;
867  }
868 
869  /* Default to the desktop format */
870  if (mode->format) {
871  target_format = mode->format;
872  } else {
873  target_format = display->desktop_mode.format;
874  }
875 
876  /* Default to the desktop refresh rate */
877  if (mode->refresh_rate) {
878  target_refresh_rate = mode->refresh_rate;
879  } else {
880  target_refresh_rate = display->desktop_mode.refresh_rate;
881  }
882 
883  match = NULL;
884  for (i = 0; i < SDL_GetNumDisplayModesForDisplay(display); ++i) {
885  current = &display->display_modes[i];
886 
887  if (current->w && (current->w < mode->w)) {
888  /* Out of sorted modes large enough here */
889  break;
890  }
891  if (current->h && (current->h < mode->h)) {
892  if (current->w && (current->w == mode->w)) {
893  /* Out of sorted modes large enough here */
894  break;
895  }
896  /* Wider, but not tall enough, due to a different
897  aspect ratio. This mode must be skipped, but closer
898  modes may still follow. */
899  continue;
900  }
901  if (!match || current->w < match->w || current->h < match->h) {
902  match = current;
903  continue;
904  }
905  if (current->format != match->format) {
906  /* Sorted highest depth to lowest */
907  if (current->format == target_format ||
908  (SDL_BITSPERPIXEL(current->format) >=
909  SDL_BITSPERPIXEL(target_format)
910  && SDL_PIXELTYPE(current->format) ==
911  SDL_PIXELTYPE(target_format))) {
912  match = current;
913  }
914  continue;
915  }
916  if (current->refresh_rate != match->refresh_rate) {
917  /* Sorted highest refresh to lowest */
918  if (current->refresh_rate >= target_refresh_rate) {
919  match = current;
920  }
921  }
922  }
923  if (match) {
924  if (match->format) {
925  closest->format = match->format;
926  } else {
927  closest->format = mode->format;
928  }
929  if (match->w && match->h) {
930  closest->w = match->w;
931  closest->h = match->h;
932  } else {
933  closest->w = mode->w;
934  closest->h = mode->h;
935  }
936  if (match->refresh_rate) {
937  closest->refresh_rate = match->refresh_rate;
938  } else {
939  closest->refresh_rate = mode->refresh_rate;
940  }
941  closest->driverdata = match->driverdata;
942 
943  /*
944  * Pick some reasonable defaults if the app and driver don't
945  * care
946  */
947  if (!closest->format) {
948  closest->format = SDL_PIXELFORMAT_RGB888;
949  }
950  if (!closest->w) {
951  closest->w = 640;
952  }
953  if (!closest->h) {
954  closest->h = 480;
955  }
956  return closest;
957  }
958  return NULL;
959 }

References SDL_VideoDisplay::desktop_mode, SDL_VideoDisplay::display_modes, SDL_DisplayMode::driverdata, SDL_DisplayMode::format, SDL_DisplayMode::h, i, NULL, SDL_DisplayMode::refresh_rate, SDL_BITSPERPIXEL, SDL_GetNumDisplayModesForDisplay(), SDL_PIXELFORMAT_RGB888, SDL_PIXELTYPE, SDL_SetError, and SDL_DisplayMode::w.

Referenced by SDL_GetClosestDisplayMode(), SDL_GetWindowDisplayMode(), and SDL_SetDisplayModeForDisplay().

◆ SDL_GetCurrentDisplayMode()

int SDL_GetCurrentDisplayMode ( int  displayIndex,
SDL_DisplayMode mode 
)

Fill in information about the current display mode.

Definition at line 841 of file SDL_video.c.

842 {
843  SDL_VideoDisplay *display;
844 
845  CHECK_DISPLAY_INDEX(displayIndex, -1);
846 
847  display = &_this->displays[displayIndex];
848  if (mode) {
849  *mode = display->current_mode;
850  }
851  return 0;
852 }

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 576 of file SDL_video.c.

577 {
578  if (!_this) {
580  return NULL;
581  }
582  return _this->name;
583 }

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 827 of file SDL_video.c.

828 {
829  SDL_VideoDisplay *display;
830 
831  CHECK_DISPLAY_INDEX(displayIndex, -1);
832 
833  display = &_this->displays[displayIndex];
834  if (mode) {
835  *mode = display->desktop_mode;
836  }
837  return 0;
838 }

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

◆ SDL_GetDisplay()

SDL_VideoDisplay* SDL_GetDisplay ( int  displayIndex)

Definition at line 1024 of file SDL_video.c.

1025 {
1026  CHECK_DISPLAY_INDEX(displayIndex, NULL);
1027 
1028  return &_this->displays[displayIndex];
1029 }

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

◆ 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 676 of file SDL_video.c.

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

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 723 of file SDL_video.c.

724 {
725  SDL_VideoDisplay *display;
726 
727  CHECK_DISPLAY_INDEX(displayIndex, -1);
728 
729  display = &_this->displays[displayIndex];
730 
731  if (_this->GetDisplayDPI) {
732  if (_this->GetDisplayDPI(_this, display, ddpi, hdpi, vdpi) == 0) {
733  return 0;
734  }
735  } else {
736  return SDL_Unsupported();
737  }
738 
739  return -1;
740 }

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

◆ SDL_GetDisplayDriverData()

void* SDL_GetDisplayDriverData ( int  displayIndex)

Definition at line 660 of file SDL_video.c.

661 {
662  CHECK_DISPLAY_INDEX(displayIndex, NULL);
663 
664  return _this->displays[displayIndex].driverdata;
665 }

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

◆ SDL_GetDisplayForWindow()

SDL_VideoDisplay* SDL_GetDisplayForWindow ( SDL_Window window)

Definition at line 1092 of file SDL_video.c.

1093 {
1094  int displayIndex = SDL_GetWindowDisplayIndex(window);
1095  if (displayIndex >= 0) {
1096  return &_this->displays[displayIndex];
1097  } else {
1098  return NULL;
1099  }
1100 }

References _this, SDL_VideoDevice::displays, NULL, and SDL_GetWindowDisplayIndex().

Referenced by SDL_CreateWindow(), SDL_DestroyWindow(), SDL_GetWindowDisplayMode(), SDL_GetWindowPixelFormat(), SDL_SetWindowDisplayMode(), and SDL_UpdateFullscreenMode().

◆ 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 809 of file SDL_video.c.

810 {
811  SDL_VideoDisplay *display;
812 
813  CHECK_DISPLAY_INDEX(displayIndex, -1);
814 
815  display = &_this->displays[displayIndex];
817  return SDL_SetError("index must be in the range of 0 - %d",
818  SDL_GetNumDisplayModesForDisplay(display) - 1);
819  }
820  if (mode) {
821  *mode = display->display_modes[index];
822  }
823  return 0;
824 }

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 668 of file SDL_video.c.

669 {
670  CHECK_DISPLAY_INDEX(displayIndex, NULL);
671 
672  return _this->displays[displayIndex].name;
673 }

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 743 of file SDL_video.c.

744 {
745  SDL_VideoDisplay *display;
746 
748 
749  display = &_this->displays[displayIndex];
750  return display->orientation;
751 }

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 703 of file SDL_video.c.

704 {
705  CHECK_DISPLAY_INDEX(displayIndex, -1);
706 
707  if (rect) {
708  SDL_VideoDisplay *display = &_this->displays[displayIndex];
709 
711  if (_this->GetDisplayUsableBounds(_this, display, rect) == 0) {
712  return 0;
713  }
714  }
715 
716  /* Oh well, just give the entire display bounds. */
717  return SDL_GetDisplayBounds(displayIndex, rect);
718  }
719  return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */
720 }

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

◆ SDL_GetFocusWindow()

SDL_Window* SDL_GetFocusWindow ( void  )

Definition at line 2699 of file SDL_video.c.

2700 {
2701  SDL_Window *window;
2702 
2703  if (!_this) {
2704  return NULL;
2705  }
2706  for (window = _this->windows; window; window = window->next) {
2707  if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
2708  return window;
2709  }
2710  }
2711  return NULL;
2712 }

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

Referenced by SDL_PromptAssertion(), SDL_StartTextInput(), and SDL_StopTextInput().

◆ 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 2578 of file SDL_video.c.

2579 {
2581  return _this->grabbed_window;
2582 }

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

◆ SDL_GetIndexOfDisplay()

int SDL_GetIndexOfDisplay ( SDL_VideoDisplay display)

Definition at line 645 of file SDL_video.c.

646 {
647  int displayIndex;
648 
649  for (displayIndex = 0; displayIndex < _this->num_displays; ++displayIndex) {
650  if (display == &_this->displays[displayIndex]) {
651  return displayIndex;
652  }
653  }
654 
655  /* Couldn't find the display, just use index 0 */
656  return 0;
657 }

References _this, SDL_VideoDevice::displays, and SDL_VideoDevice::num_displays.

Referenced by SDL_CreateWindow(), and SDL_SendDisplayEvent().

◆ SDL_GetNumDisplayModes()

int SDL_GetNumDisplayModes ( int  displayIndex)

Returns the number of available display modes.

See also
SDL_GetDisplayMode()

Definition at line 801 of file SDL_video.c.

802 {
803  CHECK_DISPLAY_INDEX(displayIndex, -1);
804 
805  return SDL_GetNumDisplayModesForDisplay(&_this->displays[displayIndex]);
806 }

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

◆ SDL_GetNumDisplayModesForDisplay()

static int SDL_GetNumDisplayModesForDisplay ( SDL_VideoDisplay display)
static

◆ 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 446 of file SDL_video.c.

447 {
448  return SDL_arraysize(bootstrap) - 1;
449 }

References bootstrap, and SDL_arraysize.

Referenced by SDL_GetVideoDriver().

◆ SDL_GetVideoDevice()

◆ 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 2049 of file SDL_video.c.

2050 {
2051  int dummy = 0;
2052 
2053  if (!top) { top = &dummy; }
2054  if (!left) { left = &dummy; }
2055  if (!right) { right = &dummy; }
2056  if (!bottom) { bottom = &dummy; }
2057 
2058  /* Always initialize, so applications don't have to care */
2059  *top = *left = *bottom = *right = 0;
2060 
2062 
2063  if (!_this->GetWindowBordersSize) {
2064  return SDL_Unsupported();
2065  }
2066 
2068 }

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 2374 of file SDL_video.c.

2375 {
2377 
2378  return window->brightness;
2379 }

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 1846 of file SDL_video.c.

1847 {
1849 
1851 
1852  /* Input validation */
1853  if (name == NULL || name[0] == '\0') {
1854  SDL_InvalidParamError("name");
1855  return NULL;
1856  }
1857 
1858  for (data = window->data; data; data = data->next) {
1859  if (data->name && SDL_strcmp(data->name, name) == 0) {
1860  return data->data;
1861  }
1862  }
1863  return NULL;
1864 }

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 1032 of file SDL_video.c.

1033 {
1034  int displayIndex;
1035  int i, dist;
1036  int closest = -1;
1037  int closest_dist = 0x7FFFFFFF;
1038  SDL_Point center;
1039  SDL_Point delta;
1040  SDL_Rect rect;
1041 
1043 
1046  displayIndex = (window->x & 0xFFFF);
1047  if (displayIndex >= _this->num_displays) {
1048  displayIndex = 0;
1049  }
1050  return displayIndex;
1051  }
1054  displayIndex = (window->y & 0xFFFF);
1055  if (displayIndex >= _this->num_displays) {
1056  displayIndex = 0;
1057  }
1058  return displayIndex;
1059  }
1060 
1061  /* Find the display containing the window */
1062  for (i = 0; i < _this->num_displays; ++i) {
1063  SDL_VideoDisplay *display = &_this->displays[i];
1064 
1065  if (display->fullscreen_window == window) {
1066  return i;
1067  }
1068  }
1069  center.x = window->x + window->w / 2;
1070  center.y = window->y + window->h / 2;
1071  for (i = 0; i < _this->num_displays; ++i) {
1073  if (SDL_EnclosePoints(&center, 1, &rect, NULL)) {
1074  return i;
1075  }
1076 
1077  delta.x = center.x - (rect.x + rect.w / 2);
1078  delta.y = center.y - (rect.y + rect.h / 2);
1079  dist = (delta.x*delta.x + delta.y*delta.y);
1080  if (dist < closest_dist) {
1081  closest = i;
1082  closest_dist = dist;
1083  }
1084  }
1085  if (closest < 0) {
1086  SDL_SetError("Couldn't find any displays");
1087  }
1088  return closest;
1089 }

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 1123 of file SDL_video.c.

1124 {
1125  SDL_DisplayMode fullscreen_mode;
1126  SDL_VideoDisplay *display;
1127 
1129 
1130  if (!mode) {
1131  return SDL_InvalidParamError("mode");
1132  }
1133 
1134  fullscreen_mode = window->fullscreen_mode;
1135  if (!fullscreen_mode.w) {
1136  fullscreen_mode.w = window->windowed.w;
1137  }
1138  if (!fullscreen_mode.h) {
1139  fullscreen_mode.h = window->windowed.h;
1140  }
1141 
1142  display = SDL_GetDisplayForWindow(window);
1143 
1144  /* if in desktop size mode, just return the size of the desktop */
1146  fullscreen_mode = display->desktop_mode;
1148  &fullscreen_mode,
1149  &fullscreen_mode)) {
1150  return SDL_SetError("Couldn't find display mode match");
1151  }
1152 
1153  if (mode) {
1154  *mode = fullscreen_mode;
1155  }
1156  return 0;
1157 }

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 1744 of file SDL_video.c.

1745 {
1747 
1748  return window->flags;
1749 }

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 1728 of file SDL_video.c.

1729 {
1730  SDL_Window *window;
1731 
1732  if (!_this) {
1733  return NULL;
1734  }
1735  for (window = _this->windows; window; window = window->next) {
1736  if (window->id == id) {
1737  return window;
1738  }
1739  }
1740  return NULL;
1741 }

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 2478 of file SDL_video.c.

2481 {
2483 
2484  if (!window->gamma) {
2485  int i;
2486 
2487  window->gamma = (Uint16 *)SDL_malloc(256*6*sizeof(Uint16));
2488  if (!window->gamma) {
2489  return SDL_OutOfMemory();
2490  }
2491  window->saved_gamma = window->gamma + 3*256;
2492 
2493  if (_this->GetWindowGammaRamp) {
2494  if (_this->GetWindowGammaRamp(_this, window, window->gamma) < 0) {
2495  return -1;
2496  }
2497  } else {
2498  /* Create an identity gamma ramp */
2499  for (i = 0; i < 256; ++i) {
2500  Uint16 value = (Uint16)((i << 8) | i);
2501 
2502  window->gamma[0*256+i] = value;
2503  window->gamma[1*256+i] = value;
2504  window->gamma[2*256+i] = value;
2505  }
2506  }
2507  SDL_memcpy(window->saved_gamma, window->gamma, 3*256*sizeof(Uint16));
2508  }
2509 
2510  if (red) {
2511  SDL_memcpy(red, &window->gamma[0*256], 256*sizeof(Uint16));
2512  }
2513  if (green) {
2514  SDL_memcpy(green, &window->gamma[1*256], 256*sizeof(Uint16));
2515  }
2516  if (blue) {
2517  SDL_memcpy(blue, &window->gamma[2*256], 256*sizeof(Uint16));
2518  }
2519  return 0;
2520 }

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 2570 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 1720 of file SDL_video.c.

1721 {
1723 
1724  return window->id;
1725 }

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 2144 of file SDL_video.c.

2145 {
2147  if (max_w) {
2148  *max_w = window->max_w;
2149  }
2150  if (max_h) {
2151  *max_h = window->max_h;
2152  }
2153 }

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 2102 of file SDL_video.c.

2103 {
2105  if (min_w) {
2106  *min_w = window->min_w;
2107  }
2108  if (min_h) {
2109  *min_h = window->min_h;
2110  }
2111 }

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 2406 of file SDL_video.c.

2407 {
2409 
2410  if (out_opacity) {
2411  *out_opacity = window->opacity;
2412  }
2413 
2414  return 0;
2415 }

References CHECK_WINDOW_MAGIC.

◆ SDL_GetWindowPixelFormat()

Uint32 SDL_GetWindowPixelFormat ( SDL_Window window)

Get the pixel format associated with the window.

Definition at line 1160 of file SDL_video.c.

1161 {
1162  SDL_VideoDisplay *display;
1163 
1165 
1166  display = SDL_GetDisplayForWindow(window);
1167  return display->current_mode.format;
1168 }

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 1911 of file SDL_video.c.

1912 {
1914 
1915  /* Fullscreen windows are always at their display's origin */
1916  if (window->flags & SDL_WINDOW_FULLSCREEN) {
1917  int displayIndex;
1918 
1919  if (x) {
1920  *x = 0;
1921  }
1922  if (y) {
1923  *y = 0;
1924  }
1925 
1926  /* Find the window's monitor and update to the
1927  monitor offset. */
1928  displayIndex = SDL_GetWindowDisplayIndex(window);
1929  if (displayIndex >= 0) {
1930  SDL_Rect bounds;
1931 
1932  SDL_zero(bounds);
1933 
1934  SDL_GetDisplayBounds(displayIndex, &bounds);
1935  if (x) {
1936  *x = bounds.x;
1937  }
1938  if (y) {
1939  *y = bounds.y;
1940  }
1941  }
1942  } else {
1943  if (x) {
1944  *x = window->x;
1945  }
1946  if (y) {
1947  *y = window->y;
1948  }
1949  }
1950 }

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 2037 of file SDL_video.c.

2038 {
2040  if (w) {
2041  *w = window->w;
2042  }
2043  if (h) {
2044  *h = window->h;
2045  }
2046 }

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 2312 of file SDL_video.c.

2313 {
2315 
2316  if (!window->surface_valid) {
2317  if (window->surface) {
2318  window->surface->flags &= ~SDL_DONTFREE;
2319  SDL_FreeSurface(window->surface);
2320  }
2322  if (window->surface) {
2323  window->surface_valid = SDL_TRUE;
2324  window->surface->flags |= SDL_DONTFREE;
2325  }
2326  }
2327  return window->surface;
2328 }

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 1769 of file SDL_video.c.

1770 {
1772 
1773  return window->title ? window->title : "";
1774 }

References CHECK_WINDOW_MAGIC.

◆ SDL_GetWindowWMInfo()

SDL_bool SDL_GetWindowWMInfo ( SDL_Window window,
SDL_SysWMinfo info 
)

This function allows access to driver-dependent window information.

Parameters
windowThe window about which information is being requested
infoThis structure must be initialized with the SDL version, and is then filled in with information about the given window.
Returns
SDL_TRUE if the function is implemented and the version member of the info struct is valid, SDL_FALSE otherwise.

You typically use this function like this:

if ( SDL_GetWindowWMInfo(window, &info) ) { ... }

Definition at line 3740 of file SDL_video.c.

3741 {
3743 
3744  if (!info) {
3745  SDL_InvalidParamError("info");
3746  return SDL_FALSE;
3747  }
3748  info->subsystem = SDL_SYSWM_UNKNOWN;
3749 
3750  if (!_this->GetWindowWMInfo) {
3751  SDL_Unsupported();
3752  return SDL_FALSE;
3753  }
3754  return (_this->GetWindowWMInfo(_this, window, info));
3755 }

References _this, CHECK_WINDOW_MAGIC, SDL_VideoDevice::GetWindowWMInfo, SDL_FALSE, SDL_InvalidParamError, SDL_SYSWM_UNKNOWN, SDL_Unsupported, and SDL_SysWMinfo::subsystem.

Referenced by SDL_MessageboxValidForDriver().

◆ 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 3496 of file SDL_video.c.

3497 {
3500 
3501  if (!(window->flags & SDL_WINDOW_OPENGL)) {
3502  SDL_SetError("The specified window isn't an OpenGL window");
3503  return NULL;
3504  }
3505 
3507 
3508  /* Creating a context is assumed to make it current in the SDL driver. */
3509  if (ctx) {
3511  _this->current_glctx = ctx;
3514  }
3515  return ctx;
3516 }

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_DeduceMaxSupportedESProfile()

void SDL_GL_DeduceMaxSupportedESProfile ( int *  major,
int *  minor 
)

Definition at line 3047 of file SDL_video.c.

3048 {
3049 /* THIS REQUIRES AN EXISTING GL CONTEXT THAT HAS BEEN MADE CURRENT. */
3050 /* Please refer to https://bugzilla.libsdl.org/show_bug.cgi?id=3725 for discussion. */
3051 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
3052  /* XXX This is fragile; it will break in the event of release of
3053  * new versions of OpenGL ES.
3054  */
3055  if (SDL_GL_ExtensionSupported("GL_ARB_ES3_2_compatibility")) {
3056  *major = 3;
3057  *minor = 2;
3058  } else if (SDL_GL_ExtensionSupported("GL_ARB_ES3_1_compatibility")) {
3059  *major = 3;
3060  *minor = 1;
3061  } else if (SDL_GL_ExtensionSupported("GL_ARB_ES3_compatibility")) {
3062  *major = 3;
3063  *minor = 0;
3064  } else {
3065  *major = 2;
3066  *minor = 0;
3067  }
3068 #endif
3069 }

References SDL_GL_ExtensionSupported().

◆ SDL_GL_DeleteContext()

void SDL_GL_DeleteContext ( SDL_GLContext  context)

Delete an OpenGL context.

See also
SDL_GL_CreateContext()

Definition at line 3627 of file SDL_video.c.

3628 {
3629  if (!_this || !context) {
3630  return;
3631  }
3632 
3633  if (SDL_GL_GetCurrentContext() == context) {
3635  }
3636 
3638 }

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 2957 of file SDL_video.c.

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

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 3247 of file SDL_video.c.

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

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 3560 of file SDL_video.c.

3561 {
3562  if (!_this) {
3564  return NULL;
3565  }
3567 }

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 3550 of file SDL_video.c.

3551 {
3552  if (!_this) {
3554  return NULL;
3555  }
3557 }

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 3569 of file SDL_video.c.

3570 {
3572 
3573  if (_this->GL_GetDrawableSize) {
3575  } else {
3577  }
3578 }

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 2910 of file SDL_video.c.

2911 {
2912  void *func;
2913 
2914  if (!_this) {
2916  return NULL;
2917  }
2918  func = NULL;
2919  if (_this->GL_GetProcAddress) {
2920  if (_this->gl_config.driver_loaded) {
2921  func = _this->GL_GetProcAddress(_this, proc);
2922  } else {
2923  SDL_SetError("No GL driver has been loaded");
2924  }
2925  } else {
2926  SDL_SetError("No dynamic GL support in current SDL video driver (%s)", _this->name);
2927  }
2928  return func;
2929 }

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 3595 of file SDL_video.c.

3596 {
3597  if (!_this) {
3598  return 0;
3599  } else if (SDL_GL_GetCurrentContext() == NULL) {
3600  return 0;
3601  } else if (_this->GL_GetSwapInterval) {
3602  return _this->GL_GetSwapInterval(_this);
3603  } else {
3604  return 0;
3605  }
3606 }

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 2881 of file SDL_video.c.

2882 {
2883  int retval;
2884 
2885  if (!_this) {
2886  return SDL_UninitializedVideo();
2887  }
2888  if (_this->gl_config.driver_loaded) {
2889  if (path && SDL_strcmp(path, _this->gl_config.driver_path) != 0) {
2890  return SDL_SetError("OpenGL library already loaded");
2891  }
2892  retval = 0;
2893  } else {
2894  if (!_this->GL_LoadLibrary) {
2895  return SDL_SetError("No dynamic GL support in current SDL video driver (%s)", _this->name);
2896  }
2898  }
2899  if (retval == 0) {
2901  } else {
2902  if (_this->GL_UnloadLibrary) {
2904  }
2905  }
2906  return (retval);
2907 }

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 3519 of file SDL_video.c.

3520 {
3521  int retval;
3522 
3523  if (window == SDL_GL_GetCurrentWindow() &&
3525  /* We're already current. */
3526  return 0;
3527  }
3528 
3529  if (!ctx) {
3530  window = NULL;
3531  } else {
3533 
3534  if (!(window->flags & SDL_WINDOW_OPENGL)) {
3535  return SDL_SetError("The specified window isn't an OpenGL window");
3536  }
3537  }
3538 
3540  if (retval == 0) {
3542  _this->current_glctx = ctx;
3545  }
3546  return retval;
3547 }

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 ( )

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

Definition at line 3072 of file SDL_video.c.

3073 {
3074  if (!_this) {
3075  return;
3076  }
3077 
3078  _this->gl_config.red_size = 3;
3079  _this->gl_config.green_size = 3;
3080  _this->gl_config.blue_size = 2;
3081  _this->gl_config.alpha_size = 0;
3083  _this->gl_config.depth_size = 16;
3090  _this->gl_config.stereo = 0;
3094  _this->gl_config.accelerated = -1; /* accelerated or not, both are fine */
3095 
3100  } else {
3101 #if SDL_VIDEO_OPENGL
3105 #elif SDL_VIDEO_OPENGL_ES2
3109 #elif SDL_VIDEO_OPENGL_ES
3113 #endif
3114  }
3115 
3116  _this->gl_config.flags = 0;
3118  _this->gl_config.no_error = 0;
3121 
3123 }

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 3126 of file SDL_video.c.

3127 {
3128 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
3129  int retval;
3130 
3131  if (!_this) {
3132  return SDL_UninitializedVideo();
3133  }
3134  retval = 0;
3135  switch (attr) {
3136  case SDL_GL_RED_SIZE:
3138  break;
3139  case SDL_GL_GREEN_SIZE:
3141  break;
3142  case SDL_GL_BLUE_SIZE:
3144  break;
3145  case SDL_GL_ALPHA_SIZE:
3147  break;
3148  case SDL_GL_DOUBLEBUFFER:
3150  break;
3151  case SDL_GL_BUFFER_SIZE:
3153  break;
3154  case SDL_GL_DEPTH_SIZE:
3156  break;
3157  case SDL_GL_STENCIL_SIZE:
3159  break;
3160  case SDL_GL_ACCUM_RED_SIZE:
3162  break;
3165  break;
3168  break;
3171  break;
3172  case SDL_GL_STEREO:
3174  break;
3177  break;
3180  break;
3183  break;
3186  break;
3189  break;
3192  break;
3193  case SDL_GL_CONTEXT_EGL:
3194  /* FIXME: SDL_GL_CONTEXT_EGL to be deprecated in SDL 2.1 */
3195  if (value != 0) {
3197  } else {
3199  };
3200  break;
3201  case SDL_GL_CONTEXT_FLAGS:
3206  retval = SDL_SetError("Unknown OpenGL context flag %d", value);
3207  break;
3208  }
3210  break;
3212  if (value != 0 &&
3216  retval = SDL_SetError("Unknown OpenGL context profile %d", value);
3217  break;
3218  }
3220  break;
3223  break;
3226  break;
3229  break;
3232  break;
3235  break;
3236  default:
3237  retval = SDL_SetError("Unknown OpenGL attribute");
3238  break;
3239  }
3240  return retval;
3241 #else
3242  return SDL_Unsupported();
3243 #endif /* SDL_VIDEO_OPENGL */
3244 }

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 3581 of file SDL_video.c.

3582 {
3583  if (!_this) {
3584  return SDL_UninitializedVideo();
3585  } else if (SDL_GL_GetCurrentContext() == NULL) {
3586  return SDL_SetError("No OpenGL context has been made current");
3587  } else if (_this->GL_SetSwapInterval) {
3588  return _this->GL_SetSwapInterval(_this, interval);
3589  } else {
3590  return SDL_SetError("Setting the swap interval is not supported");
3591  }
3592 }

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 3609 of file SDL_video.c.

3610 {
3612 
3613  if (!(window->flags & SDL_WINDOW_OPENGL)) {
3614  SDL_SetError("The specified window isn't an OpenGL window");
3615  return;
3616  }
3617 
3618  if (SDL_GL_GetCurrentWindow() != window) {
3619  SDL_SetError("The specified window has not been made current");
3620  return;
3621  }
3622 
3624 }

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  )

Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().

See also
SDL_GL_LoadLibrary()

Definition at line 2932 of file SDL_video.c.

2933 {
2934  if (!_this) {
2936  return;
2937  }
2938  if (_this->gl_config.driver_loaded > 0) {
2939  if (--_this->gl_config.driver_loaded > 0) {
2940  return;
2941  }
2942  if (_this->GL_UnloadLibrary) {
2944  }
2945  }
2946 }

References _this, SDL_VideoDevice::driver_loaded, SDL_VideoDevice::gl_config, SDL_VideoDevice::GL_UnloadLibrary, and SDL_UninitializedVideo().

Referenced by SDL_DestroyWindow(), and SDL_RecreateWindow().

◆ SDL_HasScreenKeyboardSupport()

SDL_bool SDL_HasScreenKeyboardSupport ( void  )

Returns whether the platform has some screen keyboard support.

Returns
SDL_TRUE if some keyboard support is available else SDL_FALSE.
Note
Not all screen keyboard functions are supported on all platforms.
See also
SDL_IsScreenKeyboardShown()

Definition at line 3814 of file SDL_video.c.

3815 {
3818  }
3819  return SDL_FALSE;
3820 }

References _this, SDL_VideoDevice::HasScreenKeyboardSupport, and SDL_FALSE.

Referenced by SDL_VideoInit().

◆ SDL_HasWindows()

SDL_bool SDL_HasWindows ( void  )

Definition at line 1714 of file SDL_video.c.

1715 {
1716  return (_this && _this->windows != NULL);
1717 }

References _this, NULL, and SDL_VideoDevice::windows.

Referenced by SDL_PrivateJoystickShouldIgnoreEvent().

◆ SDL_HideWindow()

void SDL_HideWindow ( SDL_Window window)

Hide a window.

See also
SDL_ShowWindow()

Definition at line 2171 of file SDL_video.c.

2172 {
2174 
2175  if (!(window->flags & SDL_WINDOW_SHOWN)) {
2176  return;
2177  }
2178 
2179  window->is_hiding = SDL_TRUE;
2181 
2182  if (_this->HideWindow) {
2184  }
2185  window->is_hiding = SDL_FALSE;
2187 }

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_IsScreenKeyboardShown()

SDL_bool SDL_IsScreenKeyboardShown ( SDL_Window window)

Returns whether the screen keyboard is shown for given window.

Parameters
windowThe window for which screen keyboard should be queried.
Returns
SDL_TRUE if screen keyboard is shown else SDL_FALSE.
See also
SDL_HasScreenKeyboardSupport()

Definition at line 3823 of file SDL_video.c.

3824 {
3825  if (window && _this && _this->IsScreenKeyboardShown) {
3827  }
3828  return SDL_FALSE;
3829 }

References _this, SDL_VideoDevice::IsScreenKeyboardShown, and SDL_FALSE.

◆ 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 2792 of file SDL_video.c.

2793 {
2794  if (!_this) {
2795  return SDL_TRUE;
2796  }
2798 }

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

◆ SDL_IsTextInputActive()

SDL_bool SDL_IsTextInputActive ( void  )

Return whether or not Unicode text input events are enabled.

See also
SDL_StartTextInput()
SDL_StopTextInput()

Definition at line 3779 of file SDL_video.c.

3780 {
3782 }

References SDL_ENABLE, SDL_GetEventState, and SDL_TEXTINPUT.

◆ SDL_MaximizeWindow()

void SDL_MaximizeWindow ( SDL_Window window)

Make a window as large as possible.

See also
SDL_RestoreWindow()

Definition at line 2203 of file SDL_video.c.

2204 {
2206 
2207  if (window->flags & SDL_WINDOW_MAXIMIZED) {
2208  return;
2209  }
2210 
2211  /* !!! FIXME: should this check if the window is resizable? */
2212 
2213  if (_this->MaximizeWindow) {
2215  }
2216 }

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

Referenced by SDL_FinishWindowCreation().

◆ SDL_MessageboxValidForDriver()

static SDL_bool SDL_MessageboxValidForDriver ( const SDL_MessageBoxData messageboxdata,
SDL_SYSWM_TYPE  drivertype 
)
static

Definition at line 3852 of file SDL_video.c.

3853 {
3854  SDL_SysWMinfo info;
3855  SDL_Window *window = messageboxdata->window;
3856 
3857  if (!window) {
3858  return SDL_TRUE;
3859  }
3860 
3861  SDL_VERSION(&info.version);
3862  if (!SDL_GetWindowWMInfo(window, &info)) {
3863  return SDL_TRUE;
3864  } else {
3865  return (info.subsystem == drivertype);
3866  }
3867 }

References SDL_GetWindowWMInfo(), SDL_TRUE, SDL_VERSION, SDL_SysWMinfo::subsystem, SDL_SysWMinfo::version, and SDL_MessageBoxData::window.

Referenced by SDL_ShowMessageBox().

◆ SDL_MinimizeWindow()

void SDL_MinimizeWindow ( SDL_Window window)

Minimize a window to an iconic representation.

See also
SDL_RestoreWindow()

Definition at line 2228 of file SDL_video.c.

2229 {
2231 
2232  if (window->flags & SDL_WINDOW_MINIMIZED) {
2233  return;
2234  }
2235 
2236  if (!CanMinimizeWindow(window)) {
2237  return;
2238  }
2239 
2241 
2242  if (_this->MinimizeWindow) {
2244  }
2245 }

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_OnApplicationDidBecomeActive()

void SDL_OnApplicationDidBecomeActive ( void  )

◆ SDL_OnApplicationDidEnterBackground()

void SDL_OnApplicationDidEnterBackground ( void  )

Definition at line 4054 of file SDL_video.c.

4055 {
4057 }

References SDL_APP_DIDENTERBACKGROUND, and SDL_SendAppEvent().

◆ SDL_OnApplicationDidReceiveMemoryWarning()

void SDL_OnApplicationDidReceiveMemoryWarning ( void  )

Definition at line 4037 of file SDL_video.c.

4038 {
4040 }

References SDL_APP_LOWMEMORY, and SDL_SendAppEvent().

◆ SDL_OnApplicationWillEnterForeground()

void SDL_OnApplicationWillEnterForeground ( void  )

Definition at line 4059 of file SDL_video.c.

References SDL_APP_WILLENTERFOREGROUND, and SDL_SendAppEvent().

◆ SDL_OnApplicationWillResignActive()

◆ SDL_OnApplicationWillTerminate()

void SDL_OnApplicationWillTerminate ( void  )

Definition at line 4032 of file SDL_video.c.

4033 {
4035 }

References SDL_APP_TERMINATING, and SDL_SendAppEvent().

◆ SDL_OnWindowEnter()

void SDL_OnWindowEnter ( SDL_Window window)

Definition at line 2626 of file SDL_video.c.

2627 {
2628  if (_this->OnWindowEnter) {
2630  }
2631 }

References _this, and SDL_VideoDevice::OnWindowEnter.

Referenced by SDL_SendWindowEvent().

◆ SDL_OnWindowFocusGained()

void SDL_OnWindowFocusGained ( SDL_Window window)

Definition at line 2639 of file SDL_video.c.

2640 {
2641  SDL_Mouse *mouse = SDL_GetMouse();
2642 
2643  if (window->gamma && _this->SetWindowGammaRamp) {
2645  }
2646 
2647  if (mouse && mouse->relative_mode) {
2650  }
2651 
2653 }

References _this, SDL_Mouse::relative_mode, SDL_GetMouse(), SDL_SetMouseFocus(), SDL_UpdateWindowGrab(), SDL_WarpMouseInWindow, and SDL_VideoDevice::SetWindowGammaRamp.

Referenced by SDL_SendWindowEvent().

◆ SDL_OnWindowFocusLost()

void SDL_OnWindowFocusLost ( SDL_Window window)

Definition at line 2683 of file SDL_video.c.

2684 {
2685  if (window->gamma && _this->SetWindowGammaRamp) {
2686  _this->SetWindowGammaRamp(_this, window, window->saved_gamma);
2687  }
2688 
2690 
2693  }
2694 }

References _this, SDL_MinimizeWindow(), SDL_UpdateWindowGrab(), SDL_VideoDevice::SetWindowGammaRamp, and ShouldMinimizeOnFocusLoss().

Referenced by SDL_SendWindowEvent().

◆ SDL_OnWindowHidden()

void SDL_OnWindowHidden ( SDL_Window window)

Definition at line 2591 of file SDL_video.c.

2592 {
2594 }

References SDL_FALSE, and SDL_UpdateFullscreenMode().

Referenced by SDL_SendWindowEvent().

◆ SDL_OnWindowLeave()

void SDL_OnWindowLeave ( SDL_Window window)

Definition at line 2634 of file SDL_video.c.

2635 {
2636 }

Referenced by SDL_SendWindowEvent().

◆ SDL_OnWindowMinimized()

void SDL_OnWindowMinimized ( SDL_Window window)

Definition at line 2604 of file SDL_video.c.

2605 {
2607 }

References SDL_FALSE, and SDL_UpdateFullscreenMode().

Referenced by SDL_SendWindowEvent().

◆ SDL_OnWindowResized()

void SDL_OnWindowResized ( SDL_Window window)

◆ SDL_OnWindowRestored()

void SDL_OnWindowRestored ( SDL_Window window)

Definition at line 2610 of file SDL_video.c.

2611 {
2612  /*
2613  * FIXME: Is this fine to just remove this, or should it be preserved just
2614  * for the fullscreen case? In principle it seems like just hiding/showing
2615  * windows shouldn't affect the stacking order; maybe the right fix is to
2616  * re-decouple OnWindowShown and OnWindowRestored.
2617  */
2618  /*SDL_RaiseWindow(window);*/
2619 
2620  if (FULLSCREEN_VISIBLE(window)) {
2622  }
2623 }

References FULLSCREEN_VISIBLE, SDL_TRUE, and SDL_UpdateFullscreenMode().

Referenced by SDL_OnWindowShown(), and SDL_SendWindowEvent().

◆ SDL_OnWindowShown()

void SDL_OnWindowShown ( SDL_Window window)

Definition at line 2585 of file SDL_video.c.

2586 {
2588 }

References SDL_OnWindowRestored().

Referenced by SDL_SendWindowEvent().

◆ SDL_RaiseWindow()

void SDL_RaiseWindow ( SDL_Window window)

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

Definition at line 2190 of file SDL_video.c.

2191 {
2193 
2194  if (!(window->flags & SDL_WINDOW_SHOWN)) {
2195  return;
2196  }
2197  if (_this->RaiseWindow) {
2199  }
2200 }

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

Referenced by SDL_ShowMessageBox().

◆ SDL_RecreateWindow()

int SDL_RecreateWindow ( SDL_Window window,
Uint32  flags 
)

Definition at line 1617 of file SDL_video.c.

1618 {
1619  SDL_bool loaded_opengl = SDL_FALSE;
1620 
1622  return SDL_SetError("OpenGL support is either not configured in SDL "
1623  "or not available in current SDL video driver "
1624  "(%s) or platform", _this->name);
1625  }
1626 
1627  if (window->flags & SDL_WINDOW_FOREIGN) {
1628  /* Can't destroy and re-create foreign windows, hrm */
1630  } else {
1632  }
1633 
1634  /* Restore video mode, etc. */
1636 
1637  /* Tear down the old native window */
1638  if (window->surface) {
1639  window->surface->flags &= ~SDL_DONTFREE;
1640  SDL_FreeSurface(window->surface);
1641  window->surface = NULL;
1642  window->surface_valid = SDL_FALSE;
1643  }
1646  }
1649  }
1650 
1651  if ((window->flags & SDL_WINDOW_OPENGL) != (flags & SDL_WINDOW_OPENGL)) {
1652  if (flags & SDL_WINDOW_OPENGL) {
1653  if (SDL_GL_LoadLibrary(NULL) < 0) {
1654  return -1;
1655  }
1656  loaded_opengl = SDL_TRUE;
1657  } else {
1659  }
1660  } else if (window->flags & SDL_WINDOW_OPENGL) {
1662  if (SDL_GL_LoadLibrary(NULL) < 0) {
1663  return -1;
1664  }
1665  loaded_opengl = SDL_TRUE;
1666  }
1667 
1668  if ((window->flags & SDL_WINDOW_VULKAN) != (flags & SDL_WINDOW_VULKAN)) {
1669  SDL_SetError("Can't change SDL_WINDOW_VULKAN window flag");
1670  return -1;
1671  }
1672 
1673  if ((window->flags & SDL_WINDOW_VULKAN) && (flags & SDL_WINDOW_OPENGL)) {
1674  SDL_SetError("Vulkan and OpenGL not supported on same window");
1675  return -1;
1676  }
1677 
1678  window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
1679  window->last_fullscreen_flags = window->flags;
1680  window->is_destroying = SDL_FALSE;
1681 
1683  if (_this->CreateSDLWindow(_this, window) < 0) {
1684  if (loaded_opengl) {
1686  window->flags &= ~SDL_WINDOW_OPENGL;
1687  }
1688  return -1;
1689  }
1690  }
1691 
1692  if (flags & SDL_WINDOW_FOREIGN) {
1693  window->flags |= SDL_WINDOW_FOREIGN;
1694  }
1695 
1696  if (_this->SetWindowTitle && window->title) {
1698  }
1699 
1700  if (_this->SetWindowIcon && window->icon) {
1702  }
1703 
1704  if (window->hit_test) {
1706  }
1707 
1709 
1710  return 0;
1711 }

References _this, CREATE_FLAGS, SDL_VideoDevice::CreateSDLWindow, SDL_VideoDevice::DestroyWindow, SDL_VideoDevice::DestroyWindowFramebuffer, SDL_VideoDevice::GL_CreateContext, SDL_VideoDevice::name, NULL, SDL_DONTFREE, SDL_FALSE, SDL_FinishWindowCreation(), SDL_FreeSurface, SDL_GL_LoadLibrary(), SDL_GL_UnloadLibrary(), SDL_HideWindow(), SDL_SetError, SDL_TRUE, SDL_WINDOW_FOREIGN, SDL_WINDOW_HIDDEN, SDL_WINDOW_OPENGL, SDL_WINDOW_VULKAN, SDL_VideoDevice::SetWindowHitTest, SDL_VideoDevice::SetWindowIcon, and SDL_VideoDevice::SetWindowTitle.

◆ SDL_RestoreMousePosition()

static void SDL_RestoreMousePosition ( SDL_Window window)
static

Definition at line 1171 of file SDL_video.c.

1172 {
1173  int x, y;
1174 
1175  if (window == SDL_GetMouseFocus()) {
1176  SDL_GetMouseState(&x, &y);
1178  }
1179 }

References SDL_GetMouseFocus, SDL_GetMouseState, and SDL_WarpMouseInWindow.

Referenced by SDL_UpdateFullscreenMode().

◆ 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 2248 of file SDL_video.c.

2249 {
2251 
2252  if (!(window->flags & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED))) {
2253  return;
2254  }
2255 
2256  if (_this->RestoreWindow) {
2258  }
2259 }

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

◆ SDL_SetDisplayModeForDisplay()

static int SDL_SetDisplayModeForDisplay ( SDL_VideoDisplay display,
const SDL_DisplayMode mode 
)
static

Definition at line 975 of file SDL_video.c.

976 {
977  SDL_DisplayMode display_mode;
978  SDL_DisplayMode current_mode;
979 
980  if (mode) {
981  display_mode = *mode;
982 
983  /* Default to the current mode */
984  if (!display_mode.format) {
985  display_mode.format = display->current_mode.format;
986  }
987  if (!display_mode.w) {
988  display_mode.w = display->current_mode.w;
989  }
990  if (!display_mode.h) {
991  display_mode.h = display->current_mode.h;
992  }
993  if (!display_mode.refresh_rate) {
994  display_mode.refresh_rate = display->current_mode.refresh_rate;
995  }
996 
997  /* Get a good video mode, the closest one possible */
998  if (!SDL_GetClosestDisplayModeForDisplay(display, &display_mode, &display_mode)) {
999  return SDL_SetError("No video mode large enough for %dx%d",
1000  display_mode.w, display_mode.h);
1001  }
1002  } else {
1003  display_mode = display->desktop_mode;
1004  }
1005 
1006  /* See if there's anything left to do */
1007  current_mode = display->current_mode;
1008  if (SDL_memcmp(&display_mode, &current_mode, sizeof(display_mode)) == 0) {
1009  return 0;
1010  }
1011 
1012  /* Actually change the display mode */
1013  if (!_this->SetDisplayMode) {
1014  return SDL_SetError("SDL video driver doesn't support changing display mode");
1015  }
1016  if (_this->SetDisplayMode(_this, display, &display_mode) < 0) {
1017  return -1;
1018  }
1019  display->current_mode = display_mode;
1020  return 0;
1021 }

References _this, SDL_VideoDisplay::current_mode, SDL_VideoDisplay::desktop_mode, SDL_DisplayMode::format, SDL_DisplayMode::h, SDL_DisplayMode::refresh_rate, SDL_GetClosestDisplayModeForDisplay(), SDL_memcmp, SDL_SetError, SDL_VideoDevice::SetDisplayMode, and SDL_DisplayMode::w.

Referenced by SDL_SetWindowDisplayMode(), and SDL_UpdateFullscreenMode().

◆ SDL_SetTextInputRect()

void SDL_SetTextInputRect ( SDL_Rect rect)

Set the rectangle used to type Unicode text inputs. This is used as a hint for IME and on-screen keyboard placement.

See also
SDL_StartTextInput()

Definition at line 3806 of file SDL_video.c.

3807 {
3808  if (_this && _this->SetTextInputRect) {
3810  }
3811 }

References _this, rect, and SDL_VideoDevice::SetTextInputRect.

◆ 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 1953 of file SDL_video.c.

1954 {
1956  if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
1957  const int want = (bordered != SDL_FALSE); /* normalize the flag. */
1958  const int have = ((window->flags & SDL_WINDOW_BORDERLESS) == 0);
1959  if ((want != have) && (_this->SetWindowBordered)) {
1960  if (want) {
1961  window->flags &= ~SDL_WINDOW_BORDERLESS;
1962  } else {
1963  window->flags |= SDL_WINDOW_BORDERLESS;
1964  }
1966  }
1967  }
1968 }

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 2358 of file SDL_video.c.

2359 {
2360  Uint16 ramp[256];
2361  int status;
2362 
2364 
2365  SDL_CalculateGammaRamp(brightness, ramp);
2366  status = SDL_SetWindowGammaRamp(window, ramp, ramp, ramp);
2367  if (status == 0) {
2368  window->brightness = brightness;
2369  }
2370  return status;
2371 }

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 1799 of file SDL_video.c.

1800 {
1801  SDL_WindowUserData *prev, *data;
1802 
1804 
1805  /* Input validation */
1806  if (name == NULL || name[0] == '\0') {
1807  SDL_InvalidParamError("name");
1808  return NULL;
1809  }
1810 
1811  /* See if the named data already exists */
1812  prev = NULL;
1813  for (data = window->data; data; prev = data, data = data->next) {
1814  if (data->name && SDL_strcmp(data->name, name) == 0) {
1815  void *last_value = data->data;
1816 
1817  if (userdata) {
1818  /* Set the new value */
1819  data->data = userdata;
1820  } else {
1821  /* Delete this value */
1822  if (prev) {
1823  prev->next = data->next;
1824  } else {
1825  window->data = data->next;
1826  }
1827  SDL_free(data->name);
1828  SDL_free(data);
1829  }
1830  return last_value;
1831  }
1832  }
1833 
1834  /* Add new data to the window */
1835  if (userdata) {
1836  data = (SDL_WindowUserData *)SDL_malloc(sizeof(*data));
1837  data->name = SDL_strdup(name);
1838  data->data = userdata;
1839  data->next = window->data;
1840  window->data = data;
1841  }
1842  return NULL;
1843 }

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 1103 of file SDL_video.c.

1104 {
1106 
1107  if (mode) {
1108  window->fullscreen_mode = *mode;
1109  } else {
1110  SDL_zero(window->fullscreen_mode);
1111  }
1112 
1114  SDL_DisplayMode fullscreen_mode;
1115  if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) {
1117  }
1118  }
1119  return 0;
1120 }

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 2262 of file SDL_video.c.

2263 {
2264  Uint32 oldflags;
2266 
2268 
2269  if (flags == (window->flags & FULLSCREEN_MASK)) {
2270  return 0;
2271  }
2272 
2273  /* clear the previous flags and OR in the new ones */
2274  oldflags = window->flags & FULLSCREEN_MASK;
2275  window->flags &= ~FULLSCREEN_MASK;
2276  window->flags |= flags;
2277 
2279  return 0;
2280  }
2281 
2282  window->flags &= ~FULLSCREEN_MASK;
2283  window->flags |= oldflags;
2284  return -1;
2285 }

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 2444 of file SDL_video.c.

2447 {
2449 
2450  if (!_this->SetWindowGammaRamp) {
2451  return SDL_Unsupported();
2452  }
2453 
2454  if (!window->gamma) {
2455  if (SDL_GetWindowGammaRamp(window, NULL, NULL, NULL) < 0) {
2456  return -1;
2457  }
2458  SDL_assert(window->gamma != NULL);
2459  }
2460 
2461  if (red) {
2462  SDL_memcpy(&window->gamma[0*256], red, 256*sizeof(Uint16));
2463  }
2464  if (green) {
2465  SDL_memcpy(&window->gamma[1*256], green, 256*sizeof(Uint16));
2466  }
2467  if (blue) {
2468  SDL_memcpy(&window->gamma[2*256], blue, 256*sizeof(Uint16));
2469  }
2470  if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
2471  return _this->SetWindowGammaRamp(_this, window, window->gamma);
2472  } else {
2473  return 0;
2474  }
2475 }

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 2554 of file SDL_video.c.

2555 {
2557 
2558  if (!!grabbed == !!(window->flags & SDL_WINDOW_INPUT_GRABBED)) {
2559  return;
2560  }
2561  if (grabbed) {
2562  window->flags |= SDL_WINDOW_INPUT_GRABBED;
2563  } else {
2564  window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
2565  }
2567 }

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 4001 of file SDL_video.c.

4002 {
4004 
4005  if (!_this->SetWindowHitTest) {
4006  return SDL_Unsupported();
4007  } else if (_this->SetWindowHitTest(window, callback != NULL) == -1) {
4008  return -1;
4009  }
4010 
4011  window->hit_test = callback;
4012  window->hit_test_data = userdata;
4013 
4014  return 0;
4015 }

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 1777 of file SDL_video.c.

1778 {
1780 
1781  if (!icon) {
1782  return;
1783  }
1784 
1785  SDL_FreeSurface(window->icon);
1786 
1787  /* Convert the icon into ARGB8888 */
1789  if (!window->icon) {
1790  return;
1791  }
1792 
1793  if (_this->SetWindowIcon) {
1795  }
1796 }

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 2431 of file SDL_video.c.

2432 {
2434 
2435  if (!_this->SetWindowInputFocus) {
2436  return SDL_Unsupported();
2437  }
2438 
2440 }

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 2114 of file SDL_video.c.

2115 {
2117  if (max_w <= 0) {
2118  SDL_InvalidParamError("max_w");
2119  return;
2120  }
2121  if (max_h <= 0) {
2122  SDL_InvalidParamError("max_h");
2123  return;
2124  }
2125 
2126  if (max_w <= window->min_w || max_h <= window->min_h) {
2127  SDL_SetError("SDL_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size");
2128  return;
2129  }
2130 
2131  window->max_w = max_w;
2132  window->max_h = max_h;
2133 
2134  if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
2135  if (_this->SetWindowMaximumSize) {
2137  }
2138  /* Ensure that window is not larger than maximal size */
2139  SDL_SetWindowSize(window, SDL_min(window->w, window->max_w), SDL_min(window->h, window->max_h));
2140  }
2141 }

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 2071 of file SDL_video.c.

2072 {
2074  if (min_w <= 0) {
2075  SDL_InvalidParamError("min_w");
2076  return;
2077  }
2078  if (min_h <= 0) {
2079  SDL_InvalidParamError("min_h");
2080  return;
2081  }
2082 
2083  if ((window->max_w && min_w >= window->max_w) ||
2084  (window->max_h && min_h >= window->max_h)) {
2085  SDL_SetError("SDL_SetWindowMinimumSize(): Tried to set minimum size larger than maximum size");
2086  return;
2087  }
2088 
2089  window->min_w = min_w;
2090  window->min_h = min_h;
2091 
2092  if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
2093  if (_this->SetWindowMinimumSize) {
2095  }
2096  /* Ensure that window is not smaller than minimal size */
2097  SDL_SetWindowSize(window, SDL_max(window->w, window->min_w), SDL_max(window->h, window->min_h));
2098  }
2099 }

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 2418 of file SDL_video.c.

2419 {
2420  CHECK_WINDOW_MAGIC(modal_window, -1);
2421  CHECK_WINDOW_MAGIC(parent_window, -1);
2422 
2423  if (!_this->SetWindowModalFor) {
2424  return SDL_Unsupported();
2425  }
2426 
2427  return _this->SetWindowModalFor(_this, modal_window, parent_window);
2428 }

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 2382 of file SDL_video.c.

2383 {
2384  int retval;
2386 
2387  if (!_this->SetWindowOpacity) {
2388  return SDL_Unsupported();
2389  }
2390 
2391  if (opacity < 0.0f) {
2392  opacity = 0.0f;
2393  } else if (opacity > 1.0f) {
2394  opacity = 1.0f;
2395  }
2396 
2397  retval = _this->SetWindowOpacity(_this, window, opacity);
2398  if (retval == 0) {
2399  window->opacity = opacity;
2400  }
2401 
2402  return retval;
2403 }

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 1867 of file SDL_video.c.

1868 {
1870 
1872  int displayIndex = (x & 0xFFFF);
1873  SDL_Rect bounds;
1874  if (displayIndex >= _this->num_displays) {
1875  displayIndex = 0;
1876  }
1877 
1878  SDL_zero(bounds);
1879 
1880  SDL_GetDisplayBounds(displayIndex, &bounds);
1881  if (SDL_WINDOWPOS_ISCENTERED(x)) {
1882  x = bounds.x + (bounds.w - window->w) / 2;
1883  }
1884  if (SDL_WINDOWPOS_ISCENTERED(y)) {
1885  y = bounds.y + (bounds.h - window->h) / 2;
1886  }
1887  }
1888 
1889  if ((window->flags & SDL_WINDOW_FULLSCREEN)) {
1890  if (!SDL_WINDOWPOS_ISUNDEFINED(x)) {
1891  window->windowed.x = x;
1892  }
1893  if (!SDL_WINDOWPOS_ISUNDEFINED(y)) {
1894  window->windowed.y = y;
1895  }
1896  } else {
1897  if (!SDL_WINDOWPOS_ISUNDEFINED(x)) {
1898  window->x = x;
1899  }
1900  if (!SDL_WINDOWPOS_ISUNDEFINED(y)) {
1901  window->y = y;
1902  }
1903 
1904  if (_this->SetWindowPosition) {
1906  }
1907  }
1908 }

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 1971 of file SDL_video.c.

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

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 1989 of file SDL_video.c.

1990 {
1992  if (w <= 0) {
1993  SDL_InvalidParamError("w");
1994  return;
1995  }
1996  if (h <= 0) {
1997  SDL_InvalidParamError("h");
1998  return;
1999  }
2000 
2001  /* Make sure we don't exceed any window size limits */
2002  if (window->min_w && w < window->min_w) {
2003  w = window->min_w;
2004  }
2005  if (window->max_w && w > window->max_w) {
2006  w = window->max_w;
2007  }
2008  if (window->min_h && h < window->min_h) {
2009  h = window->min_h;
2010  }
2011  if (window->max_h && h > window->max_h) {
2012  h = window->max_h;
2013  }
2014 
2015  window->windowed.w = w;
2016  window->windowed.h = h;
2017 
2018  if (window->flags & SDL_WINDOW_FULLSCREEN) {
2020  window->last_fullscreen_flags = 0;
2022  }
2023  } else {
2024  window->w = w;
2025  window->h = h;
2026  if (_this->SetWindowSize) {
2028  }
2029  if (window->w == w && window->h == h) {
2030  /* We didn't get a SDL_WINDOWEVENT_RESIZED event (by design) */
2032  }
2033  }
2034 }

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 1752 of file SDL_video.c.

1753 {
1755 
1756  if (title == window->title) {
1757  return;
1758  }
1759  SDL_free(window->title);
1760 
1761  window->title = SDL_strdup(title ? title : "");
1762 
1763  if (_this->SetWindowTitle) {
1765  }
1766 }

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

Referenced by SDL_CreateWindow().

◆ SDL_ShouldAllowTopmost()

SDL_bool SDL_ShouldAllowTopmost ( void  )

Definition at line 3995 of file SDL_video.c.

3996 {
3998 }

References SDL_GetHintBoolean, SDL_HINT_ALLOW_TOPMOST, and SDL_TRUE.

◆ SDL_ShowMessageBox()

int SDL_ShowMessageBox ( const SDL_MessageBoxData messageboxdata,
int *  buttonid 
)

Create a modal message box.

Parameters
messageboxdataThe SDL_MessageBoxData structure with title, text, etc.
buttonidThe pointer to which user id of hit button should be copied.
Returns
-1 on error, otherwise 0 and buttonid contains user id of button hit or -1 if dialog was closed.
Note
This function should be called on the thread that created the parent window, or on the main thread if the messagebox has no parent. It will block execution of that thread until the user clicks a button or closes the messagebox.

Definition at line 3871 of file SDL_video.c.

3872 {
3873  int dummybutton;
3874  int retval = -1;
3875  SDL_bool relative_mode;
3876  int show_cursor_prev;
3877  SDL_bool mouse_captured;
3878  SDL_Window *current_window;
3879 
3880  if (!messageboxdata) {
3881  return SDL_InvalidParamError("messageboxdata");
3882  } else if (messageboxdata->numbuttons < 0) {
3883  return SDL_SetError("Invalid number of buttons");
3884  }
3885 
3886  current_window = SDL_GetKeyboardFocus();
3887  mouse_captured = current_window && ((SDL_GetWindowFlags(current_window) & SDL_WINDOW_MOUSE_CAPTURE) != 0);
3888  relative_mode = SDL_GetRelativeMouseMode();
3891  show_cursor_prev = SDL_ShowCursor(1);
3893 
3894  if (!buttonid) {
3895  buttonid = &dummybutton;
3896  }
3897 
3898  if (_this && _this->ShowMessageBox) {
3899  retval = _this->ShowMessageBox(_this, messageboxdata, buttonid);
3900  }
3901 
3902  /* It's completely fine to call this function before video is initialized */
3903 #if SDL_VIDEO_DRIVER_ANDROID
3904  if (retval == -1 &&
3905  Android_ShowMessageBox(messageboxdata, buttonid) == 0) {
3906  retval = 0;
3907  }
3908 #endif
3909 #if SDL_VIDEO_DRIVER_WINDOWS
3910  if (retval == -1 &&
3912  WIN_ShowMessageBox(messageboxdata, buttonid) == 0) {
3913  retval = 0;
3914  }
3915 #endif
3916 #if SDL_VIDEO_DRIVER_WINRT
3917  if (retval == -1 &&
3918  SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WINRT) &&
3919  WINRT_ShowMessageBox(messageboxdata, buttonid) == 0) {
3920  retval = 0;
3921  }
3922 #endif
3923 #if SDL_VIDEO_DRIVER_COCOA
3924  if (retval == -1 &&
3925  SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_COCOA) &&
3926  Cocoa_ShowMessageBox(messageboxdata, buttonid) == 0) {
3927  retval = 0;
3928  }
3929 #endif
3930 #if SDL_VIDEO_DRIVER_UIKIT
3931  if (retval == -1 &&
3932  SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_UIKIT) &&
3933  UIKit_ShowMessageBox(messageboxdata, buttonid) == 0) {
3934  retval = 0;
3935  }
3936 #endif
3937 #if SDL_VIDEO_DRIVER_X11
3938  if (retval == -1 &&
3939  SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_X11) &&
3940  X11_ShowMessageBox(messageboxdata, buttonid) == 0) {
3941  retval = 0;
3942  }
3943 #endif
3944  if (retval == -1) {
3945  SDL_SetError("No message system available");
3946  }
3947 
3948  if (current_window) {
3949  SDL_RaiseWindow(current_window);
3950  if (mouse_captured) {
3952  }
3953  }
3954 
3955  SDL_ShowCursor(show_cursor_prev);
3956  SDL_SetRelativeMouseMode(relative_mode);
3957 
3958  return retval;
3959 }

References _this, SDL_MessageBoxData::numbuttons, retval, SDL_CaptureMouse, SDL_FALSE, SDL_GetKeyboardFocus, SDL_GetRelativeMouseMode, SDL_GetWindowFlags(), SDL_InvalidParamError, SDL_MessageboxValidForDriver(), SDL_RaiseWindow(), SDL_ResetKeyboard(), SDL_SetError, SDL_SetRelativeMouseMode, SDL_ShowCursor, SDL_SYSWM_COCOA, SDL_SYSWM_UIKIT, SDL_SYSWM_WINDOWS, SDL_SYSWM_WINRT, SDL_SYSWM_X11, SDL_TRUE, SDL_WINDOW_MOUSE_CAPTURE, and SDL_VideoDevice::ShowMessageBox.

Referenced by SDL_ShowSimpleMessageBox().

◆ SDL_ShowSimpleMessageBox()

int SDL_ShowSimpleMessageBox ( Uint32  flags,
const char *  title,
const char *  message,
SDL_Window window 
)

Create a simple modal message box.

Parameters
flagsSDL_MessageBoxFlags
titleUTF-8 title text
messageUTF-8 message text
windowThe parent window, or NULL for no parent
Returns
0 on success, -1 on error
See also
SDL_ShowMessageBox

Definition at line 3962 of file SDL_video.c.

3963 {
3964 #ifdef __EMSCRIPTEN__
3965  /* !!! FIXME: propose a browser API for this, get this #ifdef out of here? */
3966  /* Web browsers don't (currently) have an API for a custom message box
3967  that can block, but for the most common case (SDL_ShowSimpleMessageBox),
3968  we can use the standard Javascript alert() function. */
3969  EM_ASM_({
3970  alert(UTF8ToString($0) + "\n\n" + UTF8ToString($1));
3971  }, title, message);
3972  return 0;
3973 #else
3976 
3977  SDL_zero(data);
3978  data.flags = flags;
3979  data.title = title;
3980  data.message = message;
3981  data.numbuttons = 1;
3982  data.buttons = &button;
3983  data.window = window;
3984 
3985  SDL_zero(button);
3988  button.text = "OK";
3989 
3990  return SDL_ShowMessageBox(&data, NULL);
3991 #endif
3992 }

References button, NULL, SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, SDL_ShowMessageBox(), and SDL_zero.

◆ SDL_ShowWindow()

void SDL_ShowWindow ( SDL_Window window)

Show a window.

See also
SDL_HideWindow()

Definition at line 2156 of file SDL_video.c.

2157 {
2159 
2160  if (window->flags & SDL_WINDOW_SHOWN) {
2161  return;
2162  }
2163 
2164  if (_this->ShowWindow) {
2166  }
2168 }

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

Referenced by SDL_FinishWindowCreation().

◆ SDL_StartTextInput()

void SDL_StartTextInput ( void  )

Start accepting Unicode text input events. This function will show the on-screen keyboard if supported.

See also
SDL_StopTextInput()
SDL_SetTextInputRect()
SDL_HasScreenKeyboardSupport()

Definition at line 3758 of file SDL_video.c.

3759 {
3760  SDL_Window *window;
3761 
3762  /* First, enable text events */
3765 
3766  /* Then show the on-screen keyboard, if any */
3768  if (window && _this && _this->ShowScreenKeyboard) {
3770  }
3771 
3772  /* Finally start the text input system */
3773  if (_this && _this->StartTextInput) {
3775  }
3776 }

References _this, SDL_ENABLE, SDL_EventState, SDL_GetFocusWindow(), SDL_TEXTEDITING, SDL_TEXTINPUT, SDL_VideoDevice::ShowScreenKeyboard, and SDL_VideoDevice::StartTextInput.

Referenced by SDL_VideoInit().

◆ SDL_StopTextInput()

void SDL_StopTextInput ( void  )

Stop receiving any text input events. This function will hide the on-screen keyboard if supported.

See also
SDL_StartTextInput()
SDL_HasScreenKeyboardSupport()

Definition at line 3785 of file SDL_video.c.

3786 {
3787  SDL_Window *window;
3788 
3789  /* Stop the text input system */
3790  if (_this && _this->StopTextInput) {
3792  }
3793 
3794  /* Hide the on-screen keyboard, if any */
3796  if (window && _this && _this->HideScreenKeyboard) {
3798  }
3799 
3800  /* Finally disable text events */
3803 }

References _this, SDL_VideoDevice::HideScreenKeyboard, SDL_DISABLE, SDL_EventState, SDL_GetFocusWindow(), SDL_TEXTEDITING, SDL_TEXTINPUT, and SDL_VideoDevice::StopTextInput.

◆ SDL_ToggleDragAndDropSupport()

void SDL_ToggleDragAndDropSupport ( void  )

Definition at line 1374 of file SDL_video.c.

1375 {
1376  if (_this && _this->AcceptDragAndDrop) {
1378  SDL_Window *window;
1379  for (window = _this->windows; window; window = window->next) {
1381  }
1382  }
1383 }

References _this, SDL_VideoDevice::AcceptDragAndDrop, IsAcceptingDragAndDrop(), SDL_Window::next, and SDL_VideoDevice::windows.

Referenced by SDL_EventState().

◆ SDL_UninitializedVideo()

◆ SDL_UpdateFullscreenMode()

static int SDL_UpdateFullscreenMode ( SDL_Window window,
SDL_bool  fullscreen 
)
static

Definition at line 1186 of file SDL_video.c.

1187 {
1188  SDL_VideoDisplay *display;
1189  SDL_Window *other;
1190 
1192 
1193  /* if we are in the process of hiding don't go back to fullscreen */
1194  if (window->is_hiding && fullscreen) {
1195  return 0;
1196  }
1197 
1198 #ifdef __MACOSX__
1199  /* if the window is going away and no resolution change is necessary,
1200  do nothing, or else we may trigger an ugly double-transition
1201  */
1202  if (SDL_strcmp(_this->name, "cocoa") == 0) { /* don't do this for X11, etc */
1203  if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)
1204  return 0;
1205 
1206  /* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */
1207  if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) {
1208  if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) {
1209  return -1;
1210  }
1211  } else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) {
1212  display = SDL_GetDisplayForWindow(window);
1214  if (_this->SetWindowFullscreen) {
1216  }
1217  }
1218 
1219  if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
1220  if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) {
1221  return -1;
1222  }
1223  window->last_fullscreen_flags = window->flags;
1224  return 0;
1225  }
1226  }
1227 #elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
1228  /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen
1229  or not. The user can choose this, via OS-provided UI, but this can't
1230  be set programmatically.
1231 
1232  Just look at what SDL's WinRT video backend code detected with regards
1233  to fullscreen (being active, or not), and figure out a return/error code
1234  from that.
1235  */
1236  if (fullscreen == !(WINRT_DetectWindowFlags(window) & FULLSCREEN_MASK)) {
1237  /* Uh oh, either:
1238  1. fullscreen was requested, and we're already windowed
1239  2. windowed-mode was requested, and we're already fullscreen
1240 
1241  WinRT 8.x can't resolve either programmatically, so we're
1242  giving up.
1243  */
1244  return -1;
1245  } else {
1246  /* Whatever was requested, fullscreen or windowed mode, is already
1247  in-place.
1248  */
1249  return 0;
1250  }
1251 #endif
1252 
1253  display = SDL_GetDisplayForWindow(window);
1254 
1255  if (fullscreen) {
1256  /* Hide any other fullscreen windows */
1257  if (display->fullscreen_window &&
1258  display->fullscreen_window != window) {
1260  }
1261  }
1262 
1263  /* See if anything needs to be done now */
1264  if ((display->fullscreen_window == window) == fullscreen) {
1265  if ((window->last_fullscreen_flags & FULLSCREEN_MASK) == (window->flags & FULLSCREEN_MASK)) {
1266  return 0;
1267  }
1268  }
1269 
1270  /* See if there are any fullscreen windows */
1271  for (other = _this->windows; other; other = other->next) {
1272  SDL_bool setDisplayMode = SDL_FALSE;
1273 
1274  if (other == window) {
1275  setDisplayMode = fullscreen;
1276  } else if (FULLSCREEN_VISIBLE(other) &&
1277  SDL_GetDisplayForWindow(other) == display) {
1278  setDisplayMode = SDL_TRUE;
1279  }
1280 
1281  if (setDisplayMode) {
1282  SDL_DisplayMode fullscreen_mode;
1283 
1284  SDL_zero(fullscreen_mode);
1285 
1286  if (SDL_GetWindowDisplayMode(other, &fullscreen_mode) == 0) {
1287  SDL_bool resized = SDL_TRUE;
1288 
1289  if (other->w == fullscreen_mode.w && other->h == fullscreen_mode.h) {
1290  resized = SDL_FALSE;
1291  }
1292 
1293  /* only do the mode change if we want exclusive fullscreen */
1295  if (SDL_SetDisplayModeForDisplay(display, &fullscreen_mode) < 0) {
1296  return -1;
1297  }
1298  } else {
1299  if (SDL_SetDisplayModeForDisplay(display, NULL) < 0) {
1300  return -1;
1301  }
1302  }
1303 
1304  if (_this->SetWindowFullscreen) {
1305  _this->SetWindowFullscreen(_this, other, display, SDL_TRUE);
1306  }
1307  display->fullscreen_window = other;
1308 
1309  /* Generate a mode change event here */
1310  if (resized) {
1311 #ifndef ANDROID
1312  // Android may not resize the window to exactly what our fullscreen mode is, especially on
1313  // windowed Android environments like the Chromebook or Samsung DeX. Given this, we shouldn't
1314  // use fullscreen_mode.w and fullscreen_mode.h, but rather get our current native size. As such,
1315  // Android's SetWindowFullscreen will generate the window event for us with the proper final size.
1316 
1318  fullscreen_mode.w, fullscreen_mode.h);
1319 #endif
1320  } else {
1321  SDL_OnWindowResized(other);
1322  }
1323 
1324  SDL_RestoreMousePosition(other);
1325 
1326  window->last_fullscreen_flags = window->flags;
1327  return 0;
1328  }
1329  }
1330  }
1331 
1332  /* Nope, restore the desktop mode */
1334 
1335  if (_this->SetWindowFullscreen) {
1337  }
1338  display->fullscreen_window = NULL;
1339 
1340  /* Generate a mode change event here */
1342 
1343  /* Restore the cursor position */
1345 
1346  window->last_fullscreen_flags = window->flags;
1347  return 0;
1348 }

References _this, CHECK_WINDOW_MAGIC, FULLSCREEN_MASK, FULLSCREEN_VISIBLE, SDL_VideoDisplay::fullscreen_window, SDL_DisplayMode::h, SDL_Window::h, SDL_VideoDevice::name, SDL_Window::next, NULL, SDL_FALSE, SDL_GetDisplayForWindow(), SDL_GetWindowDisplayMode(), SDL_MinimizeWindow(), SDL_OnWindowResized(), SDL_RestoreMousePosition(), SDL_SendWindowEvent(), SDL_SetDisplayModeForDisplay(), SDL_strcmp, SDL_TRUE, SDL_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN_DESKTOP, SDL_WINDOWEVENT_RESIZED, SDL_zero, SDL_VideoDevice::SetWindowFullscreen, SDL_DisplayMode::w, SDL_Window::w, SDL_VideoDevice::windows, and WINRT_DetectWindowFlags().

Referenced by SDL_CreateWindow(), SDL_HideWindow(), SDL_MinimizeWindow(), SDL_OnWindowHidden(), SDL_OnWindowMinimized(), SDL_OnWindowRestored(), SDL_SetWindowFullscreen(), and SDL_SetWindowSize().

◆ SDL_UpdateWindowGrab()

void SDL_UpdateWindowGrab ( SDL_Window window)

Definition at line 2523 of file SDL_video.c.

2524 {
2525  SDL_Window *grabbed_window;
2526  SDL_bool grabbed;
2527  if ((SDL_GetMouse()->relative_mode || (window->flags & SDL_WINDOW_INPUT_GRABBED)) &&
2528  (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
2529  grabbed = SDL_TRUE;
2530  } else {
2531  grabbed = SDL_FALSE;
2532  }
2533 
2534  grabbed_window = _this->grabbed_window;
2535  if (grabbed) {
2536  if (grabbed_window && (grabbed_window != window)) {
2537  /* stealing a grab from another window! */
2538  grabbed_window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
2539  if (_this->SetWindowGrab) {
2540  _this->SetWindowGrab(_this, grabbed_window, SDL_FALSE);
2541  }
2542  }
2544  } else if (grabbed_window == window) {
2545  _this->grabbed_window = NULL; /* ungrabbing. */
2546  }
2547 
2548  if (_this->SetWindowGrab) {
2549  _this->SetWindowGrab(_this, window, grabbed);
2550  }
2551 }

References _this, SDL_Window::flags, SDL_VideoDevice::grabbed_window, NULL, SDL_FALSE, SDL_GetMouse(), SDL_TRUE, SDL_WINDOW_INPUT_FOCUS, SDL_WINDOW_INPUT_GRABBED, and SDL_VideoDevice::SetWindowGrab.

Referenced by SDL_OnWindowFocusGained(), SDL_OnWindowFocusLost(), SDL_SetRelativeMouseMode(), and SDL_SetWindowGrab().

◆ 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 2331 of file SDL_video.c.

2332 {
2333  SDL_Rect full_rect;
2334 
2336 
2337  full_rect.x = 0;
2338  full_rect.y = 0;
2339  full_rect.w = window->w;
2340  full_rect.h = window->h;
2341  return SDL_UpdateWindowSurfaceRects(window, &full_rect, 1);
2342 }

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 2345 of file SDL_video.c.

2347 {
2349 
2350  if (!window->surface_valid) {
2351  return SDL_SetError("Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface");
2352  }
2353 
2354  return _this->UpdateWindowFramebuffer(_this, window, rects, numrects);
2355 }

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

Referenced by SDL_UpdateWindowSurface().

◆ SDL_UpdateWindowTexture()

static int SDL_UpdateWindowTexture ( SDL_VideoDevice unused,
SDL_Window window,
const SDL_Rect rects,
int  numrects 
)
static

Definition at line 369 of file SDL_video.c.

370 {
372  SDL_Rect rect;
373  void *src;
374 
376  if (!data || !data->texture) {
377  return SDL_SetError("No window texture data");
378  }
379 
380  /* Update a single rect that contains subrects for best DMA performance */
381  if (SDL_GetSpanEnclosingRect(window->w, window->h, numrects, rects, &rect)) {
382  src = (void *)((Uint8 *)data->pixels +
383  rect.y * data->pitch +
384  rect.x * data->bytes_per_pixel);
385  if (SDL_UpdateTexture(data->texture, &rect, src, data->pitch) < 0) {
386  return -1;
387  }
388 
389  if (SDL_RenderCopy(data->renderer, data->texture, NULL, NULL) < 0) {
390  return -1;
391  }
392 
393  SDL_RenderPresent(data->renderer);
394  }
395  return 0;
396 }

References NULL, rect, SDL_GetSpanEnclosingRect(), SDL_GetWindowData(), SDL_RenderCopy, SDL_RenderPresent, SDL_SetError, SDL_UpdateTexture, SDL_WINDOWTEXTUREDATA, SDL_Rect::x, and SDL_Rect::y.

Referenced by SDL_VideoInit().

◆ 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 2831 of file SDL_video.c.

2832 {
2833  int i, j;
2834 
2835  if (!_this) {
2836  return;
2837  }
2838 
2839  /* Halt event processing before doing anything else */
2840  SDL_TouchQuit();
2841  SDL_MouseQuit();
2842  SDL_KeyboardQuit();
2844 
2846 
2847  /* Clean up the system video */
2848  while (_this->windows) {
2850  }
2851  _this->VideoQuit(_this);
2852 
2853  for (i = 0; i < _this->num_displays; ++i) {
2854  SDL_VideoDisplay *display = &_this->displays[i];
2855  for (j = display->num_display_modes; j--;) {
2856  SDL_free(display->display_modes[j].driverdata);
2857  display->display_modes[j].driverdata = NULL;
2858  }
2859  SDL_free(display->display_modes);
2860  display->display_modes = NULL;
2861  SDL_free(display->desktop_mode.driverdata);
2862  display->desktop_mode.driverdata = NULL;
2863  SDL_free(display->driverdata);
2864  display->driverdata = NULL;
2865  }
2866  if (_this->displays) {
2867  for (i = 0; i < _this->num_displays; ++i) {
2869  }
2871  _this->displays = NULL;
2872  _this->num_displays = 0;
2873  }
2876  _this->free(_this);
2877  _this = NULL;
2878 }

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_Vulkan_CreateSurface()

SDL_bool SDL_Vulkan_CreateSurface ( SDL_Window window,
VkInstance  instance,
VkSurfaceKHR *  surface 
)

Create a Vulkan rendering surface for a window.

Parameters
[in]windowSDL_Window to which to attach the rendering surface.
[in]instancehandle to the Vulkan instance to use.
[out]surfacepointer to a VkSurfaceKHR handle to receive the handle of the newly created surface.
Returns
SDL_TRUE on success, SDL_FALSE on error.
VkInstance instance;
// create instance and window
// create the Vulkan surface
VkSurfaceKHR surface;
handle_error();
Note
window should have been created with the SDL_WINDOW_VULKAN flag.
instance should have been created with the extensions returned by SDL_Vulkan_CreateSurface() enabled.
See also
SDL_Vulkan_GetInstanceExtensions()

Definition at line 4154 of file SDL_video.c.

4157 {
4159 
4160  if (!(window->flags & SDL_WINDOW_VULKAN)) {
4162  return SDL_FALSE;
4163  }
4164 
4165  if (!instance) {
4166  SDL_InvalidParamError("instance");
4167  return SDL_FALSE;
4168  }
4169 
4170  if (!surface) {
4171  SDL_InvalidParamError("surface");
4172  return SDL_FALSE;
4173  }
4174 
4175  return _this->Vulkan_CreateSurface(_this, window, instance, surface);
4176 }

References _this, CHECK_WINDOW_MAGIC, NOT_A_VULKAN_WINDOW, SDL_FALSE, SDL_InvalidParamError, SDL_SetError, SDL_WINDOW_VULKAN, and SDL_VideoDevice::Vulkan_CreateSurface.

◆ SDL_Vulkan_GetDrawableSize()

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

Get the size of a window's underlying drawable in pixels (for use with setting viewport, scissor & etc).

Parameters
windowSDL_Window 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.

Note
On macOS high-DPI support must be enabled for an application by setting NSHighResolutionCapable to true in its Info.plist.
See also
SDL_GetWindowSize()
SDL_CreateWindow()

Definition at line 4178 of file SDL_video.c.

4179 {
4181 
4184  } else {
4186  }
4187 }

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

◆ SDL_Vulkan_GetInstanceExtensions()

SDL_bool SDL_Vulkan_GetInstanceExtensions ( SDL_Window window,
unsigned *  count,
const char **  names 
)

Definition at line 4134 of file SDL_video.c.

4135 {
4136  if (window) {
4138 
4139  if (!(window->flags & SDL_WINDOW_VULKAN))
4140  {
4142  return SDL_FALSE;
4143  }
4144  }
4145 
4146  if (!count) {
4147  SDL_InvalidParamError("count");
4148  return SDL_FALSE;
4149  }
4150 
4152 }

References _this, CHECK_WINDOW_MAGIC, NOT_A_VULKAN_WINDOW, SDL_FALSE, SDL_InvalidParamError, SDL_SetError, SDL_WINDOW_VULKAN, and SDL_VideoDevice::Vulkan_GetInstanceExtensions.

◆ SDL_Vulkan_GetVkGetInstanceProcAddr()

void* SDL_Vulkan_GetVkGetInstanceProcAddr ( void  )

Get the address of the vkGetInstanceProcAddr function.

Note
This should be called after either calling SDL_Vulkan_LoadLibrary or creating an SDL_Window with the SDL_WINDOW_VULKAN flag.

Definition at line 4105 of file SDL_video.c.

4106 {
4107  if (!_this) {
4109  return NULL;
4110  }
4112  SDL_SetError("No Vulkan loader has been loaded");
4113  return NULL;
4114  }
4116 }

References _this, SDL_VideoDevice::loader_loaded, NULL, SDL_SetError, SDL_UninitializedVideo(), SDL_VideoDevice::vkGetInstanceProcAddr, and SDL_VideoDevice::vulkan_config.

◆ SDL_Vulkan_LoadLibrary()

int SDL_Vulkan_LoadLibrary ( const char *  path)

Dynamically load a Vulkan loader library.

Parameters
[in]pathThe platform dependent Vulkan loader library name, or NULL.
Returns
0 on success, or -1 if the library couldn't be loaded.

If path is NULL SDL will use the value of the environment variable SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan loader library.

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

Note
It is fairly common for Vulkan applications to link with libvulkan instead of explicitly loading it at run time. This will work with SDL provided the application links to a dynamic library and both it and SDL use the same search path.
If you specify a non-NULL path, an application should retrieve all of the Vulkan functions it uses from the dynamic library using SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee path points to the same vulkan loader library the application linked to.
On Apple devices, if path is NULL, SDL will attempt to find the vkGetInstanceProcAddr address within all the mach-o images of the current process. This is because it is fairly common for Vulkan applications to link with libvulkan (and historically MoltenVK was provided as a static library). If it is not found then, on macOS, SDL will attempt to load vulkan.framework/vulkan, libvulkan.1.dylib, followed by libvulkan.dylib, in that order. On iOS SDL will attempt to load libvulkan.dylib only. Applications using a dynamic framework or .dylib must ensure it is included in its application bundle.
On non-Apple devices, application linking with a static libvulkan is not supported. Either do not link to the Vulkan loader or link to a dynamic library version.
This function will fail if there are no working Vulkan drivers installed.
See also
SDL_Vulkan_GetVkGetInstanceProcAddr()
SDL_Vulkan_UnloadLibrary()

Definition at line 4079 of file SDL_video.c.

4080 {
4081  int retval;
4082  if (!_this) {
4084  return -1;
4085  }
4088  return SDL_SetError("Vulkan loader library already loaded");
4089  }
4090  retval = 0;
4091  } else {
4092  if (!_this->Vulkan_LoadLibrary) {
4093  return SDL_SetError("Vulkan support is either not configured in SDL "
4094  "or not available in current SDL video driver "
4095  "(%s) or platform", _this->name);
4096  }
4098  }
4099  if (retval == 0) {
4101  }
4102  return retval;
4103 }

References _this, SDL_VideoDevice::loader_loaded, SDL_VideoDevice::loader_path, SDL_VideoDevice::name, retval, SDL_SetError, SDL_strcmp, SDL_UninitializedVideo(), SDL_VideoDevice::vulkan_config, and SDL_VideoDevice::Vulkan_LoadLibrary.

Referenced by SDL_CreateWindow().

◆ SDL_Vulkan_UnloadLibrary()

void SDL_Vulkan_UnloadLibrary ( void  )

Unload the Vulkan loader library previously loaded by SDL_Vulkan_LoadLibrary().

See also
SDL_Vulkan_LoadLibrary()

Definition at line 4118 of file SDL_video.c.

4119 {
4120  if (!_this) {
4122  return;
4123  }
4124  if (_this->vulkan_config.loader_loaded > 0) {
4125  if (--_this->vulkan_config.loader_loaded > 0) {
4126  return;
4127  }
4128  if (_this->Vulkan_UnloadLibrary) {
4130  }
4131  }
4132 }

References _this, SDL_VideoDevice::loader_loaded, SDL_UninitializedVideo(), SDL_VideoDevice::vulkan_config, and SDL_VideoDevice::Vulkan_UnloadLibrary.

Referenced by SDL_DestroyWindow().

◆ ShouldMinimizeOnFocusLoss()

static SDL_bool ShouldMinimizeOnFocusLoss ( SDL_Window window)
static

Definition at line 2656 of file SDL_video.c.

2657 {
2658  if (!(window->flags & SDL_WINDOW_FULLSCREEN) || window->is_destroying) {
2659  return SDL_FALSE;
2660  }
2661 
2662 #ifdef __MACOSX__
2663  if (SDL_strcmp(_this->name, "cocoa") == 0) { /* don't do this for X11, etc */
2664  if (Cocoa_IsWindowInFullscreenSpace(window)) {
2665  return SDL_FALSE;
2666  }
2667  }
2668 #endif
2669 
2670 #ifdef __ANDROID__
2671  {
2674  return SDL_FALSE;
2675  }
2676  }
2677 #endif
2678 
2680 }

References _this, Android_JNI_ShouldMinimizeOnFocusLoss(), SDL_VideoDevice::name, SDL_FALSE, SDL_GetHintBoolean, SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, SDL_strcmp, SDL_TRUE, and SDL_WINDOW_FULLSCREEN.

Referenced by SDL_OnWindowFocusLost().

◆ ShouldUseTextureFramebuffer()

static SDL_bool ShouldUseTextureFramebuffer ( )
static

Definition at line 169 of file SDL_video.c.

170 {
171  const char *hint;
172 
173  /* If there's no native framebuffer support then there's no option */
175  return SDL_TRUE;
176  }
177 
178  /* If this is the dummy driver there is no texture support */
179  if (_this->is_dummy) {
180  return SDL_FALSE;
181  }
182 
183  /* If the user has specified a software renderer we can't use a
184  texture framebuffer, or renderer creation will go recursive.
185  */
187  if (hint && SDL_strcasecmp(hint, "software") == 0) {
188  return SDL_FALSE;
189  }
190 
191  /* See if the user or application wants a specific behavior */
193  if (hint) {
194  if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) {
195  return SDL_FALSE;
196  } else {
197  return SDL_TRUE;
198  }
199  }
200 
201  /* Each platform has different performance characteristics */
202 #if defined(__WIN32__)
203  /* GDI BitBlt() is way faster than Direct3D dynamic textures right now.
204  */
205  return SDL_FALSE;
206 
207 #elif defined(__MACOSX__)
208  /* Mac OS X uses OpenGL as the native fast path (for cocoa and X11) */
209  return SDL_TRUE;
210 
211 #elif defined(__LINUX__)
212  /* Properly configured OpenGL drivers are faster than MIT-SHM */
213 #if SDL_VIDEO_OPENGL
214  /* Ugh, find a way to cache this value! */
215  {
218  SDL_bool hasAcceleratedOpenGL = SDL_FALSE;
219 
220  window = SDL_CreateWindow("OpenGL test", -32, -32, 32, 32, SDL_WINDOW_OPENGL|SDL_WINDOW_HIDDEN);
221  if (window) {
223  if (context) {
224  const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
225  const char *vendor = NULL;
226 
227  glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
228  if (glGetStringFunc) {
229  vendor = (const char *) glGetStringFunc(GL_VENDOR);
230  }
231  /* Add more vendors here at will... */
232  if (vendor &&
233  (SDL_strstr(vendor, "ATI Technologies") ||
234  SDL_strstr(vendor, "NVIDIA"))) {
235  hasAcceleratedOpenGL = SDL_TRUE;
236  }
238  }
240  }
241  return hasAcceleratedOpenGL;
242  }
243 #elif SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
244  /* Let's be optimistic about this! */
245  return SDL_TRUE;
246 #else
247  return SDL_FALSE;
248 #endif
249 
250 #else
251  /* Play it safe, assume that if there is a framebuffer driver that it's
252  optimized for the current platform.
253  */
254  return SDL_FALSE;
255 #endif
256 }

References _this, APIENTRY, context, SDL_VideoDevice::CreateWindowFramebuffer, GL_VENDOR, SDL_VideoDevice::is_dummy, NULL, SDL_CreateWindow(), SDL_DestroyWindow(), SDL_FALSE, SDL_GetHint, SDL_GL_CreateContext(), SDL_GL_DeleteContext(), SDL_GL_GetProcAddress(), SDL_HINT_FRAMEBUFFER_ACCELERATION, SDL_HINT_RENDER_DRIVER, SDL_strcasecmp, SDL_strstr, SDL_TRUE, SDL_WINDOW_HIDDEN, and SDL_WINDOW_OPENGL.

Referenced by SDL_VideoInit().

Variable Documentation

◆ _this

SDL_VideoDevice* _this = NULL
static

Definition at line 121 of file SDL_video.c.

Referenced by CanMinimizeWindow(), PrepareDragAndDropSupport(), SDL_AddVideoDisplay(), SDL_CreateWindow(), SDL_CreateWindowFramebuffer(), SDL_CreateWindowFrom(), SDL_DestroyWindow(), SDL_DisableScreenSaver(), SDL_EnableScreenSaver(), SDL_GetClipboardText(), SDL_GetClosestDisplayMode(), SDL_GetCurrentDisplayMode(), SDL_GetCurrentVideoDriver(), SDL_GetDesktopDisplayMode(), SDL_GetDisplay(), SDL_GetDisplayBounds(), SDL_GetDisplayDPI(), SDL_GetDisplayDriverData(), SDL_GetDisplayForWindow(), SDL_GetDisplayMode(), SDL_GetDisplayName(), SDL_GetDisplayOrientation(), SDL_GetDisplayUsableBounds(), SDL_GetFocusWindow(), SDL_GetGrabbedWindow(), SDL_GetIndexOfDisplay(), SDL_GetNumDisplayModes(), SDL_GetNumDisplayModesForDisplay(), SDL_GetNumVideoDisplays(), SDL_GetVideoDevice(), SDL_GetWindowBordersSize(), SDL_GetWindowDisplayIndex(), SDL_GetWindowFromID(), SDL_GetWindowGammaRamp(), SDL_GetWindowGrab(), SDL_GetWindowWMInfo(), SDL_GL_CreateContext(), SDL_GL_DeleteContext(), SDL_GL_GetAttribute(), SDL_GL_GetCurrentContext(), SDL_GL_GetCurrentWindow(), SDL_GL_GetDrawableSize(), SDL_GL_GetProcAddress(), SDL_GL_GetSwapInterval(), SDL_GL_LoadLibrary(), SDL_GL_MakeCurrent(), SDL_GL_ResetAttributes(), SDL_GL_SetAttribute(), SDL_GL_SetSwapInterval(), SDL_GL_SwapWindow(), SDL_GL_UnloadLibrary(), SDL_HasClipboardText(), SDL_HasScreenKeyboardSupport(), SDL_HasWindows(), SDL_HideWindow(), SDL_IsScreenKeyboardShown(), SDL_IsScreenSaverEnabled(), SDL_MaximizeWindow(), SDL_MinimizeWindow(), SDL_OnApplicationDidBecomeActive(), SDL_OnApplicationWillResignActive(), SDL_OnWindowEnter(), SDL_OnWindowFocusGained(), SDL_OnWindowFocusLost(), SDL_PumpEvents(), SDL_RaiseWindow(), SDL_RecreateWindow(), SDL_RestoreWindow(), SDL_SetClipboardText(), SDL_SetDisplayModeForDisplay(), SDL_SetTextInputRect(), SDL_SetWindowBordered(), SDL_SetWindowGammaRamp(), SDL_SetWindowHitTest(), SDL_SetWindowIcon(), SDL_SetWindowInputFocus(), SDL_SetWindowMaximumSize(), SDL_SetWindowMinimumSize(), SDL_SetWindowModalFor(), SDL_SetWindowOpacity(), SDL_SetWindowPosition(), SDL_SetWindowResizable(), SDL_SetWindowSize(), SDL_SetWindowTitle(), SDL_ShowMessageBox(), SDL_ShowWindow(), SDL_StartTextInput(), SDL_StopTextInput(), SDL_ToggleDragAndDropSupport(), SDL_UpdateFullscreenMode(), SDL_UpdateWindowGrab(), SDL_UpdateWindowSurfaceRects(), SDL_VideoInit(), SDL_VideoQuit(), SDL_Vulkan_CreateSurface(), SDL_Vulkan_GetDrawableSize(), SDL_Vulkan_GetInstanceExtensions(), SDL_Vulkan_GetVkGetInstanceProcAddr(), SDL_Vulkan_LoadLibrary(), SDL_Vulkan_UnloadLibrary(), ShouldMinimizeOnFocusLoss(), ShouldUseTextureFramebuffer(), and videoInit().

◆ bootstrap

VideoBootStrap* bootstrap[]
static

Definition at line 60 of file SDL_video.c.

Referenced by SDL_GetNumVideoDrivers(), SDL_GetVideoDriver(), and SDL_VideoInit().

SDL_VideoDevice::CreateSDLWindow
int(* CreateSDLWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:211
SDL_SYSWM_UNKNOWN
@ SDL_SYSWM_UNKNOWN
Definition: SDL_syswm.h:121
SDL_GetMouse
SDL_Mouse * SDL_GetMouse(void)
Definition: SDL_mouse.c:178
SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:416
SDL_WINDOW_MOUSE_CAPTURE
@ SDL_WINDOW_MOUSE_CAPTURE
Definition: SDL_video.h:116
format
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: SDL_opengl.h:1572
SDL_GetMouseState
#define SDL_GetMouseState
Definition: SDL_dynapi_overrides.h:246
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:2288
SDL_BITSPERPIXEL
#define SDL_BITSPERPIXEL(X)
Definition: SDL_pixels.h:127
GL_EXTENSIONS
#define GL_EXTENSIONS
Definition: SDL_opengl.h:716
SDL_VideoDevice::SetWindowPosition
void(* SetWindowPosition)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:215
SDL_RenderPresent
#define SDL_RenderPresent
Definition: SDL_dynapi_overrides.h:346
SDL_VideoDisplay::display_modes
SDL_DisplayMode * display_modes
Definition: SDL_sysvideo.h:130
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
SDL_DisableScreenSaver
void SDL_DisableScreenSaver()
Prevent the screen from being blanked by a screensaver.
Definition: SDL_video.c:2816
SDL_DisplayMode::format
Uint32 format
Definition: SDL_video.h:55
SDL_WINDOW_ALLOW_HIGHDPI
@ SDL_WINDOW_ALLOW_HIGHDPI
Definition: SDL_video.h:113
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:3072
SDL_GL_RETAINED_BACKING
@ SDL_GL_RETAINED_BACKING
Definition: SDL_video.h:216
SDL_VideoDevice::clipboard_text
char * clipboard_text
Definition: SDL_sysvideo.h:321
SDL_APP_TERMINATING
@ SDL_APP_TERMINATING
Definition: SDL_events.h:63
SDL_VideoDevice::SuspendScreenSaver
void(* SuspendScreenSaver)(_THIS)
Definition: SDL_sysvideo.h:284
SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
@ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
Definition: SDL_messagebox.h:50
right
GLdouble GLdouble right
Definition: SDL_opengl_glext.h:6103
SDL_SYSWM_WINRT
@ SDL_SYSWM_WINRT
Definition: SDL_syswm.h:129
SDL_VideoDisplay::name
char * name
Definition: SDL_sysvideo.h:127
SDL_VideoDevice::vkGetInstanceProcAddr
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr
Definition: SDL_sysvideo.h:372
SDL_APP_DIDENTERBACKGROUND
@ SDL_APP_DIDENTERBACKGROUND
Definition: SDL_events.h:75
SDL_APP_DIDENTERFOREGROUND
@ SDL_APP_DIDENTERFOREGROUND
Definition: SDL_events.h:83
target
GLenum target
Definition: SDL_opengl_glext.h:1551
SDL_VideoDevice::Vulkan_LoadLibrary
int(* Vulkan_LoadLibrary)(_THIS, const char *path)
Definition: SDL_sysvideo.h:271
SDL_GetFocusWindow
SDL_Window * SDL_GetFocusWindow(void)
Definition: SDL_video.c:2699
SDL_ConvertSurfaceFormat
#define SDL_ConvertSurfaceFormat
Definition: SDL_dynapi_overrides.h:464
SDL_RenderSetViewport
#define SDL_RenderSetViewport
Definition: SDL_dynapi_overrides.h:324
SDL_VideoDevice::current_glwin_tls
SDL_TLSID current_glwin_tls
Definition: SDL_sysvideo.h:365
SDL_WINDOW_MINIMIZED
@ SDL_WINDOW_MINIMIZED
Definition: SDL_video.h:106
SDL_VideoDevice::SetWindowModalFor
int(* SetWindowModalFor)(_THIS, SDL_Window *modal_window, SDL_Window *parent_window)
Definition: SDL_sysvideo.h:221
SDL_VideoQuit
void SDL_VideoQuit(void)
Shuts down the video subsystem.
Definition: SDL_video.c:2831
SDL_VideoDevice::retained_backing
int retained_backing
Definition: SDL_sysvideo.h:352
SDL_VideoDevice::OnWindowEnter
void(* OnWindowEnter)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:239
SDL_ShowWindow
void SDL_ShowWindow(SDL_Window *window)
Show a window.
Definition: SDL_video.c:2156
SDL_PIXELFORMAT_RGB888
@ SDL_PIXELFORMAT_RGB888
Definition: SDL_pixels.h:236
GL_ALPHA_BITS
#define GL_ALPHA_BITS
Definition: SDL_opengl.h:512
VideoBootStrap::name
const char * name
Definition: SDL_sysvideo.h:399
GL_CONTEXT_RELEASE_BEHAVIOR_KHR
#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR
Definition: SDL_video.c:51
NULL
#define NULL
Definition: begin_code.h:167
surface
EGLSurface surface
Definition: eglext.h:248
SDL_WindowUserData::data
void * data
Definition: SDL_sysvideo.h:68
SDL_VideoDevice::buffer_size
int buffer_size
Definition: SDL_sysvideo.h:332
SDL_GL_LoadLibrary
int SDL_GL_LoadLibrary(const char *path)
Dynamically load an OpenGL library.
Definition: SDL_video.c:2881
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109
enable
GLboolean enable
Definition: SDL_opengl_glext.h:4996
SDL_VideoDevice::multisamplesamples
int multisamplesamples
Definition: SDL_sysvideo.h:341
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:652
message
GLuint GLsizei const GLchar * message
Definition: SDL_opengl_glext.h:2483
SDL_VideoDisplay::device
SDL_VideoDevice * device
Definition: SDL_sysvideo.h:137
SDL_WINDOWEVENT_FOCUS_LOST
@ SDL_WINDOWEVENT_FOCUS_LOST
Definition: SDL_video.h:166
SDL_HINT_VIDEO_ALLOW_SCREENSAVER
#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER
A variable controlling whether the screensaver is enabled.
Definition: SDL_hints.h:165
SDL_GetNumRenderDrivers
#define SDL_GetNumRenderDrivers
Definition: SDL_dynapi_overrides.h:298
SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS
#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS
Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
Definition: SDL_hints.h:332
SDL_qsort
#define SDL_qsort
Definition: SDL_dynapi_overrides.h:380
SDL_VideoDevice::blue_size
int blue_size
Definition: SDL_sysvideo.h:329
SDL_GL_ACCELERATED_VISUAL
@ SDL_GL_ACCELERATED_VISUAL
Definition: SDL_video.h:215
mode
GLenum mode
Definition: SDL_opengl_glext.h:1122
SDL_VERSION
#define SDL_VERSION(x)
Macro to determine SDL version program was compiled against.
Definition: SDL_version.h:79
GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE
Definition: SDL_opengl_glext.h:997
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:1989
SDL_VideoDevice::vulkan_config
struct SDL_VideoDevice::@264 vulkan_config
SDL_GL_CONTEXT_RESET_NOTIFICATION
@ SDL_GL_CONTEXT_RESET_NOTIFICATION
Definition: SDL_video.h:225
SDL_SysWMinfo
Definition: SDL_syswm.h:197
SDL_WindowUserData
Definition: SDL_sysvideo.h:65
SDL_PIXELLAYOUT
#define SDL_PIXELLAYOUT(X)
Definition: SDL_pixels.h:126
SDL_VideoDevice::accum_alpha_size
int accum_alpha_size
Definition: SDL_sysvideo.h:338
SDL_INIT_EVENTS
#define SDL_INIT_EVENTS
Definition: SDL.h:83
SDL_VideoDevice::accum_green_size
int accum_green_size
Definition: SDL_sysvideo.h:336
GL_VENDOR
#define GL_VENDOR
Definition: SDL_opengl.h:713
SDL_VideoDevice::SetTextInputRect
void(* SetTextInputRect)(_THIS, SDL_Rect *rect)
Definition: SDL_sysvideo.h:289
SDL_GL_MULTISAMPLEBUFFERS
@ SDL_GL_MULTISAMPLEBUFFERS
Definition: SDL_video.h:213
GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE
Definition: SDL_opengl_glext.h:995
SDL_VideoDevice::grabbed_window
SDL_Window * grabbed_window
Definition: SDL_sysvideo.h:318
attachment
GLenum attachment
Definition: SDL_opengl_glext.h:1178
count
GLuint GLuint GLsizei count
Definition: SDL_opengl.h:1571
SDL_SetWindowGrab
void SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabbed)
Set a window's input grab mode.
Definition: SDL_video.c:2554
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:354
SDL_VideoDevice::current_glctx_tls
SDL_TLSID current_glctx_tls
Definition: SDL_sysvideo.h:366
SDL_VideoDevice::major_version
int major_version
Definition: SDL_sysvideo.h:343
SDL_WINDOW_FULLSCREEN
@ SDL_WINDOW_FULLSCREEN
Definition: SDL_video.h:100
SDL_VideoDevice::SetWindowTitle
void(* SetWindowTitle)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:213
SDL_VideoDevice::UpdateWindowFramebuffer
int(* UpdateWindowFramebuffer)(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
Definition: SDL_sysvideo.h:237
SDL_WINDOW_OPENGL
@ SDL_WINDOW_OPENGL
Definition: SDL_video.h:101
SDL_VideoDevice::accum_blue_size
int accum_blue_size
Definition: SDL_sysvideo.h:337
GL_DOUBLEBUFFER
#define GL_DOUBLEBUFFER
Definition: SDL_opengl.h:521
SDL_realloc
#define SDL_realloc
Definition: SDL_dynapi_overrides.h:376
SDL_WINDOWEVENT_RESIZED
@ SDL_WINDOWEVENT_RESIZED
Definition: SDL_video.h:155
top
GLdouble GLdouble GLdouble GLdouble top
Definition: SDL_opengl_glext.h:6103
SDL_InvalidParamError
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
GL_STENCIL
#define GL_STENCIL
Definition: SDL_opengl.h:526
SDL_VideoDevice::Vulkan_UnloadLibrary
void(* Vulkan_UnloadLibrary)(_THIS)
Definition: SDL_sysvideo.h:272
SDL_RestoreMousePosition
static void SDL_RestoreMousePosition(SDL_Window *window)
Definition: SDL_video.c:1171
SDL_HideWindow
void SDL_HideWindow(SDL_Window *window)
Hide a window.
Definition: SDL_video.c:2171
SDL_TEXTEDITING
@ SDL_TEXTEDITING
Definition: SDL_events.h:98
SDL_VideoDevice::window_magic
Uint8 window_magic
Definition: SDL_sysvideo.h:319
SDL_QuitSubSystem
#define SDL_QuitSubSystem
Definition: SDL_dynapi_overrides.h:56
SDL_VideoDevice::Vulkan_GetDrawableSize
void(* Vulkan_GetDrawableSize)(_THIS, SDL_Window *window, int *w, int *h)
Definition: SDL_sysvideo.h:275
SDL_Window::is_destroying
SDL_bool is_destroying
Definition: SDL_sysvideo.h:101
SDL_GL_CONTEXT_PROFILE_CORE
@ SDL_GL_CONTEXT_PROFILE_CORE
Definition: SDL_video.h:231
red
const GLubyte GLuint red
Definition: SDL_glfuncs.h:80
SDL_WINDOW_FULLSCREEN_DESKTOP
@ SDL_WINDOW_FULLSCREEN_DESKTOP
Definition: SDL_video.h:111
NOT_A_VULKAN_WINDOW
#define NOT_A_VULKAN_WINDOW
Definition: SDL_video.c:4077
params
const GLfloat * params
Definition: SDL_opengl_glext.h:371
SDL_DONTFREE
#define SDL_DONTFREE
Definition: SDL_surface.h:55
pname
GLenum pname
Definition: SDL_opengl_glext.h:530
SDL_SetKeyboardFocus
void SDL_SetKeyboardFocus(SDL_Window *window)
Definition: SDL_keyboard.c:630
GL_FRAMEBUFFER
#define GL_FRAMEBUFFER
Definition: SDL_opengl_glext.h:1051
GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE
Definition: SDL_opengl_glext.h:994
SDL_itoa
#define SDL_itoa
Definition: SDL_dynapi_overrides.h:404
SDL_WINDOW_FOREIGN
@ SDL_WINDOW_FOREIGN
Definition: SDL_video.h:112
SDL_VideoDevice::GetWindowWMInfo
SDL_bool(* GetWindowWMInfo)(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
Definition: SDL_sysvideo.h:248
callback
static Uint32 callback(Uint32 interval, void *param)
Definition: testtimer.c:34
SDL_GL_DeleteContext
void SDL_GL_DeleteContext(SDL_GLContext context)
Delete an OpenGL context.
Definition: SDL_video.c:3627
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:2345
SDL_VideoDevice::GetWindowBordersSize
int(* GetWindowBordersSize)(_THIS, SDL_Window *window, int *top, int *left, int *bottom, int *right)
Definition: SDL_sysvideo.h:219
SDL_ENABLE
#define SDL_ENABLE
Definition: SDL_events.h:759
SDL_VideoDevice::profile_mask
int profile_mask
Definition: SDL_sysvideo.h:346
SDL_GL_ACCUM_GREEN_SIZE
@ SDL_GL_ACCUM_GREEN_SIZE
Definition: SDL_video.h:209
SDL_WINDOWPOS_ISCENTERED
#define SDL_WINDOWPOS_ISCENTERED(X)
Definition: SDL_video.h:140
path
GLsizei const GLchar *const * path
Definition: SDL_opengl_glext.h:3730
SDL_WINDOW_MAXIMIZED
@ SDL_WINDOW_MAXIMIZED
Definition: SDL_video.h:107
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:1752
bottom
GLint GLint bottom
Definition: SDL_opengl_glext.h:1949
SDL_GL_CONTEXT_RESET_NO_NOTIFICATION
@ SDL_GL_CONTEXT_RESET_NO_NOTIFICATION
Definition: SDL_video.h:252
SDL_VideoDisplay::desktop_mode
SDL_DisplayMode desktop_mode
Definition: SDL_sysvideo.h:131
SDL_VideoDevice::depth_size
int depth_size
Definition: SDL_sysvideo.h:331
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
@ SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
Definition: SDL_video.h:247
index
GLuint index
Definition: SDL_opengl_glext.h:660
SDL_VideoDevice::is_dummy
SDL_bool is_dummy
Definition: SDL_sysvideo.h:313
SDL_GL_CONTEXT_RESET_ISOLATION_FLAG
@ SDL_GL_CONTEXT_RESET_ISOLATION_FLAG
Definition: SDL_video.h:241
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
SDL_GetHint
#define SDL_GetHint
Definition: SDL_dynapi_overrides.h:191
SDL_GL_CONTEXT_RELEASE_BEHAVIOR
@ SDL_GL_CONTEXT_RELEASE_BEHAVIOR
Definition: SDL_video.h:224
func
GLenum func
Definition: SDL_opengl_glext.h:657
GLubyte
unsigned char GLubyte
Definition: SDL_opengl.h:183
SDL_GL_CONTEXT_MINOR_VERSION
@ SDL_GL_CONTEXT_MINOR_VERSION
Definition: SDL_video.h:218
SDL_APP_LOWMEMORY
@ SDL_APP_LOWMEMORY
Definition: SDL_events.h:67
SDL_InitSubSystem
#define SDL_InitSubSystem
Definition: SDL_dynapi_overrides.h:55
SDL_RaiseWindow
void SDL_RaiseWindow(SDL_Window *window)
Raise a window above other windows and set the input focus.
Definition: SDL_video.c:2190
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1946
SDL_KeyboardQuit
void SDL_KeyboardQuit(void)
Definition: SDL_keyboard.c:832
SDL_GL_CONTEXT_FLAGS
@ SDL_GL_CONTEXT_FLAGS
Definition: SDL_video.h:220
SDL_Rect::x
int x
Definition: SDL_rect.h:79
SDL_SetMouseFocus
void SDL_SetMouseFocus(SDL_Window *window)
Definition: SDL_mouse.c:211
ctx
EGLContext ctx
Definition: eglext.h:208
SDL_WINDOW_INPUT_FOCUS
@ SDL_WINDOW_INPUT_FOCUS
Definition: SDL_video.h:109
SDL_VideoDevice::HideWindow
void(* HideWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:224
SDL_RendererInfo
Information on the capabilities of a render driver or context.
Definition: SDL_render.h:78
SDL_GL_CONTEXT_EGL
@ SDL_GL_CONTEXT_EGL
Definition: SDL_video.h:219
SDL_WINDOW_RESIZABLE
@ SDL_WINDOW_RESIZABLE
Definition: SDL_video.h:105
SDL_DisplayMode::h
int h
Definition: SDL_video.h:57
SDL_APP_WILLENTERFOREGROUND
@ SDL_APP_WILLENTERFOREGROUND
Definition: SDL_events.h:79
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:327
SDL_OnWindowRestored
void SDL_OnWindowRestored(SDL_Window *window)
Definition: SDL_video.c:2610
SDL_SetRelativeMouseMode
#define SDL_SetRelativeMouseMode
Definition: SDL_dynapi_overrides.h:249
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:73
SDL_VideoDevice::SetWindowIcon
void(* SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon)
Definition: SDL_sysvideo.h:214
SDL_GetRenderDriverInfo
#define SDL_GetRenderDriverInfo
Definition: SDL_dynapi_overrides.h:299
SDL_DisplayMode
The structure that defines a display mode.
Definition: SDL_video.h:53
SDL_GetKeyboardFocus
#define SDL_GetKeyboardFocus
Definition: SDL_dynapi_overrides.h:216
SDL_VideoDevice::SetWindowGrab
void(* SetWindowGrab)(_THIS, SDL_Window *window, SDL_bool grabbed)
Definition: SDL_sysvideo.h:234
GL_VERSION
#define GL_VERSION
Definition: SDL_opengl.h:715
SDL_strcasecmp
#define SDL_strcasecmp
Definition: SDL_dynapi_overrides.h:419
SDL_VideoDevice::Vulkan_CreateSurface
SDL_bool(* Vulkan_CreateSurface)(_THIS, SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface)
Definition: SDL_sysvideo.h:274
SDL_ResetKeyboard
void SDL_ResetKeyboard(void)
Definition: SDL_keyboard.c:572
SDL_MouseQuit
void SDL_MouseQuit(void)
Definition: SDL_mouse.c:665
CREATE_FLAGS
#define CREATE_FLAGS
Definition: SDL_video.c:1350
SDL_VideoDevice::ShowScreenKeyboard
void(* ShowScreenKeyboard)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:293
SDL_strncasecmp
#define SDL_strncasecmp
Definition: SDL_dynapi_overrides.h:420
SDL_WINDOWEVENT_SHOWN
@ SDL_WINDOWEVENT_SHOWN
Definition: SDL_video.h:149
GL_NUM_EXTENSIONS
#define GL_NUM_EXTENSIONS
SDL_VideoDevice::accum_red_size
int accum_red_size
Definition: SDL_sysvideo.h:335
SDL_GL_CONTEXT_NO_ERROR
@ SDL_GL_CONTEXT_NO_ERROR
Definition: SDL_video.h:226
GL_SAMPLE_BUFFERS
#define GL_SAMPLE_BUFFERS
Definition: SDL_opengl.h:1839
SDL_Vulkan_CreateSurface
#define SDL_Vulkan_CreateSurface
Definition: SDL_dynapi_overrides.h:636
SDL_VideoDevice::GetDisplayUsableBounds
int(* GetDisplayUsableBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
Definition: SDL_sysvideo.h:187
SDL_MinimizeWindow
void SDL_MinimizeWindow(SDL_Window *window)
Minimize a window to an iconic representation.
Definition: SDL_video.c:2228
SDL_GL_ALPHA_SIZE
@ SDL_GL_ALPHA_SIZE
Definition: SDL_video.h:203
SDL_Window::w
int w
Definition: SDL_sysvideo.h:80
SDL_CreateRGBSurfaceFrom
#define SDL_CreateRGBSurfaceFrom
Definition: SDL_dynapi_overrides.h:445
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.
Definition: SDL_video.c:3496
SDL_UpdateTexture
#define SDL_UpdateTexture
Definition: SDL_dynapi_overrides.h:315
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:1123
SDL_VideoDevice::gl_config
struct SDL_VideoDevice::@263 gl_config
SDL_GL_CONTEXT_DEBUG_FLAG
@ SDL_GL_CONTEXT_DEBUG_FLAG
Definition: SDL_video.h:238
SDL_MouseInit
int SDL_MouseInit(void)
Definition: SDL_mouse.c:135
SDL_WINDOW_POPUP_MENU
@ SDL_WINDOW_POPUP_MENU
Definition: SDL_video.h:121
SDL_memcpy
#define SDL_memcpy
Definition: SDL_dynapi_overrides.h:387
SDL_GetHintBoolean
#define SDL_GetHintBoolean
Definition: SDL_dynapi_overrides.h:608
SDL_Renderer
Definition: SDL_sysrender.h:122
SDL_FALSE
@ SDL_FALSE
Definition: SDL_stdinc.h:163
SDL_SetWindowData
void * SDL_SetWindowData(SDL_Window *window, const char *name, void *userdata)
Associate an arbitrary named pointer with a window.
Definition: SDL_video.c:1799
SDL_Mouse::relative_mode
SDL_bool relative_mode
Definition: SDL_mouse_c.h:87
context
static screen_context_t context
Definition: video.c:25
SDL_strchr
#define SDL_strchr
Definition: SDL_dynapi_overrides.h:401
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:232
SDL_GetIndexOfDisplay
int SDL_GetIndexOfDisplay(SDL_VideoDisplay *display)
Definition: SDL_video.c:645
SDL_GetWindowFlags
Uint32 SDL_GetWindowFlags(SDL_Window *window)
Get the window flags.
Definition: SDL_video.c:1744
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
SDL_VideoDevice::num_displays
int num_displays
Definition: SDL_sysvideo.h:315
SDL_SYSWM_COCOA
@ SDL_SYSWM_COCOA
Definition: SDL_syswm.h:125
cmpmodes
static int cmpmodes(const void *A, const void *B)
Definition: SDL_video.c:419
retval
SDL_bool retval
Definition: testgamecontroller.c:65
SDL_GL_ACCUM_ALPHA_SIZE
@ SDL_GL_ACCUM_ALPHA_SIZE
Definition: SDL_video.h:211
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
SDL_SysWMinfo::subsystem
SDL_SYSWM_TYPE subsystem
Definition: SDL_syswm.h:200
SDL_RenderCopy
#define SDL_RenderCopy
Definition: SDL_dynapi_overrides.h:343
SDL_GetEventState
#define SDL_GetEventState(type)
Definition: SDL_events.h:772
window
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
IsAcceptingDragAndDrop
static SDL_INLINE SDL_bool IsAcceptingDragAndDrop(void)
Definition: SDL_video.c:1354
SDL_VideoDevice::SetWindowFullscreen
void(* SetWindowFullscreen)(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
Definition: SDL_sysvideo.h:231
CanMinimizeWindow
static SDL_bool CanMinimizeWindow(SDL_Window *window)
Definition: SDL_video.c:2219
SDL_TEXTINPUT
@ SDL_TEXTINPUT
Definition: SDL_events.h:99
SDL_HINT_ALLOW_TOPMOST
#define SDL_HINT_ALLOW_TOPMOST
If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it....
Definition: SDL_hints.h:588
SDL_GL_GREEN_SIZE
@ SDL_GL_GREEN_SIZE
Definition: SDL_video.h:201
SDL_GL_SHARE_WITH_CURRENT_CONTEXT
@ SDL_GL_SHARE_WITH_CURRENT_CONTEXT
Definition: SDL_video.h:222
SDL_Rect::y
int y
Definition: SDL_rect.h:79
GL_NO_ERROR
#define GL_NO_ERROR
Definition: SDL_opengl.h:719
SDL_memcmp
#define SDL_memcmp
Definition: SDL_dynapi_overrides.h:389
SDL_GetRelativeMouseMode
#define SDL_GetRelativeMouseMode
Definition: SDL_dynapi_overrides.h:250
SDL_VideoDevice::HasScreenKeyboardSupport
SDL_bool(* HasScreenKeyboardSupport)(_THIS)
Definition: SDL_sysvideo.h:292
SDL_Rect::h
int h
Definition: SDL_rect.h:80
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG
@ SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG
Definition: SDL_video.h:240
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.
Definition: SDL_video.c:1408
SDL_VideoDevice::ShowMessageBox
int(* ShowMessageBox)(_THIS, const SDL_MessageBoxData *messageboxdata, int *buttonid)
Definition: SDL_sysvideo.h:303
f
GLfloat f
Definition: SDL_opengl_glext.h:1870
SDL_DROPTEXT
@ SDL_DROPTEXT
Definition: SDL_events.h:142
SDL_DestroyWindow
void SDL_DestroyWindow(SDL_Window *window)
Destroy a window.
Definition: SDL_video.c:2715
SDL_max
#define SDL_max(x, y)
Definition: SDL_stdinc.h:407
SDL_GL_ACCUM_BLUE_SIZE
@ SDL_GL_ACCUM_BLUE_SIZE
Definition: SDL_video.h:210
SDL_UpdateWindowGrab
void SDL_UpdateWindowGrab(SDL_Window *window)
Definition: SDL_video.c:2523
SDL_VideoDevice::driver_loaded
int driver_loaded
Definition: SDL_sysvideo.h:353
isAtLeastGL3
static SDL_INLINE SDL_bool isAtLeastGL3(const char *verstr)
Definition: SDL_video.c:2950
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:3519
SDL_SYSWM_X11
@ SDL_SYSWM_X11
Definition: SDL_syswm.h:123
SDL_MessageBoxData
MessageBox structure containing title, text, window, etc.
Definition: SDL_messagebox.h:92
SDL_GL_BUFFER_SIZE
@ SDL_GL_BUFFER_SIZE
Definition: SDL_video.h:204
SDL_GL_STEREO
@ SDL_GL_STEREO
Definition: SDL_video.h:212
SDL_DisplayMode::refresh_rate
int refresh_rate
Definition: SDL_video.h:58
SDL_VideoDevice::GL_GetDrawableSize
void(* GL_GetDrawableSize)(_THIS, SDL_Window *window, int *w, int *h)
Definition: SDL_sysvideo.h:260
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:660
SDL_VideoDevice::displays
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:316
SDL_VideoDevice::GetDisplayModes
void(* GetDisplayModes)(_THIS, SDL_VideoDisplay *display)
Definition: SDL_sysvideo.h:197
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:2037
SDL_GetDisplayForWindow
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
Definition: SDL_video.c:1092
GL_ACCUM_RED_BITS
#define GL_ACCUM_RED_BITS
Definition: SDL_opengl.h:380
rect
SDL_Rect rect
Definition: testrelative.c:27
SDL_FreeSurface
#define SDL_FreeSurface
Definition: SDL_dynapi_overrides.h:446
SDL_VideoDevice::loader_path
char loader_path[256]
Definition: SDL_sysvideo.h:375
SDL_VideoDevice::multisamplebuffers
int multisamplebuffers
Definition: SDL_sysvideo.h:340
SDL_VideoDevice::VideoInit
int(* VideoInit)(_THIS)
Definition: SDL_sysvideo.h:161
SDL_WINDOWTEXTUREDATA
#define SDL_WINDOWTEXTUREDATA
Definition: SDL_video.c:158
SDL_GL_CONTEXT_PROFILE_ES
@ SDL_GL_CONTEXT_PROFILE_ES
Definition: SDL_video.h:233
SDL_WINDOW_TOOLTIP
@ SDL_WINDOW_TOOLTIP
Definition: SDL_video.h:120
SDL_MessageBoxData::window
SDL_Window * window
Definition: SDL_messagebox.h:95
SDL_VideoDevice::share_with_current_context
int share_with_current_context
Definition: SDL_sysvideo.h:347
SDL_VideoDevice::green_size
int green_size
Definition: SDL_sysvideo.h:328
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:191
SDL_VideoDevice::loader_loaded
int loader_loaded
Definition: SDL_sysvideo.h:374
SDL_PixelFormatEnumToMasks
#define SDL_PixelFormatEnumToMasks
Definition: SDL_dynapi_overrides.h:278
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:676
SDL_min
#define SDL_min(x, y)
Definition: SDL_stdinc.h:406
SDL_VideoDevice::StartTextInput
void(* StartTextInput)(_THIS)
Definition: SDL_sysvideo.h:287
SDL_VideoDevice::RaiseWindow
void(* RaiseWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:225
SDL_VideoDevice::StopTextInput
void(* StopTextInput)(_THIS)
Definition: SDL_sysvideo.h:288
names
GLuint GLuint * names
Definition: SDL_opengl_glext.h:4956
SDL_VideoDevice::VideoQuit
void(* VideoQuit)(_THIS)
Definition: SDL_sysvideo.h:167
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:217
SDL_MessageBoxButtonData
Individual button data.
Definition: SDL_messagebox.h:56
SDL_SYSWM_UIKIT
@ SDL_SYSWM_UIKIT
Definition: SDL_syswm.h:126
SDL_WINDOW_INPUT_GRABBED
@ SDL_WINDOW_INPUT_GRABBED
Definition: SDL_video.h:108
SDL_Mouse
Definition: SDL_mouse_c.h:43
SDL_APP_WILLENTERBACKGROUND
@ SDL_APP_WILLENTERBACKGROUND
Definition: SDL_events.h:71
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:351
SDL_SetDisplayModeForDisplay
static int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
Definition: SDL_video.c:975
SDL_WINDOWEVENT_SIZE_CHANGED
@ SDL_WINDOWEVENT_SIZE_CHANGED
Definition: SDL_video.h:156
SDL_VideoDevice::MinimizeWindow
void(* MinimizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:227
SDL_PIXELFORMAT_ARGB8888
@ SDL_PIXELFORMAT_ARGB8888
Definition: SDL_pixels.h:248
SDL_MaximizeWindow
void SDL_MaximizeWindow(SDL_Window *window)
Make a window as large as possible.
Definition: SDL_video.c:2203
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:2932
blue
GLbyte GLbyte blue
Definition: SDL_opengl_glext.h:379
WINRT_DetectWindowFlags
Uint32 WINRT_DetectWindowFlags(SDL_Window *window)
green
GLbyte green
Definition: SDL_opengl_glext.h:379
SDL_VideoDevice::SetWindowHitTest
int(* SetWindowHitTest)(SDL_Window *window, SDL_bool enabled)
Definition: SDL_sysvideo.h:306
SDL_assert
#define SDL_assert(condition)
Definition: SDL_assert.h:169
SDL_VideoDevice::SetWindowMaximumSize
void(* SetWindowMaximumSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:218
SDL_TLSGet
#define SDL_TLSGet
Definition: SDL_dynapi_overrides.h:481
SDL_DISABLE
#define SDL_DISABLE
Definition: SDL_events.h:758
SDL_VideoDevice::dll_handle
void * dll_handle
Definition: SDL_sysvideo.h:355
SDL_WINDOWEVENT_MINIMIZED
@ SDL_WINDOWEVENT_MINIMIZED
Definition: SDL_video.h:159
SDL_WINDOW_SHOWN
@ SDL_WINDOW_SHOWN
Definition: SDL_video.h:102
SDL_VideoDisplay::driverdata
void * driverdata
Definition: SDL_sysvideo.h:139
start
GLuint start
Definition: SDL_opengl.h:1571
pixels
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: SDL_opengl.h:1572
SDL_Window::h
int h
Definition: SDL_sysvideo.h:80
SDL_VideoDevice::double_buffer
int double_buffer
Definition: SDL_sysvideo.h:334
SDL_TLSCreate
#define SDL_TLSCreate
Definition: SDL_dynapi_overrides.h:480
SDL_GetWindowWMInfo
SDL_bool SDL_GetWindowWMInfo(SDL_Window *window, struct SDL_SysWMinfo *info)
This function allows access to driver-dependent window information.
Definition: SDL_video.c:3740
SDL_VideoDevice::release_behavior
int release_behavior
Definition: SDL_sysvideo.h:348
SDL_VideoDevice
Definition: SDL_sysvideo.h:148
APIENTRY
#define APIENTRY
Definition: SDL_opengl.h:139
SDL_OutOfMemory
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_VideoDevice::IsScreenKeyboardShown
SDL_bool(* IsScreenKeyboardShown)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:295
SDL_GL_CONTEXT_MAJOR_VERSION
@ SDL_GL_CONTEXT_MAJOR_VERSION
Definition: SDL_video.h:217
SDL_GL_ACCUM_RED_SIZE
@ SDL_GL_ACCUM_RED_SIZE
Definition: SDL_video.h:208
SDL_VideoDevice::flags
int flags
Definition: SDL_sysvideo.h:345
SDL_GL_CONTEXT_PROFILE_MASK
@ SDL_GL_CONTEXT_PROFILE_MASK
Definition: SDL_video.h:221
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:2444
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE
Definition: SDL_opengl_glext.h:996
SDL_VideoDevice::DestroyWindow
void(* DestroyWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:235
SDL_WINDOW_UTILITY
@ SDL_WINDOW_UTILITY
Definition: SDL_video.h:119
SDL_GL_DEPTH_SIZE
@ SDL_GL_DEPTH_SIZE
Definition: SDL_video.h:206
SDL_UpdateFullscreenMode
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
Definition: SDL_video.c:1186
available
static int available()
Definition: video.c:356
SDL_VideoDevice::SetWindowBordered
void(* SetWindowBordered)(_THIS, SDL_Window *window, SDL_bool bordered)
Definition: SDL_sysvideo.h:229
SDL_MessageboxValidForDriver
static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
Definition: SDL_video.c:3852
SDL_arraysize
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:115
SDL_calloc
#define SDL_calloc
Definition: SDL_dynapi_overrides.h:375
SDL_DestroyTexture
#define SDL_DestroyTexture
Definition: SDL_dynapi_overrides.h:347
SDL_atoi
#define SDL_atoi
Definition: SDL_dynapi_overrides.h:410
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:3758
FULLSCREEN_VISIBLE
#define FULLSCREEN_VISIBLE(W)
Definition: SDL_sysvideo.h:116
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:261
SDL_VideoDisplay::max_display_modes
int max_display_modes
Definition: SDL_sysvideo.h:128
SDL_VideoDevice::SetWindowResizable
void(* SetWindowResizable)(_THIS, SDL_Window *window, SDL_bool resizable)
Definition: SDL_sysvideo.h:230
SDL_GetWindowWMInfo
#define SDL_GetWindowWMInfo
Definition: SDL_dynapi_overrides.h:473
SDL_VideoDevice::reset_notification
int reset_notification
Definition: SDL_sysvideo.h:349
SDL_VideoDisplay::num_display_modes
int num_display_modes
Definition: SDL_sysvideo.h:129
SDL_VideoDevice::AcceptDragAndDrop
void(* AcceptDragAndDrop)(SDL_Window *window, SDL_bool accept)
Definition: SDL_sysvideo.h:309
SDL_GLContext
void * SDL_GLContext
An opaque handle to an OpenGL context.
Definition: SDL_video.h:193
SDL_VideoDevice::DestroyWindowFramebuffer
void(* DestroyWindowFramebuffer)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:238
SDL_VideoDevice::CreateSDLWindowFrom
int(* CreateSDLWindowFrom)(_THIS, SDL_Window *window, const void *data)
Definition: SDL_sysvideo.h:212
SDL_VideoDevice::stereo
int stereo
Definition: SDL_sysvideo.h:339
src
GLenum src
Definition: SDL_opengl_glext.h:1737
renderer
static SDL_Renderer * renderer
Definition: testaudiocapture.c:21
SDL_getenv
#define SDL_getenv
Definition: SDL_dynapi_overrides.h:378
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
SDL_AddVideoDisplay
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display)
Definition: SDL_video.c:606
SDL_WINDOW_HIDDEN
@ SDL_WINDOW_HIDDEN
Definition: SDL_video.h:103
SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT
@ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT
Definition: SDL_messagebox.h:49
SDL_GL_SetAttribute
int SDL_GL_SetAttribute(SDL_GLattr attr, int value)
Set an OpenGL window attribute before window creation.
Definition: SDL_video.c:3126
SDL_GL_GetCurrentContext
SDL_GLContext SDL_GL_GetCurrentContext(void)
Get the currently active OpenGL context.
Definition: SDL_video.c:3560
SDL_VideoDevice::free
void(* free)(_THIS)
Definition: SDL_sysvideo.h:394
SDL_ISPIXELFORMAT_FOURCC
#define SDL_ISPIXELFORMAT_FOURCC(format)
Definition: SDL_pixels.h:167
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:48
SDL_SysWMinfo::version
SDL_version version
Definition: SDL_syswm.h:199
SDL_Window::next
SDL_Window * next
Definition: SDL_sysvideo.h:114
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
SDL_sqrt
#define SDL_sqrt
Definition: SDL_dynapi_overrides.h:437
SDL_VideoDisplay
Definition: SDL_sysvideo.h:125
bootstrap
static VideoBootStrap * bootstrap[]
Definition: SDL_video.c:60
SDL_GL_RED_SIZE
@ SDL_GL_RED_SIZE
Definition: SDL_video.h:200
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:30
SDL_BYTESPERPIXEL
#define SDL_BYTESPERPIXEL(X)
Definition: SDL_pixels.h:128
SDL_VideoDevice::SetWindowInputFocus
int(* SetWindowInputFocus)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:222
SDL_VideoDevice::GL_MakeCurrent
int(* GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context)
Definition: SDL_sysvideo.h:259
SDL_VideoDevice::GL_LoadLibrary
int(* GL_LoadLibrary)(_THIS, const char *path)
Definition: SDL_sysvideo.h:255
SDL_Rect
A rectangle, with the origin at the upper left (integer).
Definition: SDL_rect.h:77
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_GetMouseFocus
#define SDL_GetMouseFocus
Definition: SDL_dynapi_overrides.h:245
SDL_VideoDevice::SetDisplayMode
int(* SetDisplayMode)(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
Definition: SDL_sysvideo.h:205
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:257
SDL_VideoDevice::GL_CreateContext
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:258
SDL_VideoDevice::GetDisplayBounds
int(* GetDisplayBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
Definition: SDL_sysvideo.h:182
SDL_VideoDevice::GetDisplayDPI
int(* GetDisplayDPI)(_THIS, SDL_VideoDisplay *display, float *ddpi, float *hdpi, float *vdpi)
Definition: SDL_sysvideo.h:192
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:3247
SDL_WindowUserData::next
struct SDL_WindowUserData * next
Definition: SDL_sysvideo.h:69
left
GLint left
Definition: SDL_opengl_glext.h:1949
ShouldUseTextureFramebuffer
static SDL_bool ShouldUseTextureFramebuffer()
Definition: SDL_video.c:169
SDL_PIXELTYPE
#define SDL_PIXELTYPE(X)
Definition: SDL_pixels.h:124
VideoBootStrap::create
SDL_VideoDevice *(* create)(int devindex)
Definition: SDL_sysvideo.h:402
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:152
GL_RED_BITS
#define GL_RED_BITS
Definition: SDL_opengl.h:513
SDL_EventState
#define SDL_EventState
Definition: SDL_dynapi_overrides.h:131
SDL_Vulkan_UnloadLibrary
void SDL_Vulkan_UnloadLibrary(void)
Unload the Vulkan loader library previously loaded by SDL_Vulkan_LoadLibrary().
Definition: SDL_video.c:4118
SDL_VideoDevice::framebuffer_srgb_capable
int framebuffer_srgb_capable
Definition: SDL_sysvideo.h:350
SDL_VideoDevice::GL_GetSwapInterval
int(* GL_GetSwapInterval)(_THIS)
Definition: SDL_sysvideo.h:262
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:320
SDL_HINT_FRAMEBUFFER_ACCELERATION
#define SDL_HINT_FRAMEBUFFER_ACCELERATION
A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
Definition: SDL_hints.h:65
SDL_Vulkan_LoadLibrary
int SDL_Vulkan_LoadLibrary(const char *path)
Dynamically load a Vulkan loader library.
Definition: SDL_video.c:4079
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:1365
SDL_strdup
#define SDL_strdup
Definition: SDL_dynapi_overrides.h:397
SDL_GL_DOUBLEBUFFER
@ SDL_GL_DOUBLEBUFFER
Definition: SDL_video.h:205
SDL_EnclosePoints
#define SDL_EnclosePoints
Definition: SDL_dynapi_overrides.h:296
SDL_VideoDevice::current_glwin
SDL_Window * current_glwin
Definition: SDL_sysvideo.h:363
SDL_VideoDevice::alpha_size
int alpha_size
Definition: SDL_sysvideo.h:330
SDL_strlen
#define SDL_strlen
Definition: SDL_dynapi_overrides.h:393
SDL_ORIENTATION_UNKNOWN
@ SDL_ORIENTATION_UNKNOWN
Definition: SDL_video.h:183
GL_INVALID_VALUE
#define GL_INVALID_VALUE
Definition: SDL_opengl.h:721
SDL_VideoDevice::Vulkan_GetInstanceExtensions
SDL_bool(* Vulkan_GetInstanceExtensions)(_THIS, SDL_Window *window, unsigned *count, const char **names)
Definition: SDL_sysvideo.h:273
SDL_GL_STENCIL_SIZE
@ SDL_GL_STENCIL_SIZE
Definition: SDL_video.h:207
SDL_CaptureMouse
#define SDL_CaptureMouse
Definition: SDL_dynapi_overrides.h:584
SDL_GL_ExtensionSupported
SDL_bool SDL_GL_ExtensionSupported(const char *extension)
Return true if an OpenGL extension is supported for the current context.
Definition: SDL_video.c:2957
SDL_ShowMessageBox
int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
Create a modal message box.
Definition: SDL_video.c:3871
SDL_FinishWindowCreation
static void SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
Definition: SDL_video.c:1386
SDL_VideoDevice::GL_SwapWindow
int(* GL_SwapWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:263
SDL_VideoDevice::MaximizeWindow
void(* MaximizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:226
GL_DEPTH
#define GL_DEPTH
Definition: SDL_opengl.h:525
SDL_VideoDevice::HideScreenKeyboard
void(* HideScreenKeyboard)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:294
SDL_RendererInfo::name
const char * name
Definition: SDL_render.h:80
SDL_GL_BLUE_SIZE
@ SDL_GL_BLUE_SIZE
Definition: SDL_video.h:202
SDL_ShowCursor
#define SDL_ShowCursor
Definition: SDL_dynapi_overrides.h:258
SDL_VideoDevice::SetWindowSize
void(* SetWindowSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:216
SDL_WINDOWEVENT_HIDDEN
@ SDL_WINDOWEVENT_HIDDEN
Definition: SDL_video.h:150
SDL_VideoDevice::GL_DefaultProfileConfig
void(* GL_DefaultProfileConfig)(_THIS, int *mask, int *major, int *minor)
Definition: SDL_sysvideo.h:265
Android_JNI_ShouldMinimizeOnFocusLoss
SDL_bool Android_JNI_ShouldMinimizeOnFocusLoss(void)
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:220
SDL_HINT_RENDER_DRIVER
#define SDL_HINT_RENDER_DRIVER
A variable specifying which render driver to use.
Definition: SDL_hints.h:85
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:233
SDL_DisplayMode::driverdata
void * driverdata
Definition: SDL_video.h:59
SDL_WINDOWEVENT_RESTORED
@ SDL_WINDOWEVENT_RESTORED
Definition: SDL_video.h:161
SDL_ISPIXELFORMAT_ALPHA
#define SDL_ISPIXELFORMAT_ALPHA(format)
Definition: SDL_pixels.h:154
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:342
SDL_VideoDevice::ShowWindow
void(* ShowWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:223
GL_CONTEXT_RELEASE_BEHAVIOR
#define GL_CONTEXT_RELEASE_BEHAVIOR
Definition: SDL_opengl_glext.h:2992
SDL_VideoDevice::CreateWindowFramebuffer
int(* CreateWindowFramebuffer)(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
Definition: SDL_sysvideo.h:236
SDL_GL_GetProcAddress
void * SDL_GL_GetProcAddress(const char *proc)
Get the address of an OpenGL function.
Definition: SDL_video.c:2910
SDL_VideoDisplay::current_mode
SDL_DisplayMode current_mode
Definition: SDL_sysvideo.h:132
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:256
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:2478
SDL_RendererInfo::texture_formats
Uint32 texture_formats[16]
Definition: SDL_render.h:83
SDL_CreateRenderer
#define SDL_CreateRenderer
Definition: SDL_dynapi_overrides.h:301
SDL_VideoDevice::stencil_size
int stencil_size
Definition: SDL_sysvideo.h:333
SDL_HasScreenKeyboardSupport
SDL_bool SDL_HasScreenKeyboardSupport(void)
Returns whether the platform has some screen keyboard support.
Definition: SDL_video.c:3814
SDL_TouchQuit
void SDL_TouchQuit(void)
Definition: SDL_touch.c:473
SDL_strcmp
#define SDL_strcmp
Definition: SDL_dynapi_overrides.h:417
void
const SDL_PRINTF_FORMAT_STRING char int const SDL_PRINTF_FORMAT_STRING char int const SDL_PRINTF_FORMAT_STRING char int const SDL_PRINTF_FORMAT_STRING char const char const SDL_SCANF_FORMAT_STRING char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
Definition: SDL_dynapi_procs.h:89
SDL_OnWindowResized
void SDL_OnWindowResized(SDL_Window *window)
Definition: SDL_video.c:2597
flags
GLbitfield flags
Definition: SDL_opengl_glext.h:1480
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:855
SDL_strstr
#define SDL_strstr
Definition: SDL_dynapi_overrides.h:403
SDL_WINDOWEVENT_FOCUS_GAINED
@ SDL_WINDOWEVENT_FOCUS_GAINED
Definition: SDL_video.h:165
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
@ SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
Definition: SDL_video.h:239
SDL_DestroyRenderer
#define SDL_DestroyRenderer
Definition: SDL_dynapi_overrides.h:348
SDL_TEXTUREACCESS_STREAMING
@ SDL_TEXTUREACCESS_STREAMING
Definition: SDL_render.h:94
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:123
SDL_SendAppEvent
int SDL_SendAppEvent(SDL_EventType eventType)
Definition: SDL_events.c:965
SDL_VideoDevice::minor_version
int minor_version
Definition: SDL_sysvideo.h:344
SDL_WindowTextureData
Definition: SDL_video.c:160
GL_INVALID_ENUM
#define GL_INVALID_ENUM
Definition: SDL_opengl.h:720
SDL_Window::prev
SDL_Window * prev
Definition: SDL_sysvideo.h:113
SDL_VideoDevice::current_glctx
SDL_GLContext current_glctx
Definition: SDL_sysvideo.h:364
SDL_VideoDevice::RestoreWindow
void(* RestoreWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:228
rects
EGLSurface EGLint * rects
Definition: eglext.h:282
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE
@ SDL_GL_FRAMEBUFFER_SRGB_CAPABLE
Definition: SDL_video.h:223
SDL_TouchInit
int SDL_TouchInit(void)
Definition: SDL_touch.c:46
SDL_WarpMouseInWindow
#define SDL_WarpMouseInWindow
Definition: SDL_dynapi_overrides.h:248
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:83
SDL_VideoDevice::GL_DeleteContext
void(* GL_DeleteContext)(_THIS, SDL_GLContext context)
Definition: SDL_sysvideo.h:264
SDL_SetWindowFullscreen
int SDL_SetWindowFullscreen(SDL_Window *window, Uint32 flags)
Set a window's fullscreen state.
Definition: SDL_video.c:2262
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
SDL_VideoDisplay::orientation
SDL_DisplayOrientation orientation
Definition: SDL_sysvideo.h:133
GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE
Definition: SDL_opengl_glext.h:999
SDL_GetNumDisplayModesForDisplay
static int SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay *display)
Definition: SDL_video.c:790
SDL_VideoDevice::suspend_screensaver
SDL_bool suspend_screensaver
Definition: SDL_sysvideo.h:314
SDL_GL_GetCurrentWindow
SDL_Window * SDL_GL_GetCurrentWindow(void)
Get the currently active OpenGL window.
Definition: SDL_video.c:3550
SDL_DROPFILE
@ SDL_DROPFILE
Definition: SDL_events.h:141
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY
@ SDL_GL_CONTEXT_PROFILE_COMPATIBILITY
Definition: SDL_video.h:232
SDL_GetWindowData
void * SDL_GetWindowData(SDL_Window *window, const char *name)
Retrieve the data pointer associated with a window.
Definition: SDL_video.c:1846
GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE
Definition: SDL_opengl_glext.h:998
SDL_CreateTexture
#define SDL_CreateTexture
Definition: SDL_dynapi_overrides.h:306
SDL_GetWindowDisplayIndex
int SDL_GetWindowDisplayIndex(SDL_Window *window)
Get the display index associated with a window.
Definition: SDL_video.c:1032
button
SDL_Texture * button
Definition: testgamecontroller.c:67
SDL_MessageBoxData::numbuttons
int numbuttons
Definition: SDL_messagebox.h:99
SDL_EnableScreenSaver
void SDL_EnableScreenSaver()
Allow the screen to be blanked by a screensaver.
Definition: SDL_video.c:2801
ShouldMinimizeOnFocusLoss
static SDL_bool ShouldMinimizeOnFocusLoss(SDL_Window *window)
Definition: SDL_video.c:2656
GLint
int GLint
Definition: SDL_opengl.h:182
SDL_WINDOWPOS_ISUNDEFINED
#define SDL_WINDOWPOS_ISUNDEFINED(X)
Definition: SDL_video.h:131
SDL_VideoDisplay::fullscreen_window
SDL_Window * fullscreen_window
Definition: SDL_sysvideo.h:135
SDL_Point::y
int y
Definition: SDL_rect.h:51
SDL_GL_MULTISAMPLESAMPLES
@ SDL_GL_MULTISAMPLESAMPLES
Definition: SDL_video.h:214
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:161
SDL_SYSWM_WINDOWS
@ SDL_SYSWM_WINDOWS
Definition: SDL_syswm.h:122
SDL_RendererInfo::num_texture_formats
Uint32 num_texture_formats
Definition: SDL_render.h:82
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:104
SDL_VideoDevice::windows
SDL_Window * windows
Definition: SDL_sysvideo.h:317
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:731
GL_SAMPLES
#define GL_SAMPLES
Definition: SDL_opengl.h:1840
SDL_GetSpanEnclosingRect
SDL_bool SDL_GetSpanEnclosingRect(int width, int height, int numrects, const SDL_Rect *rects, SDL_Rect *span)
Definition: SDL_rect.c:469
SDL_GetRendererInfo
#define SDL_GetRendererInfo
Definition: SDL_dynapi_overrides.h:304
SDL_WINDOW_VULKAN
@ SDL_WINDOW_VULKAN
Definition: SDL_video.h:122
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:179