21#include "../SDL_internal.h"
31#include "../events/SDL_events_c.h"
32#include "../timer/SDL_timer_c.h"
40#if SDL_VIDEO_OPENGL_ES
45#if SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL
50#ifndef GL_CONTEXT_RELEASE_BEHAVIOR_KHR
51#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB
56#include <emscripten.h>
61#if SDL_VIDEO_DRIVER_COCOA
64#if SDL_VIDEO_DRIVER_X11
67#if SDL_VIDEO_DRIVER_WAYLAND
70#if SDL_VIDEO_DRIVER_VIVANTE
73#if SDL_VIDEO_DRIVER_DIRECTFB
76#if SDL_VIDEO_DRIVER_WINDOWS
79#if SDL_VIDEO_DRIVER_WINRT
82#if SDL_VIDEO_DRIVER_HAIKU
85#if SDL_VIDEO_DRIVER_PANDORA
88#if SDL_VIDEO_DRIVER_UIKIT
91#if SDL_VIDEO_DRIVER_ANDROID
94#if SDL_VIDEO_DRIVER_PSP
97#if SDL_VIDEO_DRIVER_KMSDRM
100#if SDL_VIDEO_DRIVER_RPI
103#if SDL_VIDEO_DRIVER_NACL
106#if SDL_VIDEO_DRIVER_EMSCRIPTEN
109#if SDL_VIDEO_DRIVER_QNX
112#if SDL_VIDEO_DRIVER_DUMMY
120#define CHECK_WINDOW_MAGIC(window, retval) \
122 SDL_UninitializedVideo(); \
125 SDL_assert(window && window->magic == &_this->window_magic); \
126 if (!window || window->magic != &_this->window_magic) { \
127 SDL_SetError("Invalid window"); \
131#define CHECK_DISPLAY_INDEX(displayIndex, retval) \
133 SDL_UninitializedVideo(); \
136 SDL_assert(_this->displays != NULL); \
137 SDL_assert(displayIndex >= 0 && displayIndex < _this->num_displays); \
138 if (displayIndex < 0 || displayIndex >= _this->num_displays) { \
139 SDL_SetError("displayIndex must be in the range 0 - %d", \
140 _this->num_displays - 1); \
144#define FULLSCREEN_MASK (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN)
155#define SDL_WINDOWTEXTUREDATA "_SDL_WindowTextureData"
199#if defined(__WIN32__)
204#elif defined(__MACOSX__)
208#elif defined(__LINUX__)
222 const char *vendor =
NULL;
225 if (glGetStringFunc) {
226 vendor = (
const char *) glGetStringFunc(
GL_VENDOR);
238 return hasAcceleratedOpenGL;
240#elif SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
267 if (hint && *hint !=
'0' && *hint !=
'1' &&
294 return SDL_SetError(
"No hardware accelerated renderers available");
339 if (!
data->texture) {
349 const size_t allocsize =
window->h *
data->pitch;
357 *pitch =
data->pitch;
407 if (
data->renderer) {
422 }
else if (
a->w !=
b->w) {
424 }
else if (
a->h !=
b->h) {
430 }
else if (
a->refresh_rate !=
b->refresh_rate) {
431 return b->refresh_rate -
a->refresh_rate;
439 return SDL_SetError(
"Video subsystem has not been initialized");
472#if !SDL_TIMERS_DISABLED
487 if (driver_name ==
NULL) {
490 if (driver_name !=
NULL) {
537 return SDL_SetError(
"The video driver did not add any displays");
613 displays[
index] = *display;
687 if (displayIndex == 0) {
759 for (
i = 0;
i < nmodes; ++
i) {
776 modes[nmodes] = *
mode;
814 return SDL_SetError(
"index must be in the range of 0 - %d",
857 int target_refresh_rate;
861 if (!
mode || !closest) {
862 SDL_SetError(
"Missing desired mode or closest mode parameter");
868 target_format =
mode->format;
874 if (
mode->refresh_rate) {
875 target_refresh_rate =
mode->refresh_rate;
884 if (current->
w && (current->
w <
mode->w)) {
888 if (current->
h && (current->
h <
mode->h)) {
889 if (current->
w && (current->
w ==
mode->w)) {
898 if (!match || current->
w < match->
w || current->
h < match->
h) {
904 if (current->
format == target_format ||
926 if (match->
w && match->
h) {
927 closest->
w = match->
w;
928 closest->
h = match->
h;
930 closest->
w =
mode->w;
931 closest->
h =
mode->h;
978 display_mode = *
mode;
981 if (!display_mode.
format) {
984 if (!display_mode.
w) {
987 if (!display_mode.
h) {
996 return SDL_SetError(
"No video mode large enough for %dx%d",
997 display_mode.
w, display_mode.
h);
1005 if (
SDL_memcmp(&display_mode, ¤t_mode,
sizeof(display_mode)) == 0) {
1011 return SDL_SetError(
"SDL video driver doesn't support changing display mode");
1034 int closest_dist = 0x7FFFFFFF;
1043 displayIndex = (
window->x & 0xFFFF);
1047 return displayIndex;
1051 displayIndex = (
window->y & 0xFFFF);
1055 return displayIndex;
1076 dist = (delta.
x*delta.
x + delta.
y*delta.
y);
1077 if (dist < closest_dist) {
1079 closest_dist = dist;
1092 if (displayIndex >= 0) {
1131 fullscreen_mode =
window->fullscreen_mode;
1132 if (!fullscreen_mode.
w) {
1133 fullscreen_mode.
w =
window->windowed.w;
1135 if (!fullscreen_mode.
h) {
1136 fullscreen_mode.
h =
window->windowed.h;
1146 &fullscreen_mode)) {
1147 return SDL_SetError(
"Couldn't find display mode match");
1151 *
mode = fullscreen_mode;
1191 if (
window->is_hiding && fullscreen) {
1216 if (Cocoa_SetWindowFullscreenSpace(
window, fullscreen)) {
1217 if (Cocoa_IsWindowInFullscreenSpace(
window) != fullscreen) {
1224#elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
1272 setDisplayMode = fullscreen;
1278 if (setDisplayMode) {
1286 if (other->
w == fullscreen_mode.
w && other->
h == fullscreen_mode.
h) {
1315 fullscreen_mode.
w, fullscreen_mode.
h);
1347#define CREATE_FLAGS \
1348 (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)
1430 if ((
w > 16384) || (
h > 16384)) {
1436#if (SDL_VIDEO_OPENGL && __MACOSX__) || __IPHONEOS__ || __ANDROID__ || __NACL__
1443 SDL_SetError(
"OpenGL support is either not configured in SDL "
1444 "or not available in current SDL video driver "
1455 SDL_SetError(
"Vulkan support is either not configured in SDL "
1456 "or not available in current SDL video driver "
1461 SDL_SetError(
"Vulkan and OpenGL not supported on same window");
1474 flags &= ~SDL_WINDOW_ALLOW_HIGHDPI;
1498 window->x = bounds.
x + (bounds.
w -
w) / 2;
1501 window->y = bounds.
y + (bounds.
h -
h) / 2;
1526 window->brightness = 1.0f;
1543#if !defined(__WIN32__)
1545 window->flags &= ~SDL_WINDOW_MINIMIZED;
1549#if __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
1596 window->brightness = 1.0f;
1619 return SDL_SetError(
"OpenGL support is either not configured in SDL "
1620 "or not available in current SDL video driver "
1628 flags &= ~SDL_WINDOW_FOREIGN;
1636 window->surface->flags &= ~SDL_DONTFREE;
1666 SDL_SetError(
"Can't change SDL_WINDOW_VULKAN window flag");
1671 SDL_SetError(
"Vulkan and OpenGL not supported on same window");
1681 if (loaded_opengl) {
1683 window->flags &= ~SDL_WINDOW_OPENGL;
1753 if (title ==
window->title) {
1812 void *last_value =
data->data;
1816 data->data = userdata;
1835 data->data = userdata;
1869 int displayIndex = (
x & 0xFFFF);
1879 x = bounds.
x + (bounds.
w -
window->w) / 2;
1882 y = bounds.
y + (bounds.
h -
window->h) / 2;
1926 if (displayIndex >= 0) {
1954 const int want = (bordered !=
SDL_FALSE);
1958 window->flags &= ~SDL_WINDOW_BORDERLESS;
1972 const int want = (resizable !=
SDL_FALSE);
1978 window->flags &= ~SDL_WINDOW_RESIZABLE;
2017 window->last_fullscreen_flags = 0;
2050 if (!
top) {
top = &dummy; }
2082 SDL_SetError(
"SDL_SetWindowMinimumSize(): Tried to set minimum size larger than maximum size");
2123 if (max_w <= window->min_w || max_h <= window->min_h) {
2124 SDL_SetError(
"SDL_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size");
2272 window->flags &= ~FULLSCREEN_MASK;
2279 window->flags &= ~FULLSCREEN_MASK;
2280 window->flags |= oldflags;
2291 Uint32 Rmask, Gmask, Bmask, Amask;
2313 if (!
window->surface_valid) {
2315 window->surface->flags &= ~SDL_DONTFREE;
2347 if (!
window->surface_valid) {
2348 return SDL_SetError(
"Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface");
2365 window->brightness = brightness;
2375 return window->brightness;
2388 if (opacity < 0.0f) {
2390 }
else if (opacity > 1.0f) {
2396 window->opacity = opacity;
2408 *out_opacity =
window->opacity;
2496 for (
i = 0;
i < 256; ++
i) {
2533 if (grabbed_window && (grabbed_window !=
window)) {
2535 grabbed_window->
flags &= ~SDL_WINDOW_INPUT_GRABBED;
2541 }
else if (grabbed_window ==
window) {
2561 window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
2661 if (Cocoa_IsWindowInFullscreenSpace(
window)) {
2739 window->surface->flags &= ~SDL_DONTFREE;
2945#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
2949 return (verstr && (
SDL_atoi(verstr) >= 3));
2956#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
2958 const char *extensions;
2960 const char *where, *terminator;
2964 if (where || *extension ==
'\0') {
2976 if (!glGetStringFunc) {
2988 if ((!glGetStringiFunc) || (!glGetIntegervFunc)) {
2992 #ifndef GL_NUM_EXTENSIONS
2993 #define GL_NUM_EXTENSIONS 0x821D
2996 for (
i = 0;
i < num_exts;
i++) {
2997 const char *thisext = (
const char *) glGetStringiFunc(
GL_EXTENSIONS,
i);
3025 if (where == extensions || *(where - 1) ==
' ')
3026 if (*terminator ==
' ' || *terminator ==
'\0')
3048#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
3102#elif SDL_VIDEO_OPENGL_ES2
3106#elif SDL_VIDEO_OPENGL_ES
3125#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
3246#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
3261 GLenum attachmentattrib = 0;
3366 int rsize = 0, gsize = 0, bsize = 0, asize = 0;
3382 *
value = rsize + gsize + bsize + asize;
3448 if (!glGetStringFunc) {
3453 glGetFramebufferAttachmentParameterivFunc =
SDL_GL_GetProcAddress(
"glGetFramebufferAttachmentParameteriv");
3455 if (glGetFramebufferAttachmentParameterivFunc) {
3465 if (glGetIntegervFunc) {
3473 if (!glGetErrorFunc) {
3477 error = glGetErrorFunc();
3499 SDL_SetError(
"The specified window isn't an OpenGL window");
3532 return SDL_SetError(
"The specified window isn't an OpenGL window");
3583 return SDL_SetError(
"No OpenGL context has been made current");
3587 return SDL_SetError(
"Setting the swap interval is not supported");
3611 SDL_SetError(
"The specified window isn't an OpenGL window");
3616 SDL_SetError(
"The specified window has not been made current");
3647#define SET_MASKBIT(icon, x, y, mask) \
3648 mask[(y*((icon->w+7)/8))+(x/8)] &= ~(0x01<<(7-(x%8)))
3650 colorkey = icon->
format->colorkey;
3655 for (
y = 0;
y < icon->
h; ++
y) {
3657 for (
x = 0;
x < icon->
w; ++
x) {
3658 if (*
pixels++ == colorkey) {
3659 SET_MASKBIT(icon,
x,
y,
mask);
3669 for (
y = 0;
y < icon->
h; ++
y) {
3671 for (
x = 0;
x < icon->
w; ++
x) {
3673 SET_MASKBIT(icon,
x,
y,
mask);
3674 }
else if ((
flags & 2)
3676 SET_MASKBIT(icon,
x,
y,
mask);
3687 for (
y = 0;
y < icon->
h; ++
y) {
3689 for (
x = 0;
x < icon->
w; ++
x) {
3691 SET_MASKBIT(icon,
x,
y,
mask);
3692 }
else if ((
flags & 2)
3694 SET_MASKBIT(icon,
x,
y,
mask);
3710 if (icon &&
_this->SetIcon) {
3713 int mask_len = icon->
h * (icon->
w + 7) / 8;
3720 if (icon->
flags & SDL_SRCCOLORKEY)
3722 if (icon->
flags & SDL_SRCALPHA)
3725 CreateMaskFromColorKeyOrAlpha(icon,
mask,
flags);
3828#if SDL_VIDEO_DRIVER_ANDROID
3831#if SDL_VIDEO_DRIVER_WINDOWS
3834#if SDL_VIDEO_DRIVER_WINRT
3837#if SDL_VIDEO_DRIVER_COCOA
3840#if SDL_VIDEO_DRIVER_UIKIT
3843#if SDL_VIDEO_DRIVER_X11
3848#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11
3873 int show_cursor_prev;
3877 if (!messageboxdata) {
3892 buttonid = &dummybutton;
3900#if SDL_VIDEO_DRIVER_ANDROID
3902 Android_ShowMessageBox(messageboxdata, buttonid) == 0) {
3906#if SDL_VIDEO_DRIVER_WINDOWS
3909 WIN_ShowMessageBox(messageboxdata, buttonid) == 0) {
3913#if SDL_VIDEO_DRIVER_WINRT
3916 WINRT_ShowMessageBox(messageboxdata, buttonid) == 0) {
3920#if SDL_VIDEO_DRIVER_COCOA
3923 Cocoa_ShowMessageBox(messageboxdata, buttonid) == 0) {
3927#if SDL_VIDEO_DRIVER_UIKIT
3930 UIKit_ShowMessageBox(messageboxdata, buttonid) == 0) {
3934#if SDL_VIDEO_DRIVER_X11
3937 X11_ShowMessageBox(messageboxdata, buttonid) == 0) {
3945 if (current_window) {
3947 if (mouse_captured) {
3961#ifdef __EMSCRIPTEN__
3967 alert(UTF8ToString($0) +
"\n\n" + UTF8ToString($1));
3978 data.numbuttons = 1;
4009 window->hit_test_data = userdata;
4017 float den2 = hinches * hinches + vinches * vinches;
4022 return (
float)(
SDL_sqrt((
double)hpix * (
double)hpix + (
double)vpix * (
double)vpix) /
4074#define NOT_A_VULKAN_WINDOW "The specified window isn't a Vulkan window"
4085 return SDL_SetError(
"Vulkan loader library already loaded");
4090 return SDL_SetError(
"Vulkan support is either not configured in SDL "
4091 "or not available in current SDL video driver "
4152 VkInstance instance,
SDL_bool Android_JNI_ShouldMinimizeOnFocusLoss(void)
#define SDL_assert(condition)
#define SDL_RenderPresent
#define SDL_InitSubSystem
#define SDL_DestroyRenderer
#define SDL_GetMouseState
#define SDL_DestroyTexture
#define SDL_CalculateGammaRamp
#define SDL_WarpMouseInWindow
#define SDL_SetRelativeMouseMode
#define SDL_CreateTexture
#define SDL_GetKeyboardFocus
#define SDL_GetRenderDriverInfo
#define SDL_EnclosePoints
#define SDL_CreateRenderer
#define SDL_UpdateTexture
#define SDL_ConvertSurfaceFormat
#define SDL_PixelFormatEnumToMasks
#define SDL_GetNumRenderDrivers
#define SDL_GetRendererInfo
#define SDL_CreateRGBSurfaceFrom
#define SDL_GetMouseFocus
#define SDL_GetHintBoolean
#define SDL_QuitSubSystem
#define SDL_GetRelativeMouseMode
#define SDL_RenderSetViewport
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
#define SDL_OutOfMemory()
#define SDL_Unsupported()
#define SDL_InvalidParamError(param)
int SDL_SendAppEvent(SDL_EventType eventType)
@ SDL_APP_WILLENTERFOREGROUND
@ SDL_APP_DIDENTERFOREGROUND
@ SDL_APP_WILLENTERBACKGROUND
@ SDL_APP_DIDENTERBACKGROUND
#define SDL_GetEventState(type)
#define SDL_HINT_RENDER_DRIVER
A variable specifying which render driver to use.
#define SDL_HINT_FRAMEBUFFER_ACCELERATION
A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER
A variable controlling whether the screensaver is enabled.
#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS
Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
#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....
#define SDL_HINT_VIDEO_HIGHDPI_DISABLED
If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS)
int SDL_KeyboardInit(void)
void SDL_ResetKeyboard(void)
void SDL_SetKeyboardFocus(SDL_Window *window)
void SDL_KeyboardQuit(void)
@ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT
@ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
void SDL_SetMouseFocus(SDL_Window *window)
SDL_Mouse * SDL_GetMouse(void)
GLint GLint GLint GLint GLint GLint y
GLuint GLuint GLsizei count
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
#define GL_ACCUM_ALPHA_BITS
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
#define GL_SAMPLE_BUFFERS
GLint GLint GLint GLint GLint x
#define GL_ACCUM_GREEN_BITS
#define GL_ACCUM_BLUE_BITS
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
#define GL_ACCUM_RED_BITS
GLboolean GLboolean GLboolean b
#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE
GLdouble GLdouble GLdouble GLdouble top
#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE
GLboolean GLboolean GLboolean GLboolean a
GLuint GLsizei const GLchar * message
GLuint const GLchar * name
GLsizei const GLchar *const * path
GLsizei const GLfloat * value
#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE
#define GL_CONTEXT_RELEASE_BEHAVIOR
GLfloat GLfloat GLfloat GLfloat h
GLubyte GLubyte GLubyte GLubyte w
#define SDL_BYTESPERPIXEL(X)
#define SDL_BITSPERPIXEL(X)
#define SDL_ISPIXELFORMAT_ALPHA(format)
#define SDL_PIXELLAYOUT(X)
@ SDL_PIXELFORMAT_ARGB8888
@ SDL_PIXELFORMAT_UNKNOWN
#define SDL_ISPIXELFORMAT_FOURCC(format)
SDL_bool SDL_GetSpanEnclosingRect(int width, int height, int numrects, const SDL_Rect *rects, SDL_Rect *span)
@ SDL_TEXTUREACCESS_STREAMING
#define SDL_arraysize(array)
#define FULLSCREEN_VISIBLE(W)
VideoBootStrap UIKIT_bootstrap
VideoBootStrap DUMMY_bootstrap
VideoBootStrap DirectFB_bootstrap
VideoBootStrap Android_bootstrap
VideoBootStrap HAIKU_bootstrap
VideoBootStrap Wayland_bootstrap
VideoBootStrap PND_bootstrap
VideoBootStrap VIVANTE_bootstrap
VideoBootStrap RPI_bootstrap
VideoBootStrap X11_bootstrap
VideoBootStrap Emscripten_bootstrap
VideoBootStrap NACL_bootstrap
VideoBootStrap COCOA_bootstrap
VideoBootStrap WINRT_bootstrap
VideoBootStrap WINDOWS_bootstrap
VideoBootStrap PSP_bootstrap
VideoBootStrap KMSDRM_bootstrap
#define SDL_VERSION(x)
Macro to determine SDL version program was compiled against.
void SDL_HideWindow(SDL_Window *window)
Hide a window.
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,...
SDL_bool SDL_HasScreenKeyboardSupport(void)
Returns whether the platform has some screen keyboard support.
#define CHECK_DISPLAY_INDEX(displayIndex, retval)
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)
int SDL_UpdateWindowSurface(SDL_Window *window)
Copy the window surface to the screen.
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).
static int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
void SDL_SetWindowPosition(SDL_Window *window, int x, int y)
Set the position of a window.
SDL_bool SDL_IsScreenKeyboardShown(SDL_Window *window)
Returns whether the screen keyboard is shown for given window.
static SDL_bool ShouldUseTextureFramebuffer()
void * SDL_GetDisplayDriverData(int displayIndex)
#define NOT_A_VULKAN_WINDOW
SDL_Surface * SDL_GetWindowSurface(SDL_Window *window)
Get the SDL surface associated with the window.
static void SDL_DestroyWindowTexture(SDL_VideoDevice *unused, SDL_Window *window)
Uint32 SDL_GetWindowFlags(SDL_Window *window)
Get the window flags.
int SDL_GetWindowDisplayIndex(SDL_Window *window)
Get the display index associated with a window.
static SDL_DisplayMode * SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay *display, const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
SDL_bool SDL_GL_ExtensionSupported(const char *extension)
Return true if an OpenGL extension is supported for the current context.
int SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode *mode)
Fill in information about the current display mode.
int SDL_GL_SetSwapInterval(int interval)
Set the swap interval for the current OpenGL context.
#define SDL_WINDOWTEXTUREDATA
#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR
void * SDL_GetWindowData(SDL_Window *window, const char *name)
Retrieve the data pointer associated with a window.
SDL_bool SDL_ShouldAllowTopmost(void)
void SDL_OnApplicationWillEnterForeground(void)
void SDL_OnWindowLeave(SDL_Window *window)
SDL_bool SDL_GetWindowWMInfo(SDL_Window *window, struct SDL_SysWMinfo *info)
This function allows access to driver-dependent window information.
const char * SDL_GetWindowTitle(SDL_Window *window)
Get the title of a window, in UTF-8 format.
void SDL_GetWindowMaximumSize(SDL_Window *window, int *max_w, int *max_h)
Get the maximum size of a window's client area.
void SDL_OnWindowMinimized(SDL_Window *window)
static int SDL_CreateWindowTexture(SDL_VideoDevice *unused, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
SDL_bool SDL_HasWindows(void)
void SDL_GL_SwapWindow(SDL_Window *window)
Swap the OpenGL buffers for a window, if double-buffering is supported.
Uint32 SDL_GetWindowPixelFormat(SDL_Window *window)
Get the pixel format associated with the window.
int SDL_VideoInit(const char *driver_name)
Initialize the video subsystem, optionally specifying a video driver.
SDL_DisplayOrientation SDL_GetDisplayOrientation(int displayIndex)
Get the orientation of a display.
void SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabbed)
Set a window's input grab mode.
void SDL_EnableScreenSaver()
Allow the screen to be blanked by a screensaver.
int SDL_GetDisplayMode(int displayIndex, int index, SDL_DisplayMode *mode)
Fill in information about a specific display mode.
static SDL_bool CanMinimizeWindow(SDL_Window *window)
void SDL_OnWindowFocusLost(SDL_Window *window)
void * SDL_GL_GetProcAddress(const char *proc)
Get the address of an OpenGL function.
static SDL_INLINE void PrepareDragAndDropSupport(SDL_Window *window)
void SDL_OnWindowHidden(SDL_Window *window)
SDL_Window * SDL_GetFocusWindow(void)
void SDL_OnWindowShown(SDL_Window *window)
static SDL_bool ShouldMinimizeOnFocusLoss(SDL_Window *window)
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.
int SDL_GL_GetSwapInterval(void)
Get the swap interval for the current OpenGL context.
int SDL_GetWindowDisplayMode(SDL_Window *window, SDL_DisplayMode *mode)
Fill in information about the display mode used when a fullscreen window is visible.
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
int SDL_UpdateWindowSurfaceRects(SDL_Window *window, const SDL_Rect *rects, int numrects)
Copy a number of rectangles on the window surface to the screen.
static SDL_VideoDevice * _this
void SDL_OnWindowResized(SDL_Window *window)
int SDL_GetDisplayDPI(int displayIndex, float *ddpi, float *hdpi, float *vdpi)
Get the dots/pixels-per-inch for a display.
SDL_DisplayMode * SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
Get the closest match to the requested display mode.
void SDL_SetWindowTitle(SDL_Window *window, const char *title)
Set the title of a window, in UTF-8 format.
void SDL_RestoreWindow(SDL_Window *window)
Restore the size and position of a minimized or maximized window.
SDL_GLContext SDL_GL_CreateContext(SDL_Window *window)
Create an OpenGL context for use with an OpenGL window, and make it current.
void * SDL_Vulkan_GetVkGetInstanceProcAddr(void)
Get the address of the vkGetInstanceProcAddr function.
void SDL_DisableScreenSaver()
Prevent the screen from being blanked by a screensaver.
int SDL_SetWindowFullscreen(SDL_Window *window, Uint32 flags)
Set a window's fullscreen state.
static int cmpmodes(const void *A, const void *B)
void SDL_OnWindowEnter(SDL_Window *window)
void SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h)
Set the maximum size of a window's client area.
static int SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay *display)
void SDL_OnWindowRestored(SDL_Window *window)
static void SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
void SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered)
Set the border state of a window.
int SDL_GetDisplayBounds(int displayIndex, SDL_Rect *rect)
Get the desktop area represented by a display, with the primary display located at 0,...
SDL_bool SDL_GetWindowGrab(SDL_Window *window)
Get a window's input grab mode.
void SDL_StartTextInput(void)
Start accepting Unicode text input events. This function will show the on-screen keyboard if supporte...
int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
Create a modal message box.
int SDL_GetNumVideoDisplays(void)
Returns the number of available video displays.
int SDL_SetWindowInputFocus(SDL_Window *window)
Explicitly sets input focus to the window.
SDL_bool SDL_Vulkan_GetInstanceExtensions(SDL_Window *window, unsigned *count, const char **names)
#define CHECK_WINDOW_MAGIC(window, retval)
static int SDL_UninitializedVideo()
int SDL_Vulkan_LoadLibrary(const char *path)
Dynamically load a Vulkan loader library.
void SDL_GetWindowPosition(SDL_Window *window, int *x, int *y)
Get the position of a window.
int SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext ctx)
Set up an OpenGL context for rendering into an OpenGL window.
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.
int SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect *rect)
Get the usable desktop area represented by a display, with the primary display located at 0,...
SDL_GLContext SDL_GL_GetCurrentContext(void)
Get the currently active OpenGL context.
void SDL_ToggleDragAndDropSupport(void)
void SDL_ShowWindow(SDL_Window *window)
Show a window.
SDL_Window * SDL_GetGrabbedWindow(void)
Get the window that currently has an input grab enabled.
const char * SDL_GetDisplayName(int displayIndex)
Get the name of a display in UTF-8 encoding.
int SDL_RecreateWindow(SDL_Window *window, Uint32 flags)
void SDL_GL_UnloadLibrary(void)
Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
float SDL_GetWindowBrightness(SDL_Window *window)
Get the brightness (gamma correction) for a window.
static void SDL_RestoreMousePosition(SDL_Window *window)
int SDL_GL_SetAttribute(SDL_GLattr attr, int value)
Set an OpenGL window attribute before window creation.
int SDL_AddBasicVideoDisplay(const SDL_DisplayMode *desktop_mode)
int SDL_SetWindowOpacity(SDL_Window *window, float opacity)
Set the opacity for a window.
int SDL_SetWindowBrightness(SDL_Window *window, float brightness)
Set the brightness (gamma correction) for a window.
int SDL_GetNumVideoDrivers(void)
Get the number of video drivers compiled into SDL.
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
SDL_Window * SDL_GL_GetCurrentWindow(void)
Get the currently active OpenGL window.
void SDL_GL_ResetAttributes()
Reset all previously set OpenGL context attributes to their default values.
void * SDL_SetWindowData(SDL_Window *window, const char *name, void *userdata)
Associate an arbitrary named pointer with a window.
void SDL_OnApplicationDidBecomeActive(void)
void SDL_UpdateWindowGrab(SDL_Window *window)
int SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode *mode)
Fill in information about the desktop display mode.
void SDL_SetWindowMinimumSize(SDL_Window *window, int min_w, int min_h)
Set the minimum size of a window's client area.
static SDL_INLINE SDL_bool isAtLeastGL3(const char *verstr)
int SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window)
Create a simple modal message box.
SDL_VideoDisplay * SDL_GetDisplay(int displayIndex)
SDL_Window * SDL_GetWindowFromID(Uint32 id)
Get a window from a stored ID, or NULL if it doesn't exist.
void SDL_OnApplicationDidEnterBackground(void)
const char * SDL_GetVideoDriver(int index)
Get the name of a built in video driver.
void SDL_GL_DeleteContext(SDL_GLContext context)
Delete an OpenGL context.
void SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon)
Set the icon for a window.
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display)
void SDL_GetWindowSize(SDL_Window *window, int *w, int *h)
Get the size of a window's client area.
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 keyb...
void SDL_DestroyWindow(SDL_Window *window)
Destroy a window.
void SDL_MaximizeWindow(SDL_Window *window)
Make a window as large as possible.
void SDL_MinimizeWindow(SDL_Window *window)
Minimize a window to an iconic representation.
static VideoBootStrap * bootstrap[]
Uint32 SDL_GetWindowID(SDL_Window *window)
Get the numeric ID of a window, for logging purposes.
SDL_Window * SDL_CreateWindowFrom(const void *data)
Create an SDL window from an existing native window.
void SDL_SetWindowSize(SDL_Window *window, int w, int h)
Set the size of a window's client area.
int SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
Get the actual value for an attribute from the current context.
const char * SDL_GetCurrentVideoDriver()
Returns the name of the currently initialized video driver.
static int SDL_UpdateWindowTexture(SDL_VideoDevice *unused, SDL_Window *window, const SDL_Rect *rects, int numrects)
SDL_VideoDevice * SDL_GetVideoDevice(void)
int SDL_GL_LoadLibrary(const char *path)
Dynamically load an OpenGL library.
float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches)
void SDL_OnWindowFocusGained(SDL_Window *window)
static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
static SDL_INLINE SDL_bool IsAcceptingDragAndDrop(void)
void SDL_StopTextInput(void)
Stop receiving any text input events. This function will hide the on-screen keyboard if supported.
SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
int SDL_GetWindowGammaRamp(SDL_Window *window, Uint16 *red, Uint16 *green, Uint16 *blue)
Get the gamma ramp for a window.
void SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable)
Set the user-resizable state of a window.
int SDL_SetWindowGammaRamp(SDL_Window *window, const Uint16 *red, const Uint16 *green, const Uint16 *blue)
Set the gamma ramp for a window.
static SDL_Surface * SDL_CreateWindowFramebuffer(SDL_Window *window)
void SDL_GetWindowMinimumSize(SDL_Window *window, int *min_w, int *min_h)
Get the minimum size of a window's client area.
void SDL_VideoQuit(void)
Shuts down the video subsystem.
int SDL_GetIndexOfDisplay(SDL_VideoDisplay *display)
int SDL_SetWindowDisplayMode(SDL_Window *window, const SDL_DisplayMode *mode)
Set the display mode used when a fullscreen window is visible.
int SDL_GetNumDisplayModes(int displayIndex)
Returns the number of available display modes.
SDL_bool SDL_Vulkan_CreateSurface(SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface)
Create a Vulkan rendering surface for a window.
void SDL_Vulkan_UnloadLibrary(void)
Unload the Vulkan loader library previously loaded by SDL_Vulkan_LoadLibrary().
void SDL_OnApplicationDidReceiveMemoryWarning(void)
#define GL_NUM_EXTENSIONS
SDL_bool SDL_IsTextInputActive(void)
Return whether or not Unicode text input events are enabled.
void SDL_RaiseWindow(SDL_Window *window)
Raise a window above other windows and set the input focus.
void SDL_GL_DeduceMaxSupportedESProfile(int *major, int *minor)
void SDL_OnApplicationWillResignActive(void)
int SDL_GetWindowOpacity(SDL_Window *window, float *out_opacity)
Get the opacity of a window.
int SDL_SetWindowHitTest(SDL_Window *window, SDL_HitTest callback, void *userdata)
Provide a callback that decides if a window region has special properties.
SDL_bool SDL_IsScreenSaverEnabled()
Returns whether the screensaver is currently enabled (default off).
void SDL_OnApplicationWillTerminate(void)
#define SDL_WINDOWPOS_ISCENTERED(X)
SDL_HitTestResult(* SDL_HitTest)(SDL_Window *win, const SDL_Point *area, void *data)
Callback used for hit-testing.
#define SDL_WINDOWPOS_ISUNDEFINED(X)
@ SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
SDL_GLattr
OpenGL configuration attributes.
@ SDL_GL_FRAMEBUFFER_SRGB_CAPABLE
@ SDL_GL_CONTEXT_RELEASE_BEHAVIOR
@ SDL_GL_CONTEXT_MAJOR_VERSION
@ SDL_GL_CONTEXT_RESET_NOTIFICATION
@ SDL_GL_ACCUM_ALPHA_SIZE
@ SDL_GL_MULTISAMPLESAMPLES
@ SDL_GL_CONTEXT_MINOR_VERSION
@ SDL_GL_MULTISAMPLEBUFFERS
@ SDL_GL_ACCUM_GREEN_SIZE
@ SDL_GL_SHARE_WITH_CURRENT_CONTEXT
@ SDL_GL_RETAINED_BACKING
@ SDL_GL_ACCELERATED_VISUAL
@ SDL_GL_CONTEXT_PROFILE_MASK
@ SDL_GL_CONTEXT_NO_ERROR
@ SDL_WINDOW_ALLOW_HIGHDPI
@ SDL_WINDOW_MOUSE_CAPTURE
@ SDL_WINDOW_INPUT_GRABBED
@ SDL_WINDOW_FULLSCREEN_DESKTOP
@ SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
@ SDL_GL_CONTEXT_RESET_ISOLATION_FLAG
@ SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG
@ SDL_GL_CONTEXT_DEBUG_FLAG
void * SDL_GLContext
An opaque handle to an OpenGL context.
@ SDL_WINDOWEVENT_FOCUS_LOST
@ SDL_WINDOWEVENT_RESIZED
@ SDL_WINDOWEVENT_FOCUS_GAINED
@ SDL_WINDOWEVENT_MINIMIZED
@ SDL_WINDOWEVENT_SIZE_CHANGED
@ SDL_WINDOWEVENT_RESTORED
@ SDL_GL_CONTEXT_PROFILE_COMPATIBILITY
@ SDL_GL_CONTEXT_PROFILE_ES
@ SDL_GL_CONTEXT_PROFILE_CORE
@ SDL_ORIENTATION_UNKNOWN
@ SDL_GL_CONTEXT_RESET_NO_NOTIFICATION
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
Uint32 WINRT_DetectWindowFlags(SDL_Window *window)
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)
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)
EGLSurface EGLNativeWindowType * window
EGLSurface EGLint * rects
The structure that defines a display mode.
MessageBox structure containing title, text, window, etc.
The structure that defines a point (integer)
A rectangle, with the origin at the upper left (integer).
Information on the capabilities of a render driver or context.
Uint32 texture_formats[16]
Uint32 num_texture_formats
A collection of pixels used in software blitting.
int(* SetDisplayMode)(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
int(* GetDisplayBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
void(* SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon)
int(* CreateWindowFramebuffer)(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
int framebuffer_srgb_capable
void(* HideScreenKeyboard)(_THIS, SDL_Window *window)
int(* ShowMessageBox)(_THIS, const SDL_MessageBoxData *messageboxdata, int *buttonid)
int(* SetWindowHitTest)(SDL_Window *window, SDL_bool enabled)
void(* GL_DeleteContext)(_THIS, SDL_GLContext context)
void(* ShowWindow)(_THIS, SDL_Window *window)
int(* GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context)
void(* RestoreWindow)(_THIS, SDL_Window *window)
SDL_GLContext current_glctx
void(* SetWindowFullscreen)(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
int(* GetDisplayUsableBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
void(* SuspendScreenSaver)(_THIS)
int(* Vulkan_LoadLibrary)(_THIS, const char *path)
SDL_bool(* Vulkan_GetInstanceExtensions)(_THIS, SDL_Window *window, unsigned *count, const char **names)
int(* CreateSDLWindow)(_THIS, SDL_Window *window)
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
void(* SetWindowSize)(_THIS, SDL_Window *window)
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr
int(* SetWindowModalFor)(_THIS, SDL_Window *modal_window, SDL_Window *parent_window)
int(* UpdateWindowFramebuffer)(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
int(* GetDisplayDPI)(_THIS, SDL_VideoDisplay *display, float *ddpi, float *hdpi, float *vdpi)
void(* SetWindowPosition)(_THIS, SDL_Window *window)
int(* GL_SetSwapInterval)(_THIS, int interval)
void(* GL_UnloadLibrary)(_THIS)
void(* SetWindowMinimumSize)(_THIS, SDL_Window *window)
int(* SetWindowGammaRamp)(_THIS, SDL_Window *window, const Uint16 *ramp)
SDL_bool suspend_screensaver
void(* SetWindowResizable)(_THIS, SDL_Window *window, SDL_bool resizable)
SDL_bool(* HasScreenKeyboardSupport)(_THIS)
void(* Vulkan_UnloadLibrary)(_THIS)
void(* GetDisplayModes)(_THIS, SDL_VideoDisplay *display)
SDL_bool(* IsScreenKeyboardShown)(_THIS, SDL_Window *window)
SDL_TLSID current_glwin_tls
SDL_VideoDisplay * displays
SDL_Window * grabbed_window
void(* Vulkan_GetDrawableSize)(_THIS, SDL_Window *window, int *w, int *h)
int(* GL_GetSwapInterval)(_THIS)
int(* GetWindowGammaRamp)(_THIS, SDL_Window *window, Uint16 *ramp)
int(* GetWindowBordersSize)(_THIS, SDL_Window *window, int *top, int *left, int *bottom, int *right)
void(* GL_GetDrawableSize)(_THIS, SDL_Window *window, int *w, int *h)
void(* DestroyWindow)(_THIS, SDL_Window *window)
void(* StartTextInput)(_THIS)
int(* GL_LoadLibrary)(_THIS, const char *path)
int(* GL_SwapWindow)(_THIS, SDL_Window *window)
void(* SetWindowMaximumSize)(_THIS, SDL_Window *window)
void(* SetWindowTitle)(_THIS, SDL_Window *window)
int(* SetWindowInputFocus)(_THIS, SDL_Window *window)
void(* DestroyWindowFramebuffer)(_THIS, SDL_Window *window)
struct SDL_VideoDevice::@262 gl_config
void(* GL_DefaultProfileConfig)(_THIS, int *mask, int *major, int *minor)
void(* MinimizeWindow)(_THIS, SDL_Window *window)
void(* HideWindow)(_THIS, SDL_Window *window)
SDL_bool(* GetWindowWMInfo)(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
struct SDL_VideoDevice::@263 vulkan_config
void(* SetTextInputRect)(_THIS, SDL_Rect *rect)
SDL_bool(* Vulkan_CreateSurface)(_THIS, SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface)
void *(* GL_GetProcAddress)(_THIS, const char *proc)
void(* AcceptDragAndDrop)(SDL_Window *window, SDL_bool accept)
void(* SetWindowGrab)(_THIS, SDL_Window *window, SDL_bool grabbed)
void(* StopTextInput)(_THIS)
int(* CreateSDLWindowFrom)(_THIS, SDL_Window *window, const void *data)
SDL_TLSID current_glctx_tls
SDL_Window * current_glwin
void(* MaximizeWindow)(_THIS, SDL_Window *window)
void(* OnWindowEnter)(_THIS, SDL_Window *window)
int(* SetWindowOpacity)(_THIS, SDL_Window *window, float opacity)
int share_with_current_context
void(* ShowScreenKeyboard)(_THIS, SDL_Window *window)
void(* SetWindowBordered)(_THIS, SDL_Window *window, SDL_bool bordered)
void(* RaiseWindow)(_THIS, SDL_Window *window)
SDL_DisplayMode desktop_mode
SDL_DisplayOrientation orientation
SDL_DisplayMode * display_modes
SDL_Window * fullscreen_window
SDL_DisplayMode current_mode
The type used to identify a window.
struct SDL_WindowUserData * next
SDL_VideoDevice *(* create)(int devindex)
static SDL_Renderer * renderer
static Uint32 callback(Uint32 interval, void *param)
static screen_context_t context
VideoBootStrap QNX_bootstrap