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