SDL_sysvideo.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. #include "SDL_internal.h"
  19. #ifndef SDL_sysvideo_h_
  20. #define SDL_sysvideo_h_
  21. #include <SDL3/SDL_vulkan.h>
  22. #include "SDL_surface_c.h"
  23. // The SDL video driver
  24. typedef struct SDL_VideoDisplay SDL_VideoDisplay;
  25. typedef struct SDL_VideoDevice SDL_VideoDevice;
  26. typedef struct SDL_VideoData SDL_VideoData;
  27. typedef struct SDL_DisplayData SDL_DisplayData;
  28. typedef struct SDL_WindowData SDL_WindowData;
  29. typedef struct
  30. {
  31. float SDR_white_level;
  32. float HDR_headroom;
  33. } SDL_HDROutputProperties;
  34. // Define the SDL window structure, corresponding to toplevel windows
  35. struct SDL_Window
  36. {
  37. SDL_WindowID id;
  38. char *title;
  39. SDL_Surface *icon;
  40. int x, y;
  41. int w, h;
  42. int min_w, min_h;
  43. int max_w, max_h;
  44. float min_aspect;
  45. float max_aspect;
  46. int last_pixel_w, last_pixel_h;
  47. SDL_WindowFlags flags;
  48. SDL_WindowFlags pending_flags;
  49. float display_scale;
  50. bool external_graphics_context;
  51. bool fullscreen_exclusive; // The window is currently fullscreen exclusive
  52. SDL_DisplayID last_fullscreen_exclusive_display; // The last fullscreen_exclusive display
  53. SDL_DisplayID last_displayID;
  54. /* Stored position and size for the window in the non-fullscreen state,
  55. * including when the window is maximized or tiled.
  56. *
  57. * This is the size and position to which the window should return when
  58. * leaving the fullscreen state.
  59. */
  60. SDL_Rect windowed;
  61. /* Stored position and size for the window in the base 'floating' state;
  62. * when not fullscreen, nor in a state such as maximized or tiled.
  63. *
  64. * This is the size and position to which the window should return when
  65. * it's maximized and SDL_RestoreWindow() is called.
  66. */
  67. SDL_Rect floating;
  68. // The last client requested size and position for the window.
  69. SDL_Rect pending;
  70. /* Toggle for drivers to indicate that the current window state is tiled,
  71. * and sizes set non-programmatically shouldn't be cached.
  72. */
  73. bool tiled;
  74. // Whether or not the initial position was defined
  75. bool undefined_x;
  76. bool undefined_y;
  77. SDL_DisplayMode requested_fullscreen_mode;
  78. SDL_DisplayMode current_fullscreen_mode;
  79. SDL_HDROutputProperties HDR;
  80. float opacity;
  81. SDL_Surface *surface;
  82. bool surface_valid;
  83. bool is_hiding;
  84. bool restore_on_show; // Child was hidden recursively by the parent, restore when shown.
  85. bool last_position_pending; // This should NOT be cleared by the backend, as it is used for fullscreen positioning.
  86. bool last_size_pending; // This should be cleared by the backend if the new size cannot be applied.
  87. bool is_destroying;
  88. bool is_dropping; // drag/drop in progress, expecting SDL_SendDropComplete().
  89. int safe_inset_left;
  90. int safe_inset_right;
  91. int safe_inset_top;
  92. int safe_inset_bottom;
  93. SDL_Rect safe_rect;
  94. SDL_PropertiesID text_input_props;
  95. bool text_input_active;
  96. SDL_Rect text_input_rect;
  97. int text_input_cursor;
  98. SDL_Rect mouse_rect;
  99. SDL_HitTest hit_test;
  100. void *hit_test_data;
  101. SDL_PropertiesID props;
  102. SDL_WindowData *internal;
  103. SDL_Window *prev;
  104. SDL_Window *next;
  105. SDL_Window *parent;
  106. SDL_Window *first_child;
  107. SDL_Window *prev_sibling;
  108. SDL_Window *next_sibling;
  109. };
  110. #define SDL_WINDOW_FULLSCREEN_VISIBLE(W) \
  111. ((((W)->flags & SDL_WINDOW_FULLSCREEN) != 0) && \
  112. (((W)->flags & SDL_WINDOW_HIDDEN) == 0) && \
  113. (((W)->flags & SDL_WINDOW_MINIMIZED) == 0))
  114. #define SDL_WINDOW_IS_POPUP(W) \
  115. (((W)->flags & (SDL_WINDOW_TOOLTIP | SDL_WINDOW_POPUP_MENU)) != 0)
  116. /*
  117. * Define the SDL display structure.
  118. * This corresponds to physical monitors attached to the system.
  119. */
  120. struct SDL_VideoDisplay
  121. {
  122. SDL_DisplayID id;
  123. char *name;
  124. int max_fullscreen_modes;
  125. int num_fullscreen_modes;
  126. SDL_DisplayMode *fullscreen_modes;
  127. SDL_DisplayMode desktop_mode;
  128. const SDL_DisplayMode *current_mode;
  129. SDL_DisplayOrientation natural_orientation;
  130. SDL_DisplayOrientation current_orientation;
  131. float content_scale;
  132. SDL_HDROutputProperties HDR;
  133. SDL_Window *fullscreen_window;
  134. SDL_VideoDevice *device;
  135. SDL_PropertiesID props;
  136. SDL_DisplayData *internal;
  137. };
  138. // Video device flags
  139. typedef enum
  140. {
  141. VIDEO_DEVICE_CAPS_MODE_SWITCHING_EMULATED = 0x01,
  142. VIDEO_DEVICE_CAPS_HAS_POPUP_WINDOW_SUPPORT = 0x02,
  143. VIDEO_DEVICE_CAPS_SENDS_FULLSCREEN_DIMENSIONS = 0x04,
  144. VIDEO_DEVICE_CAPS_FULLSCREEN_ONLY = 0x08,
  145. VIDEO_DEVICE_CAPS_SENDS_DISPLAY_CHANGES = 0x10,
  146. VIDEO_DEVICE_CAPS_DISABLE_MOUSE_WARP_ON_FULLSCREEN_TRANSITIONS = 0x20,
  147. VIDEO_DEVICE_CAPS_SENDS_HDR_CHANGES = 0x40
  148. } DeviceCaps;
  149. // Fullscreen operations
  150. typedef enum
  151. {
  152. SDL_FULLSCREEN_OP_LEAVE = 0,
  153. SDL_FULLSCREEN_OP_ENTER,
  154. SDL_FULLSCREEN_OP_UPDATE
  155. } SDL_FullscreenOp;
  156. typedef enum
  157. {
  158. SDL_FULLSCREEN_FAILED,
  159. SDL_FULLSCREEN_SUCCEEDED,
  160. SDL_FULLSCREEN_PENDING
  161. } SDL_FullscreenResult;
  162. struct SDL_VideoDevice
  163. {
  164. /* * * */
  165. // The name of this video driver
  166. const char *name;
  167. /* * * */
  168. // Initialization/Query functions
  169. /*
  170. * Initialize the native video subsystem, filling in the list of
  171. * displays for this driver, returning 0 or -1 if there's an error.
  172. */
  173. bool (*VideoInit)(SDL_VideoDevice *_this);
  174. /*
  175. * Reverse the effects VideoInit() -- called if VideoInit() fails or
  176. * if the application is shutting down the video subsystem.
  177. */
  178. void (*VideoQuit)(SDL_VideoDevice *_this);
  179. /*
  180. * Reinitialize the touch devices -- called if an unknown touch ID occurs.
  181. */
  182. void (*ResetTouch)(SDL_VideoDevice *_this);
  183. /* * * */
  184. /*
  185. * Display functions
  186. */
  187. /*
  188. * Refresh the display list
  189. */
  190. void (*RefreshDisplays)(SDL_VideoDevice *_this);
  191. /*
  192. * Get the bounds of a display
  193. */
  194. bool (*GetDisplayBounds)(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect);
  195. /*
  196. * Get the usable bounds of a display (bounds minus menubar or whatever)
  197. */
  198. bool (*GetDisplayUsableBounds)(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect);
  199. /*
  200. * Get a list of the available display modes for a display.
  201. */
  202. bool (*GetDisplayModes)(SDL_VideoDevice *_this, SDL_VideoDisplay *display);
  203. /*
  204. * Setting the display mode is independent of creating windows, so
  205. * when the display mode is changed, all existing windows should have
  206. * their data updated accordingly, including the display surfaces
  207. * associated with them.
  208. */
  209. bool (*SetDisplayMode)(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
  210. /* * * */
  211. /*
  212. * Window functions
  213. */
  214. bool (*CreateSDLWindow)(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props);
  215. void (*SetWindowTitle)(SDL_VideoDevice *_this, SDL_Window *window);
  216. bool (*SetWindowIcon)(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surface *icon);
  217. bool (*SetWindowPosition)(SDL_VideoDevice *_this, SDL_Window *window);
  218. void (*SetWindowSize)(SDL_VideoDevice *_this, SDL_Window *window);
  219. void (*SetWindowMinimumSize)(SDL_VideoDevice *_this, SDL_Window *window);
  220. void (*SetWindowMaximumSize)(SDL_VideoDevice *_this, SDL_Window *window);
  221. void (*SetWindowAspectRatio)(SDL_VideoDevice *_this, SDL_Window *window);
  222. bool (*GetWindowBordersSize)(SDL_VideoDevice *_this, SDL_Window *window, int *top, int *left, int *bottom, int *right);
  223. float (*GetWindowContentScale)(SDL_VideoDevice *_this, SDL_Window *window);
  224. void (*GetWindowSizeInPixels)(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h);
  225. bool (*SetWindowOpacity)(SDL_VideoDevice *_this, SDL_Window *window, float opacity);
  226. bool (*SetWindowParent)(SDL_VideoDevice *_this, SDL_Window *window, SDL_Window *parent);
  227. bool (*SetWindowModal)(SDL_VideoDevice *_this, SDL_Window *window, bool modal);
  228. void (*ShowWindow)(SDL_VideoDevice *_this, SDL_Window *window);
  229. void (*HideWindow)(SDL_VideoDevice *_this, SDL_Window *window);
  230. void (*RaiseWindow)(SDL_VideoDevice *_this, SDL_Window *window);
  231. void (*MaximizeWindow)(SDL_VideoDevice *_this, SDL_Window *window);
  232. void (*MinimizeWindow)(SDL_VideoDevice *_this, SDL_Window *window);
  233. void (*RestoreWindow)(SDL_VideoDevice *_this, SDL_Window *window);
  234. void (*SetWindowBordered)(SDL_VideoDevice *_this, SDL_Window *window, bool bordered);
  235. void (*SetWindowResizable)(SDL_VideoDevice *_this, SDL_Window *window, bool resizable);
  236. void (*SetWindowAlwaysOnTop)(SDL_VideoDevice *_this, SDL_Window *window, bool on_top);
  237. SDL_FullscreenResult (*SetWindowFullscreen)(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_FullscreenOp fullscreen);
  238. void *(*GetWindowICCProfile)(SDL_VideoDevice *_this, SDL_Window *window, size_t *size);
  239. SDL_DisplayID (*GetDisplayForWindow)(SDL_VideoDevice *_this, SDL_Window *window);
  240. bool (*SetWindowMouseRect)(SDL_VideoDevice *_this, SDL_Window *window);
  241. bool (*SetWindowMouseGrab)(SDL_VideoDevice *_this, SDL_Window *window, bool grabbed);
  242. bool (*SetWindowKeyboardGrab)(SDL_VideoDevice *_this, SDL_Window *window, bool grabbed);
  243. void (*DestroyWindow)(SDL_VideoDevice *_this, SDL_Window *window);
  244. bool (*CreateWindowFramebuffer)(SDL_VideoDevice *_this, SDL_Window *window, SDL_PixelFormat *format, void **pixels, int *pitch);
  245. bool (*SetWindowFramebufferVSync)(SDL_VideoDevice *_this, SDL_Window *window, int vsync);
  246. bool (*GetWindowFramebufferVSync)(SDL_VideoDevice *_this, SDL_Window *window, int *vsync);
  247. bool (*UpdateWindowFramebuffer)(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects);
  248. void (*DestroyWindowFramebuffer)(SDL_VideoDevice *_this, SDL_Window *window);
  249. void (*OnWindowEnter)(SDL_VideoDevice *_this, SDL_Window *window);
  250. bool (*UpdateWindowShape)(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surface *shape);
  251. bool (*FlashWindow)(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation);
  252. bool (*SetWindowFocusable)(SDL_VideoDevice *_this, SDL_Window *window, bool focusable);
  253. bool (*SyncWindow)(SDL_VideoDevice *_this, SDL_Window *window);
  254. /* * * */
  255. /*
  256. * OpenGL support
  257. */
  258. bool (*GL_LoadLibrary)(SDL_VideoDevice *_this, const char *path);
  259. SDL_FunctionPointer (*GL_GetProcAddress)(SDL_VideoDevice *_this, const char *proc);
  260. void (*GL_UnloadLibrary)(SDL_VideoDevice *_this);
  261. SDL_GLContext (*GL_CreateContext)(SDL_VideoDevice *_this, SDL_Window *window);
  262. bool (*GL_MakeCurrent)(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context);
  263. SDL_EGLSurface (*GL_GetEGLSurface)(SDL_VideoDevice *_this, SDL_Window *window);
  264. bool (*GL_SetSwapInterval)(SDL_VideoDevice *_this, int interval);
  265. bool (*GL_GetSwapInterval)(SDL_VideoDevice *_this, int *interval);
  266. bool (*GL_SwapWindow)(SDL_VideoDevice *_this, SDL_Window *window);
  267. bool (*GL_DestroyContext)(SDL_VideoDevice *_this, SDL_GLContext context);
  268. void (*GL_DefaultProfileConfig)(SDL_VideoDevice *_this, int *mask, int *major, int *minor);
  269. /* * * */
  270. /*
  271. * Vulkan support
  272. */
  273. bool (*Vulkan_LoadLibrary)(SDL_VideoDevice *_this, const char *path);
  274. void (*Vulkan_UnloadLibrary)(SDL_VideoDevice *_this);
  275. char const* const* (*Vulkan_GetInstanceExtensions)(SDL_VideoDevice *_this, Uint32 *count);
  276. bool (*Vulkan_CreateSurface)(SDL_VideoDevice *_this, SDL_Window *window, VkInstance instance, const struct VkAllocationCallbacks *allocator, VkSurfaceKHR *surface);
  277. void (*Vulkan_DestroySurface)(SDL_VideoDevice *_this, VkInstance instance, VkSurfaceKHR surface, const struct VkAllocationCallbacks *allocator);
  278. bool (*Vulkan_GetPresentationSupport)(SDL_VideoDevice *_this, VkInstance instance, VkPhysicalDevice physicalDevice, Uint32 queueFamilyIndex);
  279. /* * * */
  280. /*
  281. * Metal support
  282. */
  283. SDL_MetalView (*Metal_CreateView)(SDL_VideoDevice *_this, SDL_Window *window);
  284. void (*Metal_DestroyView)(SDL_VideoDevice *_this, SDL_MetalView view);
  285. void *(*Metal_GetLayer)(SDL_VideoDevice *_this, SDL_MetalView view);
  286. /* * * */
  287. /*
  288. * Event manager functions
  289. */
  290. int (*WaitEventTimeout)(SDL_VideoDevice *_this, Sint64 timeoutNS);
  291. void (*SendWakeupEvent)(SDL_VideoDevice *_this, SDL_Window *window);
  292. void (*PumpEvents)(SDL_VideoDevice *_this);
  293. // Suspend/resume the screensaver
  294. bool (*SuspendScreenSaver)(SDL_VideoDevice *_this);
  295. // Text input
  296. bool (*StartTextInput)(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props);
  297. bool (*StopTextInput)(SDL_VideoDevice *_this, SDL_Window *window);
  298. bool (*UpdateTextInputArea)(SDL_VideoDevice *_this, SDL_Window *window);
  299. bool (*ClearComposition)(SDL_VideoDevice *_this, SDL_Window *window);
  300. // Screen keyboard
  301. bool (*HasScreenKeyboardSupport)(SDL_VideoDevice *_this);
  302. void (*ShowScreenKeyboard)(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props);
  303. void (*HideScreenKeyboard)(SDL_VideoDevice *_this, SDL_Window *window);
  304. void (*SetTextInputProperties)(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props);
  305. bool (*IsScreenKeyboardShown)(SDL_VideoDevice *_this, SDL_Window *window);
  306. // Clipboard
  307. const char **(*GetTextMimeTypes)(SDL_VideoDevice *_this, size_t *num_mime_types);
  308. bool (*SetClipboardData)(SDL_VideoDevice *_this);
  309. void *(*GetClipboardData)(SDL_VideoDevice *_this, const char *mime_type, size_t *size);
  310. bool (*HasClipboardData)(SDL_VideoDevice *_this, const char *mime_type);
  311. /* If you implement *ClipboardData, you don't need to implement *ClipboardText */
  312. bool (*SetClipboardText)(SDL_VideoDevice *_this, const char *text);
  313. char *(*GetClipboardText)(SDL_VideoDevice *_this);
  314. bool (*HasClipboardText)(SDL_VideoDevice *_this);
  315. // These functions are only needed if the platform has a separate primary selection buffer
  316. bool (*SetPrimarySelectionText)(SDL_VideoDevice *_this, const char *text);
  317. char *(*GetPrimarySelectionText)(SDL_VideoDevice *_this);
  318. bool (*HasPrimarySelectionText)(SDL_VideoDevice *_this);
  319. // MessageBox
  320. bool (*ShowMessageBox)(SDL_VideoDevice *_this, const SDL_MessageBoxData *messageboxdata, int *buttonID);
  321. // Hit-testing
  322. bool (*SetWindowHitTest)(SDL_Window *window, bool enabled);
  323. // Tell window that app enabled drag'n'drop events
  324. void (*AcceptDragAndDrop)(SDL_Window *window, bool accept);
  325. // Display the system-level window menu
  326. void (*ShowWindowSystemMenu)(SDL_Window *window, int x, int y);
  327. /* * * */
  328. // Data common to all drivers
  329. SDL_ThreadID thread;
  330. bool checked_texture_framebuffer;
  331. bool is_dummy;
  332. bool suspend_screensaver;
  333. SDL_Window *wakeup_window;
  334. SDL_Mutex *wakeup_lock; // Initialized only if WaitEventTimeout/SendWakeupEvent are supported
  335. int num_displays;
  336. SDL_VideoDisplay **displays;
  337. SDL_Rect desktop_bounds;
  338. SDL_Window *windows;
  339. SDL_Window *grabbed_window;
  340. Uint32 clipboard_sequence;
  341. SDL_ClipboardDataCallback clipboard_callback;
  342. SDL_ClipboardCleanupCallback clipboard_cleanup;
  343. void *clipboard_userdata;
  344. char **clipboard_mime_types;
  345. size_t num_clipboard_mime_types;
  346. char *primary_selection_text;
  347. bool setting_display_mode;
  348. Uint32 device_caps;
  349. SDL_SystemTheme system_theme;
  350. /* * * */
  351. // Data used by the GL drivers
  352. struct
  353. {
  354. int red_size;
  355. int green_size;
  356. int blue_size;
  357. int alpha_size;
  358. int depth_size;
  359. int buffer_size;
  360. int stencil_size;
  361. int double_buffer;
  362. int accum_red_size;
  363. int accum_green_size;
  364. int accum_blue_size;
  365. int accum_alpha_size;
  366. int stereo;
  367. int multisamplebuffers;
  368. int multisamplesamples;
  369. int floatbuffers;
  370. int accelerated;
  371. int major_version;
  372. int minor_version;
  373. int flags;
  374. int profile_mask;
  375. int share_with_current_context;
  376. int release_behavior;
  377. int reset_notification;
  378. int framebuffer_srgb_capable;
  379. int no_error;
  380. int retained_backing;
  381. int egl_platform;
  382. int driver_loaded;
  383. char driver_path[256];
  384. SDL_SharedObject *dll_handle;
  385. } gl_config;
  386. SDL_EGLAttribArrayCallback egl_platformattrib_callback;
  387. SDL_EGLIntArrayCallback egl_surfaceattrib_callback;
  388. SDL_EGLIntArrayCallback egl_contextattrib_callback;
  389. void *egl_attrib_callback_userdata;
  390. /* * * */
  391. // Cache current GL context; don't call the OS when it hasn't changed.
  392. /* We have the global pointers here so Cocoa continues to work the way
  393. it always has, and the thread-local storage for the general case.
  394. */
  395. SDL_Window *current_glwin;
  396. SDL_GLContext current_glctx;
  397. SDL_TLSID current_glwin_tls;
  398. SDL_TLSID current_glctx_tls;
  399. /* Flag that stores whether it's allowed to call SDL_GL_MakeCurrent()
  400. * with a NULL window, but a non-NULL context. (Not allowed in most cases,
  401. * except on EGL under some circumstances.) */
  402. bool gl_allow_no_surface;
  403. /* * * */
  404. // Data used by the Vulkan drivers
  405. struct
  406. {
  407. SDL_FunctionPointer vkGetInstanceProcAddr;
  408. SDL_FunctionPointer vkEnumerateInstanceExtensionProperties;
  409. int loader_loaded;
  410. char loader_path[256];
  411. SDL_SharedObject *loader_handle;
  412. } vulkan_config;
  413. /* * * */
  414. // Data private to this driver
  415. SDL_VideoData *internal;
  416. struct SDL_GLDriverData *gl_data;
  417. #ifdef SDL_VIDEO_OPENGL_EGL
  418. struct SDL_EGL_VideoData *egl_data;
  419. #endif
  420. #if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2)
  421. struct SDL_PrivateGLESData *gles_data;
  422. #endif
  423. /* * * */
  424. // The function used to dispose of this structure
  425. void (*free)(SDL_VideoDevice *_this);
  426. };
  427. typedef struct VideoBootStrap
  428. {
  429. const char *name;
  430. const char *desc;
  431. SDL_VideoDevice *(*create)(void);
  432. bool (*ShowMessageBox)(const SDL_MessageBoxData *messageboxdata, int *buttonID); // can be done without initializing backend!
  433. } VideoBootStrap;
  434. // Not all of these are available in a given build. Use #ifdefs, etc.
  435. extern VideoBootStrap PRIVATE_bootstrap;
  436. extern VideoBootStrap COCOA_bootstrap;
  437. extern VideoBootStrap X11_bootstrap;
  438. extern VideoBootStrap WINDOWS_bootstrap;
  439. extern VideoBootStrap HAIKU_bootstrap;
  440. extern VideoBootStrap UIKIT_bootstrap;
  441. extern VideoBootStrap Android_bootstrap;
  442. extern VideoBootStrap PS2_bootstrap;
  443. extern VideoBootStrap PSP_bootstrap;
  444. extern VideoBootStrap VITA_bootstrap;
  445. extern VideoBootStrap RISCOS_bootstrap;
  446. extern VideoBootStrap N3DS_bootstrap;
  447. extern VideoBootStrap RPI_bootstrap;
  448. extern VideoBootStrap KMSDRM_bootstrap;
  449. extern VideoBootStrap DUMMY_bootstrap;
  450. extern VideoBootStrap DUMMY_evdev_bootstrap;
  451. extern VideoBootStrap Wayland_preferred_bootstrap;
  452. extern VideoBootStrap Wayland_bootstrap;
  453. extern VideoBootStrap VIVANTE_bootstrap;
  454. extern VideoBootStrap Emscripten_bootstrap;
  455. extern VideoBootStrap OFFSCREEN_bootstrap;
  456. extern VideoBootStrap QNX_bootstrap;
  457. extern VideoBootStrap OPENVR_bootstrap;
  458. // Use SDL_OnVideoThread() sparingly, to avoid regressions in use cases that currently happen to work
  459. extern bool SDL_OnVideoThread(void);
  460. extern SDL_VideoDevice *SDL_GetVideoDevice(void);
  461. extern void SDL_SetSystemTheme(SDL_SystemTheme theme);
  462. extern SDL_DisplayID SDL_AddBasicVideoDisplay(const SDL_DisplayMode *desktop_mode);
  463. extern SDL_DisplayID SDL_AddVideoDisplay(const SDL_VideoDisplay *display, bool send_event);
  464. extern void SDL_DelVideoDisplay(SDL_DisplayID display, bool send_event);
  465. extern bool SDL_AddFullscreenDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode);
  466. extern void SDL_ResetFullscreenDisplayModes(SDL_VideoDisplay *display);
  467. extern void SDL_SetDesktopDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode);
  468. extern void SDL_SetCurrentDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode);
  469. extern void SDL_SetDisplayContentScale(SDL_VideoDisplay *display, float scale);
  470. extern void SDL_SetDisplayHDRProperties(SDL_VideoDisplay *display, const SDL_HDROutputProperties *HDR);
  471. extern bool SDL_SetDisplayModeForDisplay(SDL_VideoDisplay *display, SDL_DisplayMode *mode);
  472. extern SDL_VideoDisplay *SDL_GetVideoDisplay(SDL_DisplayID display);
  473. extern SDL_DisplayID SDL_GetDisplayForWindowPosition(SDL_Window *window);
  474. extern SDL_VideoDisplay *SDL_GetVideoDisplayForWindow(SDL_Window *window);
  475. extern SDL_VideoDisplay *SDL_GetVideoDisplayForFullscreenWindow(SDL_Window *window);
  476. extern int SDL_GetDisplayIndex(SDL_DisplayID displayID);
  477. extern SDL_DisplayData *SDL_GetDisplayDriverData(SDL_DisplayID display);
  478. extern SDL_DisplayData *SDL_GetDisplayDriverDataForWindow(SDL_Window *window);
  479. extern int SDL_GetMessageBoxCount(void);
  480. extern void SDL_SetWindowHDRProperties(SDL_Window *window, const SDL_HDROutputProperties *HDR, bool send_event);
  481. extern void SDL_SetWindowSafeAreaInsets(SDL_Window *window, int left, int right, int top, int bottom);
  482. extern void SDL_GL_DeduceMaxSupportedESProfile(int *major, int *minor);
  483. extern bool SDL_RecreateWindow(SDL_Window *window, SDL_WindowFlags flags);
  484. extern bool SDL_HasWindows(void);
  485. extern void SDL_RelativeToGlobalForWindow(SDL_Window *window, int rel_x, int rel_y, int *abs_x, int *abs_y);
  486. extern void SDL_GlobalToRelativeForWindow(SDL_Window *window, int abs_x, int abs_y, int *rel_x, int *rel_y);
  487. extern void SDL_OnDisplayAdded(SDL_VideoDisplay *display);
  488. extern void SDL_OnDisplayMoved(SDL_VideoDisplay *display);
  489. extern void SDL_OnWindowShown(SDL_Window *window);
  490. extern void SDL_OnWindowHidden(SDL_Window *window);
  491. extern void SDL_OnWindowMoved(SDL_Window *window);
  492. extern void SDL_OnWindowResized(SDL_Window *window);
  493. extern void SDL_CheckWindowPixelSizeChanged(SDL_Window *window);
  494. extern void SDL_OnWindowPixelSizeChanged(SDL_Window *window);
  495. extern void SDL_OnWindowLiveResizeUpdate(SDL_Window *window);
  496. extern void SDL_OnWindowMinimized(SDL_Window *window);
  497. extern void SDL_OnWindowMaximized(SDL_Window *window);
  498. extern void SDL_OnWindowRestored(SDL_Window *window);
  499. extern void SDL_OnWindowEnter(SDL_Window *window);
  500. extern void SDL_OnWindowLeave(SDL_Window *window);
  501. extern void SDL_OnWindowFocusGained(SDL_Window *window);
  502. extern void SDL_OnWindowFocusLost(SDL_Window *window);
  503. extern void SDL_OnWindowDisplayChanged(SDL_Window *window);
  504. extern void SDL_UpdateWindowGrab(SDL_Window *window);
  505. extern bool SDL_UpdateFullscreenMode(SDL_Window *window, SDL_FullscreenOp fullscreen, bool commit);
  506. extern SDL_Window *SDL_GetToplevelForKeyboardFocus(void);
  507. extern bool SDL_ShouldAllowTopmost(void);
  508. extern void SDL_ToggleDragAndDropSupport(void);
  509. extern SDL_TextInputType SDL_GetTextInputType(SDL_PropertiesID props);
  510. extern SDL_Capitalization SDL_GetTextInputCapitalization(SDL_PropertiesID props);
  511. extern bool SDL_GetTextInputAutocorrect(SDL_PropertiesID props);
  512. extern bool SDL_GetTextInputMultiline(SDL_PropertiesID props);
  513. #endif // SDL_sysvideo_h_