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_metal.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 send_event)
 
void SDL_DelVideoDisplay (int index)
 
SDL_bool SDL_AddDisplayMode (SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
 
int SDL_GetIndexOfDisplay (SDL_VideoDisplay *display)
 
SDL_VideoDisplaySDL_GetDisplay (int displayIndex)
 
SDL_VideoDisplaySDL_GetDisplayForWindow (SDL_Window *window)
 
voidSDL_GetDisplayDriverData (int displayIndex)
 
SDL_bool SDL_IsVideoContextExternal (void)
 
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_ToggleDragAndDropSupport (void)
 

Variables

VideoBootStrap COCOA_bootstrap
 
VideoBootStrap X11_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 KMSDRM_LEGACY_bootstrap
 
VideoBootStrap DUMMY_bootstrap
 
VideoBootStrap Wayland_bootstrap
 
VideoBootStrap NACL_bootstrap
 
VideoBootStrap VIVANTE_bootstrap
 
VideoBootStrap Emscripten_bootstrap
 
VideoBootStrap QNX_bootstrap
 
VideoBootStrap OFFSCREEN_bootstrap
 
VideoBootStrap OS2DIVE_bootstrap
 
VideoBootStrap OS2VMAN_bootstrap
 

Macro Definition Documentation

◆ _THIS

#define _THIS   SDL_VideoDevice *_this

Definition at line 147 of file SDL_sysvideo.h.

◆ FULLSCREEN_VISIBLE

#define FULLSCREEN_VISIBLE (   W)
Value:
((W)->flags & SDL_WINDOW_SHOWN) && \
GLbitfield flags
@ SDL_WINDOW_SHOWN
Definition: SDL_video.h:101
@ SDL_WINDOW_MINIMIZED
Definition: SDL_video.h:105
@ SDL_WINDOW_FULLSCREEN
Definition: SDL_video.h:99
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld W[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub

Definition at line 117 of file SDL_sysvideo.h.

Function Documentation

◆ SDL_AddBasicVideoDisplay()

int SDL_AddBasicVideoDisplay ( const SDL_DisplayMode desktop_mode)

Definition at line 593 of file SDL_video.c.

594 {
595  SDL_VideoDisplay display;
596 
597  SDL_zero(display);
598  if (desktop_mode) {
599  display.desktop_mode = *desktop_mode;
600  }
601  display.current_mode = display.desktop_mode;
602 
603  return SDL_AddVideoDisplay(&display, SDL_FALSE);
604 }
#define SDL_zero(x)
Definition: SDL_stdinc.h:426
@ SDL_FALSE
Definition: SDL_stdinc.h:169
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display, SDL_bool send_event)
Definition: SDL_video.c:607
SDL_DisplayMode desktop_mode
Definition: SDL_sysvideo.h:132
SDL_DisplayMode current_mode
Definition: SDL_sysvideo.h:133

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

◆ SDL_AddDisplayMode()

SDL_bool SDL_AddDisplayMode ( SDL_VideoDisplay display,
const SDL_DisplayMode mode 
)

Definition at line 792 of file SDL_video.c.

793 {
794  SDL_DisplayMode *modes;
795  int i, nmodes;
796 
797  /* Make sure we don't already have the mode in the list */
798  modes = display->display_modes;
799  nmodes = display->num_display_modes;
800  for (i = 0; i < nmodes; ++i) {
801  if (cmpmodes(mode, &modes[i]) == 0) {
802  return SDL_FALSE;
803  }
804  }
805 
806  /* Go ahead and add the new mode */
807  if (nmodes == display->max_display_modes) {
808  modes =
809  SDL_realloc(modes,
810  (display->max_display_modes + 32) * sizeof(*modes));
811  if (!modes) {
812  return SDL_FALSE;
813  }
814  display->display_modes = modes;
815  display->max_display_modes += 32;
816  }
817  modes[nmodes] = *mode;
818  display->num_display_modes++;
819 
820  /* Re-sort video modes */
821  SDL_qsort(display->display_modes, display->num_display_modes,
822  sizeof(SDL_DisplayMode), cmpmodes);
823 
824  return SDL_TRUE;
825 }
#define SDL_qsort
#define SDL_realloc
GLenum mode
@ SDL_TRUE
Definition: SDL_stdinc.h:170
static int cmpmodes(const void *A, const void *B)
Definition: SDL_video.c:424
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
The structure that defines a display mode.
Definition: SDL_video.h:54
SDL_DisplayMode * display_modes
Definition: SDL_sysvideo.h:131

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,
SDL_bool  send_event 
)

Definition at line 607 of file SDL_video.c.

608 {
609  SDL_VideoDisplay *displays;
610  int index = -1;
611 
612  displays =
614  (_this->num_displays + 1) * sizeof(*displays));
615  if (displays) {
616  index = _this->num_displays++;
617  displays[index] = *display;
618  displays[index].device = _this;
619  _this->displays = displays;
620 
621  if (display->name) {
622  displays[index].name = SDL_strdup(display->name);
623  } else {
624  char name[32];
625 
626  SDL_itoa(index, name, 10);
627  displays[index].name = SDL_strdup(name);
628  }
629 
630  if (send_event) {
632  }
633  } else {
634  SDL_OutOfMemory();
635  }
636  return index;
637 }
int SDL_SendDisplayEvent(SDL_VideoDisplay *display, Uint8 displayevent, int data1)
#define SDL_strdup
#define SDL_itoa
#define SDL_OutOfMemory()
Definition: SDL_error.h:88
GLuint index
GLuint const GLchar * name
static SDL_VideoDevice * _this
Definition: SDL_video.c:126
@ SDL_DISPLAYEVENT_CONNECTED
Definition: SDL_video.h:179
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:326
SDL_VideoDevice * device
Definition: SDL_sysvideo.h:138

References _this, SDL_VideoDisplay::device, SDL_VideoDevice::displays, SDL_VideoDisplay::name, SDL_VideoDevice::num_displays, SDL_DISPLAYEVENT_CONNECTED, SDL_itoa, SDL_OutOfMemory, SDL_realloc, SDL_SendDisplayEvent(), 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 4162 of file SDL_video.c.

4163 {
4164  float den2 = hinches * hinches + vinches * vinches;
4165  if (den2 <= 0.0f) {
4166  return 0.0f;
4167  }
4168 
4169  return (float)(SDL_sqrt((double)hpix * (double)hpix + (double)vpix * (double)vpix) /
4170  SDL_sqrt((double)den2));
4171 }
#define SDL_sqrt

References SDL_sqrt.

◆ SDL_DelVideoDisplay()

void SDL_DelVideoDisplay ( int  index)

Definition at line 640 of file SDL_video.c.

641 {
643  return;
644  }
645 
647 
648  if (index < (_this->num_displays - 1)) {
650  }
651  --_this->num_displays;
652 }
#define SDL_memmove
@ SDL_DISPLAYEVENT_DISCONNECTED
Definition: SDL_video.h:180

References _this, SDL_VideoDevice::displays, SDL_VideoDevice::num_displays, SDL_DISPLAYEVENT_DISCONNECTED, SDL_memmove, and SDL_SendDisplayEvent().

◆ SDL_GetDisplay()

SDL_VideoDisplay* SDL_GetDisplay ( int  displayIndex)

Definition at line 1062 of file SDL_video.c.

1063 {
1064  CHECK_DISPLAY_INDEX(displayIndex, NULL);
1065 
1066  return &_this->displays[displayIndex];
1067 }
#define CHECK_DISPLAY_INDEX(displayIndex, retval)
Definition: SDL_video.c:139
#define NULL
Definition: begin_code.h:163

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

◆ SDL_GetDisplayDriverData()

void* SDL_GetDisplayDriverData ( int  displayIndex)

Definition at line 680 of file SDL_video.c.

681 {
682  CHECK_DISPLAY_INDEX(displayIndex, NULL);
683 
684  return _this->displays[displayIndex].driverdata;
685 }

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

1131 {
1132  int displayIndex = SDL_GetWindowDisplayIndex(window);
1133  if (displayIndex >= 0) {
1134  return &_this->displays[displayIndex];
1135  } else {
1136  return NULL;
1137  }
1138 }
int SDL_GetWindowDisplayIndex(SDL_Window *window)
Get the display index associated with a window.
Definition: SDL_video.c:1070
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025

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

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

◆ SDL_GetFocusWindow()

SDL_Window* SDL_GetFocusWindow ( void  )

Definition at line 2812 of file SDL_video.c.

2813 {
2814  SDL_Window *window;
2815 
2816  if (!_this) {
2817  return NULL;
2818  }
2819  for (window = _this->windows; window; window = window->next) {
2820  if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
2821  return window;
2822  }
2823  }
2824  return NULL;
2825 }
@ SDL_WINDOW_INPUT_FOCUS
Definition: SDL_video.h:108
SDL_Window * windows
Definition: SDL_sysvideo.h:327
The type used to identify a window.
Definition: SDL_sysvideo.h:75
SDL_Window * next
Definition: SDL_sysvideo.h:115

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

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

◆ SDL_GetIndexOfDisplay()

int SDL_GetIndexOfDisplay ( SDL_VideoDisplay display)

Definition at line 665 of file SDL_video.c.

666 {
667  int displayIndex;
668 
669  for (displayIndex = 0; displayIndex < _this->num_displays; ++displayIndex) {
670  if (display == &_this->displays[displayIndex]) {
671  return displayIndex;
672  }
673  }
674 
675  /* Couldn't find the display, just use index 0 */
676  return 0;
677 }

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

Referenced by SDL_CreateWindow(), and SDL_SendDisplayEvent().

◆ SDL_GetVideoDevice()

◆ SDL_GL_DeduceMaxSupportedESProfile()

void SDL_GL_DeduceMaxSupportedESProfile ( int major,
int minor 
)

Definition at line 3162 of file SDL_video.c.

3163 {
3164 /* THIS REQUIRES AN EXISTING GL CONTEXT THAT HAS BEEN MADE CURRENT. */
3165 /* Please refer to https://bugzilla.libsdl.org/show_bug.cgi?id=3725 for discussion. */
3166 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
3167  /* XXX This is fragile; it will break in the event of release of
3168  * new versions of OpenGL ES.
3169  */
3170  if (SDL_GL_ExtensionSupported("GL_ARB_ES3_2_compatibility")) {
3171  *major = 3;
3172  *minor = 2;
3173  } else if (SDL_GL_ExtensionSupported("GL_ARB_ES3_1_compatibility")) {
3174  *major = 3;
3175  *minor = 1;
3176  } else if (SDL_GL_ExtensionSupported("GL_ARB_ES3_compatibility")) {
3177  *major = 3;
3178  *minor = 0;
3179  } else {
3180  *major = 2;
3181  *minor = 0;
3182  }
3183 #endif
3184 }
SDL_bool SDL_GL_ExtensionSupported(const char *extension)
Return true if an OpenGL extension is supported for the current context.
Definition: SDL_video.c:3072

References SDL_GL_ExtensionSupported().

◆ SDL_HasWindows()

SDL_bool SDL_HasWindows ( void  )

Definition at line 1822 of file SDL_video.c.

1823 {
1824  return (_this && _this->windows != NULL);
1825 }

References _this, NULL, and SDL_VideoDevice::windows.

Referenced by SDL_PrivateJoystickShouldIgnoreEvent().

◆ SDL_IsVideoContextExternal()

SDL_bool SDL_IsVideoContextExternal ( void  )

Definition at line 688 of file SDL_video.c.

689 {
691 }
#define SDL_GetHintBoolean
#define SDL_HINT_VIDEO_EXTERNAL_CONTEXT
A variable controlling whether the graphics context is externally managed.
Definition: SDL_hints.h:180

References SDL_FALSE, SDL_GetHintBoolean, and SDL_HINT_VIDEO_EXTERNAL_CONTEXT.

Referenced by SDL_CreateWindow().

◆ SDL_OnWindowEnter()

void SDL_OnWindowEnter ( SDL_Window window)

Definition at line 2739 of file SDL_video.c.

2740 {
2741  if (_this->OnWindowEnter) {
2743  }
2744 }
void(* OnWindowEnter)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:240

References _this, and SDL_VideoDevice::OnWindowEnter.

Referenced by SDL_SendWindowEvent().

◆ SDL_OnWindowFocusGained()

void SDL_OnWindowFocusGained ( SDL_Window window)

Definition at line 2752 of file SDL_video.c.

2753 {
2754  SDL_Mouse *mouse = SDL_GetMouse();
2755 
2756  if (window->gamma && _this->SetWindowGammaRamp) {
2758  }
2759 
2760  if (mouse && mouse->relative_mode) {
2763  }
2764 
2766 }
#define SDL_WarpMouseInWindow
SDL_Mouse * SDL_GetMouse(void)
Definition: SDL_mouse.c:175
void SDL_SetMouseFocus(SDL_Window *window)
Definition: SDL_mouse.c:208
void SDL_UpdateWindowGrab(SDL_Window *window)
Definition: SDL_video.c:2636
SDL_bool relative_mode
Definition: SDL_mouse_c.h:87
int(* SetWindowGammaRamp)(_THIS, SDL_Window *window, const Uint16 *ramp)
Definition: SDL_sysvideo.h:233

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

2797 {
2798  if (window->gamma && _this->SetWindowGammaRamp) {
2799  _this->SetWindowGammaRamp(_this, window, window->saved_gamma);
2800  }
2801 
2803 
2806  }
2807 }
static SDL_bool ShouldMinimizeOnFocusLoss(SDL_Window *window)
Definition: SDL_video.c:2769
void SDL_MinimizeWindow(SDL_Window *window)
Minimize a window to an iconic representation.
Definition: SDL_video.c:2336

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

2705 {
2707 }
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
Definition: SDL_video.c:1224

References SDL_FALSE, and SDL_UpdateFullscreenMode().

Referenced by SDL_SendWindowEvent().

◆ SDL_OnWindowLeave()

void SDL_OnWindowLeave ( SDL_Window window)

Definition at line 2747 of file SDL_video.c.

2748 {
2749 }

Referenced by SDL_SendWindowEvent().

◆ SDL_OnWindowMinimized()

void SDL_OnWindowMinimized ( SDL_Window window)

Definition at line 2717 of file SDL_video.c.

2718 {
2720 }

References SDL_FALSE, and SDL_UpdateFullscreenMode().

Referenced by SDL_SendWindowEvent().

◆ SDL_OnWindowResized()

void SDL_OnWindowResized ( SDL_Window window)

Definition at line 2710 of file SDL_video.c.

2711 {
2712  window->surface_valid = SDL_FALSE;
2714 }
@ SDL_WINDOWEVENT_SIZE_CHANGED
Definition: SDL_video.h:156
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)

References SDL_FALSE, SDL_SendWindowEvent(), and SDL_WINDOWEVENT_SIZE_CHANGED.

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

◆ SDL_OnWindowRestored()

void SDL_OnWindowRestored ( SDL_Window window)

Definition at line 2723 of file SDL_video.c.

2724 {
2725  /*
2726  * FIXME: Is this fine to just remove this, or should it be preserved just
2727  * for the fullscreen case? In principle it seems like just hiding/showing
2728  * windows shouldn't affect the stacking order; maybe the right fix is to
2729  * re-decouple OnWindowShown and OnWindowRestored.
2730  */
2731  /*SDL_RaiseWindow(window);*/
2732 
2733  if (FULLSCREEN_VISIBLE(window)) {
2735  }
2736 }
#define FULLSCREEN_VISIBLE(W)
Definition: SDL_sysvideo.h:117

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

2699 {
2701 }
void SDL_OnWindowRestored(SDL_Window *window)
Definition: SDL_video.c:2723

References SDL_OnWindowRestored().

Referenced by SDL_SendWindowEvent().

◆ SDL_RecreateWindow()

int SDL_RecreateWindow ( SDL_Window window,
Uint32  flags 
)

Definition at line 1673 of file SDL_video.c.

1674 {
1675  SDL_bool loaded_opengl = SDL_FALSE;
1676  SDL_bool need_gl_unload = SDL_FALSE;
1677  SDL_bool need_gl_load = SDL_FALSE;
1678  SDL_bool loaded_vulkan = SDL_FALSE;
1679  SDL_bool need_vulkan_unload = SDL_FALSE;
1680  SDL_bool need_vulkan_load = SDL_FALSE;
1681 
1683  return SDL_SetError("OpenGL support is either not configured in SDL "
1684  "or not available in current SDL video driver "
1685  "(%s) or platform", _this->name);
1686  }
1687 
1688  if (window->flags & SDL_WINDOW_FOREIGN) {
1689  /* Can't destroy and re-create foreign windows, hrm */
1691  } else {
1693  }
1694 
1695  /* Restore video mode, etc. */
1697 
1698  /* Tear down the old native window */
1699  if (window->surface) {
1700  window->surface->flags &= ~SDL_DONTFREE;
1701  SDL_FreeSurface(window->surface);
1702  window->surface = NULL;
1703  window->surface_valid = SDL_FALSE;
1704  }
1707  }
1710  }
1711 
1712  if ((window->flags & SDL_WINDOW_OPENGL) != (flags & SDL_WINDOW_OPENGL)) {
1713  if (flags & SDL_WINDOW_OPENGL) {
1714  need_gl_load = SDL_TRUE;
1715  } else {
1716  need_gl_unload = SDL_TRUE;
1717  }
1718  } else if (window->flags & SDL_WINDOW_OPENGL) {
1719  need_gl_unload = SDL_TRUE;
1720  need_gl_load = SDL_TRUE;
1721  }
1722 
1723  if ((window->flags & SDL_WINDOW_METAL) != (flags & SDL_WINDOW_METAL)) {
1724  if (flags & SDL_WINDOW_METAL) {
1725  need_gl_load = SDL_TRUE;
1726  } else {
1727  need_gl_unload = SDL_TRUE;
1728  }
1729  } else if (window->flags & SDL_WINDOW_METAL) {
1730  need_gl_unload = SDL_TRUE;
1731  need_gl_load = SDL_TRUE;
1732  }
1733 
1734  if ((window->flags & SDL_WINDOW_VULKAN) != (flags & SDL_WINDOW_VULKAN)) {
1735  if (flags & SDL_WINDOW_VULKAN) {
1736  need_vulkan_load = SDL_TRUE;
1737  } else {
1738  need_vulkan_unload = SDL_TRUE;
1739  }
1740  } else if (window->flags & SDL_WINDOW_VULKAN) {
1741  need_vulkan_unload = SDL_TRUE;
1742  need_vulkan_load = SDL_TRUE;
1743  }
1744 
1746  SDL_SetError("Vulkan and OpenGL not supported on same window");
1747  return -1;
1748  }
1749 
1750  if ((flags & SDL_WINDOW_METAL) && (flags & SDL_WINDOW_OPENGL)) {
1751  SDL_SetError("Metal and OpenGL not supported on same window");
1752  return -1;
1753  }
1754 
1755  if ((flags & SDL_WINDOW_METAL) && (flags & SDL_WINDOW_VULKAN)) {
1756  SDL_SetError("Metal and Vulkan not supported on same window");
1757  return -1;
1758  }
1759 
1760  if (need_gl_unload) {
1762  }
1763 
1764  if (need_vulkan_unload) {
1766  }
1767 
1768  if (need_gl_load) {
1769  if (SDL_GL_LoadLibrary(NULL) < 0) {
1770  return -1;
1771  }
1772  loaded_opengl = SDL_TRUE;
1773  }
1774 
1775  if (need_vulkan_load) {
1776  if (SDL_Vulkan_LoadLibrary(NULL) < 0) {
1777  return -1;
1778  }
1779  loaded_vulkan = SDL_TRUE;
1780  }
1781 
1782  window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
1783  window->last_fullscreen_flags = window->flags;
1784  window->is_destroying = SDL_FALSE;
1785 
1787  if (_this->CreateSDLWindow(_this, window) < 0) {
1788  if (loaded_opengl) {
1790  window->flags &= ~SDL_WINDOW_OPENGL;
1791  }
1792  if (loaded_vulkan) {
1794  window->flags &= ~SDL_WINDOW_VULKAN;
1795  }
1796  return -1;
1797  }
1798  }
1799 
1800  if (flags & SDL_WINDOW_FOREIGN) {
1801  window->flags |= SDL_WINDOW_FOREIGN;
1802  }
1803 
1804  if (_this->SetWindowTitle && window->title) {
1806  }
1807 
1808  if (_this->SetWindowIcon && window->icon) {
1810  }
1811 
1812  if (window->hit_test) {
1814  }
1815 
1817 
1818  return 0;
1819 }
#define SDL_SetError
#define SDL_FreeSurface
SDL_bool
Definition: SDL_stdinc.h:168
#define SDL_DONTFREE
Definition: SDL_surface.h:55
void SDL_HideWindow(SDL_Window *window)
Hide a window.
Definition: SDL_video.c:2279
#define CREATE_FLAGS
Definition: SDL_video.c:1388
static void SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
Definition: SDL_video.c:1424
int SDL_Vulkan_LoadLibrary(const char *path)
Dynamically load a Vulkan loader library.
Definition: SDL_video.c:4223
void SDL_GL_UnloadLibrary(void)
Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
Definition: SDL_video.c:3047
int SDL_GL_LoadLibrary(const char *path)
Dynamically load an OpenGL library.
Definition: SDL_video.c:2996
void SDL_Vulkan_UnloadLibrary(void)
Unload the Vulkan loader library previously loaded by SDL_Vulkan_LoadLibrary().
Definition: SDL_video.c:4262
@ SDL_WINDOW_FOREIGN
Definition: SDL_video.h:111
@ SDL_WINDOW_VULKAN
Definition: SDL_video.h:121
@ SDL_WINDOW_OPENGL
Definition: SDL_video.h:100
@ SDL_WINDOW_METAL
Definition: SDL_video.h:122
@ SDL_WINDOW_HIDDEN
Definition: SDL_video.h:102
void(* SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon)
Definition: SDL_sysvideo.h:215
int(* SetWindowHitTest)(SDL_Window *window, SDL_bool enabled)
Definition: SDL_sysvideo.h:316
const char * name
Definition: SDL_sysvideo.h:153
int(* CreateSDLWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:212
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:259
void(* DestroyWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:236
void(* SetWindowTitle)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:214
void(* DestroyWindowFramebuffer)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:239

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_Vulkan_LoadLibrary(), SDL_Vulkan_UnloadLibrary(), SDL_WINDOW_FOREIGN, SDL_WINDOW_HIDDEN, SDL_WINDOW_METAL, SDL_WINDOW_OPENGL, SDL_WINDOW_VULKAN, SDL_VideoDevice::SetWindowHitTest, SDL_VideoDevice::SetWindowIcon, and SDL_VideoDevice::SetWindowTitle.

◆ SDL_ShouldAllowTopmost()

SDL_bool SDL_ShouldAllowTopmost ( void  )

Definition at line 4139 of file SDL_video.c.

4140 {
4142 }
#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:739

References SDL_GetHintBoolean, SDL_HINT_ALLOW_TOPMOST, and SDL_TRUE.

◆ SDL_ToggleDragAndDropSupport()

void SDL_ToggleDragAndDropSupport ( void  )

Definition at line 1412 of file SDL_video.c.

1413 {
1414  if (_this && _this->AcceptDragAndDrop) {
1416  SDL_Window *window;
1417  for (window = _this->windows; window; window = window->next) {
1419  }
1420  }
1421 }
GLboolean enable
static SDL_INLINE SDL_bool IsAcceptingDragAndDrop(void)
Definition: SDL_video.c:1392
void(* AcceptDragAndDrop)(SDL_Window *window, SDL_bool accept)
Definition: SDL_sysvideo.h:319

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

Referenced by SDL_EventState().

◆ SDL_UpdateWindowGrab()

void SDL_UpdateWindowGrab ( SDL_Window window)

Definition at line 2636 of file SDL_video.c.

2637 {
2638  SDL_Window *grabbed_window;
2639  SDL_bool grabbed;
2640  if ((SDL_GetMouse()->relative_mode || (window->flags & SDL_WINDOW_INPUT_GRABBED)) &&
2641  (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
2642  grabbed = SDL_TRUE;
2643  } else {
2644  grabbed = SDL_FALSE;
2645  }
2646 
2647  grabbed_window = _this->grabbed_window;
2648  if (grabbed) {
2649  if (grabbed_window && (grabbed_window != window)) {
2650  /* stealing a grab from another window! */
2651  grabbed_window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
2652  if (_this->SetWindowGrab) {
2653  _this->SetWindowGrab(_this, grabbed_window, SDL_FALSE);
2654  }
2655  }
2657  } else if (grabbed_window == window) {
2658  _this->grabbed_window = NULL; /* ungrabbing. */
2659  }
2660 
2661  if (_this->SetWindowGrab) {
2662  _this->SetWindowGrab(_this, window, grabbed);
2663  }
2664 }
@ SDL_WINDOW_INPUT_GRABBED
Definition: SDL_video.h:107
SDL_Window * grabbed_window
Definition: SDL_sysvideo.h:328
void(* SetWindowGrab)(_THIS, SDL_Window *window, SDL_bool grabbed)
Definition: SDL_sysvideo.h:235
Uint32 flags
Definition: SDL_sysvideo.h:84

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

Variable Documentation

◆ Android_bootstrap

VideoBootStrap Android_bootstrap
extern

◆ COCOA_bootstrap

VideoBootStrap COCOA_bootstrap
extern

◆ DirectFB_bootstrap

VideoBootStrap DirectFB_bootstrap
extern

◆ DUMMY_bootstrap

VideoBootStrap DUMMY_bootstrap
extern

◆ Emscripten_bootstrap

VideoBootStrap Emscripten_bootstrap
extern

◆ HAIKU_bootstrap

VideoBootStrap HAIKU_bootstrap
extern

◆ KMSDRM_bootstrap

VideoBootStrap KMSDRM_bootstrap
extern

◆ KMSDRM_LEGACY_bootstrap

VideoBootStrap KMSDRM_LEGACY_bootstrap
extern

◆ NACL_bootstrap

VideoBootStrap NACL_bootstrap
extern

◆ OFFSCREEN_bootstrap

VideoBootStrap OFFSCREEN_bootstrap
extern

◆ OS2DIVE_bootstrap

VideoBootStrap OS2DIVE_bootstrap
extern

◆ OS2VMAN_bootstrap

VideoBootStrap OS2VMAN_bootstrap
extern

◆ PND_bootstrap

VideoBootStrap PND_bootstrap
extern

◆ PSP_bootstrap

VideoBootStrap PSP_bootstrap
extern

◆ QNX_bootstrap

VideoBootStrap QNX_bootstrap
extern

Definition at line 355 of file video.c.

◆ RPI_bootstrap

VideoBootStrap RPI_bootstrap
extern

◆ UIKIT_bootstrap

VideoBootStrap UIKIT_bootstrap
extern

◆ VIVANTE_bootstrap

VideoBootStrap VIVANTE_bootstrap
extern

◆ Wayland_bootstrap

VideoBootStrap Wayland_bootstrap
extern

◆ WINDOWS_bootstrap

VideoBootStrap WINDOWS_bootstrap
extern

◆ WINRT_bootstrap

VideoBootStrap WINRT_bootstrap
extern

◆ X11_bootstrap

VideoBootStrap X11_bootstrap
extern