SDL_sysvideo.h 24 KB

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