SDL  2.0
SDL_sysvideo.h File Reference
#include "../SDL_internal.h"
#include "SDL_messagebox.h"
#include "SDL_shape.h"
#include "SDL_thread.h"
#include "SDL_vulkan_internal.h"
+ Include dependency graph for SDL_sysvideo.h:

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_VideoDeviceSDL_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_VideoDisplaySDL_GetDisplayForWindow (SDL_Window *window)
 
voidSDL_GetDisplayDriverData (int displayIndex)
 
void SDL_GL_DeduceMaxSupportedESProfile (int *major, int *minor)
 
int SDL_RecreateWindow (SDL_Window *window, Uint32 flags)
 
SDL_bool SDL_HasWindows (void)
 
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_WindowSDL_GetFocusWindow (void)
 
SDL_bool SDL_ShouldAllowTopmost (void)
 
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)
 

Variables

VideoBootStrap COCOA_bootstrap
 
VideoBootStrap X11_bootstrap
 
VideoBootStrap MIR_bootstrap
 
VideoBootStrap DirectFB_bootstrap
 
VideoBootStrap WINDOWS_bootstrap
 
VideoBootStrap WINRT_bootstrap
 
VideoBootStrap HAIKU_bootstrap
 
VideoBootStrap PND_bootstrap
 
VideoBootStrap UIKIT_bootstrap
 
VideoBootStrap Android_bootstrap
 
VideoBootStrap PSP_bootstrap
 
VideoBootStrap RPI_bootstrap
 
VideoBootStrap KMSDRM_bootstrap
 
VideoBootStrap DUMMY_bootstrap
 
VideoBootStrap Wayland_bootstrap
 
VideoBootStrap NACL_bootstrap
 
VideoBootStrap VIVANTE_bootstrap
 
VideoBootStrap Emscripten_bootstrap
 
VideoBootStrap QNX_bootstrap
 

Macro Definition Documentation

◆ _THIS

#define _THIS   SDL_VideoDevice *_this

Definition at line 145 of file SDL_sysvideo.h.

◆ FULLSCREEN_VISIBLE

Function Documentation

◆ SDL_AddBasicVideoDisplay()

int SDL_AddBasicVideoDisplay ( const SDL_DisplayMode desktop_mode)

Definition at line 592 of file SDL_video.c.

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

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 }
SDL_DisplayMode current_mode
Definition: SDL_sysvideo.h:132
#define SDL_zero(x)
Definition: SDL_stdinc.h:416
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display)
Definition: SDL_video.c:606
SDL_DisplayMode desktop_mode
Definition: SDL_sysvideo.h:131

◆ SDL_AddDisplayMode()

SDL_bool SDL_AddDisplayMode ( SDL_VideoDisplay display,
const SDL_DisplayMode mode 
)

Definition at line 743 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.

744 {
745  SDL_DisplayMode *modes;
746  int i, nmodes;
747 
748  /* Make sure we don't already have the mode in the list */
749  modes = display->display_modes;
750  nmodes = display->num_display_modes;
751  for (i = 0; i < nmodes; ++i) {
752  if (cmpmodes(mode, &modes[i]) == 0) {
753  return SDL_FALSE;
754  }
755  }
756 
757  /* Go ahead and add the new mode */
758  if (nmodes == display->max_display_modes) {
759  modes =
760  SDL_realloc(modes,
761  (display->max_display_modes + 32) * sizeof(*modes));
762  if (!modes) {
763  return SDL_FALSE;
764  }
765  display->display_modes = modes;
766  display->max_display_modes += 32;
767  }
768  modes[nmodes] = *mode;
769  display->num_display_modes++;
770 
771  /* Re-sort video modes */
772  SDL_qsort(display->display_modes, display->num_display_modes,
773  sizeof(SDL_DisplayMode), cmpmodes);
774 
775  return SDL_TRUE;
776 }
#define SDL_qsort
The structure that defines a display mode.
Definition: SDL_video.h:53
#define SDL_realloc
static int cmpmodes(const void *A, const void *B)
Definition: SDL_video.c:419
SDL_DisplayMode * display_modes
Definition: SDL_sysvideo.h:130
GLenum mode
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_AddVideoDisplay()

int SDL_AddVideoDisplay ( const SDL_VideoDisplay display)

Definition at line 606 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(), and videoInit().

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 }
#define SDL_itoa
#define SDL_realloc
GLuint const GLchar * name
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
SDL_VideoDevice * device
Definition: SDL_sysvideo.h:136
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:312
GLuint index
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
#define SDL_strdup

◆ SDL_ComputeDiagonalDPI()

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

Definition at line 3911 of file SDL_video.c.

References SDL_sqrt.

3912 {
3913  float den2 = hinches * hinches + vinches * vinches;
3914  if (den2 <= 0.0f) {
3915  return 0.0f;
3916  }
3917 
3918  return (float)(SDL_sqrt((double)hpix * (double)hpix + (double)vpix * (double)vpix) /
3919  SDL_sqrt((double)den2));
3920 }
GLfloat f
#define SDL_sqrt

◆ SDL_GetDisplayDriverData()

void* SDL_GetDisplayDriverData ( int  displayIndex)

Definition at line 660 of file SDL_video.c.

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

661 {
662  CHECK_DISPLAY_INDEX(displayIndex, NULL);
663 
664  return _this->displays[displayIndex].driverdata;
665 }
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:312
#define NULL
Definition: begin_code.h:164
#define CHECK_DISPLAY_INDEX(displayIndex, retval)
Definition: SDL_video.c:134

◆ SDL_GetDisplayForWindow()

SDL_VideoDisplay* SDL_GetDisplayForWindow ( SDL_Window window)

Definition at line 1073 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().

1074 {
1075  int displayIndex = SDL_GetWindowDisplayIndex(window);
1076  if (displayIndex >= 0) {
1077  return &_this->displays[displayIndex];
1078  } else {
1079  return NULL;
1080  }
1081 }
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:312
#define NULL
Definition: begin_code.h:164
int SDL_GetWindowDisplayIndex(SDL_Window *window)
Get the display index associated with a window.
Definition: SDL_video.c:1013

◆ SDL_GetFocusWindow()

SDL_Window* SDL_GetFocusWindow ( void  )

Definition at line 2594 of file SDL_video.c.

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

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

2595 {
2596  SDL_Window *window;
2597 
2598  if (!_this) {
2599  return NULL;
2600  }
2601  for (window = _this->windows; window; window = window->next) {
2602  if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
2603  return window;
2604  }
2605  }
2606  return NULL;
2607 }
SDL_Window * next
Definition: SDL_sysvideo.h:114
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
SDL_Window * windows
Definition: SDL_sysvideo.h:313
#define NULL
Definition: begin_code.h:164
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
The type used to identify a window.
Definition: SDL_sysvideo.h:73
Uint32 flags
Definition: SDL_sysvideo.h:83

◆ SDL_GetVideoDevice()

SDL_VideoDevice* SDL_GetVideoDevice ( void  )

Definition at line 586 of file SDL_video.c.

References _this.

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

587 {
588  return _this;
589 }
static SDL_VideoDevice * _this
Definition: SDL_video.c:121

◆ SDL_GL_DeduceMaxSupportedESProfile()

void SDL_GL_DeduceMaxSupportedESProfile ( int *  major,
int *  minor 
)

Definition at line 2942 of file SDL_video.c.

References SDL_GL_ExtensionSupported().

2943 {
2944 /* THIS REQUIRES AN EXISTING GL CONTEXT THAT HAS BEEN MADE CURRENT. */
2945 /* Please refer to https://bugzilla.libsdl.org/show_bug.cgi?id=3725 for discussion. */
2946 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
2947  /* XXX This is fragile; it will break in the event of release of
2948  * new versions of OpenGL ES.
2949  */
2950  if (SDL_GL_ExtensionSupported("GL_ARB_ES3_2_compatibility")) {
2951  *major = 3;
2952  *minor = 2;
2953  } else if (SDL_GL_ExtensionSupported("GL_ARB_ES3_1_compatibility")) {
2954  *major = 3;
2955  *minor = 1;
2956  } else if (SDL_GL_ExtensionSupported("GL_ARB_ES3_compatibility")) {
2957  *major = 3;
2958  *minor = 0;
2959  } else {
2960  *major = 2;
2961  *minor = 0;
2962  }
2963 #endif
2964 }
SDL_bool SDL_GL_ExtensionSupported(const char *extension)
Return true if an OpenGL extension is supported for the current context.
Definition: SDL_video.c:2852

◆ SDL_HasWindows()

SDL_bool SDL_HasWindows ( void  )

Definition at line 1630 of file SDL_video.c.

References NULL, and SDL_VideoDevice::windows.

Referenced by SDL_PrivateJoystickShouldIgnoreEvent().

1631 {
1632  return (_this && _this->windows != NULL);
1633 }
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
SDL_Window * windows
Definition: SDL_sysvideo.h:313
#define NULL
Definition: begin_code.h:164

◆ SDL_OnApplicationDidBecomeActive()

void SDL_OnApplicationDidBecomeActive ( void  )

Definition at line 3957 of file SDL_video.c.

References SDL_Window::next, NULL, SDL_APP_DIDENTERFOREGROUND, SDL_SendAppEvent(), SDL_SendWindowEvent(), SDL_WINDOWEVENT_FOCUS_GAINED, SDL_WINDOWEVENT_RESTORED, and SDL_VideoDevice::windows.

3958 {
3960 
3961  if (_this) {
3962  SDL_Window *window;
3963  for (window = _this->windows; window != NULL; window = window->next) {
3966  }
3967  }
3968 }
SDL_Window * next
Definition: SDL_sysvideo.h:114
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
SDL_Window * windows
Definition: SDL_sysvideo.h:313
#define NULL
Definition: begin_code.h:164
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
The type used to identify a window.
Definition: SDL_sysvideo.h:73
int SDL_SendAppEvent(SDL_EventType eventType)
Definition: SDL_events.c:919

◆ SDL_OnApplicationDidEnterBackground()

void SDL_OnApplicationDidEnterBackground ( void  )

Definition at line 3947 of file SDL_video.c.

References SDL_APP_DIDENTERBACKGROUND, and SDL_SendAppEvent().

3948 {
3950 }
int SDL_SendAppEvent(SDL_EventType eventType)
Definition: SDL_events.c:919

◆ SDL_OnApplicationDidReceiveMemoryWarning()

void SDL_OnApplicationDidReceiveMemoryWarning ( void  )

Definition at line 3930 of file SDL_video.c.

References SDL_APP_LOWMEMORY, and SDL_SendAppEvent().

3931 {
3933 }
int SDL_SendAppEvent(SDL_EventType eventType)
Definition: SDL_events.c:919

◆ SDL_OnApplicationWillEnterForeground()

void SDL_OnApplicationWillEnterForeground ( void  )

Definition at line 3952 of file SDL_video.c.

References SDL_APP_WILLENTERFOREGROUND, and SDL_SendAppEvent().

3953 {
3955 }
int SDL_SendAppEvent(SDL_EventType eventType)
Definition: SDL_events.c:919

◆ SDL_OnApplicationWillResignActive()

void SDL_OnApplicationWillResignActive ( void  )

Definition at line 3935 of file SDL_video.c.

References SDL_Window::next, NULL, SDL_APP_WILLENTERBACKGROUND, SDL_SendAppEvent(), SDL_SendWindowEvent(), SDL_WINDOWEVENT_FOCUS_LOST, SDL_WINDOWEVENT_MINIMIZED, and SDL_VideoDevice::windows.

3936 {
3937  if (_this) {
3938  SDL_Window *window;
3939  for (window = _this->windows; window != NULL; window = window->next) {
3942  }
3943  }
3945 }
SDL_Window * next
Definition: SDL_sysvideo.h:114
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
SDL_Window * windows
Definition: SDL_sysvideo.h:313
#define NULL
Definition: begin_code.h:164
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
The type used to identify a window.
Definition: SDL_sysvideo.h:73
int SDL_SendAppEvent(SDL_EventType eventType)
Definition: SDL_events.c:919

◆ SDL_OnApplicationWillTerminate()

void SDL_OnApplicationWillTerminate ( void  )

Definition at line 3925 of file SDL_video.c.

References SDL_APP_TERMINATING, and SDL_SendAppEvent().

3926 {
3928 }
int SDL_SendAppEvent(SDL_EventType eventType)
Definition: SDL_events.c:919

◆ SDL_OnWindowEnter()

void SDL_OnWindowEnter ( SDL_Window window)

Definition at line 2530 of file SDL_video.c.

References SDL_VideoDevice::OnWindowEnter.

Referenced by SDL_SendWindowEvent().

2531 {
2532  if (_this->OnWindowEnter) {
2533  _this->OnWindowEnter(_this, window);
2534  }
2535 }
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
void(* OnWindowEnter)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:238

◆ SDL_OnWindowFocusGained()

void SDL_OnWindowFocusGained ( SDL_Window window)

Definition at line 2543 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().

2544 {
2545  SDL_Mouse *mouse = SDL_GetMouse();
2546 
2547  if (window->gamma && _this->SetWindowGammaRamp) {
2548  _this->SetWindowGammaRamp(_this, window, window->gamma);
2549  }
2550 
2551  if (mouse && mouse->relative_mode) {
2552  SDL_SetMouseFocus(window);
2553  SDL_WarpMouseInWindow(window, window->w/2, window->h/2);
2554  }
2555 
2556  SDL_UpdateWindowGrab(window);
2557 }
SDL_Mouse * SDL_GetMouse(void)
Definition: SDL_mouse.c:112
void SDL_SetMouseFocus(SDL_Window *window)
Definition: SDL_mouse.c:151
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
SDL_bool relative_mode
Definition: SDL_mouse_c.h:87
void SDL_UpdateWindowGrab(SDL_Window *window)
Definition: SDL_video.c:2427
#define SDL_WarpMouseInWindow
Uint16 * gamma
Definition: SDL_sysvideo.h:94
int(* SetWindowGammaRamp)(_THIS, SDL_Window *window, const Uint16 *ramp)
Definition: SDL_sysvideo.h:231

◆ SDL_OnWindowFocusLost()

void SDL_OnWindowFocusLost ( SDL_Window window)

Definition at line 2578 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().

2579 {
2580  if (window->gamma && _this->SetWindowGammaRamp) {
2581  _this->SetWindowGammaRamp(_this, window, window->saved_gamma);
2582  }
2583 
2584  SDL_UpdateWindowGrab(window);
2585 
2586  if (ShouldMinimizeOnFocusLoss(window)) {
2587  SDL_MinimizeWindow(window);
2588  }
2589 }
Uint16 * saved_gamma
Definition: SDL_sysvideo.h:95
void SDL_MinimizeWindow(SDL_Window *window)
Minimize a window to an iconic representation.
Definition: SDL_video.c:2136
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
void SDL_UpdateWindowGrab(SDL_Window *window)
Definition: SDL_video.c:2427
Uint16 * gamma
Definition: SDL_sysvideo.h:94
int(* SetWindowGammaRamp)(_THIS, SDL_Window *window, const Uint16 *ramp)
Definition: SDL_sysvideo.h:231
static SDL_bool ShouldMinimizeOnFocusLoss(SDL_Window *window)
Definition: SDL_video.c:2560

◆ SDL_OnWindowHidden()

void SDL_OnWindowHidden ( SDL_Window window)

Definition at line 2495 of file SDL_video.c.

References SDL_FALSE, and SDL_UpdateFullscreenMode().

Referenced by SDL_SendWindowEvent().

2496 {
2498 }
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
Definition: SDL_video.c:1167

◆ SDL_OnWindowLeave()

void SDL_OnWindowLeave ( SDL_Window window)

Definition at line 2538 of file SDL_video.c.

Referenced by SDL_SendWindowEvent().

2539 {
2540 }

◆ SDL_OnWindowMinimized()

void SDL_OnWindowMinimized ( SDL_Window window)

Definition at line 2508 of file SDL_video.c.

References SDL_FALSE, and SDL_UpdateFullscreenMode().

Referenced by SDL_SendWindowEvent().

2509 {
2511 }
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
Definition: SDL_video.c:1167

◆ SDL_OnWindowResized()

void SDL_OnWindowResized ( SDL_Window window)

Definition at line 2501 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().

2502 {
2503  window->surface_valid = SDL_FALSE;
2504  SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, window->w, window->h);
2505 }
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
SDL_bool surface_valid
Definition: SDL_sysvideo.h:98

◆ SDL_OnWindowRestored()

void SDL_OnWindowRestored ( SDL_Window window)

Definition at line 2514 of file SDL_video.c.

References FULLSCREEN_VISIBLE, SDL_TRUE, and SDL_UpdateFullscreenMode().

Referenced by SDL_OnWindowShown(), and SDL_SendWindowEvent().

2515 {
2516  /*
2517  * FIXME: Is this fine to just remove this, or should it be preserved just
2518  * for the fullscreen case? In principle it seems like just hiding/showing
2519  * windows shouldn't affect the stacking order; maybe the right fix is to
2520  * re-decouple OnWindowShown and OnWindowRestored.
2521  */
2522  /*SDL_RaiseWindow(window);*/
2523 
2524  if (FULLSCREEN_VISIBLE(window)) {
2526  }
2527 }
#define FULLSCREEN_VISIBLE(W)
Definition: SDL_sysvideo.h:116
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
Definition: SDL_video.c:1167

◆ SDL_OnWindowShown()

void SDL_OnWindowShown ( SDL_Window window)

Definition at line 2489 of file SDL_video.c.

References SDL_OnWindowRestored().

Referenced by SDL_SendWindowEvent().

2490 {
2491  SDL_OnWindowRestored(window);
2492 }
void SDL_OnWindowRestored(SDL_Window *window)
Definition: SDL_video.c:2514

◆ SDL_RecreateWindow()

int SDL_RecreateWindow ( SDL_Window window,
Uint32  flags 
)

Definition at line 1542 of file SDL_video.c.

References CREATE_FLAGS, SDL_VideoDevice::CreateSDLWindow, 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_WINDOW_VULKAN, SDL_VideoDevice::SetWindowHitTest, SDL_VideoDevice::SetWindowIcon, SDL_VideoDevice::SetWindowTitle, SDL_Window::surface, and SDL_Window::title.

1543 {
1544  SDL_bool loaded_opengl = SDL_FALSE;
1545 
1547  return SDL_SetError("No OpenGL support in video driver");
1548  }
1549 
1550  if (window->flags & SDL_WINDOW_FOREIGN) {
1551  /* Can't destroy and re-create foreign windows, hrm */
1553  } else {
1555  }
1556 
1557  /* Restore video mode, etc. */
1558  SDL_HideWindow(window);
1559 
1560  /* Tear down the old native window */
1561  if (window->surface) {
1562  window->surface->flags &= ~SDL_DONTFREE;
1563  SDL_FreeSurface(window->surface);
1564  window->surface = NULL;
1565  }
1568  }
1570  _this->DestroyWindow(_this, window);
1571  }
1572 
1573  if ((window->flags & SDL_WINDOW_OPENGL) != (flags & SDL_WINDOW_OPENGL)) {
1574  if (flags & SDL_WINDOW_OPENGL) {
1575  if (SDL_GL_LoadLibrary(NULL) < 0) {
1576  return -1;
1577  }
1578  loaded_opengl = SDL_TRUE;
1579  } else {
1581  }
1582  }
1583 
1584  if ((window->flags & SDL_WINDOW_VULKAN) != (flags & SDL_WINDOW_VULKAN)) {
1585  SDL_SetError("Can't change SDL_WINDOW_VULKAN window flag");
1586  return -1;
1587  }
1588 
1589  if ((window->flags & SDL_WINDOW_VULKAN) && (flags & SDL_WINDOW_OPENGL)) {
1590  SDL_SetError("Vulkan and OpenGL not supported on same window");
1591  return -1;
1592  }
1593 
1594  window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
1595  window->last_fullscreen_flags = window->flags;
1596  window->is_destroying = SDL_FALSE;
1597 
1598  if (_this->CreateSDLWindow && !(flags & SDL_WINDOW_FOREIGN)) {
1599  if (_this->CreateSDLWindow(_this, window) < 0) {
1600  if (loaded_opengl) {
1602  window->flags &= ~SDL_WINDOW_OPENGL;
1603  }
1604  return -1;
1605  }
1606  }
1607 
1608  if (flags & SDL_WINDOW_FOREIGN) {
1609  window->flags |= SDL_WINDOW_FOREIGN;
1610  }
1611 
1612  if (_this->SetWindowTitle && window->title) {
1613  _this->SetWindowTitle(_this, window);
1614  }
1615 
1616  if (_this->SetWindowIcon && window->icon) {
1617  _this->SetWindowIcon(_this, window, window->icon);
1618  }
1619 
1620  if (window->hit_test) {
1621  _this->SetWindowHitTest(window, SDL_TRUE);
1622  }
1623 
1625 
1626  return 0;
1627 }
int(* SetWindowHitTest)(SDL_Window *window, SDL_bool enabled)
Definition: SDL_sysvideo.h:305
int SDL_GL_LoadLibrary(const char *path)
Dynamically load an OpenGL library.
Definition: SDL_video.c:2776
#define SDL_DONTFREE
Definition: SDL_surface.h:55
SDL_bool is_destroying
Definition: SDL_sysvideo.h:101
void SDL_HideWindow(SDL_Window *window)
Hide a window.
Definition: SDL_video.c:2088
Uint32 flags
Definition: SDL_surface.h:71
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
#define CREATE_FLAGS
Definition: SDL_video.c:1324
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:257
#define SDL_FreeSurface
void SDL_GL_UnloadLibrary(void)
Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
Definition: SDL_video.c:2827
void(* DestroyWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:234
void(* SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon)
Definition: SDL_sysvideo.h:213
char * title
Definition: SDL_sysvideo.h:77
void(* DestroyWindowFramebuffer)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:237
#define NULL
Definition: begin_code.h:164
int(* CreateSDLWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:210
SDL_bool
Definition: SDL_stdinc.h:139
SDL_HitTest hit_test
Definition: SDL_sysvideo.h:106
Uint32 last_fullscreen_flags
Definition: SDL_sysvideo.h:84
#define SDL_SetError
GLbitfield flags
SDL_Surface * icon
Definition: SDL_sysvideo.h:78
static void SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
Definition: SDL_video.c:1328
void(* SetWindowTitle)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:212
Uint32 flags
Definition: SDL_sysvideo.h:83
SDL_Surface * surface
Definition: SDL_sysvideo.h:97

◆ SDL_ShouldAllowTopmost()

SDL_bool SDL_ShouldAllowTopmost ( void  )

Definition at line 3888 of file SDL_video.c.

References SDL_GetHintBoolean, SDL_HINT_ALLOW_TOPMOST, and SDL_TRUE.

3889 {
3891 }
#define SDL_GetHintBoolean
#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:476

◆ SDL_UpdateWindowGrab()

void SDL_UpdateWindowGrab ( SDL_Window window)

Definition at line 2427 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, and SDL_VideoDevice::SetWindowGrab.

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

2428 {
2429  SDL_Window *grabbed_window;
2430  SDL_bool grabbed;
2431  if ((SDL_GetMouse()->relative_mode || (window->flags & SDL_WINDOW_INPUT_GRABBED)) &&
2432  (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
2433  grabbed = SDL_TRUE;
2434  } else {
2435  grabbed = SDL_FALSE;
2436  }
2437 
2438  grabbed_window = _this->grabbed_window;
2439  if (grabbed) {
2440  if (grabbed_window && (grabbed_window != window)) {
2441  /* stealing a grab from another window! */
2442  grabbed_window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
2443  if (_this->SetWindowGrab) {
2444  _this->SetWindowGrab(_this, grabbed_window, SDL_FALSE);
2445  }
2446  }
2448  } else if (grabbed_window == window) {
2449  _this->grabbed_window = NULL; /* ungrabbing. */
2450  }
2451 
2452  if (_this->SetWindowGrab) {
2453  _this->SetWindowGrab(_this, window, grabbed);
2454  }
2455 }
SDL_Mouse * SDL_GetMouse(void)
Definition: SDL_mouse.c:112
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
#define NULL
Definition: begin_code.h:164
SDL_bool
Definition: SDL_stdinc.h:139
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
The type used to identify a window.
Definition: SDL_sysvideo.h:73
SDL_Window * grabbed_window
Definition: SDL_sysvideo.h:314
Uint32 flags
Definition: SDL_sysvideo.h:83
void(* SetWindowGrab)(_THIS, SDL_Window *window, SDL_bool grabbed)
Definition: SDL_sysvideo.h:233

Variable Documentation

◆ Android_bootstrap

VideoBootStrap Android_bootstrap

◆ COCOA_bootstrap

VideoBootStrap COCOA_bootstrap

◆ DirectFB_bootstrap

VideoBootStrap DirectFB_bootstrap

◆ DUMMY_bootstrap

VideoBootStrap DUMMY_bootstrap

◆ Emscripten_bootstrap

VideoBootStrap Emscripten_bootstrap

◆ HAIKU_bootstrap

VideoBootStrap HAIKU_bootstrap

◆ KMSDRM_bootstrap

VideoBootStrap KMSDRM_bootstrap

◆ MIR_bootstrap

VideoBootStrap MIR_bootstrap

◆ NACL_bootstrap

VideoBootStrap NACL_bootstrap

◆ PND_bootstrap

VideoBootStrap PND_bootstrap

◆ PSP_bootstrap

VideoBootStrap PSP_bootstrap

◆ QNX_bootstrap

VideoBootStrap QNX_bootstrap

Definition at line 361 of file video.c.

◆ RPI_bootstrap

VideoBootStrap RPI_bootstrap

◆ UIKIT_bootstrap

VideoBootStrap UIKIT_bootstrap

◆ VIVANTE_bootstrap

VideoBootStrap VIVANTE_bootstrap

◆ Wayland_bootstrap

VideoBootStrap Wayland_bootstrap

◆ WINDOWS_bootstrap

VideoBootStrap WINDOWS_bootstrap

◆ WINRT_bootstrap

VideoBootStrap WINRT_bootstrap

◆ X11_bootstrap

VideoBootStrap X11_bootstrap