SDL_sysvideo.h File Reference
`#include "../SDL_internal.h"`
`#include "SDL_messagebox.h"`
`#include "SDL_shape.h"`
`#include "SDL_thread.h"`
Include dependency graph for SDL_sysvideo.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | SDL_WindowShaper
struct | SDL_ShapeDriver
struct | SDL_WindowUserData
struct | SDL_Window
| The type used to identify a window. More...
struct | SDL_VideoDisplay
struct | SDL_VideoDevice
struct | VideoBootStrap

## Macros

#define | FULLSCREEN_VISIBLE(W)
#define | _THIS SDL_VideoDevice *_this

## Functions

SDL_VideoDevice * | SDL_GetVideoDevice (void)
int | SDL_AddBasicVideoDisplay (const SDL_DisplayMode *desktop_mode)
int | SDL_AddVideoDisplay (const SDL_VideoDisplay *display)
SDL_bool | SDL_AddDisplayMode (SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
SDL_VideoDisplay * | SDL_GetDisplayForWindow (SDL_Window *window)
void * | SDL_GetDisplayDriverData (int displayIndex)
int | SDL_RecreateWindow (SDL_Window *window, Uint32 flags)
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)
void | SDL_OnWindowFocusLost (SDL_Window *window)
void | SDL_UpdateWindowGrab (SDL_Window *window)
SDL_Window * | SDL_GetFocusWindow (void)
SDL_bool | SDL_ShouldAllowTopmost (void)
float | SDL_ComputeDiagonalDPI (int hpix, int vpix, float hinches, float vinches)

## Macro Definition Documentation

#define _THIS SDL_VideoDevice *_this

Definition at line 140 of file SDL_sysvideo.h.

#define FULLSCREEN_VISIBLE | ( |  | W | ) |

Value:
(((W)->flags & SDL_WINDOW_FULLSCREEN) && \
((W)->flags & SDL_WINDOW_SHOWN) && \
!((W)->flags & SDL_WINDOW_MINIMIZED))
SDL_WINDOW_SHOWN
Definition: SDL_video.h:100
SDL_WINDOW_MINIMIZED
Definition: SDL_video.h:104
SDL_WINDOW_FULLSCREEN
Definition: SDL_video.h:98
flags
GLbitfield flags
Definition: SDL_opengl_glext.h:1480

Definition at line 111 of file SDL_sysvideo.h.

Referenced by SDL_CreateWindow(), SDL_OnWindowRestored(), SDL_SetWindowDisplayMode(), SDL_SetWindowFullscreen(), SDL_SetWindowSize(), and SDL_UpdateFullscreenMode().

## Function Documentation

int SDL_AddBasicVideoDisplay | ( | const SDL_DisplayMode * | desktop_mode | ) |

Definition at line 579 of file SDL_video.c.

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

{
SDL_VideoDisplay display;
SDL_zero(display);
if (desktop_mode) {
display.desktop_mode = *desktop_mode;
}
display.current_mode = display.desktop_mode;
return SDL_AddVideoDisplay(&display);
}
SDL_VideoDisplay::current_mode
SDL_DisplayMode current_mode
Definition: SDL_sysvideo.h:127
SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:357
SDL_VideoDisplay
Definition: SDL_sysvideo.h:120
SDL_AddVideoDisplay
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display)
Definition: SDL_video.c:593
SDL_VideoDisplay::desktop_mode
SDL_DisplayMode desktop_mode
Definition: SDL_sysvideo.h:126

SDL_bool SDL_AddDisplayMode | ( | SDL_VideoDisplay * | display,
|  | const SDL_DisplayMode * | mode
| ) |  |

Definition at line 709 of file SDL_video.c.

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_DisplayMode *modes;
int i, nmodes;
/* Make sure we don't already have the mode in the list */
modes = display->display_modes;
nmodes = display->num_display_modes;
for (i = 0; i < nmodes; ++i) {
if (cmpmodes(mode, &modes[i]) == 0) {
return SDL_FALSE;
}
}
/* Go ahead and add the new mode */
if (nmodes == display->max_display_modes) {
modes =
SDL_realloc(modes,
(display->max_display_modes + 32) * sizeof(*modes));
if (!modes) {
return SDL_FALSE;
}
display->display_modes = modes;
display->max_display_modes += 32;
}
modes[nmodes] = *mode;
display->num_display_modes++;
/* Re-sort video modes */
SDL_qsort(display->display_modes, display->num_display_modes,
sizeof(SDL_DisplayMode), cmpmodes);
return SDL_TRUE;
}
SDL_qsort
#define SDL_qsort
Definition: SDL_dynapi_overrides.h:386
SDL_DisplayMode
The structure that defines a display mode.
Definition: SDL_video.h:53
SDL_realloc
#define SDL_realloc
Definition: SDL_dynapi_overrides.h:382
SDL_VideoDisplay::num_display_modes
int num_display_modes
Definition: SDL_sysvideo.h:124
cmpmodes
static int cmpmodes(const void *A, const void *B)
Definition: SDL_video.c:398
SDL_VideoDisplay::display_modes
SDL_DisplayMode * display_modes
Definition: SDL_sysvideo.h:125
mode
GLenum mode
Definition: SDL_opengl_glext.h:1122
SDL_TRUE
Definition: SDL_stdinc.h:129
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:42
SDL_FALSE
Definition: SDL_stdinc.h:128
SDL_VideoDisplay::max_display_modes
int max_display_modes
Definition: SDL_sysvideo.h:123

int SDL_AddVideoDisplay | ( | const SDL_VideoDisplay * | display | ) |

Definition at line 593 of file SDL_video.c.

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

{
SDL_VideoDisplay *displays;
int index = -1;
displays =
SDL_realloc(_this->displays,
(_this->num_displays + 1) * sizeof(*displays));
if (displays) {
index = _this->num_displays++;
displays[index] = *display;
displays[index].device = _this;
_this->displays = displays;
if (display->name) {
displays[index].name = SDL_strdup(display->name);
} else {
char name[32];
SDL_itoa(index, name, 10);
displays[index].name = SDL_strdup(name);
}
} else {
SDL_OutOfMemory();
}
return index;
}
SDL_VideoDisplay::name
char * name
Definition: SDL_sysvideo.h:122
SDL_itoa
#define SDL_itoa
Definition: SDL_dynapi_overrides.h:410
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:660
SDL_realloc
#define SDL_realloc
Definition: SDL_dynapi_overrides.h:382
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDisplay::device
SDL_VideoDevice * device
Definition: SDL_sysvideo.h:131
SDL_VideoDevice::num_displays
int num_displays
Definition: SDL_sysvideo.h:279
SDL_VideoDevice::displays
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:280
index
GLuint index
Definition: SDL_opengl_glext.h:660
SDL_VideoDisplay
Definition: SDL_sysvideo.h:120
SDL_OutOfMemory
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_strdup
#define SDL_strdup
Definition: SDL_dynapi_overrides.h:403

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

Definition at line 3649 of file SDL_video.c.

References SDL_sqrt.

{
float den2 = hinches * hinches + vinches * vinches;
if ( den2 <= 0.0f ) {
return 0.0f;
}
return (float)(SDL_sqrt((double)hpix * (double)hpix + (double)vpix * (double)vpix) /
SDL_sqrt((double)den2));
}
f
GLfloat f
Definition: SDL_opengl_glext.h:1870
SDL_sqrt
#define SDL_sqrt
Definition: SDL_dynapi_overrides.h:443

void* SDL_GetDisplayDriverData | ( | int | displayIndex | ) |

Definition at line 647 of file SDL_video.c.

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

{
CHECK_DISPLAY_INDEX(displayIndex, NULL);
return _this->displays[displayIndex].driverdata;
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::displays
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:280
NULL
#define NULL
Definition: begin_code.h:143
CHECK_DISPLAY_INDEX
#define CHECK_DISPLAY_INDEX(displayIndex, retval)
Definition: SDL_video.c:126
SDL_VideoDisplay::driverdata
void * driverdata
Definition: SDL_sysvideo.h:133

SDL_VideoDisplay* SDL_GetDisplayForWindow | ( | SDL_Window * | window | ) |

Definition at line 1039 of file SDL_video.c.

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

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

{
int displayIndex = SDL_GetWindowDisplayIndex(window);
if (displayIndex >= 0) {
return &_this->displays[displayIndex];
} else {
return NULL;
}
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::displays
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:280
NULL
#define NULL
Definition: begin_code.h:143
SDL_GetWindowDisplayIndex
int SDL_GetWindowDisplayIndex(SDL_Window *window)
Get the display index associated with a window.
Definition: SDL_video.c:979

SDL_Window* SDL_GetFocusWindow | ( | void |  | ) |

Definition at line 2403 of file SDL_video.c.

References SDL_Window::flags, SDL_Window::next, NULL, SDL_WINDOW_INPUT_FOCUS, window, and SDL_VideoDevice::windows.

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

{
SDL_Window *window;
if (!_this) {
return NULL;
}
for (window = _this->windows; window; window = window->next) {
if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
return window;
}
}
return NULL;
}
SDL_Window::next
SDL_Window * next
Definition: SDL_sysvideo.h:109
window
SDL_Window * window
Definition: testautomation_render.c:26
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::windows
SDL_Window * windows
Definition: SDL_sysvideo.h:281
NULL
#define NULL
Definition: begin_code.h:143
SDL_WINDOW_INPUT_FOCUS
Definition: SDL_video.h:107
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:71
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81

SDL_VideoDevice* SDL_GetVideoDevice | ( | void |  | ) |

Definition at line 573 of file SDL_video.c.

References _this.

Referenced by SDL_CreateShapedWindow(), SDL_GetClipboardText(), SDL_HasClipboardText(), SDL_PumpEvents(), SDL_SetClipboardText(), SDL_SetKeyboardFocus(), and SDL_SetWindowShape().

{
return _this;
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114

void SDL_OnWindowEnter | ( | SDL_Window * | window | ) |

Definition at line 2330 of file SDL_video.c.

References SDL_VideoDevice::OnWindowEnter.

Referenced by SDL_SendWindowEvent().

{
if (_this->OnWindowEnter) {
_this->OnWindowEnter(_this, window);
}
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::OnWindowEnter
void(* OnWindowEnter)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:218

void SDL_OnWindowFocusGained | ( | SDL_Window * | window | ) |

Definition at line 2343 of file SDL_video.c.

References SDL_Window::gamma, SDL_Window::h, SDL_Mouse::relative_mode, SDL_GetMouse(), SDL_SetMouseFocus(), SDL_UpdateWindowGrab(), SDL_WarpMouseInWindow, SDL_VideoDevice::SetWindowGammaRamp, and SDL_Window::w.

Referenced by SDL_SendWindowEvent().

{
SDL_Mouse *mouse = SDL_GetMouse();
if (window->gamma && _this->SetWindowGammaRamp) {
_this->SetWindowGammaRamp(_this, window, window->gamma);
}
if (mouse && mouse->relative_mode) {
SDL_SetMouseFocus(window);
SDL_WarpMouseInWindow(window, window->w/2, window->h/2);
}
SDL_UpdateWindowGrab(window);
}
SDL_GetMouse
SDL_Mouse * SDL_GetMouse(void)
Definition: SDL_mouse.c:66
SDL_Window::w
int w
Definition: SDL_sysvideo.h:78
SDL_SetMouseFocus
void SDL_SetMouseFocus(SDL_Window *window)
Definition: SDL_mouse.c:103
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_Mouse::relative_mode
SDL_bool relative_mode
Definition: SDL_mouse_c.h:84
SDL_UpdateWindowGrab
void SDL_UpdateWindowGrab(SDL_Window *window)
Definition: SDL_video.c:2227
SDL_Window::h
int h
Definition: SDL_sysvideo.h:78
SDL_Mouse
Definition: SDL_mouse_c.h:43
SDL_WarpMouseInWindow
#define SDL_WarpMouseInWindow
Definition: SDL_dynapi_overrides.h:254
SDL_Window::gamma
Uint16 * gamma
Definition: SDL_sysvideo.h:90
SDL_VideoDevice::SetWindowGammaRamp
int(* SetWindowGammaRamp)(_THIS, SDL_Window *window, const Uint16 *ramp)
Definition: SDL_sysvideo.h:211

void SDL_OnWindowFocusLost | ( | SDL_Window * | window | ) |

Definition at line 2387 of file SDL_video.c.

References SDL_Window::gamma, SDL_Window::saved_gamma, SDL_MinimizeWindow(), SDL_UpdateWindowGrab(), SDL_VideoDevice::SetWindowGammaRamp, and ShouldMinimizeOnFocusLoss().

Referenced by SDL_SendWindowEvent().

{
if (window->gamma && _this->SetWindowGammaRamp) {
_this->SetWindowGammaRamp(_this, window, window->saved_gamma);
}
SDL_UpdateWindowGrab(window);
if (ShouldMinimizeOnFocusLoss(window)) {
SDL_MinimizeWindow(window);
}
}
SDL_Window::saved_gamma
Uint16 * saved_gamma
Definition: SDL_sysvideo.h:91
SDL_MinimizeWindow
void SDL_MinimizeWindow(SDL_Window *window)
Minimize a window to an iconic representation.
Definition: SDL_video.c:1998
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_UpdateWindowGrab
void SDL_UpdateWindowGrab(SDL_Window *window)
Definition: SDL_video.c:2227
SDL_Window::gamma
Uint16 * gamma
Definition: SDL_sysvideo.h:90
SDL_VideoDevice::SetWindowGammaRamp
int(* SetWindowGammaRamp)(_THIS, SDL_Window *window, const Uint16 *ramp)
Definition: SDL_sysvideo.h:211
ShouldMinimizeOnFocusLoss
static SDL_bool ShouldMinimizeOnFocusLoss(SDL_Window *window)
Definition: SDL_video.c:2360

void SDL_OnWindowHidden | ( | SDL_Window * | window | ) |

Definition at line 2295 of file SDL_video.c.

References SDL_FALSE, and SDL_UpdateFullscreenMode().

Referenced by SDL_SendWindowEvent().

{
SDL_UpdateFullscreenMode(window, SDL_FALSE);
}
SDL_UpdateFullscreenMode
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
Definition: SDL_video.c:1133
SDL_FALSE
Definition: SDL_stdinc.h:128

void SDL_OnWindowLeave | ( | SDL_Window * | window | ) |

Definition at line 2338 of file SDL_video.c.

Referenced by SDL_SendWindowEvent().

{
}

void SDL_OnWindowMinimized | ( | SDL_Window * | window | ) |

Definition at line 2308 of file SDL_video.c.

References SDL_FALSE, and SDL_UpdateFullscreenMode().

Referenced by SDL_SendWindowEvent().

{
SDL_UpdateFullscreenMode(window, SDL_FALSE);
}
SDL_UpdateFullscreenMode
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
Definition: SDL_video.c:1133
SDL_FALSE
Definition: SDL_stdinc.h:128

void SDL_OnWindowResized | ( | SDL_Window * | window | ) |

Definition at line 2301 of file SDL_video.c.

References SDL_Window::h, SDL_FALSE, SDL_SendWindowEvent(), SDL_WINDOWEVENT_SIZE_CHANGED, SDL_Window::surface_valid, and SDL_Window::w.

Referenced by SDL_SendWindowEvent(), SDL_SetWindowSize(), and SDL_UpdateFullscreenMode().

{
window->surface_valid = SDL_FALSE;
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, window->w, window->h);
}
SDL_Window::w
int w
Definition: SDL_sysvideo.h:78
SDL_SendWindowEvent
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
Definition: SDL_windowevents.c:74
SDL_WINDOWEVENT_SIZE_CHANGED
Definition: SDL_video.h:146
SDL_Window::h
int h
Definition: SDL_sysvideo.h:78
SDL_FALSE
Definition: SDL_stdinc.h:128
SDL_Window::surface_valid
SDL_bool surface_valid
Definition: SDL_sysvideo.h:94

void SDL_OnWindowRestored | ( | SDL_Window * | window | ) |

Definition at line 2314 of file SDL_video.c.

References FULLSCREEN_VISIBLE, SDL_TRUE, and SDL_UpdateFullscreenMode().

Referenced by SDL_OnWindowShown(), and SDL_SendWindowEvent().

{
/*
* FIXME: Is this fine to just remove this, or should it be preserved just
* for the fullscreen case? In principle it seems like just hiding/showing
* windows shouldn't affect the stacking order; maybe the right fix is to
* re-decouple OnWindowShown and OnWindowRestored.
*/
/*SDL_RaiseWindow(window);*/
if (FULLSCREEN_VISIBLE(window)) {
SDL_UpdateFullscreenMode(window, SDL_TRUE);
}
}
FULLSCREEN_VISIBLE
#define FULLSCREEN_VISIBLE(W)
Definition: SDL_sysvideo.h:111
SDL_UpdateFullscreenMode
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
Definition: SDL_video.c:1133
SDL_TRUE
Definition: SDL_stdinc.h:129

void SDL_OnWindowShown | ( | SDL_Window * | window | ) |

Definition at line 2289 of file SDL_video.c.

References SDL_OnWindowRestored().

Referenced by SDL_SendWindowEvent().

{
SDL_OnWindowRestored(window);
}
SDL_OnWindowRestored
void SDL_OnWindowRestored(SDL_Window *window)
Definition: SDL_video.c:2314

int SDL_RecreateWindow | ( | SDL_Window * | window,
|  | Uint32 | flags
| ) |  |

Definition at line 1469 of file SDL_video.c.

References CREATE_FLAGS, SDL_VideoDevice::CreateWindow, SDL_VideoDevice::DestroyWindow, SDL_VideoDevice::DestroyWindowFramebuffer, SDL_Surface::flags, SDL_Window::flags, SDL_VideoDevice::GL_CreateContext, SDL_Window::hit_test, SDL_Window::icon, SDL_Window::is_destroying, SDL_Window::last_fullscreen_flags, 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_VideoDevice::SetWindowHitTest, SDL_VideoDevice::SetWindowIcon, SDL_VideoDevice::SetWindowTitle, SDL_Window::surface, and SDL_Window::title.

{
SDL_bool loaded_opengl = SDL_FALSE;
if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
return SDL_SetError("No OpenGL support in video driver");
}
if (window->flags & SDL_WINDOW_FOREIGN) {
/* Can't destroy and re-create foreign windows, hrm */
flags |= SDL_WINDOW_FOREIGN;
} else {
flags &= ~SDL_WINDOW_FOREIGN;
}
/* Restore video mode, etc. */
SDL_HideWindow(window);
/* Tear down the old native window */
if (window->surface) {
window->surface->flags &= ~SDL_DONTFREE;
SDL_FreeSurface(window->surface);
window->surface = NULL;
}
if (_this->DestroyWindowFramebuffer) {
_this->DestroyWindowFramebuffer(_this, window);
}
if (_this->DestroyWindow && !(flags & SDL_WINDOW_FOREIGN)) {
_this->DestroyWindow(_this, window);
}
if ((window->flags & SDL_WINDOW_OPENGL) != (flags & SDL_WINDOW_OPENGL)) {
if (flags & SDL_WINDOW_OPENGL) {
if (SDL_GL_LoadLibrary(NULL) < 0) {
return -1;
}
loaded_opengl = SDL_TRUE;
} else {
SDL_GL_UnloadLibrary();
}
}
window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
window->last_fullscreen_flags = window->flags;
window->is_destroying = SDL_FALSE;
if (_this->CreateWindow && !(flags & SDL_WINDOW_FOREIGN)) {
if (_this->CreateWindow(_this, window) < 0) {
if (loaded_opengl) {
SDL_GL_UnloadLibrary();
window->flags &= ~SDL_WINDOW_OPENGL;
}
return -1;
}
}
if (flags & SDL_WINDOW_FOREIGN) {
window->flags |= SDL_WINDOW_FOREIGN;
}
if (_this->SetWindowTitle && window->title) {
_this->SetWindowTitle(_this, window);
}
if (_this->SetWindowIcon && window->icon) {
_this->SetWindowIcon(_this, window, window->icon);
}
if (window->hit_test) {
_this->SetWindowHitTest(window, SDL_TRUE);
}
SDL_FinishWindowCreation(window, flags);
return 0;
}
SDL_VideoDevice::SetWindowHitTest
int(* SetWindowHitTest)(SDL_Window *window, SDL_bool enabled)
Definition: SDL_sysvideo.h:274
SDL_GL_LoadLibrary
int SDL_GL_LoadLibrary(const char *path)
Dynamically load an OpenGL library.
Definition: SDL_video.c:2582
SDL_DONTFREE
#define SDL_DONTFREE
Definition: SDL_surface.h:55
SDL_Window::is_destroying
SDL_bool is_destroying
Definition: SDL_sysvideo.h:97
SDL_HideWindow
void SDL_HideWindow(SDL_Window *window)
Hide a window.
Definition: SDL_video.c:1950
SDL_WINDOW_HIDDEN
Definition: SDL_video.h:101
SDL_Surface::flags
Uint32 flags
Definition: SDL_surface.h:71
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:126
CREATE_FLAGS
#define CREATE_FLAGS
Definition: SDL_video.c:1287
SDL_VideoDevice::GL_CreateContext
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:237
SDL_FreeSurface
#define SDL_FreeSurface
Definition: SDL_dynapi_overrides.h:450
SDL_GL_UnloadLibrary
void SDL_GL_UnloadLibrary(void)
Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
Definition: SDL_video.c:2633
SDL_VideoDevice::DestroyWindow
void(* DestroyWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:214
SDL_VideoDevice::SetWindowIcon
void(* SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon)
Definition: SDL_sysvideo.h:198
SDL_Window::title
char * title
Definition: SDL_sysvideo.h:75
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_VideoDevice::DestroyWindowFramebuffer
void(* DestroyWindowFramebuffer)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:217
NULL
#define NULL
Definition: begin_code.h:143
SDL_Window::hit_test
SDL_HitTest hit_test
Definition: SDL_sysvideo.h:101
SDL_Window::last_fullscreen_flags
Uint32 last_fullscreen_flags
Definition: SDL_sysvideo.h:82
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:36
SDL_Window::icon
SDL_Surface * icon
Definition: SDL_sysvideo.h:76
SDL_VideoDevice::CreateWindow
int(* CreateWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:195
SDL_FinishWindowCreation
static void SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
Definition: SDL_video.c:1291
SDL_FALSE
Definition: SDL_stdinc.h:128
flags
GLbitfield flags
Definition: SDL_opengl_glext.h:1480
SDL_WINDOW_OPENGL
Definition: SDL_video.h:99
SDL_VideoDevice::SetWindowTitle
void(* SetWindowTitle)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:197
SDL_WINDOW_FOREIGN
Definition: SDL_video.h:110
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
SDL_Window::surface
SDL_Surface * surface
Definition: SDL_sysvideo.h:93

SDL_bool SDL_ShouldAllowTopmost | ( | void |  | ) |

Definition at line 3619 of file SDL_video.c.

References SDL_FALSE, SDL_GetHint, SDL_HINT_ALLOW_TOPMOST, and SDL_TRUE.

{
const char *hint = SDL_GetHint(SDL_HINT_ALLOW_TOPMOST);
if (hint) {
if (*hint == '0') {
return SDL_FALSE;
} else {
return SDL_TRUE;
}
}
return SDL_TRUE;
}
SDL_GetHint
#define SDL_GetHint
Definition: SDL_dynapi_overrides.h:197
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:345
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_FALSE
Definition: SDL_stdinc.h:128

void SDL_UpdateWindowGrab | ( | SDL_Window * | window | ) |

Definition at line 2227 of file SDL_video.c.

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

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

{
SDL_Window *grabbed_window;
SDL_bool grabbed;
if ((SDL_GetMouse()->relative_mode || (window->flags & SDL_WINDOW_INPUT_GRABBED)) &&
(window->flags & SDL_WINDOW_INPUT_FOCUS)) {
grabbed = SDL_TRUE;
} else {
grabbed = SDL_FALSE;
}
grabbed_window = _this->grabbed_window;
if (grabbed) {
if (grabbed_window && (grabbed_window != window)) {
/* stealing a grab from another window! */
grabbed_window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
if (_this->SetWindowGrab) {
_this->SetWindowGrab(_this, grabbed_window, SDL_FALSE);
}
}
_this->grabbed_window = window;
} else if (grabbed_window == window) {
_this->grabbed_window = NULL; /* ungrabbing. */
}
if (_this->SetWindowGrab) {
_this->SetWindowGrab(_this, window, grabbed);
}
}
SDL_GetMouse
SDL_Mouse * SDL_GetMouse(void)
Definition: SDL_mouse.c:66
window
SDL_Window * window
Definition: testautomation_render.c:26
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:126
SDL_TRUE
Definition: SDL_stdinc.h:129
NULL
#define NULL
Definition: begin_code.h:143
SDL_WINDOW_INPUT_FOCUS
Definition: SDL_video.h:107
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:71
SDL_FALSE
Definition: SDL_stdinc.h:128
SDL_VideoDevice::grabbed_window
SDL_Window * grabbed_window
Definition: SDL_sysvideo.h:282
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
SDL_VideoDevice::SetWindowGrab
void(* SetWindowGrab)(_THIS, SDL_Window *window, SDL_bool grabbed)
Definition: SDL_sysvideo.h:213
SDL_WINDOW_INPUT_GRABBED
Definition: SDL_video.h:106