SDL  2.0
SDL_video.c
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2020 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 /* The high-level video driver subsystem */
24 
25 #include "SDL.h"
26 #include "SDL_video.h"
27 #include "SDL_sysvideo.h"
28 #include "SDL_blit.h"
29 #include "SDL_pixels_c.h"
30 #include "SDL_rect_c.h"
31 #include "../events/SDL_events_c.h"
32 #include "../timer/SDL_timer_c.h"
33 
34 #include "SDL_syswm.h"
35 
36 #if SDL_VIDEO_OPENGL
37 #include "SDL_opengl.h"
38 #endif /* SDL_VIDEO_OPENGL */
39 
40 #if SDL_VIDEO_OPENGL_ES && !SDL_VIDEO_OPENGL
41 #include "SDL_opengles.h"
42 #endif /* SDL_VIDEO_OPENGL_ES && !SDL_VIDEO_OPENGL */
43 
44 /* GL and GLES2 headers conflict on Linux 32 bits */
45 #if SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL
46 #include "SDL_opengles2.h"
47 #endif /* SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL */
48 
49 #if !SDL_VIDEO_OPENGL
50 #ifndef GL_CONTEXT_RELEASE_BEHAVIOR_KHR
51 #define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB
52 #endif
53 #endif
54 
55 #ifdef __EMSCRIPTEN__
56 #include <emscripten.h>
57 #endif
58 
59 /* Available video drivers */
61 #if SDL_VIDEO_DRIVER_COCOA
63 #endif
64 #if SDL_VIDEO_DRIVER_X11
66 #endif
67 #if SDL_VIDEO_DRIVER_WAYLAND
69 #endif
70 #if SDL_VIDEO_DRIVER_VIVANTE
72 #endif
73 #if SDL_VIDEO_DRIVER_DIRECTFB
75 #endif
76 #if SDL_VIDEO_DRIVER_WINDOWS
78 #endif
79 #if SDL_VIDEO_DRIVER_WINRT
81 #endif
82 #if SDL_VIDEO_DRIVER_HAIKU
84 #endif
85 #if SDL_VIDEO_DRIVER_PANDORA
87 #endif
88 #if SDL_VIDEO_DRIVER_UIKIT
90 #endif
91 #if SDL_VIDEO_DRIVER_ANDROID
93 #endif
94 #if SDL_VIDEO_DRIVER_PSP
96 #endif
97 #if SDL_VIDEO_DRIVER_KMSDRM
99 #endif
100 #if SDL_VIDEO_DRIVER_RPI
101  &RPI_bootstrap,
102 #endif
103 #if SDL_VIDEO_DRIVER_NACL
105 #endif
106 #if SDL_VIDEO_DRIVER_EMSCRIPTEN
108 #endif
109 #if SDL_VIDEO_DRIVER_QNX
110  &QNX_bootstrap,
111 #endif
112 #if SDL_VIDEO_DRIVER_OFFSCREEN
114 #endif
115 #if SDL_VIDEO_DRIVER_DUMMY
117 #endif
118  NULL
119 };
120 
122 
123 #define CHECK_WINDOW_MAGIC(window, retval) \
124  if (!_this) { \
125  SDL_UninitializedVideo(); \
126  return retval; \
127  } \
128  SDL_assert(window && window->magic == &_this->window_magic); \
129  if (!window || window->magic != &_this->window_magic) { \
130  SDL_SetError("Invalid window"); \
131  return retval; \
132  }
133 
134 #define CHECK_DISPLAY_INDEX(displayIndex, retval) \
135  if (!_this) { \
136  SDL_UninitializedVideo(); \
137  return retval; \
138  } \
139  SDL_assert(_this->displays != NULL); \
140  SDL_assert(displayIndex >= 0 && displayIndex < _this->num_displays); \
141  if (displayIndex < 0 || displayIndex >= _this->num_displays) { \
142  SDL_SetError("displayIndex must be in the range 0 - %d", \
143  _this->num_displays - 1); \
144  return retval; \
145  }
146 
147 #define FULLSCREEN_MASK (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN)
148 
149 #ifdef __MACOSX__
150 /* Support for Mac OS X fullscreen spaces */
151 extern SDL_bool Cocoa_IsWindowInFullscreenSpace(SDL_Window * window);
152 extern SDL_bool Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state);
153 #endif
154 
155 
156 /* Support for framebuffer emulation using an accelerated renderer */
157 
158 #define SDL_WINDOWTEXTUREDATA "_SDL_WindowTextureData"
159 
160 typedef struct {
163  void *pixels;
164  int pitch;
167 
168 static SDL_bool
170 {
171  const char *hint;
172 
173  /* If there's no native framebuffer support then there's no option */
175  return SDL_TRUE;
176  }
177 
178  /* If this is the dummy driver there is no texture support */
179  if (_this->is_dummy) {
180  return SDL_FALSE;
181  }
182 
183  /* If the user has specified a software renderer we can't use a
184  texture framebuffer, or renderer creation will go recursive.
185  */
187  if (hint && SDL_strcasecmp(hint, "software") == 0) {
188  return SDL_FALSE;
189  }
190 
191  /* See if the user or application wants a specific behavior */
193  if (hint) {
194  if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) {
195  return SDL_FALSE;
196  } else {
197  return SDL_TRUE;
198  }
199  }
200 
201  /* Each platform has different performance characteristics */
202 #if defined(__WIN32__)
203  /* GDI BitBlt() is way faster than Direct3D dynamic textures right now.
204  */
205  return SDL_FALSE;
206 
207 #elif defined(__MACOSX__)
208  /* Mac OS X uses OpenGL as the native fast path (for cocoa and X11) */
209  return SDL_TRUE;
210 
211 #elif defined(__LINUX__)
212  /* Properly configured OpenGL drivers are faster than MIT-SHM */
213 #if SDL_VIDEO_OPENGL
214  /* Ugh, find a way to cache this value! */
215  {
218  SDL_bool hasAcceleratedOpenGL = SDL_FALSE;
219 
220  window = SDL_CreateWindow("OpenGL test", -32, -32, 32, 32, SDL_WINDOW_OPENGL|SDL_WINDOW_HIDDEN);
221  if (window) {
223  if (context) {
224  const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
225  const char *vendor = NULL;
226 
227  glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
228  if (glGetStringFunc) {
229  vendor = (const char *) glGetStringFunc(GL_VENDOR);
230  }
231  /* Add more vendors here at will... */
232  if (vendor &&
233  (SDL_strstr(vendor, "ATI Technologies") ||
234  SDL_strstr(vendor, "NVIDIA"))) {
235  hasAcceleratedOpenGL = SDL_TRUE;
236  }
238  }
240  }
241  return hasAcceleratedOpenGL;
242  }
243 #elif SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
244  /* Let's be optimistic about this! */
245  return SDL_TRUE;
246 #else
247  return SDL_FALSE;
248 #endif
249 
250 #else
251  /* Play it safe, assume that if there is a framebuffer driver that it's
252  optimized for the current platform.
253  */
254  return SDL_FALSE;
255 #endif
256 }
257 
258 static int
260 {
262 
264  if (!data) {
266  int i;
268 
269  /* Check to see if there's a specific driver requested */
270  if (hint && *hint != '0' && *hint != '1' &&
271  SDL_strcasecmp(hint, "true") != 0 &&
272  SDL_strcasecmp(hint, "false") != 0 &&
273  SDL_strcasecmp(hint, "software") != 0) {
274  for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
275  SDL_RendererInfo info;
276  SDL_GetRenderDriverInfo(i, &info);
277  if (SDL_strcasecmp(info.name, hint) == 0) {
279  break;
280  }
281  }
282  }
283 
284  if (!renderer) {
285  for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
286  SDL_RendererInfo info;
287  SDL_GetRenderDriverInfo(i, &info);
288  if (SDL_strcmp(info.name, "software") != 0) {
290  if (renderer) {
291  break;
292  }
293  }
294  }
295  }
296  if (!renderer) {
297  return SDL_SetError("No hardware accelerated renderers available");
298  }
299 
300  /* Create the data after we successfully create the renderer (bug #1116) */
301  data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(*data));
302  if (!data) {
304  return SDL_OutOfMemory();
305  }
307 
308  data->renderer = renderer;
309  }
310 
311  /* Free any old texture and pixel data */
312  if (data->texture) {
313  SDL_DestroyTexture(data->texture);
314  data->texture = NULL;
315  }
316  SDL_free(data->pixels);
317  data->pixels = NULL;
318 
319  {
320  SDL_RendererInfo info;
321  Uint32 i;
322 
323  if (SDL_GetRendererInfo(data->renderer, &info) < 0) {
324  return -1;
325  }
326 
327  /* Find the first format without an alpha channel */
328  *format = info.texture_formats[0];
329 
330  for (i = 0; i < info.num_texture_formats; ++i) {
333  *format = info.texture_formats[i];
334  break;
335  }
336  }
337  }
338 
339  data->texture = SDL_CreateTexture(data->renderer, *format,
341  window->w, window->h);
342  if (!data->texture) {
343  return -1;
344  }
345 
346  /* Create framebuffer data */
347  data->bytes_per_pixel = SDL_BYTESPERPIXEL(*format);
348  data->pitch = (((window->w * data->bytes_per_pixel) + 3) & ~3);
349 
350  {
351  /* Make static analysis happy about potential malloc(0) calls. */
352  const size_t allocsize = window->h * data->pitch;
353  data->pixels = SDL_malloc((allocsize > 0) ? allocsize : 1);
354  if (!data->pixels) {
355  return SDL_OutOfMemory();
356  }
357  }
358 
359  *pixels = data->pixels;
360  *pitch = data->pitch;
361 
362  /* Make sure we're not double-scaling the viewport */
363  SDL_RenderSetViewport(data->renderer, NULL);
364 
365  return 0;
366 }
367 
368 static int
370 {
372  SDL_Rect rect;
373  void *src;
374 
376  if (!data || !data->texture) {
377  return SDL_SetError("No window texture data");
378  }
379 
380  /* Update a single rect that contains subrects for best DMA performance */
381  if (SDL_GetSpanEnclosingRect(window->w, window->h, numrects, rects, &rect)) {
382  src = (void *)((Uint8 *)data->pixels +
383  rect.y * data->pitch +
384  rect.x * data->bytes_per_pixel);
385  if (SDL_UpdateTexture(data->texture, &rect, src, data->pitch) < 0) {
386  return -1;
387  }
388 
389  if (SDL_RenderCopy(data->renderer, data->texture, NULL, NULL) < 0) {
390  return -1;
391  }
392 
393  SDL_RenderPresent(data->renderer);
394  }
395  return 0;
396 }
397 
398 static void
400 {
402 
404  if (!data) {
405  return;
406  }
407  if (data->texture) {
408  SDL_DestroyTexture(data->texture);
409  }
410  if (data->renderer) {
411  SDL_DestroyRenderer(data->renderer);
412  }
413  SDL_free(data->pixels);
414  SDL_free(data);
415 }
416 
417 
418 static int
419 cmpmodes(const void *A, const void *B)
420 {
421  const SDL_DisplayMode *a = (const SDL_DisplayMode *) A;
422  const SDL_DisplayMode *b = (const SDL_DisplayMode *) B;
423  if (a == b) {
424  return 0;
425  } else if (a->w != b->w) {
426  return b->w - a->w;
427  } else if (a->h != b->h) {
428  return b->h - a->h;
429  } else if (SDL_BITSPERPIXEL(a->format) != SDL_BITSPERPIXEL(b->format)) {
430  return SDL_BITSPERPIXEL(b->format) - SDL_BITSPERPIXEL(a->format);
431  } else if (SDL_PIXELLAYOUT(a->format) != SDL_PIXELLAYOUT(b->format)) {
432  return SDL_PIXELLAYOUT(b->format) - SDL_PIXELLAYOUT(a->format);
433  } else if (a->refresh_rate != b->refresh_rate) {
434  return b->refresh_rate - a->refresh_rate;
435  }
436  return 0;
437 }
438 
439 static int
441 {
442  return SDL_SetError("Video subsystem has not been initialized");
443 }
444 
445 int
447 {
448  return SDL_arraysize(bootstrap) - 1;
449 }
450 
451 const char *
453 {
454  if (index >= 0 && index < SDL_GetNumVideoDrivers()) {
455  return bootstrap[index]->name;
456  }
457  return NULL;
458 }
459 
460 /*
461  * Initialize the video and event subsystems -- determine native pixel format
462  */
463 int
464 SDL_VideoInit(const char *driver_name)
465 {
466  SDL_VideoDevice *video;
467  int index;
468  int i;
469 
470  /* Check to make sure we don't overwrite '_this' */
471  if (_this != NULL) {
472  SDL_VideoQuit();
473  }
474 
475 #if !SDL_TIMERS_DISABLED
476  SDL_TicksInit();
477 #endif
478 
479  /* Start the event loop */
481  SDL_KeyboardInit() < 0 ||
482  SDL_MouseInit() < 0 ||
483  SDL_TouchInit() < 0) {
484  return -1;
485  }
486 
487  /* Select the proper video driver */
488  index = 0;
489  video = NULL;
490  if (driver_name == NULL) {
491  driver_name = SDL_getenv("SDL_VIDEODRIVER");
492  }
493  if (driver_name != NULL) {
494  for (i = 0; bootstrap[i]; ++i) {
495  if (SDL_strncasecmp(bootstrap[i]->name, driver_name, SDL_strlen(driver_name)) == 0) {
496  if (bootstrap[i]->available()) {
497  video = bootstrap[i]->create(index);
498  break;
499  }
500  }
501  }
502  } else {
503  for (i = 0; bootstrap[i]; ++i) {
504  if (bootstrap[i]->available()) {
505  video = bootstrap[i]->create(index);
506  if (video != NULL) {
507  break;
508  }
509  }
510  }
511  }
512  if (video == NULL) {
513  if (driver_name) {
514  return SDL_SetError("%s not available", driver_name);
515  }
516  return SDL_SetError("No available video device");
517  }
518  _this = video;
519  _this->name = bootstrap[i]->name;
520  _this->next_object_id = 1;
521 
522 
523  /* Set some very sane GL defaults */
527 
530 
531  /* Initialize the video subsystem */
532  if (_this->VideoInit(_this) < 0) {
533  SDL_VideoQuit();
534  return -1;
535  }
536 
537  /* Make sure some displays were added */
538  if (_this->num_displays == 0) {
539  SDL_VideoQuit();
540  return SDL_SetError("The video driver did not add any displays");
541  }
542 
543  /* Add the renderer framebuffer emulation if desired */
548  }
549 
550  /* Disable the screen saver by default. This is a change from <= 2.0.1,
551  but most things using SDL are games or media players; you wouldn't
552  want a screensaver to trigger if you're playing exclusively with a
553  joystick, or passively watching a movie. Things that use SDL but
554  function more like a normal desktop app should explicitly reenable the
555  screensaver. */
558  }
559 
560  /* If we don't use a screen keyboard, turn on text input by default,
561  otherwise programs that expect to get text events without enabling
562  UNICODE input won't get any events.
563 
564  Actually, come to think of it, you needed to call SDL_EnableUNICODE(1)
565  in SDL 1.2 before you got text input events. Hmm...
566  */
569  }
570 
571  /* We're ready to go! */
572  return 0;
573 }
574 
575 const char *
577 {
578  if (!_this) {
580  return NULL;
581  }
582  return _this->name;
583 }
584 
587 {
588  return _this;
589 }
590 
591 int
593 {
594  SDL_VideoDisplay display;
595 
596  SDL_zero(display);
597  if (desktop_mode) {
598  display.desktop_mode = *desktop_mode;
599  }
600  display.current_mode = display.desktop_mode;
601 
602  return SDL_AddVideoDisplay(&display);
603 }
604 
605 int
607 {
608  SDL_VideoDisplay *displays;
609  int index = -1;
610 
611  displays =
613  (_this->num_displays + 1) * sizeof(*displays));
614  if (displays) {
615  index = _this->num_displays++;
616  displays[index] = *display;
617  displays[index].device = _this;
618  _this->displays = displays;
619 
620  if (display->name) {
621  displays[index].name = SDL_strdup(display->name);
622  } else {
623  char name[32];
624 
625  SDL_itoa(index, name, 10);
626  displays[index].name = SDL_strdup(name);
627  }
628  } else {
629  SDL_OutOfMemory();
630  }
631  return index;
632 }
633 
634 int
636 {
637  if (!_this) {
639  return 0;
640  }
641  return _this->num_displays;
642 }
643 
644 int
646 {
647  int displayIndex;
648 
649  for (displayIndex = 0; displayIndex < _this->num_displays; ++displayIndex) {
650  if (display == &_this->displays[displayIndex]) {
651  return displayIndex;
652  }
653  }
654 
655  /* Couldn't find the display, just use index 0 */
656  return 0;
657 }
658 
659 void *
660 SDL_GetDisplayDriverData(int displayIndex)
661 {
662  CHECK_DISPLAY_INDEX(displayIndex, NULL);
663 
664  return _this->displays[displayIndex].driverdata;
665 }
666 
667 SDL_bool
669 {
671 }
672 
673 const char *
674 SDL_GetDisplayName(int displayIndex)
675 {
676  CHECK_DISPLAY_INDEX(displayIndex, NULL);
677 
678  return _this->displays[displayIndex].name;
679 }
680 
681 int
682 SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect)
683 {
684  CHECK_DISPLAY_INDEX(displayIndex, -1);
685 
686  if (rect) {
687  SDL_VideoDisplay *display = &_this->displays[displayIndex];
688 
689  if (_this->GetDisplayBounds) {
690  if (_this->GetDisplayBounds(_this, display, rect) == 0) {
691  return 0;
692  }
693  }
694 
695  /* Assume that the displays are left to right */
696  if (displayIndex == 0) {
697  rect->x = 0;
698  rect->y = 0;
699  } else {
700  SDL_GetDisplayBounds(displayIndex-1, rect);
701  rect->x += rect->w;
702  }
703  rect->w = display->current_mode.w;
704  rect->h = display->current_mode.h;
705  }
706  return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */
707 }
708 
709 static int
711 {
712  const char *hint = SDL_GetHint(SDL_HINT_DISPLAY_USABLE_BOUNDS);
713  return hint && (SDL_sscanf(hint, "%d,%d,%d,%d", &rect->x, &rect->y, &rect->w, &rect->h) == 4);
714 }
715 
716 int
718 {
719  CHECK_DISPLAY_INDEX(displayIndex, -1);
720 
721  if (rect) {
722  SDL_VideoDisplay *display = &_this->displays[displayIndex];
723 
724  if ((displayIndex == 0) && ParseDisplayUsableBoundsHint(rect)) {
725  return 0;
726  }
727 
729  if (_this->GetDisplayUsableBounds(_this, display, rect) == 0) {
730  return 0;
731  }
732  }
733 
734  /* Oh well, just give the entire display bounds. */
735  return SDL_GetDisplayBounds(displayIndex, rect);
736  }
737  return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */
738 }
739 
740 int
741 SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi)
742 {
743  SDL_VideoDisplay *display;
744 
745  CHECK_DISPLAY_INDEX(displayIndex, -1);
746 
747  display = &_this->displays[displayIndex];
748 
749  if (_this->GetDisplayDPI) {
750  if (_this->GetDisplayDPI(_this, display, ddpi, hdpi, vdpi) == 0) {
751  return 0;
752  }
753  } else {
754  return SDL_Unsupported();
755  }
756 
757  return -1;
758 }
759 
761 SDL_GetDisplayOrientation(int displayIndex)
762 {
763  SDL_VideoDisplay *display;
764 
766 
767  display = &_this->displays[displayIndex];
768  return display->orientation;
769 }
770 
771 SDL_bool
773 {
774  SDL_DisplayMode *modes;
775  int i, nmodes;
776 
777  /* Make sure we don't already have the mode in the list */
778  modes = display->display_modes;
779  nmodes = display->num_display_modes;
780  for (i = 0; i < nmodes; ++i) {
781  if (cmpmodes(mode, &modes[i]) == 0) {
782  return SDL_FALSE;
783  }
784  }
785 
786  /* Go ahead and add the new mode */
787  if (nmodes == display->max_display_modes) {
788  modes =
789  SDL_realloc(modes,
790  (display->max_display_modes + 32) * sizeof(*modes));
791  if (!modes) {
792  return SDL_FALSE;
793  }
794  display->display_modes = modes;
795  display->max_display_modes += 32;
796  }
797  modes[nmodes] = *mode;
798  display->num_display_modes++;
799 
800  /* Re-sort video modes */
801  SDL_qsort(display->display_modes, display->num_display_modes,
802  sizeof(SDL_DisplayMode), cmpmodes);
803 
804  return SDL_TRUE;
805 }
806 
807 static int
809 {
810  if (!display->num_display_modes && _this->GetDisplayModes) {
811  _this->GetDisplayModes(_this, display);
812  SDL_qsort(display->display_modes, display->num_display_modes,
813  sizeof(SDL_DisplayMode), cmpmodes);
814  }
815  return display->num_display_modes;
816 }
817 
818 int
819 SDL_GetNumDisplayModes(int displayIndex)
820 {
821  CHECK_DISPLAY_INDEX(displayIndex, -1);
822 
823  return SDL_GetNumDisplayModesForDisplay(&_this->displays[displayIndex]);
824 }
825 
826 int
827 SDL_GetDisplayMode(int displayIndex, int index, SDL_DisplayMode * mode)
828 {
829  SDL_VideoDisplay *display;
830 
831  CHECK_DISPLAY_INDEX(displayIndex, -1);
832 
833  display = &_this->displays[displayIndex];
835  return SDL_SetError("index must be in the range of 0 - %d",
836  SDL_GetNumDisplayModesForDisplay(display) - 1);
837  }
838  if (mode) {
839  *mode = display->display_modes[index];
840  }
841  return 0;
842 }
843 
844 int
846 {
847  SDL_VideoDisplay *display;
848 
849  CHECK_DISPLAY_INDEX(displayIndex, -1);
850 
851  display = &_this->displays[displayIndex];
852  if (mode) {
853  *mode = display->desktop_mode;
854  }
855  return 0;
856 }
857 
858 int
860 {
861  SDL_VideoDisplay *display;
862 
863  CHECK_DISPLAY_INDEX(displayIndex, -1);
864 
865  display = &_this->displays[displayIndex];
866  if (mode) {
867  *mode = display->current_mode;
868  }
869  return 0;
870 }
871 
872 static SDL_DisplayMode *
874  const SDL_DisplayMode * mode,
875  SDL_DisplayMode * closest)
876 {
877  Uint32 target_format;
878  int target_refresh_rate;
879  int i;
880  SDL_DisplayMode *current, *match;
881 
882  if (!mode || !closest) {
883  SDL_SetError("Missing desired mode or closest mode parameter");
884  return NULL;
885  }
886 
887  /* Default to the desktop format */
888  if (mode->format) {
889  target_format = mode->format;
890  } else {
891  target_format = display->desktop_mode.format;
892  }
893 
894  /* Default to the desktop refresh rate */
895  if (mode->refresh_rate) {
896  target_refresh_rate = mode->refresh_rate;
897  } else {
898  target_refresh_rate = display->desktop_mode.refresh_rate;
899  }
900 
901  match = NULL;
902  for (i = 0; i < SDL_GetNumDisplayModesForDisplay(display); ++i) {
903  current = &display->display_modes[i];
904 
905  if (current->w && (current->w < mode->w)) {
906  /* Out of sorted modes large enough here */
907  break;
908  }
909  if (current->h && (current->h < mode->h)) {
910  if (current->w && (current->w == mode->w)) {
911  /* Out of sorted modes large enough here */
912  break;
913  }
914  /* Wider, but not tall enough, due to a different
915  aspect ratio. This mode must be skipped, but closer
916  modes may still follow. */
917  continue;
918  }
919  if (!match || current->w < match->w || current->h < match->h) {
920  match = current;
921  continue;
922  }
923  if (current->format != match->format) {
924  /* Sorted highest depth to lowest */
925  if (current->format == target_format ||
926  (SDL_BITSPERPIXEL(current->format) >=
927  SDL_BITSPERPIXEL(target_format)
928  && SDL_PIXELTYPE(current->format) ==
929  SDL_PIXELTYPE(target_format))) {
930  match = current;
931  }
932  continue;
933  }
934  if (current->refresh_rate != match->refresh_rate) {
935  /* Sorted highest refresh to lowest */
936  if (current->refresh_rate >= target_refresh_rate) {
937  match = current;
938  }
939  }
940  }
941  if (match) {
942  if (match->format) {
943  closest->format = match->format;
944  } else {
945  closest->format = mode->format;
946  }
947  if (match->w && match->h) {
948  closest->w = match->w;
949  closest->h = match->h;
950  } else {
951  closest->w = mode->w;
952  closest->h = mode->h;
953  }
954  if (match->refresh_rate) {
955  closest->refresh_rate = match->refresh_rate;
956  } else {
957  closest->refresh_rate = mode->refresh_rate;
958  }
959  closest->driverdata = match->driverdata;
960 
961  /*
962  * Pick some reasonable defaults if the app and driver don't
963  * care
964  */
965  if (!closest->format) {
966  closest->format = SDL_PIXELFORMAT_RGB888;
967  }
968  if (!closest->w) {
969  closest->w = 640;
970  }
971  if (!closest->h) {
972  closest->h = 480;
973  }
974  return closest;
975  }
976  return NULL;
977 }
978 
980 SDL_GetClosestDisplayMode(int displayIndex,
981  const SDL_DisplayMode * mode,
982  SDL_DisplayMode * closest)
983 {
984  SDL_VideoDisplay *display;
985 
986  CHECK_DISPLAY_INDEX(displayIndex, NULL);
987 
988  display = &_this->displays[displayIndex];
989  return SDL_GetClosestDisplayModeForDisplay(display, mode, closest);
990 }
991 
992 static int
994 {
995  SDL_DisplayMode display_mode;
996  SDL_DisplayMode current_mode;
997 
998  if (mode) {
999  display_mode = *mode;
1000 
1001  /* Default to the current mode */
1002  if (!display_mode.format) {
1003  display_mode.format = display->current_mode.format;
1004  }
1005  if (!display_mode.w) {
1006  display_mode.w = display->current_mode.w;
1007  }
1008  if (!display_mode.h) {
1009  display_mode.h = display->current_mode.h;
1010  }
1011  if (!display_mode.refresh_rate) {
1012  display_mode.refresh_rate = display->current_mode.refresh_rate;
1013  }
1014 
1015  /* Get a good video mode, the closest one possible */
1016  if (!SDL_GetClosestDisplayModeForDisplay(display, &display_mode, &display_mode)) {
1017  return SDL_SetError("No video mode large enough for %dx%d",
1018  display_mode.w, display_mode.h);
1019  }
1020  } else {
1021  display_mode = display->desktop_mode;
1022  }
1023 
1024  /* See if there's anything left to do */
1025  current_mode = display->current_mode;
1026  if (SDL_memcmp(&display_mode, &current_mode, sizeof(display_mode)) == 0) {
1027  return 0;
1028  }
1029 
1030  /* Actually change the display mode */
1031  if (!_this->SetDisplayMode) {
1032  return SDL_SetError("SDL video driver doesn't support changing display mode");
1033  }
1034  if (_this->SetDisplayMode(_this, display, &display_mode) < 0) {
1035  return -1;
1036  }
1037  display->current_mode = display_mode;
1038  return 0;
1039 }
1040 
1042 SDL_GetDisplay(int displayIndex)
1043 {
1044  CHECK_DISPLAY_INDEX(displayIndex, NULL);
1045 
1046  return &_this->displays[displayIndex];
1047 }
1048 
1049 int
1051 {
1052  int displayIndex;
1053  int i, dist;
1054  int closest = -1;
1055  int closest_dist = 0x7FFFFFFF;
1056  SDL_Point center;
1057  SDL_Point delta;
1058  SDL_Rect rect;
1059 
1061 
1064  displayIndex = (window->x & 0xFFFF);
1065  if (displayIndex >= _this->num_displays) {
1066  displayIndex = 0;
1067  }
1068  return displayIndex;
1069  }
1072  displayIndex = (window->y & 0xFFFF);
1073  if (displayIndex >= _this->num_displays) {
1074  displayIndex = 0;
1075  }
1076  return displayIndex;
1077  }
1078 
1079  /* Find the display containing the window */
1080  for (i = 0; i < _this->num_displays; ++i) {
1081  SDL_VideoDisplay *display = &_this->displays[i];
1082 
1083  if (display->fullscreen_window == window) {
1084  return i;
1085  }
1086  }
1087  center.x = window->x + window->w / 2;
1088  center.y = window->y + window->h / 2;
1089  for (i = 0; i < _this->num_displays; ++i) {
1091  if (SDL_EnclosePoints(&center, 1, &rect, NULL)) {
1092  return i;
1093  }
1094 
1095  delta.x = center.x - (rect.x + rect.w / 2);
1096  delta.y = center.y - (rect.y + rect.h / 2);
1097  dist = (delta.x*delta.x + delta.y*delta.y);
1098  if (dist < closest_dist) {
1099  closest = i;
1100  closest_dist = dist;
1101  }
1102  }
1103  if (closest < 0) {
1104  SDL_SetError("Couldn't find any displays");
1105  }
1106  return closest;
1107 }
1108 
1111 {
1112  int displayIndex = SDL_GetWindowDisplayIndex(window);
1113  if (displayIndex >= 0) {
1114  return &_this->displays[displayIndex];
1115  } else {
1116  return NULL;
1117  }
1118 }
1119 
1120 int
1122 {
1124 
1125  if (mode) {
1126  window->fullscreen_mode = *mode;
1127  } else {
1128  SDL_zero(window->fullscreen_mode);
1129  }
1130 
1132  SDL_DisplayMode fullscreen_mode;
1133  if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) {
1135  }
1136  }
1137  return 0;
1138 }
1139 
1140 int
1142 {
1143  SDL_DisplayMode fullscreen_mode;
1144  SDL_VideoDisplay *display;
1145 
1147 
1148  if (!mode) {
1149  return SDL_InvalidParamError("mode");
1150  }
1151 
1152  fullscreen_mode = window->fullscreen_mode;
1153  if (!fullscreen_mode.w) {
1154  fullscreen_mode.w = window->windowed.w;
1155  }
1156  if (!fullscreen_mode.h) {
1157  fullscreen_mode.h = window->windowed.h;
1158  }
1159 
1160  display = SDL_GetDisplayForWindow(window);
1161 
1162  /* if in desktop size mode, just return the size of the desktop */
1164  fullscreen_mode = display->desktop_mode;
1166  &fullscreen_mode,
1167  &fullscreen_mode)) {
1168  return SDL_SetError("Couldn't find display mode match");
1169  }
1170 
1171  if (mode) {
1172  *mode = fullscreen_mode;
1173  }
1174  return 0;
1175 }
1176 
1177 Uint32
1179 {
1180  SDL_VideoDisplay *display;
1181 
1183 
1184  display = SDL_GetDisplayForWindow(window);
1185  return display->current_mode.format;
1186 }
1187 
1188 static void
1190 {
1191  int x, y;
1192 
1193  if (window == SDL_GetMouseFocus()) {
1194  SDL_GetMouseState(&x, &y);
1196  }
1197 }
1198 
1199 #if __WINRT__
1201 #endif
1202 
1203 static int
1205 {
1206  SDL_VideoDisplay *display;
1207  SDL_Window *other;
1208 
1210 
1211  /* if we are in the process of hiding don't go back to fullscreen */
1212  if (window->is_hiding && fullscreen) {
1213  return 0;
1214  }
1215 
1216 #ifdef __MACOSX__
1217  /* if the window is going away and no resolution change is necessary,
1218  do nothing, or else we may trigger an ugly double-transition
1219  */
1220  if (SDL_strcmp(_this->name, "cocoa") == 0) { /* don't do this for X11, etc */
1221  if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)
1222  return 0;
1223 
1224  /* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */
1225  if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) {
1226  if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) {
1227  return -1;
1228  }
1229  } else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) {
1230  display = SDL_GetDisplayForWindow(window);
1232  if (_this->SetWindowFullscreen) {
1234  }
1235  }
1236 
1237  if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
1238  if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) {
1239  return -1;
1240  }
1241  window->last_fullscreen_flags = window->flags;
1242  return 0;
1243  }
1244  }
1245 #elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
1246  /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen
1247  or not. The user can choose this, via OS-provided UI, but this can't
1248  be set programmatically.
1249 
1250  Just look at what SDL's WinRT video backend code detected with regards
1251  to fullscreen (being active, or not), and figure out a return/error code
1252  from that.
1253  */
1254  if (fullscreen == !(WINRT_DetectWindowFlags(window) & FULLSCREEN_MASK)) {
1255  /* Uh oh, either:
1256  1. fullscreen was requested, and we're already windowed
1257  2. windowed-mode was requested, and we're already fullscreen
1258 
1259  WinRT 8.x can't resolve either programmatically, so we're
1260  giving up.
1261  */
1262  return -1;
1263  } else {
1264  /* Whatever was requested, fullscreen or windowed mode, is already
1265  in-place.
1266  */
1267  return 0;
1268  }
1269 #endif
1270 
1271  display = SDL_GetDisplayForWindow(window);
1272 
1273  if (fullscreen) {
1274  /* Hide any other fullscreen windows */
1275  if (display->fullscreen_window &&
1276  display->fullscreen_window != window) {
1278  }
1279  }
1280 
1281  /* See if anything needs to be done now */
1282  if ((display->fullscreen_window == window) == fullscreen) {
1283  if ((window->last_fullscreen_flags & FULLSCREEN_MASK) == (window->flags & FULLSCREEN_MASK)) {
1284  return 0;
1285  }
1286  }
1287 
1288  /* See if there are any fullscreen windows */
1289  for (other = _this->windows; other; other = other->next) {
1290  SDL_bool setDisplayMode = SDL_FALSE;
1291 
1292  if (other == window) {
1293  setDisplayMode = fullscreen;
1294  } else if (FULLSCREEN_VISIBLE(other) &&
1295  SDL_GetDisplayForWindow(other) == display) {
1296  setDisplayMode = SDL_TRUE;
1297  }
1298 
1299  if (setDisplayMode) {
1300  SDL_DisplayMode fullscreen_mode;
1301 
1302  SDL_zero(fullscreen_mode);
1303 
1304  if (SDL_GetWindowDisplayMode(other, &fullscreen_mode) == 0) {
1305  SDL_bool resized = SDL_TRUE;
1306 
1307  if (other->w == fullscreen_mode.w && other->h == fullscreen_mode.h) {
1308  resized = SDL_FALSE;
1309  }
1310 
1311  /* only do the mode change if we want exclusive fullscreen */
1313  if (SDL_SetDisplayModeForDisplay(display, &fullscreen_mode) < 0) {
1314  return -1;
1315  }
1316  } else {
1317  if (SDL_SetDisplayModeForDisplay(display, NULL) < 0) {
1318  return -1;
1319  }
1320  }
1321 
1322  if (_this->SetWindowFullscreen) {
1323  _this->SetWindowFullscreen(_this, other, display, SDL_TRUE);
1324  }
1325  display->fullscreen_window = other;
1326 
1327  /* Generate a mode change event here */
1328  if (resized) {
1329 #ifndef ANDROID
1330  // Android may not resize the window to exactly what our fullscreen mode is, especially on
1331  // windowed Android environments like the Chromebook or Samsung DeX. Given this, we shouldn't
1332  // use fullscreen_mode.w and fullscreen_mode.h, but rather get our current native size. As such,
1333  // Android's SetWindowFullscreen will generate the window event for us with the proper final size.
1334 
1336  fullscreen_mode.w, fullscreen_mode.h);
1337 #endif
1338  } else {
1339  SDL_OnWindowResized(other);
1340  }
1341 
1342  SDL_RestoreMousePosition(other);
1343 
1344  window->last_fullscreen_flags = window->flags;
1345  return 0;
1346  }
1347  }
1348  }
1349 
1350  /* Nope, restore the desktop mode */
1352 
1353  if (_this->SetWindowFullscreen) {
1355  }
1356  display->fullscreen_window = NULL;
1357 
1358  /* Generate a mode change event here */
1360 
1361  /* Restore the cursor position */
1363 
1364  window->last_fullscreen_flags = window->flags;
1365  return 0;
1366 }
1367 
1368 #define CREATE_FLAGS \
1369  (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED)
1370 
1371 static SDL_INLINE SDL_bool
1373 {
1376  return SDL_TRUE;
1377  }
1378  return SDL_FALSE;
1379 }
1380 
1381 /* prepare a newly-created window */
1382 static SDL_INLINE void
1384 {
1385  if (_this->AcceptDragAndDrop) {
1387  }
1388 }
1389 
1390 /* toggle d'n'd for all existing windows. */
1391 void
1393 {
1394  if (_this && _this->AcceptDragAndDrop) {
1396  SDL_Window *window;
1397  for (window = _this->windows; window; window = window->next) {
1399  }
1400  }
1401 }
1402 
1403 static void
1405 {
1407 
1408  if (flags & SDL_WINDOW_MAXIMIZED) {
1410  }
1411  if (flags & SDL_WINDOW_MINIMIZED) {
1413  }
1414  if (flags & SDL_WINDOW_FULLSCREEN) {
1416  }
1419  }
1420  if (!(flags & SDL_WINDOW_HIDDEN)) {
1422  }
1423 }
1424 
1425 SDL_Window *
1426 SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
1427 {
1428  SDL_Window *window;
1429 
1430  if (!_this) {
1431  /* Initialize the video system if needed */
1432  if (SDL_VideoInit(NULL) < 0) {
1433  return NULL;
1434  }
1435  }
1436 
1437  if ((((flags & SDL_WINDOW_UTILITY) != 0) + ((flags & SDL_WINDOW_TOOLTIP) != 0) + ((flags & SDL_WINDOW_POPUP_MENU) != 0)) > 1) {
1438  SDL_SetError("Conflicting window flags specified");
1439  return NULL;
1440  }
1441 
1442  /* Some platforms can't create zero-sized windows */
1443  if (w < 1) {
1444  w = 1;
1445  }
1446  if (h < 1) {
1447  h = 1;
1448  }
1449 
1450  /* Some platforms blow up if the windows are too large. Raise it later? */
1451  if ((w > 16384) || (h > 16384)) {
1452  SDL_SetError("Window is too large.");
1453  return NULL;
1454  }
1455 
1456  /* Some platforms have OpenGL enabled by default */
1457 #if (SDL_VIDEO_OPENGL && __MACOSX__) || __IPHONEOS__ || __ANDROID__ || __NACL__
1460  }
1461 #endif
1462  if (flags & SDL_WINDOW_OPENGL) {
1463  if (!_this->GL_CreateContext) {
1464  SDL_SetError("OpenGL support is either not configured in SDL "
1465  "or not available in current SDL video driver "
1466  "(%s) or platform", _this->name);
1467  return NULL;
1468  }
1469  if (SDL_GL_LoadLibrary(NULL) < 0) {
1470  return NULL;
1471  }
1472  }
1473 
1474  if (flags & SDL_WINDOW_VULKAN) {
1475  if (!_this->Vulkan_CreateSurface) {
1476  SDL_SetError("Vulkan support is either not configured in SDL "
1477  "or not available in current SDL video driver "
1478  "(%s) or platform", _this->name);
1479  return NULL;
1480  }
1481  if (flags & SDL_WINDOW_OPENGL) {
1482  SDL_SetError("Vulkan and OpenGL not supported on same window");
1483  return NULL;
1484  }
1485  if (SDL_Vulkan_LoadLibrary(NULL) < 0) {
1486  return NULL;
1487  }
1488  }
1489 
1490  /* Unless the user has specified the high-DPI disabling hint, respect the
1491  * SDL_WINDOW_ALLOW_HIGHDPI flag.
1492  */
1496  }
1497  }
1498 
1499  window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
1500  if (!window) {
1501  SDL_OutOfMemory();
1502  return NULL;
1503  }
1504  window->magic = &_this->window_magic;
1505  window->id = _this->next_object_id++;
1506  window->x = x;
1507  window->y = y;
1508  window->w = w;
1509  window->h = h;
1513  int displayIndex;
1514  SDL_Rect bounds;
1515 
1516  displayIndex = SDL_GetIndexOfDisplay(display);
1517  SDL_GetDisplayBounds(displayIndex, &bounds);
1519  window->x = bounds.x + (bounds.w - w) / 2;
1520  }
1522  window->y = bounds.y + (bounds.h - h) / 2;
1523  }
1524  }
1525  window->windowed.x = window->x;
1526  window->windowed.y = window->y;
1527  window->windowed.w = window->w;
1528  window->windowed.h = window->h;
1529 
1530  if (flags & SDL_WINDOW_FULLSCREEN) {
1532  int displayIndex;
1533  SDL_Rect bounds;
1534 
1535  displayIndex = SDL_GetIndexOfDisplay(display);
1536  SDL_GetDisplayBounds(displayIndex, &bounds);
1537 
1538  window->x = bounds.x;
1539  window->y = bounds.y;
1540  window->w = bounds.w;
1541  window->h = bounds.h;
1542  }
1543 
1544  window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
1545  window->last_fullscreen_flags = window->flags;
1546  window->opacity = 1.0f;
1547  window->brightness = 1.0f;
1548  window->next = _this->windows;
1550 
1551  if (_this->windows) {
1552  _this->windows->prev = window;
1553  }
1554  _this->windows = window;
1555 
1558  return NULL;
1559  }
1560 
1561  /* Clear minimized if not on windows, only windows handles it at create rather than FinishWindowCreation,
1562  * but it's important or window focus will get broken on windows!
1563  */
1564 #if !defined(__WIN32__)
1565  if (window->flags & SDL_WINDOW_MINIMIZED) {
1566  window->flags &= ~SDL_WINDOW_MINIMIZED;
1567  }
1568 #endif
1569 
1570 #if __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
1571  /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen
1572  or not. The user can choose this, via OS-provided UI, but this can't
1573  be set programmatically.
1574 
1575  Just look at what SDL's WinRT video backend code detected with regards
1576  to fullscreen (being active, or not), and figure out a return/error code
1577  from that.
1578  */
1579  flags = window->flags;
1580 #endif
1581 
1582  if (title) {
1583  SDL_SetWindowTitle(window, title);
1584  }
1586 
1587  /* If the window was created fullscreen, make sure the mode code matches */
1589 
1590  return window;
1591 }
1592 
1593 SDL_Window *
1595 {
1596  SDL_Window *window;
1597 
1598  if (!_this) {
1600  return NULL;
1601  }
1602  if (!_this->CreateSDLWindowFrom) {
1603  SDL_Unsupported();
1604  return NULL;
1605  }
1606  window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
1607  if (!window) {
1608  SDL_OutOfMemory();
1609  return NULL;
1610  }
1611  window->magic = &_this->window_magic;
1612  window->id = _this->next_object_id++;
1613  window->flags = SDL_WINDOW_FOREIGN;
1614  window->last_fullscreen_flags = window->flags;
1615  window->is_destroying = SDL_FALSE;
1616  window->opacity = 1.0f;
1617  window->brightness = 1.0f;
1618  window->next = _this->windows;
1619  if (_this->windows) {
1620  _this->windows->prev = window;
1621  }
1622  _this->windows = window;
1623 
1624  if (_this->CreateSDLWindowFrom(_this, window, data) < 0) {
1626  return NULL;
1627  }
1628 
1630 
1631  return window;
1632 }
1633 
1634 int
1636 {
1637  SDL_bool loaded_opengl = SDL_FALSE;
1638 
1640  return SDL_SetError("OpenGL support is either not configured in SDL "
1641  "or not available in current SDL video driver "
1642  "(%s) or platform", _this->name);
1643  }
1644 
1645  if (window->flags & SDL_WINDOW_FOREIGN) {
1646  /* Can't destroy and re-create foreign windows, hrm */
1648  } else {
1650  }
1651 
1652  /* Restore video mode, etc. */
1654 
1655  /* Tear down the old native window */
1656  if (window->surface) {
1657  window->surface->flags &= ~SDL_DONTFREE;
1658  SDL_FreeSurface(window->surface);
1659  window->surface = NULL;
1660  window->surface_valid = SDL_FALSE;
1661  }
1664  }
1667  }
1668 
1669  if ((window->flags & SDL_WINDOW_OPENGL) != (flags & SDL_WINDOW_OPENGL)) {
1670  if (flags & SDL_WINDOW_OPENGL) {
1671  if (SDL_GL_LoadLibrary(NULL) < 0) {
1672  return -1;
1673  }
1674  loaded_opengl = SDL_TRUE;
1675  } else {
1677  }
1678  } else if (window->flags & SDL_WINDOW_OPENGL) {
1680  if (SDL_GL_LoadLibrary(NULL) < 0) {
1681  return -1;
1682  }
1683  loaded_opengl = SDL_TRUE;
1684  }
1685 
1686  if ((window->flags & SDL_WINDOW_VULKAN) != (flags & SDL_WINDOW_VULKAN)) {
1687  SDL_SetError("Can't change SDL_WINDOW_VULKAN window flag");
1688  return -1;
1689  }
1690 
1691  if ((window->flags & SDL_WINDOW_VULKAN) && (flags & SDL_WINDOW_OPENGL)) {
1692  SDL_SetError("Vulkan and OpenGL not supported on same window");
1693  return -1;
1694  }
1695 
1696  window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
1697  window->last_fullscreen_flags = window->flags;
1698  window->is_destroying = SDL_FALSE;
1699 
1701  if (_this->CreateSDLWindow(_this, window) < 0) {
1702  if (loaded_opengl) {
1704  window->flags &= ~SDL_WINDOW_OPENGL;
1705  }
1706  return -1;
1707  }
1708  }
1709 
1710  if (flags & SDL_WINDOW_FOREIGN) {
1711  window->flags |= SDL_WINDOW_FOREIGN;
1712  }
1713 
1714  if (_this->SetWindowTitle && window->title) {
1716  }
1717 
1718  if (_this->SetWindowIcon && window->icon) {
1720  }
1721 
1722  if (window->hit_test) {
1724  }
1725 
1727 
1728  return 0;
1729 }
1730 
1731 SDL_bool
1733 {
1734  return (_this && _this->windows != NULL);
1735 }
1736 
1737 Uint32
1739 {
1741 
1742  return window->id;
1743 }
1744 
1745 SDL_Window *
1747 {
1748  SDL_Window *window;
1749 
1750  if (!_this) {
1751  return NULL;
1752  }
1753  for (window = _this->windows; window; window = window->next) {
1754  if (window->id == id) {
1755  return window;
1756  }
1757  }
1758  return NULL;
1759 }
1760 
1761 Uint32
1763 {
1765 
1766  return window->flags;
1767 }
1768 
1769 void
1770 SDL_SetWindowTitle(SDL_Window * window, const char *title)
1771 {
1773 
1774  if (title == window->title) {
1775  return;
1776  }
1777  SDL_free(window->title);
1778 
1779  window->title = SDL_strdup(title ? title : "");
1780 
1781  if (_this->SetWindowTitle) {
1783  }
1784 }
1785 
1786 const char *
1788 {
1790 
1791  return window->title ? window->title : "";
1792 }
1793 
1794 void
1796 {
1798 
1799  if (!icon) {
1800  return;
1801  }
1802 
1803  SDL_FreeSurface(window->icon);
1804 
1805  /* Convert the icon into ARGB8888 */
1807  if (!window->icon) {
1808  return;
1809  }
1810 
1811  if (_this->SetWindowIcon) {
1813  }
1814 }
1815 
1816 void*
1817 SDL_SetWindowData(SDL_Window * window, const char *name, void *userdata)
1818 {
1819  SDL_WindowUserData *prev, *data;
1820 
1822 
1823  /* Input validation */
1824  if (name == NULL || name[0] == '\0') {
1825  SDL_InvalidParamError("name");
1826  return NULL;
1827  }
1828 
1829  /* See if the named data already exists */
1830  prev = NULL;
1831  for (data = window->data; data; prev = data, data = data->next) {
1832  if (data->name && SDL_strcmp(data->name, name) == 0) {
1833  void *last_value = data->data;
1834 
1835  if (userdata) {
1836  /* Set the new value */
1837  data->data = userdata;
1838  } else {
1839  /* Delete this value */
1840  if (prev) {
1841  prev->next = data->next;
1842  } else {
1843  window->data = data->next;
1844  }
1845  SDL_free(data->name);
1846  SDL_free(data);
1847  }
1848  return last_value;
1849  }
1850  }
1851 
1852  /* Add new data to the window */
1853  if (userdata) {
1854  data = (SDL_WindowUserData *)SDL_malloc(sizeof(*data));
1855  data->name = SDL_strdup(name);
1856  data->data = userdata;
1857  data->next = window->data;
1858  window->data = data;
1859  }
1860  return NULL;
1861 }
1862 
1863 void *
1865 {
1867 
1869 
1870  /* Input validation */
1871  if (name == NULL || name[0] == '\0') {
1872  SDL_InvalidParamError("name");
1873  return NULL;
1874  }
1875 
1876  for (data = window->data; data; data = data->next) {
1877  if (data->name && SDL_strcmp(data->name, name) == 0) {
1878  return data->data;
1879  }
1880  }
1881  return NULL;
1882 }
1883 
1884 void
1886 {
1888 
1890  int displayIndex = (x & 0xFFFF);
1891  SDL_Rect bounds;
1892  if (displayIndex >= _this->num_displays) {
1893  displayIndex = 0;
1894  }
1895 
1896  SDL_zero(bounds);
1897 
1898  SDL_GetDisplayBounds(displayIndex, &bounds);
1899  if (SDL_WINDOWPOS_ISCENTERED(x)) {
1900  x = bounds.x + (bounds.w - window->w) / 2;
1901  }
1902  if (SDL_WINDOWPOS_ISCENTERED(y)) {
1903  y = bounds.y + (bounds.h - window->h) / 2;
1904  }
1905  }
1906 
1907  if ((window->flags & SDL_WINDOW_FULLSCREEN)) {
1908  if (!SDL_WINDOWPOS_ISUNDEFINED(x)) {
1909  window->windowed.x = x;
1910  }
1911  if (!SDL_WINDOWPOS_ISUNDEFINED(y)) {
1912  window->windowed.y = y;
1913  }
1914  } else {
1915  if (!SDL_WINDOWPOS_ISUNDEFINED(x)) {
1916  window->x = x;
1917  }
1918  if (!SDL_WINDOWPOS_ISUNDEFINED(y)) {
1919  window->y = y;
1920  }
1921 
1922  if (_this->SetWindowPosition) {
1924  }
1925  }
1926 }
1927 
1928 void
1930 {
1932 
1933  /* Fullscreen windows are always at their display's origin */
1934  if (window->flags & SDL_WINDOW_FULLSCREEN) {
1935  int displayIndex;
1936 
1937  if (x) {
1938  *x = 0;
1939  }
1940  if (y) {
1941  *y = 0;
1942  }
1943 
1944  /* Find the window's monitor and update to the
1945  monitor offset. */
1946  displayIndex = SDL_GetWindowDisplayIndex(window);
1947  if (displayIndex >= 0) {
1948  SDL_Rect bounds;
1949 
1950  SDL_zero(bounds);
1951 
1952  SDL_GetDisplayBounds(displayIndex, &bounds);
1953  if (x) {
1954  *x = bounds.x;
1955  }
1956  if (y) {
1957  *y = bounds.y;
1958  }
1959  }
1960  } else {
1961  if (x) {
1962  *x = window->x;
1963  }
1964  if (y) {
1965  *y = window->y;
1966  }
1967  }
1968 }
1969 
1970 void
1972 {
1974  if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
1975  const int want = (bordered != SDL_FALSE); /* normalize the flag. */
1976  const int have = ((window->flags & SDL_WINDOW_BORDERLESS) == 0);
1977  if ((want != have) && (_this->SetWindowBordered)) {
1978  if (want) {
1979  window->flags &= ~SDL_WINDOW_BORDERLESS;
1980  } else {
1981  window->flags |= SDL_WINDOW_BORDERLESS;
1982  }
1984  }
1985  }
1986 }
1987 
1988 void
1990 {
1992  if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
1993  const int want = (resizable != SDL_FALSE); /* normalize the flag. */
1994  const int have = ((window->flags & SDL_WINDOW_RESIZABLE) != 0);
1995  if ((want != have) && (_this->SetWindowResizable)) {
1996  if (want) {
1997  window->flags |= SDL_WINDOW_RESIZABLE;
1998  } else {
1999  window->flags &= ~SDL_WINDOW_RESIZABLE;
2000  }
2002  }
2003  }
2004 }
2005 
2006 void
2008 {
2010  if (w <= 0) {
2011  SDL_InvalidParamError("w");
2012  return;
2013  }
2014  if (h <= 0) {
2015  SDL_InvalidParamError("h");
2016  return;
2017  }
2018 
2019  /* Make sure we don't exceed any window size limits */
2020  if (window->min_w && w < window->min_w) {
2021  w = window->min_w;
2022  }
2023  if (window->max_w && w > window->max_w) {
2024  w = window->max_w;
2025  }
2026  if (window->min_h && h < window->min_h) {
2027  h = window->min_h;
2028  }
2029  if (window->max_h && h > window->max_h) {
2030  h = window->max_h;
2031  }
2032 
2033  window->windowed.w = w;
2034  window->windowed.h = h;
2035 
2036  if (window->flags & SDL_WINDOW_FULLSCREEN) {
2038  window->last_fullscreen_flags = 0;
2040  }
2041  } else {
2042  window->w = w;
2043  window->h = h;
2044  if (_this->SetWindowSize) {
2046  }
2047  if (window->w == w && window->h == h) {
2048  /* We didn't get a SDL_WINDOWEVENT_RESIZED event (by design) */
2050  }
2051  }
2052 }
2053 
2054 void
2056 {
2058  if (w) {
2059  *w = window->w;
2060  }
2061  if (h) {
2062  *h = window->h;
2063  }
2064 }
2065 
2066 int
2068 {
2069  int dummy = 0;
2070 
2071  if (!top) { top = &dummy; }
2072  if (!left) { left = &dummy; }
2073  if (!right) { right = &dummy; }
2074  if (!bottom) { bottom = &dummy; }
2075 
2076  /* Always initialize, so applications don't have to care */
2077  *top = *left = *bottom = *right = 0;
2078 
2080 
2081  if (!_this->GetWindowBordersSize) {
2082  return SDL_Unsupported();
2083  }
2084 
2086 }
2087 
2088 void
2090 {
2092  if (min_w <= 0) {
2093  SDL_InvalidParamError("min_w");
2094  return;
2095  }
2096  if (min_h <= 0) {
2097  SDL_InvalidParamError("min_h");
2098  return;
2099  }
2100 
2101  if ((window->max_w && min_w >= window->max_w) ||
2102  (window->max_h && min_h >= window->max_h)) {
2103  SDL_SetError("SDL_SetWindowMinimumSize(): Tried to set minimum size larger than maximum size");
2104  return;
2105  }
2106 
2107  window->min_w = min_w;
2108  window->min_h = min_h;
2109 
2110  if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
2111  if (_this->SetWindowMinimumSize) {
2113  }
2114  /* Ensure that window is not smaller than minimal size */
2115  SDL_SetWindowSize(window, SDL_max(window->w, window->min_w), SDL_max(window->h, window->min_h));
2116  }
2117 }
2118 
2119 void
2120 SDL_GetWindowMinimumSize(SDL_Window * window, int *min_w, int *min_h)
2121 {
2123  if (min_w) {
2124  *min_w = window->min_w;
2125  }
2126  if (min_h) {
2127  *min_h = window->min_h;
2128  }
2129 }
2130 
2131 void
2133 {
2135  if (max_w <= 0) {
2136  SDL_InvalidParamError("max_w");
2137  return;
2138  }
2139  if (max_h <= 0) {
2140  SDL_InvalidParamError("max_h");
2141  return;
2142  }
2143 
2144  if (max_w <= window->min_w || max_h <= window->min_h) {
2145  SDL_SetError("SDL_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size");
2146  return;
2147  }
2148 
2149  window->max_w = max_w;
2150  window->max_h = max_h;
2151 
2152  if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
2153  if (_this->SetWindowMaximumSize) {
2155  }
2156  /* Ensure that window is not larger than maximal size */
2157  SDL_SetWindowSize(window, SDL_min(window->w, window->max_w), SDL_min(window->h, window->max_h));
2158  }
2159 }
2160 
2161 void
2162 SDL_GetWindowMaximumSize(SDL_Window * window, int *max_w, int *max_h)
2163 {
2165  if (max_w) {
2166  *max_w = window->max_w;
2167  }
2168  if (max_h) {
2169  *max_h = window->max_h;
2170  }
2171 }
2172 
2173 void
2175 {
2177 
2178  if (window->flags & SDL_WINDOW_SHOWN) {
2179  return;
2180  }
2181 
2182  if (_this->ShowWindow) {
2184  }
2186 }
2187 
2188 void
2190 {
2192 
2193  if (!(window->flags & SDL_WINDOW_SHOWN)) {
2194  return;
2195  }
2196 
2197  window->is_hiding = SDL_TRUE;
2199 
2200  if (_this->HideWindow) {
2202  }
2203  window->is_hiding = SDL_FALSE;
2205 }
2206 
2207 void
2209 {
2211 
2212  if (!(window->flags & SDL_WINDOW_SHOWN)) {
2213  return;
2214  }
2215  if (_this->RaiseWindow) {
2217  }
2218 }
2219 
2220 void
2222 {
2224 
2225  if (window->flags & SDL_WINDOW_MAXIMIZED) {
2226  return;
2227  }
2228 
2229  /* !!! FIXME: should this check if the window is resizable? */
2230 
2231  if (_this->MaximizeWindow) {
2233  }
2234 }
2235 
2236 static SDL_bool
2238 {
2239  if (!_this->MinimizeWindow) {
2240  return SDL_FALSE;
2241  }
2242  return SDL_TRUE;
2243 }
2244 
2245 void
2247 {
2249 
2250  if (window->flags & SDL_WINDOW_MINIMIZED) {
2251  return;
2252  }
2253 
2254  if (!CanMinimizeWindow(window)) {
2255  return;
2256  }
2257 
2259 
2260  if (_this->MinimizeWindow) {
2262  }
2263 }
2264 
2265 void
2267 {
2269 
2270  if (!(window->flags & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED))) {
2271  return;
2272  }
2273 
2274  if (_this->RestoreWindow) {
2276  }
2277 }
2278 
2279 int
2281 {
2282  Uint32 oldflags;
2284 
2286 
2287  if (flags == (window->flags & FULLSCREEN_MASK)) {
2288  return 0;
2289  }
2290 
2291  /* clear the previous flags and OR in the new ones */
2292  oldflags = window->flags & FULLSCREEN_MASK;
2293  window->flags &= ~FULLSCREEN_MASK;
2294  window->flags |= flags;
2295 
2297  return 0;
2298  }
2299 
2300  window->flags &= ~FULLSCREEN_MASK;
2301  window->flags |= oldflags;
2302  return -1;
2303 }
2304 
2305 static SDL_Surface *
2307 {
2308  Uint32 format;
2309  void *pixels;
2310  int pitch;
2311  int bpp;
2312  Uint32 Rmask, Gmask, Bmask, Amask;
2313 
2315  return NULL;
2316  }
2317 
2318  if (_this->CreateWindowFramebuffer(_this, window, &format, &pixels, &pitch) < 0) {
2319  return NULL;
2320  }
2321 
2322  if (!SDL_PixelFormatEnumToMasks(format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
2323  return NULL;
2324  }
2325 
2326  return SDL_CreateRGBSurfaceFrom(pixels, window->w, window->h, bpp, pitch, Rmask, Gmask, Bmask, Amask);
2327 }
2328 
2329 SDL_Surface *
2331 {
2333 
2334  if (!window->surface_valid) {
2335  if (window->surface) {
2336  window->surface->flags &= ~SDL_DONTFREE;
2337  SDL_FreeSurface(window->surface);
2338  }
2340  if (window->surface) {
2341  window->surface_valid = SDL_TRUE;
2342  window->surface->flags |= SDL_DONTFREE;
2343  }
2344  }
2345  return window->surface;
2346 }
2347 
2348 int
2350 {
2351  SDL_Rect full_rect;
2352 
2354 
2355  full_rect.x = 0;
2356  full_rect.y = 0;
2357  full_rect.w = window->w;
2358  full_rect.h = window->h;
2359  return SDL_UpdateWindowSurfaceRects(window, &full_rect, 1);
2360 }
2361 
2362 int
2364  int numrects)
2365 {
2367 
2368  if (!window->surface_valid) {
2369  return SDL_SetError("Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface");
2370  }
2371 
2372  return _this->UpdateWindowFramebuffer(_this, window, rects, numrects);
2373 }
2374 
2375 int
2377 {
2378  Uint16 ramp[256];
2379  int status;
2380 
2382 
2383  SDL_CalculateGammaRamp(brightness, ramp);
2384  status = SDL_SetWindowGammaRamp(window, ramp, ramp, ramp);
2385  if (status == 0) {
2386  window->brightness = brightness;
2387  }
2388  return status;
2389 }
2390 
2391 float
2393 {
2395 
2396  return window->brightness;
2397 }
2398 
2399 int
2401 {
2402  int retval;
2404 
2405  if (!_this->SetWindowOpacity) {
2406  return SDL_Unsupported();
2407  }
2408 
2409  if (opacity < 0.0f) {
2410  opacity = 0.0f;
2411  } else if (opacity > 1.0f) {
2412  opacity = 1.0f;
2413  }
2414 
2415  retval = _this->SetWindowOpacity(_this, window, opacity);
2416  if (retval == 0) {
2417  window->opacity = opacity;
2418  }
2419 
2420  return retval;
2421 }
2422 
2423 int
2424 SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity)
2425 {
2427 
2428  if (out_opacity) {
2429  *out_opacity = window->opacity;
2430  }
2431 
2432  return 0;
2433 }
2434 
2435 int
2436 SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window)
2437 {
2438  CHECK_WINDOW_MAGIC(modal_window, -1);
2439  CHECK_WINDOW_MAGIC(parent_window, -1);
2440 
2441  if (!_this->SetWindowModalFor) {
2442  return SDL_Unsupported();
2443  }
2444 
2445  return _this->SetWindowModalFor(_this, modal_window, parent_window);
2446 }
2447 
2448 int
2450 {
2452 
2453  if (!_this->SetWindowInputFocus) {
2454  return SDL_Unsupported();
2455  }
2456 
2458 }
2459 
2460 
2461 int
2463  const Uint16 * green,
2464  const Uint16 * blue)
2465 {
2467 
2468  if (!_this->SetWindowGammaRamp) {
2469  return SDL_Unsupported();
2470  }
2471 
2472  if (!window->gamma) {
2473  if (SDL_GetWindowGammaRamp(window, NULL, NULL, NULL) < 0) {
2474  return -1;
2475  }
2476  SDL_assert(window->gamma != NULL);
2477  }
2478 
2479  if (red) {
2480  SDL_memcpy(&window->gamma[0*256], red, 256*sizeof(Uint16));
2481  }
2482  if (green) {
2483  SDL_memcpy(&window->gamma[1*256], green, 256*sizeof(Uint16));
2484  }
2485  if (blue) {
2486  SDL_memcpy(&window->gamma[2*256], blue, 256*sizeof(Uint16));
2487  }
2488  if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
2489  return _this->SetWindowGammaRamp(_this, window, window->gamma);
2490  } else {
2491  return 0;
2492  }
2493 }
2494 
2495 int
2497  Uint16 * green,
2498  Uint16 * blue)
2499 {
2501 
2502  if (!window->gamma) {
2503  int i;
2504 
2505  window->gamma = (Uint16 *)SDL_malloc(256*6*sizeof(Uint16));
2506  if (!window->gamma) {
2507  return SDL_OutOfMemory();
2508  }
2509  window->saved_gamma = window->gamma + 3*256;
2510 
2511  if (_this->GetWindowGammaRamp) {
2512  if (_this->GetWindowGammaRamp(_this, window, window->gamma) < 0) {
2513  return -1;
2514  }
2515  } else {
2516  /* Create an identity gamma ramp */
2517  for (i = 0; i < 256; ++i) {
2518  Uint16 value = (Uint16)((i << 8) | i);
2519 
2520  window->gamma[0*256+i] = value;
2521  window->gamma[1*256+i] = value;
2522  window->gamma[2*256+i] = value;
2523  }
2524  }
2525  SDL_memcpy(window->saved_gamma, window->gamma, 3*256*sizeof(Uint16));
2526  }
2527 
2528  if (red) {
2529  SDL_memcpy(red, &window->gamma[0*256], 256*sizeof(Uint16));
2530  }
2531  if (green) {
2532  SDL_memcpy(green, &window->gamma[1*256], 256*sizeof(Uint16));
2533  }
2534  if (blue) {
2535  SDL_memcpy(blue, &window->gamma[2*256], 256*sizeof(Uint16));
2536  }
2537  return 0;
2538 }
2539 
2540 void
2542 {
2543  SDL_Window *grabbed_window;
2544  SDL_bool grabbed;
2545  if ((SDL_GetMouse()->relative_mode || (window->flags & SDL_WINDOW_INPUT_GRABBED)) &&
2546  (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
2547  grabbed = SDL_TRUE;
2548  } else {
2549  grabbed = SDL_FALSE;
2550  }
2551 
2552  grabbed_window = _this->grabbed_window;
2553  if (grabbed) {
2554  if (grabbed_window && (grabbed_window != window)) {
2555  /* stealing a grab from another window! */
2556  grabbed_window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
2557  if (_this->SetWindowGrab) {
2558  _this->SetWindowGrab(_this, grabbed_window, SDL_FALSE);
2559  }
2560  }
2562  } else if (grabbed_window == window) {
2563  _this->grabbed_window = NULL; /* ungrabbing. */
2564  }
2565 
2566  if (_this->SetWindowGrab) {
2567  _this->SetWindowGrab(_this, window, grabbed);
2568  }
2569 }
2570 
2571 void
2573 {
2575 
2576  if (!!grabbed == !!(window->flags & SDL_WINDOW_INPUT_GRABBED)) {
2577  return;
2578  }
2579  if (grabbed) {
2580  window->flags |= SDL_WINDOW_INPUT_GRABBED;
2581  } else {
2582  window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
2583  }
2585 }
2586 
2587 SDL_bool
2589 {
2592  return window == _this->grabbed_window;
2593 }
2594 
2595 SDL_Window *
2597 {
2599  return _this->grabbed_window;
2600 }
2601 
2602 void
2604 {
2606 }
2607 
2608 void
2610 {
2612 }
2613 
2614 void
2616 {
2617  window->surface_valid = SDL_FALSE;
2619 }
2620 
2621 void
2623 {
2625 }
2626 
2627 void
2629 {
2630  /*
2631  * FIXME: Is this fine to just remove this, or should it be preserved just
2632  * for the fullscreen case? In principle it seems like just hiding/showing
2633  * windows shouldn't affect the stacking order; maybe the right fix is to
2634  * re-decouple OnWindowShown and OnWindowRestored.
2635  */
2636  /*SDL_RaiseWindow(window);*/
2637 
2638  if (FULLSCREEN_VISIBLE(window)) {
2640  }
2641 }
2642 
2643 void
2645 {
2646  if (_this->OnWindowEnter) {
2648  }
2649 }
2650 
2651 void
2653 {
2654 }
2655 
2656 void
2658 {
2659  SDL_Mouse *mouse = SDL_GetMouse();
2660 
2661  if (window->gamma && _this->SetWindowGammaRamp) {
2663  }
2664 
2665  if (mouse && mouse->relative_mode) {
2668  }
2669 
2671 }
2672 
2673 static SDL_bool
2675 {
2676  if (!(window->flags & SDL_WINDOW_FULLSCREEN) || window->is_destroying) {
2677  return SDL_FALSE;
2678  }
2679 
2680 #ifdef __MACOSX__
2681  if (SDL_strcmp(_this->name, "cocoa") == 0) { /* don't do this for X11, etc */
2682  if (Cocoa_IsWindowInFullscreenSpace(window)) {
2683  return SDL_FALSE;
2684  }
2685  }
2686 #endif
2687 
2688 #ifdef __ANDROID__
2689  {
2692  return SDL_FALSE;
2693  }
2694  }
2695 #endif
2696 
2698 }
2699 
2700 void
2702 {
2703  if (window->gamma && _this->SetWindowGammaRamp) {
2704  _this->SetWindowGammaRamp(_this, window, window->saved_gamma);
2705  }
2706 
2708 
2711  }
2712 }
2713 
2714 /* !!! FIXME: is this different than SDL_GetKeyboardFocus()?
2715  !!! FIXME: Also, SDL_GetKeyboardFocus() is O(1), this isn't. */
2716 SDL_Window *
2718 {
2719  SDL_Window *window;
2720 
2721  if (!_this) {
2722  return NULL;
2723  }
2724  for (window = _this->windows; window; window = window->next) {
2725  if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
2726  return window;
2727  }
2728  }
2729  return NULL;
2730 }
2731 
2732 void
2734 {
2735  SDL_VideoDisplay *display;
2736 
2738 
2739  window->is_destroying = SDL_TRUE;
2740 
2741  /* Restore video mode, etc. */
2743 
2744  /* Make sure this window no longer has focus */
2745  if (SDL_GetKeyboardFocus() == window) {
2747  }
2748  if (SDL_GetMouseFocus() == window) {
2750  }
2751 
2752  /* make no context current if this is the current context window. */
2753  if (window->flags & SDL_WINDOW_OPENGL) {
2754  if (_this->current_glwin == window) {
2756  }
2757  }
2758 
2759  if (window->surface) {
2760  window->surface->flags &= ~SDL_DONTFREE;
2761  SDL_FreeSurface(window->surface);
2762  }
2765  }
2766  if (_this->DestroyWindow) {
2768  }
2769  if (window->flags & SDL_WINDOW_OPENGL) {
2771  }
2772  if (window->flags & SDL_WINDOW_VULKAN) {
2774  }
2775 
2776  display = SDL_GetDisplayForWindow(window);
2777  if (display->fullscreen_window == window) {
2778  display->fullscreen_window = NULL;
2779  }
2780 
2781  /* Now invalidate magic */
2782  window->magic = NULL;
2783 
2784  /* Free memory associated with the window */
2785  SDL_free(window->title);
2786  SDL_FreeSurface(window->icon);
2787  SDL_free(window->gamma);
2788  while (window->data) {
2790 
2791  window->data = data->next;
2792  SDL_free(data->name);
2793  SDL_free(data);
2794  }
2795 
2796  /* Unlink the window from the list */
2797  if (window->next) {
2798  window->next->prev = window->prev;
2799  }
2800  if (window->prev) {
2801  window->prev->next = window->next;
2802  } else {
2803  _this->windows = window->next;
2804  }
2805 
2806  SDL_free(window);
2807 }
2808 
2809 SDL_bool
2811 {
2812  if (!_this) {
2813  return SDL_TRUE;
2814  }
2816 }
2817 
2818 void
2820 {
2821  if (!_this) {
2822  return;
2823  }
2824  if (!_this->suspend_screensaver) {
2825  return;
2826  }
2828  if (_this->SuspendScreenSaver) {
2830  }
2831 }
2832 
2833 void
2835 {
2836  if (!_this) {
2837  return;
2838  }
2839  if (_this->suspend_screensaver) {
2840  return;
2841  }
2843  if (_this->SuspendScreenSaver) {
2845  }
2846 }
2847 
2848 void
2850 {
2851  int i, j;
2852 
2853  if (!_this) {
2854  return;
2855  }
2856 
2857  /* Halt event processing before doing anything else */
2858  SDL_TouchQuit();
2859  SDL_MouseQuit();
2860  SDL_KeyboardQuit();
2862 
2864 
2865  /* Clean up the system video */
2866  while (_this->windows) {
2868  }
2869  _this->VideoQuit(_this);
2870 
2871  for (i = 0; i < _this->num_displays; ++i) {
2872  SDL_VideoDisplay *display = &_this->displays[i];
2873  for (j = display->num_display_modes; j--;) {
2874  SDL_free(display->display_modes[j].driverdata);
2875  display->display_modes[j].driverdata = NULL;
2876  }
2877  SDL_free(display->display_modes);
2878  display->display_modes = NULL;
2879  SDL_free(display->desktop_mode.driverdata);
2880  display->desktop_mode.driverdata = NULL;
2881  SDL_free(display->driverdata);
2882  display->driverdata = NULL;
2883  }
2884  if (_this->displays) {
2885  for (i = 0; i < _this->num_displays; ++i) {
2887  }
2889  _this->displays = NULL;
2890  _this->num_displays = 0;
2891  }
2894  _this->free(_this);
2895  _this = NULL;
2896 }
2897 
2898 int
2900 {
2901  int retval;
2902 
2903  if (!_this) {
2904  return SDL_UninitializedVideo();
2905  }
2906  if (_this->gl_config.driver_loaded) {
2907  if (path && SDL_strcmp(path, _this->gl_config.driver_path) != 0) {
2908  return SDL_SetError("OpenGL library already loaded");
2909  }
2910  retval = 0;
2911  } else {
2912  if (!_this->GL_LoadLibrary) {
2913  return SDL_SetError("No dynamic GL support in current SDL video driver (%s)", _this->name);
2914  }
2916  }
2917  if (retval == 0) {
2919  } else {
2920  if (_this->GL_UnloadLibrary) {
2922  }
2923  }
2924  return (retval);
2925 }
2926 
2927 void *
2928 SDL_GL_GetProcAddress(const char *proc)
2929 {
2930  void *func;
2931 
2932  if (!_this) {
2934  return NULL;
2935  }
2936  func = NULL;
2937  if (_this->GL_GetProcAddress) {
2938  if (_this->gl_config.driver_loaded) {
2939  func = _this->GL_GetProcAddress(_this, proc);
2940  } else {
2941  SDL_SetError("No GL driver has been loaded");
2942  }
2943  } else {
2944  SDL_SetError("No dynamic GL support in current SDL video driver (%s)", _this->name);
2945  }
2946  return func;
2947 }
2948 
2949 void
2951 {
2952  if (!_this) {
2954  return;
2955  }
2956  if (_this->gl_config.driver_loaded > 0) {
2957  if (--_this->gl_config.driver_loaded > 0) {
2958  return;
2959  }
2960  if (_this->GL_UnloadLibrary) {
2962  }
2963  }
2964 }
2965 
2966 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
2967 static SDL_INLINE SDL_bool
2968 isAtLeastGL3(const char *verstr)
2969 {
2970  return (verstr && (SDL_atoi(verstr) >= 3));
2971 }
2972 #endif
2973 
2974 SDL_bool
2975 SDL_GL_ExtensionSupported(const char *extension)
2976 {
2977 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
2978  const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
2979  const char *extensions;
2980  const char *start;
2981  const char *where, *terminator;
2982 
2983  /* Extension names should not have spaces. */
2984  where = SDL_strchr(extension, ' ');
2985  if (where || *extension == '\0') {
2986  return SDL_FALSE;
2987  }
2988  /* See if there's an environment variable override */
2989  start = SDL_getenv(extension);
2990  if (start && *start == '0') {
2991  return SDL_FALSE;
2992  }
2993 
2994  /* Lookup the available extensions */
2995 
2996  glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
2997  if (!glGetStringFunc) {
2998  return SDL_FALSE;
2999  }
3000 
3001  if (isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) {
3002  const GLubyte *(APIENTRY * glGetStringiFunc) (GLenum, GLuint);
3003  void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params);
3004  GLint num_exts = 0;
3005  GLint i;
3006 
3007  glGetStringiFunc = SDL_GL_GetProcAddress("glGetStringi");
3008  glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
3009  if ((!glGetStringiFunc) || (!glGetIntegervFunc)) {
3010  return SDL_FALSE;
3011  }
3012 
3013  #ifndef GL_NUM_EXTENSIONS
3014  #define GL_NUM_EXTENSIONS 0x821D
3015  #endif
3016  glGetIntegervFunc(GL_NUM_EXTENSIONS, &num_exts);
3017  for (i = 0; i < num_exts; i++) {
3018  const char *thisext = (const char *) glGetStringiFunc(GL_EXTENSIONS, i);
3019  if (SDL_strcmp(thisext, extension) == 0) {
3020  return SDL_TRUE;
3021  }
3022  }
3023 
3024  return SDL_FALSE;
3025  }
3026 
3027  /* Try the old way with glGetString(GL_EXTENSIONS) ... */
3028 
3029  extensions = (const char *) glGetStringFunc(GL_EXTENSIONS);
3030  if (!extensions) {
3031  return SDL_FALSE;
3032  }
3033  /*
3034  * It takes a bit of care to be fool-proof about parsing the OpenGL
3035  * extensions string. Don't be fooled by sub-strings, etc.
3036  */
3037 
3038  start = extensions;
3039 
3040  for (;;) {
3041  where = SDL_strstr(start, extension);
3042  if (!where)
3043  break;
3044 
3045  terminator = where + SDL_strlen(extension);
3046  if (where == extensions || *(where - 1) == ' ')
3047  if (*terminator == ' ' || *terminator == '\0')
3048  return SDL_TRUE;
3049 
3050  start = terminator;
3051  }
3052  return SDL_FALSE;
3053 #else
3054  return SDL_FALSE;
3055 #endif
3056 }
3057 
3058 /* Deduce supported ES profile versions from the supported
3059  ARB_ES*_compatibility extensions. There is no direct query.
3060 
3061  This is normally only called when the OpenGL driver supports
3062  {GLX,WGL}_EXT_create_context_es2_profile.
3063  */
3064 void
3065 SDL_GL_DeduceMaxSupportedESProfile(int* major, int* minor)
3066 {
3067 /* THIS REQUIRES AN EXISTING GL CONTEXT THAT HAS BEEN MADE CURRENT. */
3068 /* Please refer to https://bugzilla.libsdl.org/show_bug.cgi?id=3725 for discussion. */
3069 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
3070  /* XXX This is fragile; it will break in the event of release of
3071  * new versions of OpenGL ES.
3072  */
3073  if (SDL_GL_ExtensionSupported("GL_ARB_ES3_2_compatibility")) {
3074  *major = 3;
3075  *minor = 2;
3076  } else if (SDL_GL_ExtensionSupported("GL_ARB_ES3_1_compatibility")) {
3077  *major = 3;
3078  *minor = 1;
3079  } else if (SDL_GL_ExtensionSupported("GL_ARB_ES3_compatibility")) {
3080  *major = 3;
3081  *minor = 0;
3082  } else {
3083  *major = 2;
3084  *minor = 0;
3085  }
3086 #endif
3087 }
3088 
3089 void
3091 {
3092  if (!_this) {
3093  return;
3094  }
3095 
3096  _this->gl_config.red_size = 3;
3097  _this->gl_config.green_size = 3;
3098  _this->gl_config.blue_size = 2;
3099  _this->gl_config.alpha_size = 0;
3101  _this->gl_config.depth_size = 16;
3108  _this->gl_config.stereo = 0;
3112  _this->gl_config.accelerated = -1; /* accelerated or not, both are fine */
3113 
3118  } else {
3119 #if SDL_VIDEO_OPENGL
3123 #elif SDL_VIDEO_OPENGL_ES2
3127 #elif SDL_VIDEO_OPENGL_ES
3131 #endif
3132  }
3133 
3134  _this->gl_config.flags = 0;
3136  _this->gl_config.no_error = 0;
3139 
3141 }
3142 
3143 int
3145 {
3146 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
3147  int retval;
3148 
3149  if (!_this) {
3150  return SDL_UninitializedVideo();
3151  }
3152  retval = 0;
3153  switch (attr) {
3154  case SDL_GL_RED_SIZE:
3156  break;
3157  case SDL_GL_GREEN_SIZE:
3159  break;
3160  case SDL_GL_BLUE_SIZE:
3162  break;
3163  case SDL_GL_ALPHA_SIZE:
3165  break;
3166  case SDL_GL_DOUBLEBUFFER:
3168  break;
3169  case SDL_GL_BUFFER_SIZE:
3171  break;
3172  case SDL_GL_DEPTH_SIZE:
3174  break;
3175  case SDL_GL_STENCIL_SIZE:
3177  break;
3178  case SDL_GL_ACCUM_RED_SIZE:
3180  break;
3183  break;
3186  break;
3189  break;
3190  case SDL_GL_STEREO:
3192  break;
3195  break;
3198  break;
3201  break;
3204  break;
3207  break;
3210  break;
3211  case SDL_GL_CONTEXT_EGL:
3212  /* FIXME: SDL_GL_CONTEXT_EGL to be deprecated in SDL 2.1 */
3213  if (value != 0) {
3215  } else {
3217  };
3218  break;
3219  case SDL_GL_CONTEXT_FLAGS:
3224  retval = SDL_SetError("Unknown OpenGL context flag %d", value);
3225  break;
3226  }
3228  break;
3230  if (value != 0 &&
3234  retval = SDL_SetError("Unknown OpenGL context profile %d", value);
3235  break;
3236  }
3238  break;
3241  break;
3244  break;
3247  break;
3250  break;
3253  break;
3254  default:
3255  retval = SDL_SetError("Unknown OpenGL attribute");
3256  break;
3257  }
3258  return retval;
3259 #else
3260  return SDL_Unsupported();
3261 #endif /* SDL_VIDEO_OPENGL */
3262 }
3263 
3264 int
3266 {
3267 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
3268  GLenum (APIENTRY *glGetErrorFunc) (void);
3269  GLenum attrib = 0;
3270  GLenum error = 0;
3271 
3272  /*
3273  * Some queries in Core Profile desktop OpenGL 3+ contexts require
3274  * glGetFramebufferAttachmentParameteriv instead of glGetIntegerv. Note that
3275  * the enums we use for the former function don't exist in OpenGL ES 2, and
3276  * the function itself doesn't exist prior to OpenGL 3 and OpenGL ES 2.
3277  */
3278 #if SDL_VIDEO_OPENGL
3279  const GLubyte *(APIENTRY *glGetStringFunc) (GLenum name);
3280  void (APIENTRY *glGetFramebufferAttachmentParameterivFunc) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
3282  GLenum attachmentattrib = 0;
3283 #endif
3284 
3285  if (!value) {
3286  return SDL_InvalidParamError("value");
3287  }
3288 
3289  /* Clear value in any case */
3290  *value = 0;
3291 
3292  if (!_this) {
3293  return SDL_UninitializedVideo();
3294  }
3295 
3296  switch (attr) {
3297  case SDL_GL_RED_SIZE:
3298 #if SDL_VIDEO_OPENGL
3299  attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE;
3300 #endif
3301  attrib = GL_RED_BITS;
3302  break;
3303  case SDL_GL_BLUE_SIZE:
3304 #if SDL_VIDEO_OPENGL
3305  attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE;
3306 #endif
3307  attrib = GL_BLUE_BITS;
3308  break;
3309  case SDL_GL_GREEN_SIZE:
3310 #if SDL_VIDEO_OPENGL
3311  attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE;
3312 #endif
3313  attrib = GL_GREEN_BITS;
3314  break;
3315  case SDL_GL_ALPHA_SIZE:
3316 #if SDL_VIDEO_OPENGL
3317  attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE;
3318 #endif
3319  attrib = GL_ALPHA_BITS;
3320  break;
3321  case SDL_GL_DOUBLEBUFFER:
3322 #if SDL_VIDEO_OPENGL
3323  attrib = GL_DOUBLEBUFFER;
3324  break;
3325 #else
3326  /* OpenGL ES 1.0 and above specifications have EGL_SINGLE_BUFFER */
3327  /* parameter which switches double buffer to single buffer. OpenGL ES */
3328  /* SDL driver must set proper value after initialization */
3330  return 0;
3331 #endif
3332  case SDL_GL_DEPTH_SIZE:
3333 #if SDL_VIDEO_OPENGL
3334  attachment = GL_DEPTH;
3335  attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE;
3336 #endif
3337  attrib = GL_DEPTH_BITS;
3338  break;
3339  case SDL_GL_STENCIL_SIZE:
3340 #if SDL_VIDEO_OPENGL
3342  attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE;
3343 #endif
3344  attrib = GL_STENCIL_BITS;
3345  break;
3346 #if SDL_VIDEO_OPENGL
3347  case SDL_GL_ACCUM_RED_SIZE:
3348  attrib = GL_ACCUM_RED_BITS;
3349  break;
3351  attrib = GL_ACCUM_GREEN_BITS;
3352  break;
3354  attrib = GL_ACCUM_BLUE_BITS;
3355  break;
3357  attrib = GL_ACCUM_ALPHA_BITS;
3358  break;
3359  case SDL_GL_STEREO:
3360  attrib = GL_STEREO;
3361  break;
3362 #else
3363  case SDL_GL_ACCUM_RED_SIZE:
3367  case SDL_GL_STEREO:
3368  /* none of these are supported in OpenGL ES */
3369  *value = 0;
3370  return 0;
3371 #endif
3373  attrib = GL_SAMPLE_BUFFERS;
3374  break;
3376  attrib = GL_SAMPLES;
3377  break;
3379 #if SDL_VIDEO_OPENGL
3380  attrib = GL_CONTEXT_RELEASE_BEHAVIOR;
3381 #else
3383 #endif
3384  break;
3385  case SDL_GL_BUFFER_SIZE:
3386  {
3387  int rsize = 0, gsize = 0, bsize = 0, asize = 0;
3388 
3389  /* There doesn't seem to be a single flag in OpenGL for this! */
3390  if (SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &rsize) < 0) {
3391  return -1;
3392  }
3393  if (SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &gsize) < 0) {
3394  return -1;
3395  }
3396  if (SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &bsize) < 0) {
3397  return -1;
3398  }
3399  if (SDL_GL_GetAttribute(SDL_GL_ALPHA_SIZE, &asize) < 0) {
3400  return -1;
3401  }
3402 
3403  *value = rsize + gsize + bsize + asize;
3404  return 0;
3405  }
3407  {
3408  /* FIXME: How do we get this information? */
3409  *value = (_this->gl_config.accelerated != 0);
3410  return 0;
3411  }
3413  {
3415  return 0;
3416  }
3418  {
3420  return 0;
3421  }
3423  {
3425  return 0;
3426  }
3427  case SDL_GL_CONTEXT_EGL:
3428  /* FIXME: SDL_GL_CONTEXT_EGL to be deprecated in SDL 2.1 */
3429  {
3431  *value = 1;
3432  }
3433  else {
3434  *value = 0;
3435  }
3436  return 0;
3437  }
3438  case SDL_GL_CONTEXT_FLAGS:
3439  {
3440  *value = _this->gl_config.flags;
3441  return 0;
3442  }
3444  {
3446  return 0;
3447  }
3449  {
3451  return 0;
3452  }
3454  {
3456  return 0;
3457  }
3459  {
3461  return 0;
3462  }
3463  default:
3464  return SDL_SetError("Unknown OpenGL attribute");
3465  }
3466 
3467 #if SDL_VIDEO_OPENGL
3468  glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
3469  if (!glGetStringFunc) {
3470  return -1;
3471  }
3472 
3473  if (attachmentattrib && isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) {
3474  glGetFramebufferAttachmentParameterivFunc = SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameteriv");
3475 
3476  if (glGetFramebufferAttachmentParameterivFunc) {
3477  glGetFramebufferAttachmentParameterivFunc(GL_FRAMEBUFFER, attachment, attachmentattrib, (GLint *) value);
3478  } else {
3479  return -1;
3480  }
3481  } else
3482 #endif
3483  {
3484  void (APIENTRY *glGetIntegervFunc) (GLenum pname, GLint * params);
3485  glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
3486  if (glGetIntegervFunc) {
3487  glGetIntegervFunc(attrib, (GLint *) value);
3488  } else {
3489  return -1;
3490  }
3491  }
3492 
3493  glGetErrorFunc = SDL_GL_GetProcAddress("glGetError");
3494  if (!glGetErrorFunc) {
3495  return -1;
3496  }
3497 
3498  error = glGetErrorFunc();
3499  if (error != GL_NO_ERROR) {
3500  if (error == GL_INVALID_ENUM) {
3501  return SDL_SetError("OpenGL error: GL_INVALID_ENUM");
3502  } else if (error == GL_INVALID_VALUE) {
3503  return SDL_SetError("OpenGL error: GL_INVALID_VALUE");
3504  }
3505  return SDL_SetError("OpenGL error: %08X", error);
3506  }
3507  return 0;
3508 #else
3509  return SDL_Unsupported();
3510 #endif /* SDL_VIDEO_OPENGL */
3511 }
3512 
3515 {
3518 
3519  if (!(window->flags & SDL_WINDOW_OPENGL)) {
3520  SDL_SetError("The specified window isn't an OpenGL window");
3521  return NULL;
3522  }
3523 
3525 
3526  /* Creating a context is assumed to make it current in the SDL driver. */
3527  if (ctx) {
3529  _this->current_glctx = ctx;
3532  }
3533  return ctx;
3534 }
3535 
3536 int
3538 {
3539  int retval;
3540 
3541  if (window == SDL_GL_GetCurrentWindow() &&
3543  /* We're already current. */
3544  return 0;
3545  }
3546 
3547  if (!ctx) {
3548  window = NULL;
3549  } else {
3551 
3552  if (!(window->flags & SDL_WINDOW_OPENGL)) {
3553  return SDL_SetError("The specified window isn't an OpenGL window");
3554  }
3555  }
3556 
3558  if (retval == 0) {
3560  _this->current_glctx = ctx;
3563  }
3564  return retval;
3565 }
3566 
3567 SDL_Window *
3569 {
3570  if (!_this) {
3572  return NULL;
3573  }
3575 }
3576 
3579 {
3580  if (!_this) {
3582  return NULL;
3583  }
3585 }
3586 
3588 {
3590 
3591  if (_this->GL_GetDrawableSize) {
3593  } else {
3595  }
3596 }
3597 
3598 int
3600 {
3601  if (!_this) {
3602  return SDL_UninitializedVideo();
3603  } else if (SDL_GL_GetCurrentContext() == NULL) {
3604  return SDL_SetError("No OpenGL context has been made current");
3605  } else if (_this->GL_SetSwapInterval) {
3606  return _this->GL_SetSwapInterval(_this, interval);
3607  } else {
3608  return SDL_SetError("Setting the swap interval is not supported");
3609  }
3610 }
3611 
3612 int
3614 {
3615  if (!_this) {
3616  return 0;
3617  } else if (SDL_GL_GetCurrentContext() == NULL) {
3618  return 0;
3619  } else if (_this->GL_GetSwapInterval) {
3620  return _this->GL_GetSwapInterval(_this);
3621  } else {
3622  return 0;
3623  }
3624 }
3625 
3626 void
3628 {
3630 
3631  if (!(window->flags & SDL_WINDOW_OPENGL)) {
3632  SDL_SetError("The specified window isn't an OpenGL window");
3633  return;
3634  }
3635 
3636  if (SDL_GL_GetCurrentWindow() != window) {
3637  SDL_SetError("The specified window has not been made current");
3638  return;
3639  }
3640 
3642 }
3643 
3644 void
3646 {
3647  if (!_this || !context) {
3648  return;
3649  }
3650 
3651  if (SDL_GL_GetCurrentContext() == context) {
3653  }
3654 
3656 }
3657 
3658 #if 0 /* FIXME */
3659 /*
3660  * Utility function used by SDL_WM_SetIcon(); flags & 1 for color key, flags
3661  * & 2 for alpha channel.
3662  */
3663 static void
3664 CreateMaskFromColorKeyOrAlpha(SDL_Surface * icon, Uint8 * mask, int flags)
3665 {
3666  int x, y;
3667  Uint32 colorkey;
3668 #define SET_MASKBIT(icon, x, y, mask) \
3669  mask[(y*((icon->w+7)/8))+(x/8)] &= ~(0x01<<(7-(x%8)))
3670 
3671  colorkey = icon->format->colorkey;
3672  switch (icon->format->BytesPerPixel) {
3673  case 1:
3674  {
3675  Uint8 *pixels;
3676  for (y = 0; y < icon->h; ++y) {
3677  pixels = (Uint8 *) icon->pixels + y * icon->pitch;
3678  for (x = 0; x < icon->w; ++x) {
3679  if (*pixels++ == colorkey) {
3680  SET_MASKBIT(icon, x, y, mask);
3681  }
3682  }
3683  }
3684  }
3685  break;
3686 
3687  case 2:
3688  {
3689  Uint16 *pixels;
3690  for (y = 0; y < icon->h; ++y) {
3691  pixels = (Uint16 *) icon->pixels + y * icon->pitch / 2;
3692  for (x = 0; x < icon->w; ++x) {
3693  if ((flags & 1) && *pixels == colorkey) {
3694  SET_MASKBIT(icon, x, y, mask);
3695  } else if ((flags & 2)
3696  && (*pixels & icon->format->Amask) == 0) {
3697  SET_MASKBIT(icon, x, y, mask);
3698  }
3699  pixels++;
3700  }
3701  }
3702  }
3703  break;
3704 
3705  case 4:
3706  {
3707  Uint32 *pixels;
3708  for (y = 0; y < icon->h; ++y) {
3709  pixels = (Uint32 *) icon->pixels + y * icon->pitch / 4;
3710  for (x = 0; x < icon->w; ++x) {
3711  if ((flags & 1) && *pixels == colorkey) {
3712  SET_MASKBIT(icon, x, y, mask);
3713  } else if ((flags & 2)
3714  && (*pixels & icon->format->Amask) == 0) {
3715  SET_MASKBIT(icon, x, y, mask);
3716  }
3717  pixels++;
3718  }
3719  }
3720  }
3721  break;
3722  }
3723 }
3724 
3725 /*
3726  * Sets the window manager icon for the display window.
3727  */
3728 void
3729 SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask)
3730 {
3731  if (icon && _this->SetIcon) {
3732  /* Generate a mask if necessary, and create the icon! */
3733  if (mask == NULL) {
3734  int mask_len = icon->h * (icon->w + 7) / 8;
3735  int flags = 0;
3736  mask = (Uint8 *) SDL_malloc(mask_len);
3737  if (mask == NULL) {
3738  return;
3739  }
3740  SDL_memset(mask, ~0, mask_len);
3741  if (icon->flags & SDL_SRCCOLORKEY)
3742  flags |= 1;
3743  if (icon->flags & SDL_SRCALPHA)
3744  flags |= 2;
3745  if (flags) {
3746  CreateMaskFromColorKeyOrAlpha(icon, mask, flags);
3747  }
3748  _this->SetIcon(_this, icon, mask);
3749  SDL_free(mask);
3750  } else {
3751  _this->SetIcon(_this, icon, mask);
3752  }
3753  }
3754 }
3755 #endif
3756 
3757 SDL_bool
3759 {
3761 
3762  if (!info) {
3763  SDL_InvalidParamError("info");
3764  return SDL_FALSE;
3765  }
3766  info->subsystem = SDL_SYSWM_UNKNOWN;
3767 
3768  if (!_this->GetWindowWMInfo) {
3769  SDL_Unsupported();
3770  return SDL_FALSE;
3771  }
3772  return (_this->GetWindowWMInfo(_this, window, info));
3773 }
3774 
3775 void
3777 {
3778  SDL_Window *window;
3779 
3780  /* First, enable text events */
3783 
3784  /* Then show the on-screen keyboard, if any */
3786  if (window && _this && _this->ShowScreenKeyboard) {
3788  }
3789 
3790  /* Finally start the text input system */
3791  if (_this && _this->StartTextInput) {
3793  }
3794 }
3795 
3796 SDL_bool
3798 {
3800 }
3801 
3802 void
3804 {
3805  SDL_Window *window;
3806 
3807  /* Stop the text input system */
3808  if (_this && _this->StopTextInput) {
3810  }
3811 
3812  /* Hide the on-screen keyboard, if any */
3814  if (window && _this && _this->HideScreenKeyboard) {
3816  }
3817 
3818  /* Finally disable text events */
3821 }
3822 
3823 void
3825 {
3826  if (_this && _this->SetTextInputRect) {
3828  }
3829 }
3830 
3831 SDL_bool
3833 {
3836  }
3837  return SDL_FALSE;
3838 }
3839 
3840 SDL_bool
3842 {
3843  if (window && _this && _this->IsScreenKeyboardShown) {
3845  }
3846  return SDL_FALSE;
3847 }
3848 
3849 #if SDL_VIDEO_DRIVER_ANDROID
3851 #endif
3852 #if SDL_VIDEO_DRIVER_WINDOWS
3854 #endif
3855 #if SDL_VIDEO_DRIVER_WINRT
3856 #include "winrt/SDL_winrtmessagebox.h"
3857 #endif
3858 #if SDL_VIDEO_DRIVER_COCOA
3859 #include "cocoa/SDL_cocoamessagebox.h"
3860 #endif
3861 #if SDL_VIDEO_DRIVER_UIKIT
3862 #include "uikit/SDL_uikitmessagebox.h"
3863 #endif
3864 #if SDL_VIDEO_DRIVER_X11
3865 #include "x11/SDL_x11messagebox.h"
3866 #endif
3867 #if SDL_VIDEO_DRIVER_HAIKU
3868 #include "haiku/SDL_bmessagebox.h"
3869 #endif
3870 
3871 
3872 #if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_HAIKU
3874 {
3875  SDL_SysWMinfo info;
3876  SDL_Window *window = messageboxdata->window;
3877 
3878  if (!window) {
3879  return SDL_TRUE;
3880  }
3881 
3882  SDL_VERSION(&info.version);
3883  if (!SDL_GetWindowWMInfo(window, &info)) {
3884  return SDL_TRUE;
3885  } else {
3886  return (info.subsystem == drivertype);
3887  }
3888 }
3889 #endif
3890 
3891 int
3892 SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
3893 {
3894  int dummybutton;
3895  int retval = -1;
3896  SDL_bool relative_mode;
3897  int show_cursor_prev;
3898  SDL_bool mouse_captured;
3899  SDL_Window *current_window;
3900 
3901  if (!messageboxdata) {
3902  return SDL_InvalidParamError("messageboxdata");
3903  } else if (messageboxdata->numbuttons < 0) {
3904  return SDL_SetError("Invalid number of buttons");
3905  }
3906 
3907  current_window = SDL_GetKeyboardFocus();
3908  mouse_captured = current_window && ((SDL_GetWindowFlags(current_window) & SDL_WINDOW_MOUSE_CAPTURE) != 0);
3909  relative_mode = SDL_GetRelativeMouseMode();
3912  show_cursor_prev = SDL_ShowCursor(1);
3914 
3915  if (!buttonid) {
3916  buttonid = &dummybutton;
3917  }
3918 
3919  if (_this && _this->ShowMessageBox) {
3920  retval = _this->ShowMessageBox(_this, messageboxdata, buttonid);
3921  }
3922 
3923  /* It's completely fine to call this function before video is initialized */
3924 #if SDL_VIDEO_DRIVER_ANDROID
3925  if (retval == -1 &&
3926  Android_ShowMessageBox(messageboxdata, buttonid) == 0) {
3927  retval = 0;
3928  }
3929 #endif
3930 #if SDL_VIDEO_DRIVER_WINDOWS
3931  if (retval == -1 &&
3933  WIN_ShowMessageBox(messageboxdata, buttonid) == 0) {
3934  retval = 0;
3935  }
3936 #endif
3937 #if SDL_VIDEO_DRIVER_WINRT
3938  if (retval == -1 &&
3939  SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WINRT) &&
3940  WINRT_ShowMessageBox(messageboxdata, buttonid) == 0) {
3941  retval = 0;
3942  }
3943 #endif
3944 #if SDL_VIDEO_DRIVER_COCOA
3945  if (retval == -1 &&
3946  SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_COCOA) &&
3947  Cocoa_ShowMessageBox(messageboxdata, buttonid) == 0) {
3948  retval = 0;
3949  }
3950 #endif
3951 #if SDL_VIDEO_DRIVER_UIKIT
3952  if (retval == -1 &&
3953  SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_UIKIT) &&
3954  UIKit_ShowMessageBox(messageboxdata, buttonid) == 0) {
3955  retval = 0;
3956  }
3957 #endif
3958 #if SDL_VIDEO_DRIVER_X11
3959  if (retval == -1 &&
3960  SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_X11) &&
3961  X11_ShowMessageBox(messageboxdata, buttonid) == 0) {
3962  retval = 0;
3963  }
3964 #endif
3965 #if SDL_VIDEO_DRIVER_HAIKU
3966  if (retval == -1 &&
3967  SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_HAIKU) &&
3968  HAIKU_ShowMessageBox(messageboxdata, buttonid) == 0) {
3969  retval = 0;
3970  }
3971 #endif
3972  if (retval == -1) {
3973  SDL_SetError("No message system available");
3974  }
3975 
3976  if (current_window) {
3977  SDL_RaiseWindow(current_window);
3978  if (mouse_captured) {
3980  }
3981  }
3982 
3983  SDL_ShowCursor(show_cursor_prev);
3984  SDL_SetRelativeMouseMode(relative_mode);
3985 
3986  return retval;
3987 }
3988 
3989 int
3990 SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window)
3991 {
3992 #ifdef __EMSCRIPTEN__
3993  /* !!! FIXME: propose a browser API for this, get this #ifdef out of here? */
3994  /* Web browsers don't (currently) have an API for a custom message box
3995  that can block, but for the most common case (SDL_ShowSimpleMessageBox),
3996  we can use the standard Javascript alert() function. */
3997  EM_ASM_({
3998  alert(UTF8ToString($0) + "\n\n" + UTF8ToString($1));
3999  }, title, message);
4000  return 0;
4001 #else
4004 
4005  SDL_zero(data);
4006  data.flags = flags;
4007  data.title = title;
4008  data.message = message;
4009  data.numbuttons = 1;
4010  data.buttons = &button;
4011  data.window = window;
4012 
4013  SDL_zero(button);
4016  button.text = "OK";
4017 
4018  return SDL_ShowMessageBox(&data, NULL);
4019 #endif
4020 }
4021 
4022 SDL_bool
4024 {
4026 }
4027 
4028 int
4030 {
4032 
4033  if (!_this->SetWindowHitTest) {
4034  return SDL_Unsupported();
4035  } else if (_this->SetWindowHitTest(window, callback != NULL) == -1) {
4036  return -1;
4037  }
4038 
4039  window->hit_test = callback;
4040  window->hit_test_data = userdata;
4041 
4042  return 0;
4043 }
4044 
4045 float
4046 SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches)
4047 {
4048  float den2 = hinches * hinches + vinches * vinches;
4049  if (den2 <= 0.0f) {
4050  return 0.0f;
4051  }
4052 
4053  return (float)(SDL_sqrt((double)hpix * (double)hpix + (double)vpix * (double)vpix) /
4054  SDL_sqrt((double)den2));
4055 }
4056 
4057 /*
4058  * Functions used by iOS application delegates
4059  */
4061 {
4063 }
4064 
4066 {
4068 }
4069 
4071 {
4072  if (_this) {
4073  SDL_Window *window;
4074  for (window = _this->windows; window != NULL; window = window->next) {
4077  }
4078  }
4080 }
4081 
4083 {
4085 }
4086 
4088 {
4090 }
4091 
4093 {
4095 
4096  if (_this) {
4097  SDL_Window *window;
4098  for (window = _this->windows; window != NULL; window = window->next) {
4101  }
4102  }
4103 }
4104 
4105 #define NOT_A_VULKAN_WINDOW "The specified window isn't a Vulkan window"
4108 {
4109  int retval;
4110  if (!_this) {
4112  return -1;
4113  }
4116  return SDL_SetError("Vulkan loader library already loaded");
4117  }
4118  retval = 0;
4119  } else {
4120  if (!_this->Vulkan_LoadLibrary) {
4121  return SDL_SetError("Vulkan support is either not configured in SDL "
4122  "or not available in current SDL video driver "
4123  "(%s) or platform", _this->name);
4124  }
4126  }
4127  if (retval == 0) {
4129  }
4130  return retval;
4131 }
4132 
4134 {
4135  if (!_this) {
4137  return NULL;
4138  }
4140  SDL_SetError("No Vulkan loader has been loaded");
4141  return NULL;
4142  }
4144 }
4145 
4147 {
4148  if (!_this) {
4150  return;
4151  }
4152  if (_this->vulkan_config.loader_loaded > 0) {
4153  if (--_this->vulkan_config.loader_loaded > 0) {
4154  return;
4155  }
4156  if (_this->Vulkan_UnloadLibrary) {
4158  }
4159  }
4160 }
4161 
4163 {
4164  if (window) {
4166 
4167  if (!(window->flags & SDL_WINDOW_VULKAN))
4168  {
4170  return SDL_FALSE;
4171  }
4172  }
4173 
4174  if (!count) {
4175  SDL_InvalidParamError("count");
4176  return SDL_FALSE;
4177  }
4178 
4180 }
4181 
4183  VkInstance instance,
4184  VkSurfaceKHR *surface)
4185 {
4187 
4188  if (!(window->flags & SDL_WINDOW_VULKAN)) {
4190  return SDL_FALSE;
4191  }
4192 
4193  if (!instance) {
4194  SDL_InvalidParamError("instance");
4195  return SDL_FALSE;
4196  }
4197 
4198  if (!surface) {
4199  SDL_InvalidParamError("surface");
4200  return SDL_FALSE;
4201  }
4202 
4203  return _this->Vulkan_CreateSurface(_this, window, instance, surface);
4204 }
4205 
4207 {
4209 
4212  } else {
4214  }
4215 }
4216 
4219 {
4221 
4222  if (_this->Metal_CreateView) {
4223  return _this->Metal_CreateView(_this, window);
4224  } else {
4225  SDL_SetError("Metal is not supported.");
4226  return NULL;
4227  }
4228 }
4229 
4230 void
4232 {
4233  if (_this && view && _this->Metal_DestroyView) {
4234  _this->Metal_DestroyView(_this, view);
4235  }
4236 }
4237 
4238 /* vi: set ts=4 sw=4 expandtab: */
SDL_VideoDevice::CreateSDLWindow
int(* CreateSDLWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:212
SDL_OnWindowLeave
void SDL_OnWindowLeave(SDL_Window *window)
Definition: SDL_video.c:2652
SDL.h
SDL_SYSWM_UNKNOWN
@ SDL_SYSWM_UNKNOWN
Definition: SDL_syswm.h:124
SDL_GetMouse
SDL_Mouse * SDL_GetMouse(void)
Definition: SDL_mouse.c:170
SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:418
SDL_WINDOW_MOUSE_CAPTURE
@ SDL_WINDOW_MOUSE_CAPTURE
Definition: SDL_video.h:115
SDL_HINT_VIDEO_EXTERNAL_CONTEXT
#define SDL_HINT_VIDEO_EXTERNAL_CONTEXT
A variable controlling whether the graphics context is externally managed.
Definition: SDL_hints.h:180
format
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: SDL_opengl.h:1572
SDL_GetMouseState
#define SDL_GetMouseState
Definition: SDL_dynapi_overrides.h:246
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:179
SDL_Point::x
int x
Definition: SDL_rect.h:50
SDL_GetWindowTitle
const char * SDL_GetWindowTitle(SDL_Window *window)
Get the title of a window, in UTF-8 format.
Definition: SDL_video.c:1787
SDL_memset
#define SDL_memset
Definition: SDL_dynapi_overrides.h:386
GL_BLUE_BITS
#define GL_BLUE_BITS
Definition: SDL_opengl.h:515
SDL_CreateWindowFramebuffer
static SDL_Surface * SDL_CreateWindowFramebuffer(SDL_Window *window)
Definition: SDL_video.c:2306
SDL_BITSPERPIXEL
#define SDL_BITSPERPIXEL(X)
Definition: SDL_pixels.h:127
SDL_GetWindowMinimumSize
void SDL_GetWindowMinimumSize(SDL_Window *window, int *min_w, int *min_h)
Get the minimum size of a window's client area.
Definition: SDL_video.c:2120
GL_EXTENSIONS
#define GL_EXTENSIONS
Definition: SDL_opengl.h:716
SDL_VideoDevice::SetWindowPosition
void(* SetWindowPosition)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:216
SDL_VideoDevice::Metal_DestroyView
void(* Metal_DestroyView)(_THIS, SDL_MetalView view)
Definition: SDL_sysvideo.h:283
SDL_RenderPresent
#define SDL_RenderPresent
Definition: SDL_dynapi_overrides.h:346
SDL_VideoDisplay::display_modes
SDL_DisplayMode * display_modes
Definition: SDL_sysvideo.h:131
SDL_GetWindowBordersSize
int SDL_GetWindowBordersSize(SDL_Window *window, int *top, int *left, int *bottom, int *right)
Get the size of a window's borders (decorations) around the client area.
Definition: SDL_video.c:2067
SDL_DisableScreenSaver
void SDL_DisableScreenSaver()
Prevent the screen from being blanked by a screensaver.
Definition: SDL_video.c:2834
SDL_Vulkan_GetInstanceExtensions
SDL_bool SDL_Vulkan_GetInstanceExtensions(SDL_Window *window, unsigned *count, const char **names)
Definition: SDL_video.c:4162
WINRT_bootstrap
VideoBootStrap WINRT_bootstrap
SDL_DisplayMode::format
Uint32 format
Definition: SDL_video.h:55
SDL_WINDOW_ALLOW_HIGHDPI
@ SDL_WINDOW_ALLOW_HIGHDPI
Definition: SDL_video.h:112
SDL_TLSSet
#define SDL_TLSSet
Definition: SDL_dynapi_overrides.h:482
GL_STENCIL_BITS
#define GL_STENCIL_BITS
Definition: SDL_opengl.h:474
SDL_GL_ResetAttributes
void SDL_GL_ResetAttributes()
Reset all previously set OpenGL context attributes to their default values.
Definition: SDL_video.c:3090
SDL_androidmessagebox.h
SDL_WindowTextureData::renderer
SDL_Renderer * renderer
Definition: SDL_video.c:161
SDL_VideoDevice::clipboard_text
char * clipboard_text
Definition: SDL_sysvideo.h:329
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:323
SDL_APP_TERMINATING
@ SDL_APP_TERMINATING
Definition: SDL_events.h:63
SDL_OnApplicationDidReceiveMemoryWarning
void SDL_OnApplicationDidReceiveMemoryWarning(void)
Definition: SDL_video.c:4065
SDL_VideoDevice::SuspendScreenSaver
void(* SuspendScreenSaver)(_THIS)
Definition: SDL_sysvideo.h:292
SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
@ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
Definition: SDL_messagebox.h:52
right
GLdouble GLdouble right
Definition: SDL_opengl_glext.h:6106
SDL_SYSWM_WINRT
@ SDL_SYSWM_WINRT
Definition: SDL_syswm.h:132
SDL_GL_MULTISAMPLESAMPLES
@ SDL_GL_MULTISAMPLESAMPLES
Definition: SDL_video.h:213
SDL_VideoDisplay::name
char * name
Definition: SDL_sysvideo.h:128
SDL_VideoDevice::vkGetInstanceProcAddr
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr
Definition: SDL_sysvideo.h:380
SDL_APP_DIDENTERBACKGROUND
@ SDL_APP_DIDENTERBACKGROUND
Definition: SDL_events.h:75
SDL_APP_DIDENTERFOREGROUND
@ SDL_APP_DIDENTERFOREGROUND
Definition: SDL_events.h:83
SDL_SYSWM_HAIKU
@ SDL_SYSWM_HAIKU
Definition: SDL_syswm.h:136
target
GLenum target
Definition: SDL_opengl_glext.h:1554
SDL_VideoDevice::Vulkan_LoadLibrary
int(* Vulkan_LoadLibrary)(_THIS, const char *path)
Definition: SDL_sysvideo.h:272
mask
GLenum GLint GLuint mask
Definition: SDL_opengl_glext.h:660
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:191
SDL_GetFocusWindow
SDL_Window * SDL_GetFocusWindow(void)
Definition: SDL_video.c:2717
SDL_Surface
A collection of pixels used in software blitting.
Definition: SDL_surface.h:71
SDL_GL_CONTEXT_EGL
@ SDL_GL_CONTEXT_EGL
Definition: SDL_video.h:218
SDL_ConvertSurfaceFormat
#define SDL_ConvertSurfaceFormat
Definition: SDL_dynapi_overrides.h:464
SDL_RenderSetViewport
#define SDL_RenderSetViewport
Definition: SDL_dynapi_overrides.h:324
SDL_VideoDevice::current_glwin_tls
SDL_TLSID current_glwin_tls
Definition: SDL_sysvideo.h:373
SDL_WINDOW_MINIMIZED
@ SDL_WINDOW_MINIMIZED
Definition: SDL_video.h:105
SDL_VideoDevice::SetWindowModalFor
int(* SetWindowModalFor)(_THIS, SDL_Window *modal_window, SDL_Window *parent_window)
Definition: SDL_sysvideo.h:222
SDL_VideoQuit
void SDL_VideoQuit(void)
Shuts down the video subsystem.
Definition: SDL_video.c:2849
SDL_VideoDevice::retained_backing
int retained_backing
Definition: SDL_sysvideo.h:360
SDL_VideoDevice::OnWindowEnter
void(* OnWindowEnter)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:240
SDL_ShowWindow
void SDL_ShowWindow(SDL_Window *window)
Show a window.
Definition: SDL_video.c:2174
SDL_PIXELFORMAT_RGB888
@ SDL_PIXELFORMAT_RGB888
Definition: SDL_pixels.h:239
SDL_IsScreenKeyboardShown
SDL_bool SDL_IsScreenKeyboardShown(SDL_Window *window)
Returns whether the screen keyboard is shown for given window.
Definition: SDL_video.c:3841
SDL_opengles2.h
GL_ALPHA_BITS
#define GL_ALPHA_BITS
Definition: SDL_opengl.h:512
VideoBootStrap::name
const char * name
Definition: SDL_sysvideo.h:407
SDL_OnWindowFocusGained
void SDL_OnWindowFocusGained(SDL_Window *window)
Definition: SDL_video.c:2657
NULL
#define NULL
Definition: begin_code.h:167
surface
EGLSurface surface
Definition: eglext.h:248
SDL_WindowUserData::data
void * data
Definition: SDL_sysvideo.h:69
SDL_VideoDevice::buffer_size
int buffer_size
Definition: SDL_sysvideo.h:340
SDL_opengl.h
SDL_GL_LoadLibrary
int SDL_GL_LoadLibrary(const char *path)
Dynamically load an OpenGL library.
Definition: SDL_video.c:2899
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1112
enable
GLboolean enable
Definition: SDL_opengl_glext.h:4999
SDL_VideoDevice::multisamplesamples
int multisamplesamples
Definition: SDL_sysvideo.h:349
SDL_HINT_VIDEO_HIGHDPI_DISABLED
#define SDL_HINT_VIDEO_HIGHDPI_DISABLED
If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS)
Definition: SDL_hints.h:736
message
GLuint GLsizei const GLchar * message
Definition: SDL_opengl_glext.h:2486
SDL_VideoDisplay::device
SDL_VideoDevice * device
Definition: SDL_sysvideo.h:138
SDL_GL_DEPTH_SIZE
@ SDL_GL_DEPTH_SIZE
Definition: SDL_video.h:205
SDL_GL_GetDrawableSize
void SDL_GL_GetDrawableSize(SDL_Window *window, int *w, int *h)
Get the size of a window's underlying drawable in pixels (for use with glViewport).
Definition: SDL_video.c:3587
SDL_WINDOWEVENT_FOCUS_LOST
@ SDL_WINDOWEVENT_FOCUS_LOST
Definition: SDL_video.h:165
SDL_Surface::pixels
void * pixels
Definition: SDL_surface.h:76
SDL_HINT_VIDEO_ALLOW_SCREENSAVER
#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER
A variable controlling whether the screensaver is enabled.
Definition: SDL_hints.h:165
X11_bootstrap
VideoBootStrap X11_bootstrap
SDL_GetNumRenderDrivers
#define SDL_GetNumRenderDrivers
Definition: SDL_dynapi_overrides.h:298
SDL_IsScreenSaverEnabled
SDL_bool SDL_IsScreenSaverEnabled()
Returns whether the screensaver is currently enabled (default off).
Definition: SDL_video.c:2810
SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS
#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS
Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
Definition: SDL_hints.h:364
ParseDisplayUsableBoundsHint
static int ParseDisplayUsableBoundsHint(SDL_Rect *rect)
Definition: SDL_video.c:710
SDL_qsort
#define SDL_qsort
Definition: SDL_dynapi_overrides.h:380
SDL_VideoDevice::blue_size
int blue_size
Definition: SDL_sysvideo.h:337
mode
GLenum mode
Definition: SDL_opengl_glext.h:1125
SDL_VERSION
#define SDL_VERSION(x)
Macro to determine SDL version program was compiled against.
Definition: SDL_version.h:79
GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE
Definition: SDL_opengl_glext.h:1000
SDL_SetWindowSize
void SDL_SetWindowSize(SDL_Window *window, int w, int h)
Set the size of a window's client area.
Definition: SDL_video.c:2007
SDL_SetWindowInputFocus
int SDL_SetWindowInputFocus(SDL_Window *window)
Explicitly sets input focus to the window.
Definition: SDL_video.c:2449
SDL_SysWMinfo
Definition: SDL_syswm.h:202
SDL_WindowUserData
Definition: SDL_sysvideo.h:67
SDL_PIXELLAYOUT
#define SDL_PIXELLAYOUT(X)
Definition: SDL_pixels.h:126
SDL_VideoDevice::accum_alpha_size
int accum_alpha_size
Definition: SDL_sysvideo.h:346
SDL_Surface::w
int w
Definition: SDL_surface.h:74
SDL_INIT_EVENTS
#define SDL_INIT_EVENTS
Definition: SDL.h:84
SDL_VideoDevice::accum_green_size
int accum_green_size
Definition: SDL_sysvideo.h:344
GL_VENDOR
#define GL_VENDOR
Definition: SDL_opengl.h:713
SDL_VideoDevice::SetTextInputRect
void(* SetTextInputRect)(_THIS, SDL_Rect *rect)
Definition: SDL_sysvideo.h:297
GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE
Definition: SDL_opengl_glext.h:998
SDL_VideoDevice::grabbed_window
SDL_Window * grabbed_window
Definition: SDL_sysvideo.h:326
attachment
GLenum attachment
Definition: SDL_opengl_glext.h:1181
count
GLuint GLuint GLsizei count
Definition: SDL_opengl.h:1571
SDL_GetWindowFromID
SDL_Window * SDL_GetWindowFromID(Uint32 id)
Get a window from a stored ID, or NULL if it doesn't exist.
Definition: SDL_video.c:1746
SDL_SetWindowGrab
void SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabbed)
Set a window's input grab mode.
Definition: SDL_video.c:2572
GL_BACK_LEFT
#define GL_BACK_LEFT
Definition: SDL_opengl.h:499
SDL_GetDisplayMode
int SDL_GetDisplayMode(int displayIndex, int index, SDL_DisplayMode *mode)
Fill in information about a specific display mode.
Definition: SDL_video.c:827
GL_DEPTH_BITS
#define GL_DEPTH_BITS
Definition: SDL_opengl.h:328
SDL_OnApplicationWillEnterForeground
void SDL_OnApplicationWillEnterForeground(void)
Definition: SDL_video.c:4087
SDL_VideoDevice::vulkan_config
struct SDL_VideoDevice::@256 vulkan_config
SDL_TicksInit
void SDL_TicksInit(void)
SDL_VideoDevice::driver_path
char driver_path[256]
Definition: SDL_sysvideo.h:362
SDL_VideoDevice::current_glctx_tls
SDL_TLSID current_glctx_tls
Definition: SDL_sysvideo.h:374
SDL_VideoDevice::major_version
int major_version
Definition: SDL_sysvideo.h:351
SDL_WINDOW_FULLSCREEN
@ SDL_WINDOW_FULLSCREEN
Definition: SDL_video.h:99
SDL_VideoDevice::SetWindowTitle
void(* SetWindowTitle)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:214
SDL_SYSWM_TYPE
SDL_SYSWM_TYPE
Definition: SDL_syswm.h:123
SDL_GL_BUFFER_SIZE
@ SDL_GL_BUFFER_SIZE
Definition: SDL_video.h:203
SDL_VideoDevice::UpdateWindowFramebuffer
int(* UpdateWindowFramebuffer)(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
Definition: SDL_sysvideo.h:238
SDL_WINDOW_OPENGL
@ SDL_WINDOW_OPENGL
Definition: SDL_video.h:100
SDL_VideoDevice::accum_blue_size
int accum_blue_size
Definition: SDL_sysvideo.h:345
GL_DOUBLEBUFFER
#define GL_DOUBLEBUFFER
Definition: SDL_opengl.h:521
SDL_GetWindowOpacity
int SDL_GetWindowOpacity(SDL_Window *window, float *out_opacity)
Get the opacity of a window.
Definition: SDL_video.c:2424
SDL_realloc
#define SDL_realloc
Definition: SDL_dynapi_overrides.h:376
SDL_WINDOWEVENT_RESIZED
@ SDL_WINDOWEVENT_RESIZED
Definition: SDL_video.h:154
top
GLdouble GLdouble GLdouble GLdouble top
Definition: SDL_opengl_glext.h:6106
SDL_InvalidParamError
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
SDL_GL_SetSwapInterval
int SDL_GL_SetSwapInterval(int interval)
Set the swap interval for the current OpenGL context.
Definition: SDL_video.c:3599
Emscripten_bootstrap
VideoBootStrap Emscripten_bootstrap
GL_STENCIL
#define GL_STENCIL
Definition: SDL_opengl.h:526
SDL_VideoDevice::Vulkan_UnloadLibrary
void(* Vulkan_UnloadLibrary)(_THIS)
Definition: SDL_sysvideo.h:273
SDL_RestoreMousePosition
static void SDL_RestoreMousePosition(SDL_Window *window)
Definition: SDL_video.c:1189
SDL_HideWindow
void SDL_HideWindow(SDL_Window *window)
Hide a window.
Definition: SDL_video.c:2189
SDL_TEXTEDITING
@ SDL_TEXTEDITING
Definition: SDL_events.h:98
SDL_VideoDevice::window_magic
Uint8 window_magic
Definition: SDL_sysvideo.h:327
SDL_QuitSubSystem
#define SDL_QuitSubSystem
Definition: SDL_dynapi_overrides.h:56
SDL_VideoDevice::Vulkan_GetDrawableSize
void(* Vulkan_GetDrawableSize)(_THIS, SDL_Window *window, int *w, int *h)
Definition: SDL_sysvideo.h:276
SDL_Window::is_destroying
SDL_bool is_destroying
Definition: SDL_sysvideo.h:102
SDL_GL_CONTEXT_PROFILE_CORE
@ SDL_GL_CONTEXT_PROFILE_CORE
Definition: SDL_video.h:230
red
const GLubyte GLuint red
Definition: SDL_glfuncs.h:80
SDL_SetWindowMinimumSize
void SDL_SetWindowMinimumSize(SDL_Window *window, int min_w, int min_h)
Set the minimum size of a window's client area.
Definition: SDL_video.c:2089
SDL_WINDOW_FULLSCREEN_DESKTOP
@ SDL_WINDOW_FULLSCREEN_DESKTOP
Definition: SDL_video.h:110
SDL_GL_RETAINED_BACKING
@ SDL_GL_RETAINED_BACKING
Definition: SDL_video.h:215
NOT_A_VULKAN_WINDOW
#define NOT_A_VULKAN_WINDOW
Definition: SDL_video.c:4105
params
const GLfloat * params
Definition: SDL_opengl_glext.h:374
SDL_DONTFREE
#define SDL_DONTFREE
Definition: SDL_surface.h:55
COCOA_bootstrap
VideoBootStrap COCOA_bootstrap
pname
GLenum pname
Definition: SDL_opengl_glext.h:533
SDL_SetKeyboardFocus
void SDL_SetKeyboardFocus(SDL_Window *window)
Definition: SDL_keyboard.c:630
SDL_GetWindowPosition
void SDL_GetWindowPosition(SDL_Window *window, int *x, int *y)
Get the position of a window.
Definition: SDL_video.c:1929
GL_FRAMEBUFFER
#define GL_FRAMEBUFFER
Definition: SDL_opengl_glext.h:1054
SDL_GL_CONTEXT_PROFILE_MASK
@ SDL_GL_CONTEXT_PROFILE_MASK
Definition: SDL_video.h:220
GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE
Definition: SDL_opengl_glext.h:997
SDL_itoa
#define SDL_itoa
Definition: SDL_dynapi_overrides.h:404
SDL_WINDOW_FOREIGN
@ SDL_WINDOW_FOREIGN
Definition: SDL_video.h:111
unused
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF base if bpp PF set rept prefetch_distance PF set OFFSET endr endif endm macro preload_leading_step2 base if bpp ifc DST PF PF else if bpp lsl PF PF lsl PF PF lsl PF PF PF else PF lsl PF lsl PF lsl PF endif SIZE macro preload_middle scratch_holds_offset if bpp if else PF PF endif endif endif endm macro preload_trailing base if bpp if bpp *pix_per_block PF PF lsl PF PF PF PF PF else PF lsl PF lsl PF PF PF PF PF base if bpp if narrow_case &&bpp<=dst_w_bpp) PF bic, WK0, base, #31 PF pld,[WK0] PF add, WK1, base, X, LSL #bpp_shift PF sub, WK1, WK1, #1 PF bic, WK1, WK1, #31 PF cmp, WK1, WK0 PF beq, 90f PF pld,[WK1]90:.else PF bic, WK0, base, #31 PF pld,[WK0] PF add, WK1, base, X, lsl #bpp_shift PF sub, WK1, WK1, #1 PF bic, WK1, WK1, #31 PF cmp, WK1, WK0 PF beq, 92f91:PF add, WK0, WK0, #32 PF cmp, WK0, WK1 PF pld,[WK0] PF bne, 91b92:.endif .endif.endm.macro conditional_process1_helper cond, process_head, process_tail, numbytes, firstreg, unaligned_src, unaligned_mask, decrementx process_head cond, numbytes, firstreg, unaligned_src, unaligned_mask, 0 .if decrementx sub &cond X, X, #8 *numbytes/dst_w_bpp .endif process_tail cond, numbytes, firstreg .if !((flags) &FLAG_PROCESS_DOES_STORE) pixst cond, numbytes, firstreg, DST .endif.endm.macro conditional_process1 cond, process_head, process_tail, numbytes, firstreg, unaligned_src, unaligned_mask, decrementx .if(flags) &FLAG_BRANCH_OVER .ifc cond, mi bpl 100f .endif .ifc cond, cs bcc 100f .endif .ifc cond, ne beq 100f .endif conditional_process1_helper, process_head, process_tail, numbytes, firstreg, unaligned_src, unaligned_mask, decrementx100:.else conditional_process1_helper cond, process_head, process_tail, numbytes, firstreg, unaligned_src, unaligned_mask, decrementx .endif.endm.macro conditional_process2 test, cond1, cond2, process_head, process_tail, numbytes1, numbytes2, firstreg1, firstreg2, unaligned_src, unaligned_mask, decrementx .if(flags) &(FLAG_DST_READWRITE|FLAG_BRANCH_OVER|FLAG_PROCESS_CORRUPTS_PSR|FLAG_PROCESS_DOES_STORE) test conditional_process1 cond1, process_head, process_tail, numbytes1, firstreg1, unaligned_src, unaligned_mask, decrementx .if(flags) &FLAG_PROCESS_CORRUPTS_PSR test .endif conditional_process1 cond2, process_head, process_tail, numbytes2, firstreg2, unaligned_src, unaligned_mask, decrementx .else test process_head cond1, numbytes1, firstreg1, unaligned_src, unaligned_mask, 0 process_head cond2, numbytes2, firstreg2, unaligned_src, unaligned_mask, 0 .if decrementx sub &cond1 X, X, #8 *numbytes1/dst_w_bpp sub &cond2 X, X, #8 *numbytes2/dst_w_bpp .endif process_tail cond1, numbytes1, firstreg1 process_tail cond2, numbytes2, firstreg2 pixst cond1, numbytes1, firstreg1, DST pixst cond2, numbytes2, firstreg2, DST .endif.endm.macro test_bits_1_0_ptr .if(flags) &FLAG_PROCESS_CORRUPTS_WK0 movs SCRATCH, X, lsl #32-1 .else movs SCRATCH, WK0, lsl #32-1 .endif.endm.macro test_bits_3_2_ptr .if(flags) &FLAG_PROCESS_CORRUPTS_WK0 movs SCRATCH, X, lsl #32-3 .else movs SCRATCH, WK0, lsl #32-3 .endif.endm.macro leading_15bytes process_head, process_tail .set DECREMENT_X, 1 .if(flags) &FLAG_PROCESS_CORRUPTS_WK0 .set DECREMENT_X, 0 sub X, X, WK0, lsr #dst_bpp_shift str X,[sp, #LINE_SAVED_REG_COUNT *4] mov X, WK0 .endif .if dst_w_bpp==8 conditional_process2 test_bits_1_0_ptr, mi, cs, process_head, process_tail, 1, 2, 1, 2, 1, 1, DECREMENT_X .elseif dst_w_bpp==16 test_bits_1_0_ptr conditional_process1 cs, process_head, process_tail, 2, 2, 1, 1, DECREMENT_X .endif conditional_process2 test_bits_3_2_ptr, mi, cs, process_head, process_tail, 4, 8, 1, 2, 1, 1, DECREMENT_X .if(flags) &FLAG_PROCESS_CORRUPTS_WK0 ldr X,[sp, #LINE_SAVED_REG_COUNT *4] .endif.endm.macro test_bits_3_2_pix movs SCRATCH, X, lsl #dst_bpp_shift+32-3.endm.macro test_bits_1_0_pix .if dst_w_bpp==8 movs SCRATCH, X, lsl #dst_bpp_shift+32-1 .else movs SCRATCH, X, lsr #1 .endif.endm.macro trailing_15bytes process_head, process_tail, unaligned_src, unaligned_mask conditional_process2 test_bits_3_2_pix, cs, mi, process_head, process_tail, 8, 4, 0, 2, unaligned_src, unaligned_mask, 0 .if dst_w_bpp==16 test_bits_1_0_pix conditional_process1 cs, process_head, process_tail, 2, 0, unaligned_src, unaligned_mask, 0 .elseif dst_w_bpp==8 conditional_process2 test_bits_1_0_pix, cs, mi, process_head, process_tail, 2, 1, 0, 1, unaligned_src, unaligned_mask, 0 .endif.endm.macro wide_case_inner_loop process_head, process_tail, unaligned_src, unaligned_mask, dst_alignment110:.set SUBBLOCK, 0 .rept pix_per_block *dst_w_bpp/128 process_head, 16, 0, unaligned_src, unaligned_mask, 1 .if(src_bpp > 0) &&(mask_bpp==0) &&((flags) &FLAG_PROCESS_PRESERVES_SCRATCH) preload_middle src_bpp, SRC, 1 .elseif(src_bpp==0) &&(mask_bpp > 0) &&((flags) &FLAG_PROCESS_PRESERVES_SCRATCH) preload_middle mask_bpp, MASK, 1 .else preload_middle src_bpp, SRC, 0 preload_middle mask_bpp, MASK, 0 .endif .if(dst_r_bpp > 0) &&((SUBBLOCK % 2)==0) &&(((flags) &FLAG_NO_PRELOAD_DST)==0) PF pld,[DST, #32 *prefetch_distance - dst_alignment] .endif process_tail, 16, 0 .if !((flags) &FLAG_PROCESS_DOES_STORE) pixst, 16, 0, DST .endif .set SUBBLOCK, SUBBLOCK+1 .endr subs X, X, #pix_per_block bhs 110b.endm.macro wide_case_inner_loop_and_trailing_pixels process_head, process_tail, process_inner_loop, exit_label, unaligned_src, unaligned_mask .if dst_r_bpp > tst bne process_inner_loop DST_PRELOAD_BIAS endif preload_trailing SRC preload_trailing MASK DST endif add medium_case_inner_loop_and_trailing_pixels unaligned_mask endm macro medium_case_inner_loop_and_trailing_pixels unused
Definition: pixman-arm-simd-asm.h:487
SDL_windowsmessagebox.h
SDL_VideoDevice::GetWindowWMInfo
SDL_bool(* GetWindowWMInfo)(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
Definition: SDL_sysvideo.h:249
callback
static Uint32 callback(Uint32 interval, void *param)
Definition: testtimer.c:34
SDL_GL_DeleteContext
void SDL_GL_DeleteContext(SDL_GLContext context)
Delete an OpenGL context.
Definition: SDL_video.c:3645
SDL_UpdateWindowSurfaceRects
int SDL_UpdateWindowSurfaceRects(SDL_Window *window, const SDL_Rect *rects, int numrects)
Copy a number of rectangles on the window surface to the screen.
Definition: SDL_video.c:2363
SDL_CreateWindowFrom
SDL_Window * SDL_CreateWindowFrom(const void *data)
Create an SDL window from an existing native window.
Definition: SDL_video.c:1594
SDL_VideoDevice::GetWindowBordersSize
int(* GetWindowBordersSize)(_THIS, SDL_Window *window, int *top, int *left, int *bottom, int *right)
Definition: SDL_sysvideo.h:220
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
SDL_ENABLE
#define SDL_ENABLE
Definition: SDL_events.h:760
SDL_VideoDevice::profile_mask
int profile_mask
Definition: SDL_sysvideo.h:354
SDL_GL_ALPHA_SIZE
@ SDL_GL_ALPHA_SIZE
Definition: SDL_video.h:202
SDL_WINDOWPOS_ISCENTERED
#define SDL_WINDOWPOS_ISCENTERED(X)
Definition: SDL_video.h:139
SDL_HitTest
SDL_HitTestResult(* SDL_HitTest)(SDL_Window *win, const SDL_Point *area, void *data)
Callback used for hit-testing.
Definition: SDL_video.h:1038
path
GLsizei const GLchar *const * path
Definition: SDL_opengl_glext.h:3733
SDL_WINDOW_MAXIMIZED
@ SDL_WINDOW_MAXIMIZED
Definition: SDL_video.h:106
SDL_GetDesktopDisplayMode
int SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode *mode)
Fill in information about the desktop display mode.
Definition: SDL_video.c:845
SDL_SetWindowTitle
void SDL_SetWindowTitle(SDL_Window *window, const char *title)
Set the title of a window, in UTF-8 format.
Definition: SDL_video.c:1770
bottom
GLint GLint bottom
Definition: SDL_opengl_glext.h:1952
SDL_GL_CONTEXT_RESET_NO_NOTIFICATION
@ SDL_GL_CONTEXT_RESET_NO_NOTIFICATION
Definition: SDL_video.h:251
SDL_VideoDisplay::desktop_mode
SDL_DisplayMode desktop_mode
Definition: SDL_sysvideo.h:132
SDL_VideoDevice::depth_size
int depth_size
Definition: SDL_sysvideo.h:339
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
@ SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
Definition: SDL_video.h:246
index
GLuint index
Definition: SDL_opengl_glext.h:663
SDL_VideoDevice::is_dummy
SDL_bool is_dummy
Definition: SDL_sysvideo.h:321
SDL_GL_CONTEXT_RESET_ISOLATION_FLAG
@ SDL_GL_CONTEXT_RESET_ISOLATION_FLAG
Definition: SDL_video.h:240
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1112
SDL_GetHint
#define SDL_GetHint
Definition: SDL_dynapi_overrides.h:191
func
GLenum func
Definition: SDL_opengl_glext.h:660
GLubyte
unsigned char GLubyte
Definition: SDL_opengl.h:183
SDL_APP_LOWMEMORY
@ SDL_APP_LOWMEMORY
Definition: SDL_events.h:67
SDL_InitSubSystem
#define SDL_InitSubSystem
Definition: SDL_dynapi_overrides.h:55
SDL_RaiseWindow
void SDL_RaiseWindow(SDL_Window *window)
Raise a window above other windows and set the input focus.
Definition: SDL_video.c:2208
SDL_GL_CONTEXT_NO_ERROR
@ SDL_GL_CONTEXT_NO_ERROR
Definition: SDL_video.h:225
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1949
SDL_opengles.h
SDL_x11messagebox.h
Android_bootstrap
VideoBootStrap Android_bootstrap
SDL_OnWindowMinimized
void SDL_OnWindowMinimized(SDL_Window *window)
Definition: SDL_video.c:2622
SDL_KeyboardQuit
void SDL_KeyboardQuit(void)
Definition: SDL_keyboard.c:832
SDL_Rect::x
int x
Definition: SDL_rect.h:79
SDL_SetMouseFocus
void SDL_SetMouseFocus(SDL_Window *window)
Definition: SDL_mouse.c:203
SDL_GetWindowBrightness
float SDL_GetWindowBrightness(SDL_Window *window)
Get the brightness (gamma correction) for a window.
Definition: SDL_video.c:2392
SDL_ToggleDragAndDropSupport
void SDL_ToggleDragAndDropSupport(void)
Definition: SDL_video.c:1392
ctx
EGLContext ctx
Definition: eglext.h:208
SDL_WINDOW_INPUT_FOCUS
@ SDL_WINDOW_INPUT_FOCUS
Definition: SDL_video.h:108
SDL_VideoDevice::HideWindow
void(* HideWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:225
SDL_RendererInfo
Information on the capabilities of a render driver or context.
Definition: SDL_render.h:79
SDL_WINDOW_RESIZABLE
@ SDL_WINDOW_RESIZABLE
Definition: SDL_video.h:104
SDL_DisplayMode::h
int h
Definition: SDL_video.h:57
SDL_SetWindowOpacity
int SDL_SetWindowOpacity(SDL_Window *window, float opacity)
Set the opacity for a window.
Definition: SDL_video.c:2400
SDL_APP_WILLENTERFOREGROUND
@ SDL_APP_WILLENTERFOREGROUND
Definition: SDL_events.h:79
SDL_GL_DeduceMaxSupportedESProfile
void SDL_GL_DeduceMaxSupportedESProfile(int *major, int *minor)
Definition: SDL_video.c:3065
SDL_MetalView
void * SDL_MetalView
A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).
Definition: SDL_metal.h:44
SDL_GLattr
SDL_GLattr
OpenGL configuration attributes.
Definition: SDL_video.h:198
GL_STEREO
#define GL_STEREO
Definition: SDL_opengl.h:522
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
SDL_Rect::w
int w
Definition: SDL_rect.h:80
SDL_SetWindowBrightness
int SDL_SetWindowBrightness(SDL_Window *window, float brightness)
Set the brightness (gamma correction) for a window.
Definition: SDL_video.c:2376
SDL_cocoamessagebox.h
SDL_VideoDevice::red_size
int red_size
Definition: SDL_sysvideo.h:335
SDL_WindowTextureData::pitch
int pitch
Definition: SDL_video.c:164
SDL_OnWindowRestored
void SDL_OnWindowRestored(SDL_Window *window)
Definition: SDL_video.c:2628
SDL_SetRelativeMouseMode
#define SDL_SetRelativeMouseMode
Definition: SDL_dynapi_overrides.h:249
SDL_SetWindowHitTest
int SDL_SetWindowHitTest(SDL_Window *window, SDL_HitTest callback, void *userdata)
Provide a callback that decides if a window region has special properties.
Definition: SDL_video.c:4029
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:75
SDL_GetCurrentVideoDriver
const char * SDL_GetCurrentVideoDriver()
Returns the name of the currently initialized video driver.
Definition: SDL_video.c:576
SDL_winrtmessagebox.h
SDL_VideoDevice::SetWindowIcon
void(* SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon)
Definition: SDL_sysvideo.h:215
SDL_GetRenderDriverInfo
#define SDL_GetRenderDriverInfo
Definition: SDL_dynapi_overrides.h:299
SDL_DisplayMode
The structure that defines a display mode.
Definition: SDL_video.h:54
SDL_GetKeyboardFocus
#define SDL_GetKeyboardFocus
Definition: SDL_dynapi_overrides.h:216
SDL_VideoDevice::SetWindowGrab
void(* SetWindowGrab)(_THIS, SDL_Window *window, SDL_bool grabbed)
Definition: SDL_sysvideo.h:235
GL_VERSION
#define GL_VERSION
Definition: SDL_opengl.h:715
SDL_WindowTextureData::pixels
void * pixels
Definition: SDL_video.c:163
SDL_GetWindowSurface
SDL_Surface * SDL_GetWindowSurface(SDL_Window *window)
Get the SDL surface associated with the window.
Definition: SDL_video.c:2330
SDL_OnApplicationWillTerminate
void SDL_OnApplicationWillTerminate(void)
Definition: SDL_video.c:4060
SDL_strcasecmp
#define SDL_strcasecmp
Definition: SDL_dynapi_overrides.h:419
SDL_VideoDevice::Vulkan_CreateSurface
SDL_bool(* Vulkan_CreateSurface)(_THIS, SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface)
Definition: SDL_sysvideo.h:275
SDL_ResetKeyboard
void SDL_ResetKeyboard(void)
Definition: SDL_keyboard.c:572
SDL_MouseQuit
void SDL_MouseQuit(void)
Definition: SDL_mouse.c:654
CREATE_FLAGS
#define CREATE_FLAGS
Definition: SDL_video.c:1368
SDL_VideoDevice::ShowScreenKeyboard
void(* ShowScreenKeyboard)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:301
SDL_strncasecmp
#define SDL_strncasecmp
Definition: SDL_dynapi_overrides.h:420
SDL_WINDOWEVENT_SHOWN
@ SDL_WINDOWEVENT_SHOWN
Definition: SDL_video.h:148
GL_NUM_EXTENSIONS
#define GL_NUM_EXTENSIONS
RPI_bootstrap
VideoBootStrap RPI_bootstrap
SDL_VideoDevice::accum_red_size
int accum_red_size
Definition: SDL_sysvideo.h:343
GL_SAMPLE_BUFFERS
#define GL_SAMPLE_BUFFERS
Definition: SDL_opengl.h:1839
SDL_VideoDevice::GetDisplayUsableBounds
int(* GetDisplayUsableBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
Definition: SDL_sysvideo.h:188
SDL_GetDisplayName
const char * SDL_GetDisplayName(int displayIndex)
Get the name of a display in UTF-8 encoding.
Definition: SDL_video.c:674
SDL_GLContext
void * SDL_GLContext
An opaque handle to an OpenGL context.
Definition: SDL_video.h:192
SDL_GetDisplay
SDL_VideoDisplay * SDL_GetDisplay(int displayIndex)
Definition: SDL_video.c:1042
SDL_Surface::pitch
int pitch
Definition: SDL_surface.h:75
SDL_MinimizeWindow
void SDL_MinimizeWindow(SDL_Window *window)
Minimize a window to an iconic representation.
Definition: SDL_video.c:2246
SDL_Window::w
int w
Definition: SDL_sysvideo.h:81
SDL_CreateRGBSurfaceFrom
#define SDL_CreateRGBSurfaceFrom
Definition: SDL_dynapi_overrides.h:445
SDL_VideoDevice::gl_config
struct SDL_VideoDevice::@255 gl_config
SDL_GL_CreateContext
SDL_GLContext SDL_GL_CreateContext(SDL_Window *window)
Create an OpenGL context for use with an OpenGL window, and make it current.
Definition: SDL_video.c:3514
SDL_UpdateTexture
#define SDL_UpdateTexture
Definition: SDL_dynapi_overrides.h:315
SDL_GetWindowDisplayMode
int SDL_GetWindowDisplayMode(SDL_Window *window, SDL_DisplayMode *mode)
Fill in information about the display mode used when a fullscreen window is visible.
Definition: SDL_video.c:1141
SDL_GL_GetSwapInterval
int SDL_GL_GetSwapInterval(void)
Get the swap interval for the current OpenGL context.
Definition: SDL_video.c:3613
SDL_GL_DOUBLEBUFFER
@ SDL_GL_DOUBLEBUFFER
Definition: SDL_video.h:204
SDL_GL_CONTEXT_DEBUG_FLAG
@ SDL_GL_CONTEXT_DEBUG_FLAG
Definition: SDL_video.h:237
SDL_GetClosestDisplayMode
SDL_DisplayMode * SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
Get the closest match to the requested display mode.
Definition: SDL_video.c:980
DUMMY_bootstrap
VideoBootStrap DUMMY_bootstrap
SDL_MouseInit
int SDL_MouseInit(void)
Definition: SDL_mouse.c:127
SDL_SetWindowDisplayMode
int SDL_SetWindowDisplayMode(SDL_Window *window, const SDL_DisplayMode *mode)
Set the display mode used when a fullscreen window is visible.
Definition: SDL_video.c:1121
SDL_WINDOW_POPUP_MENU
@ SDL_WINDOW_POPUP_MENU
Definition: SDL_video.h:120
SDL_memcpy
#define SDL_memcpy
Definition: SDL_dynapi_overrides.h:387
SDL_GetHintBoolean
#define SDL_GetHintBoolean
Definition: SDL_dynapi_overrides.h:608
SDL_Renderer
Definition: SDL_sysrender.h:110
SDL_SetWindowData
void * SDL_SetWindowData(SDL_Window *window, const char *name, void *userdata)
Associate an arbitrary named pointer with a window.
Definition: SDL_video.c:1817
SDL_ShouldAllowTopmost
SDL_bool SDL_ShouldAllowTopmost(void)
Definition: SDL_video.c:4023
SDL_Mouse::relative_mode
SDL_bool relative_mode
Definition: SDL_mouse_c.h:87
context
static screen_context_t context
Definition: video.c:25
SDL_strchr
#define SDL_strchr
Definition: SDL_dynapi_overrides.h:401
SDL_GL_GREEN_SIZE
@ SDL_GL_GREEN_SIZE
Definition: SDL_video.h:200
SDL_UpdateWindowTexture
static int SDL_UpdateWindowTexture(SDL_VideoDevice *unused, SDL_Window *window, const SDL_Rect *rects, int numrects)
Definition: SDL_video.c:369
SDL_VideoDevice::SetWindowGammaRamp
int(* SetWindowGammaRamp)(_THIS, SDL_Window *window, const Uint16 *ramp)
Definition: SDL_sysvideo.h:233
SDL_GetIndexOfDisplay
int SDL_GetIndexOfDisplay(SDL_VideoDisplay *display)
Definition: SDL_video.c:645
SDL_GetWindowFlags
Uint32 SDL_GetWindowFlags(SDL_Window *window)
Get the window flags.
Definition: SDL_video.c:1762
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
SDL_VideoDevice::num_displays
int num_displays
Definition: SDL_sysvideo.h:323
SDL_SYSWM_COCOA
@ SDL_SYSWM_COCOA
Definition: SDL_syswm.h:128
cmpmodes
static int cmpmodes(const void *A, const void *B)
Definition: SDL_video.c:419
retval
SDL_bool retval
Definition: testgamecontroller.c:65
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
SDL_SysWMinfo::subsystem
SDL_SYSWM_TYPE subsystem
Definition: SDL_syswm.h:204
SDL_GL_SHARE_WITH_CURRENT_CONTEXT
@ SDL_GL_SHARE_WITH_CURRENT_CONTEXT
Definition: SDL_video.h:221
SDL_RenderCopy
#define SDL_RenderCopy
Definition: SDL_dynapi_overrides.h:343
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE
@ SDL_GL_FRAMEBUFFER_SRGB_CAPABLE
Definition: SDL_video.h:222
SDL_GetEventState
#define SDL_GetEventState(type)
Definition: SDL_events.h:773
window
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
IsAcceptingDragAndDrop
static SDL_INLINE SDL_bool IsAcceptingDragAndDrop(void)
Definition: SDL_video.c:1372
SDL_GetVideoDriver
const char * SDL_GetVideoDriver(int index)
Get the name of a built in video driver.
Definition: SDL_video.c:452
SDL_VideoDevice::SetWindowFullscreen
void(* SetWindowFullscreen)(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
Definition: SDL_sysvideo.h:232
SDL_VideoDevice::Metal_CreateView
SDL_MetalView(* Metal_CreateView)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:282
CanMinimizeWindow
static SDL_bool CanMinimizeWindow(SDL_Window *window)
Definition: SDL_video.c:2237
KMSDRM_bootstrap
VideoBootStrap KMSDRM_bootstrap
SDL_TEXTINPUT
@ SDL_TEXTINPUT
Definition: SDL_events.h:99
SDL_HINT_ALLOW_TOPMOST
#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:672
SDL_Rect::y
int y
Definition: SDL_rect.h:79
GL_NO_ERROR
#define GL_NO_ERROR
Definition: SDL_opengl.h:719
SDL_memcmp
#define SDL_memcmp
Definition: SDL_dynapi_overrides.h:389
SDL_GetRelativeMouseMode
#define SDL_GetRelativeMouseMode
Definition: SDL_dynapi_overrides.h:250
SDL_VideoDevice::HasScreenKeyboardSupport
SDL_bool(* HasScreenKeyboardSupport)(_THIS)
Definition: SDL_sysvideo.h:300
SDL_INLINE
#define SDL_INLINE
Definition: begin_code.h:134
SDL_Rect::h
int h
Definition: SDL_rect.h:80
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
SDL_DisplayOrientation
SDL_DisplayOrientation
Definition: SDL_video.h:181
SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG
@ SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG
Definition: SDL_video.h:239
SDL_CreateWindow
SDL_Window * SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
Create a window with the specified position, dimensions, and flags.
Definition: SDL_video.c:1426
SDL_VideoDevice::ShowMessageBox
int(* ShowMessageBox)(_THIS, const SDL_MessageBoxData *messageboxdata, int *buttonid)
Definition: SDL_sysvideo.h:311
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
SDL_DROPTEXT
@ SDL_DROPTEXT
Definition: SDL_events.h:142
SDL_GetWindowGrab
SDL_bool SDL_GetWindowGrab(SDL_Window *window)
Get a window's input grab mode.
Definition: SDL_video.c:2588
SDL_blit.h
SDL_DestroyWindow
void SDL_DestroyWindow(SDL_Window *window)
Destroy a window.
Definition: SDL_video.c:2733
SDL_max
#define SDL_max(x, y)
Definition: SDL_stdinc.h:407
SDL_UpdateWindowGrab
void SDL_UpdateWindowGrab(SDL_Window *window)
Definition: SDL_video.c:2541
SDL_VideoDevice::driver_loaded
int driver_loaded
Definition: SDL_sysvideo.h:361
isAtLeastGL3
static SDL_INLINE SDL_bool isAtLeastGL3(const char *verstr)
Definition: SDL_video.c:2968
SDL_GL_MakeCurrent
int SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext ctx)
Set up an OpenGL context for rendering into an OpenGL window.
Definition: SDL_video.c:3537
SDL_SYSWM_X11
@ SDL_SYSWM_X11
Definition: SDL_syswm.h:126
SDL_MessageBoxData
MessageBox structure containing title, text, window, etc.
Definition: SDL_messagebox.h:95
SDL_DisplayMode::refresh_rate
int refresh_rate
Definition: SDL_video.h:58
SDL_VideoDevice::GL_GetDrawableSize
void(* GL_GetDrawableSize)(_THIS, SDL_Window *window, int *w, int *h)
Definition: SDL_sysvideo.h:261
SDL_Surface::flags
Uint32 flags
Definition: SDL_surface.h:72
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:663
SDL_VideoDevice::displays
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:324
SDL_VideoDevice::GetDisplayModes
void(* GetDisplayModes)(_THIS, SDL_VideoDisplay *display)
Definition: SDL_sysvideo.h:198
SDL_GetWindowSize
void SDL_GetWindowSize(SDL_Window *window, int *w, int *h)
Get the size of a window's client area.
Definition: SDL_video.c:2055
SDL_GetDisplayForWindow
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
Definition: SDL_video.c:1110
GL_ACCUM_RED_BITS
#define GL_ACCUM_RED_BITS
Definition: SDL_opengl.h:380
rect
SDL_Rect rect
Definition: testrelative.c:27
SDL_GL_ACCELERATED_VISUAL
@ SDL_GL_ACCELERATED_VISUAL
Definition: SDL_video.h:214
SDL_Vulkan_GetDrawableSize
void SDL_Vulkan_GetDrawableSize(SDL_Window *window, int *w, int *h)
Get the size of a window's underlying drawable in pixels (for use with setting viewport,...
Definition: SDL_video.c:4206
WINDOWS_bootstrap
VideoBootStrap WINDOWS_bootstrap
SDL_FreeSurface
#define SDL_FreeSurface
Definition: SDL_dynapi_overrides.h:446
SDL_VideoDevice::loader_path
char loader_path[256]
Definition: SDL_sysvideo.h:383
SDL_VideoDevice::multisamplebuffers
int multisamplebuffers
Definition: SDL_sysvideo.h:348
SDL_VideoDevice::VideoInit
int(* VideoInit)(_THIS)
Definition: SDL_sysvideo.h:162
SDL_HasWindows
SDL_bool SDL_HasWindows(void)
Definition: SDL_video.c:1732
SDL_WINDOWTEXTUREDATA
#define SDL_WINDOWTEXTUREDATA
Definition: SDL_video.c:158
SDL_GL_CONTEXT_PROFILE_ES
@ SDL_GL_CONTEXT_PROFILE_ES
Definition: SDL_video.h:232
SDL_WINDOW_TOOLTIP
@ SDL_WINDOW_TOOLTIP
Definition: SDL_video.h:119
SDL_MessageBoxData::window
SDL_Window * window
Definition: SDL_messagebox.h:97
SDL_VideoDevice::share_with_current_context
int share_with_current_context
Definition: SDL_sysvideo.h:355
SDL_VideoDevice::green_size
int green_size
Definition: SDL_sysvideo.h:336
SDL_VideoDevice::loader_loaded
int loader_loaded
Definition: SDL_sysvideo.h:382
SDL_PixelFormatEnumToMasks
#define SDL_PixelFormatEnumToMasks
Definition: SDL_dynapi_overrides.h:278
SDL_SetWindowMaximumSize
void SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h)
Set the maximum size of a window's client area.
Definition: SDL_video.c:2132
SDL_GetDisplayBounds
int SDL_GetDisplayBounds(int displayIndex, SDL_Rect *rect)
Get the desktop area represented by a display, with the primary display located at 0,...
Definition: SDL_video.c:682
SDL_uikitmessagebox.h
SDL_min
#define SDL_min(x, y)
Definition: SDL_stdinc.h:406
SDL_AddBasicVideoDisplay
int SDL_AddBasicVideoDisplay(const SDL_DisplayMode *desktop_mode)
Definition: SDL_video.c:592
SDL_VideoDevice::StartTextInput
void(* StartTextInput)(_THIS)
Definition: SDL_sysvideo.h:295
SDL_VideoDevice::RaiseWindow
void(* RaiseWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:226
SDL_StopTextInput
void SDL_StopTextInput(void)
Stop receiving any text input events. This function will hide the on-screen keyboard if supported.
Definition: SDL_video.c:3803
OFFSCREEN_bootstrap
VideoBootStrap OFFSCREEN_bootstrap
SDL_VideoDevice::StopTextInput
void(* StopTextInput)(_THIS)
Definition: SDL_sysvideo.h:296
names
GLuint GLuint * names
Definition: SDL_opengl_glext.h:4959
SDL_VideoDevice::VideoQuit
void(* VideoQuit)(_THIS)
Definition: SDL_sysvideo.h:168
SDL_OnApplicationDidEnterBackground
void SDL_OnApplicationDidEnterBackground(void)
Definition: SDL_video.c:4082
SDL_DestroyWindowTexture
static void SDL_DestroyWindowTexture(SDL_VideoDevice *unused, SDL_Window *window)
Definition: SDL_video.c:399
SDL_OnWindowEnter
void SDL_OnWindowEnter(SDL_Window *window)
Definition: SDL_video.c:2644
SDL_VideoDevice::SetWindowMinimumSize
void(* SetWindowMinimumSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:218
SDL_MessageBoxButtonData
Individual button data.
Definition: SDL_messagebox.h:59
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:328
SDL_SYSWM_UIKIT
@ SDL_SYSWM_UIKIT
Definition: SDL_syswm.h:129
SDL_WINDOW_INPUT_GRABBED
@ SDL_WINDOW_INPUT_GRABBED
Definition: SDL_video.h:107
SDL_Mouse
Definition: SDL_mouse_c.h:44
SDL_RestoreWindow
void SDL_RestoreWindow(SDL_Window *window)
Restore the size and position of a minimized or maximized window.
Definition: SDL_video.c:2266
SDL_APP_WILLENTERBACKGROUND
@ SDL_APP_WILLENTERBACKGROUND
Definition: SDL_events.h:71
SDL_CreateWindowTexture
static int SDL_CreateWindowTexture(SDL_VideoDevice *unused, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
Definition: SDL_video.c:259
SDL_VideoDevice::no_error
int no_error
Definition: SDL_sysvideo.h:359
SDL_SetDisplayModeForDisplay
static int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
Definition: SDL_video.c:993
SDL_WINDOWEVENT_SIZE_CHANGED
@ SDL_WINDOWEVENT_SIZE_CHANGED
Definition: SDL_video.h:155
SDL_GetDisplayUsableBounds
int SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect *rect)
Get the usable desktop area represented by a display, with the primary display located at 0,...
Definition: SDL_video.c:717
SDL_GL_ACCUM_ALPHA_SIZE
@ SDL_GL_ACCUM_ALPHA_SIZE
Definition: SDL_video.h:210
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
SDL_GetNumVideoDisplays
int SDL_GetNumVideoDisplays(void)
Returns the number of available video displays.
Definition: SDL_video.c:635
SDL_VideoDevice::MinimizeWindow
void(* MinimizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:228
SDL_PIXELFORMAT_ARGB8888
@ SDL_PIXELFORMAT_ARGB8888
Definition: SDL_pixels.h:251
SDL_MaximizeWindow
void SDL_MaximizeWindow(SDL_Window *window)
Make a window as large as possible.
Definition: SDL_video.c:2221
SDL_DisplayMode::w
int w
Definition: SDL_video.h:56
SDL_GL_UnloadLibrary
void SDL_GL_UnloadLibrary(void)
Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
Definition: SDL_video.c:2950
SDL_bmessagebox.h
PSP_bootstrap
VideoBootStrap PSP_bootstrap
blue
GLbyte GLbyte blue
Definition: SDL_opengl_glext.h:382
WINRT_DetectWindowFlags
Uint32 WINRT_DetectWindowFlags(SDL_Window *window)
green
GLbyte green
Definition: SDL_opengl_glext.h:382
SDL_VideoDevice::SetWindowHitTest
int(* SetWindowHitTest)(SDL_Window *window, SDL_bool enabled)
Definition: SDL_sysvideo.h:314
SDL_assert
#define SDL_assert(condition)
Definition: SDL_assert.h:169
SDL_OnApplicationDidBecomeActive
void SDL_OnApplicationDidBecomeActive(void)
Definition: SDL_video.c:4092
SDL_GetWindowPixelFormat
Uint32 SDL_GetWindowPixelFormat(SDL_Window *window)
Get the pixel format associated with the window.
Definition: SDL_video.c:1178
SDL_VideoDevice::SetWindowMaximumSize
void(* SetWindowMaximumSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:219
SDL_TLSGet
#define SDL_TLSGet
Definition: SDL_dynapi_overrides.h:481
SDL_DISABLE
#define SDL_DISABLE
Definition: SDL_events.h:759
SDL_VideoDevice::dll_handle
void * dll_handle
Definition: SDL_sysvideo.h:363
SDL_GL_ACCUM_BLUE_SIZE
@ SDL_GL_ACCUM_BLUE_SIZE
Definition: SDL_video.h:209
SDL_GetCurrentDisplayMode
int SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode *mode)
Fill in information about the current display mode.
Definition: SDL_video.c:859
SDL_WINDOWEVENT_MINIMIZED
@ SDL_WINDOWEVENT_MINIMIZED
Definition: SDL_video.h:158
Wayland_bootstrap
VideoBootStrap Wayland_bootstrap
SDL_WINDOW_SHOWN
@ SDL_WINDOW_SHOWN
Definition: SDL_video.h:101
VIVANTE_bootstrap
VideoBootStrap VIVANTE_bootstrap
SDL_VideoDisplay::driverdata
void * driverdata
Definition: SDL_sysvideo.h:140
start
GLuint start
Definition: SDL_opengl.h:1571
pixels
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: SDL_opengl.h:1572
SDL_sscanf
#define SDL_sscanf
Definition: SDL_dynapi_overrides.h:39
NACL_bootstrap
VideoBootStrap NACL_bootstrap
SDL_Window::h
int h
Definition: SDL_sysvideo.h:81
SDL_VideoDevice::double_buffer
int double_buffer
Definition: SDL_sysvideo.h:342
SDL_TLSCreate
#define SDL_TLSCreate
Definition: SDL_dynapi_overrides.h:480
DirectFB_bootstrap
VideoBootStrap DirectFB_bootstrap
SDL_GetWindowWMInfo
SDL_bool SDL_GetWindowWMInfo(SDL_Window *window, struct SDL_SysWMinfo *info)
This function allows access to driver-dependent window information.
Definition: SDL_video.c:3758
SDL_VideoDevice::release_behavior
int release_behavior
Definition: SDL_sysvideo.h:356
SDL_VideoDevice
Definition: SDL_sysvideo.h:150
APIENTRY
#define APIENTRY
Definition: SDL_opengl.h:139
SDL_OutOfMemory
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_VideoDevice::IsScreenKeyboardShown
SDL_bool(* IsScreenKeyboardShown)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:303
SDL_VideoDevice::flags
int flags
Definition: SDL_sysvideo.h:353
SDL_SetWindowGammaRamp
int SDL_SetWindowGammaRamp(SDL_Window *window, const Uint16 *red, const Uint16 *green, const Uint16 *blue)
Set the gamma ramp for a window.
Definition: SDL_video.c:2462
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE
Definition: SDL_opengl_glext.h:999
SDL_GL_BLUE_SIZE
@ SDL_GL_BLUE_SIZE
Definition: SDL_video.h:201
SDL_VideoDevice::DestroyWindow
void(* DestroyWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:236
bpp
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
Definition: pixman-arm-neon-asm.h:146
HAIKU_bootstrap
VideoBootStrap HAIKU_bootstrap
SDL_WINDOW_UTILITY
@ SDL_WINDOW_UTILITY
Definition: SDL_video.h:118
SDL_UpdateFullscreenMode
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
Definition: SDL_video.c:1204
available
static int available()
Definition: video.c:356
SDL_VideoDevice::SetWindowBordered
void(* SetWindowBordered)(_THIS, SDL_Window *window, SDL_bool bordered)
Definition: SDL_sysvideo.h:230
SDL_AddDisplayMode
SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
Definition: SDL_video.c:772
SDL_SetWindowBordered
void SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered)
Set the border state of a window.
Definition: SDL_video.c:1971
SDL_SetWindowModalFor
int SDL_SetWindowModalFor(SDL_Window *modal_window, SDL_Window *parent_window)
Sets the window as a modal for another window (TODO: reconsider this function and/or its name)
Definition: SDL_video.c:2436
SDL_MessageboxValidForDriver
static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
Definition: SDL_video.c:3873
SDL_GetGrabbedWindow
SDL_Window * SDL_GetGrabbedWindow(void)
Get the window that currently has an input grab enabled.
Definition: SDL_video.c:2596
SDL_OnApplicationWillResignActive
void SDL_OnApplicationWillResignActive(void)
Definition: SDL_video.c:4070
SDL_arraysize
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:115
SDL_Surface::h
int h
Definition: SDL_surface.h:74
SDL_SetWindowResizable
void SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable)
Set the user-resizable state of a window.
Definition: SDL_video.c:1989
SDL_calloc
#define SDL_calloc
Definition: SDL_dynapi_overrides.h:375
SDL_DestroyTexture
#define SDL_DestroyTexture
Definition: SDL_dynapi_overrides.h:347
SDL_atoi
#define SDL_atoi
Definition: SDL_dynapi_overrides.h:410
SDL_StartTextInput
void SDL_StartTextInput(void)
Start accepting Unicode text input events. This function will show the on-screen keyboard if supporte...
Definition: SDL_video.c:3776
FULLSCREEN_VISIBLE
#define FULLSCREEN_VISIBLE(W)
Definition: SDL_sysvideo.h:117
SDL_HINT_DISPLAY_USABLE_BOUNDS
#define SDL_HINT_DISPLAY_USABLE_BOUNDS
Definition: SDL_hints.h:1273
GL_ACCUM_BLUE_BITS
#define GL_ACCUM_BLUE_BITS
Definition: SDL_opengl.h:382
SDL_VideoDevice::GL_SetSwapInterval
int(* GL_SetSwapInterval)(_THIS, int interval)
Definition: SDL_sysvideo.h:262
SDL_GetWindowMaximumSize
void SDL_GetWindowMaximumSize(SDL_Window *window, int *max_w, int *max_h)
Get the maximum size of a window's client area.
Definition: SDL_video.c:2162
SDL_VideoDisplay::max_display_modes
int max_display_modes
Definition: SDL_sysvideo.h:129
SDL_VideoDevice::SetWindowResizable
void(* SetWindowResizable)(_THIS, SDL_Window *window, SDL_bool resizable)
Definition: SDL_sysvideo.h:231
SDL_VideoDevice::reset_notification
int reset_notification
Definition: SDL_sysvideo.h:357
SDL_VideoDisplay::num_display_modes
int num_display_modes
Definition: SDL_sysvideo.h:130
SDL_VideoDevice::AcceptDragAndDrop
void(* AcceptDragAndDrop)(SDL_Window *window, SDL_bool accept)
Definition: SDL_sysvideo.h:317
SDL_VideoDevice::DestroyWindowFramebuffer
void(* DestroyWindowFramebuffer)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:239
SDL_VideoDevice::CreateSDLWindowFrom
int(* CreateSDLWindowFrom)(_THIS, SDL_Window *window, const void *data)
Definition: SDL_sysvideo.h:213
SDL_VideoDevice::stereo
int stereo
Definition: SDL_sysvideo.h:347
src
GLenum src
Definition: SDL_opengl_glext.h:1740
SDL_Vulkan_CreateSurface
SDL_bool SDL_Vulkan_CreateSurface(SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface)
Create a Vulkan rendering surface for a window.
Definition: SDL_video.c:4182
SDL_ComputeDiagonalDPI
float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches)
Definition: SDL_video.c:4046
renderer
static SDL_Renderer * renderer
Definition: testaudiocapture.c:21
SDL_getenv
#define SDL_getenv
Definition: SDL_dynapi_overrides.h:378
SDL_AddVideoDisplay
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display)
Definition: SDL_video.c:606
SDL_GetVideoDevice
SDL_VideoDevice * SDL_GetVideoDevice(void)
Definition: SDL_video.c:586
SDL_WINDOW_HIDDEN
@ SDL_WINDOW_HIDDEN
Definition: SDL_video.h:102
SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT
@ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT
Definition: SDL_messagebox.h:51
SDL_GL_SetAttribute
int SDL_GL_SetAttribute(SDL_GLattr attr, int value)
Set an OpenGL window attribute before window creation.
Definition: SDL_video.c:3144
SDL_GL_GetCurrentContext
SDL_GLContext SDL_GL_GetCurrentContext(void)
Get the currently active OpenGL context.
Definition: SDL_video.c:3578
SDL_VideoDevice::free
void(* free)(_THIS)
Definition: SDL_sysvideo.h:402
SDL_ISPIXELFORMAT_FOURCC
#define SDL_ISPIXELFORMAT_FOURCC(format)
Definition: SDL_pixels.h:167
SDL_GetDisplayDPI
int SDL_GetDisplayDPI(int displayIndex, float *ddpi, float *hdpi, float *vdpi)
Get the dots/pixels-per-inch for a display.
Definition: SDL_video.c:741
GL_ACCUM_ALPHA_BITS
#define GL_ACCUM_ALPHA_BITS
Definition: SDL_opengl.h:383
SDL_KeyboardInit
int SDL_KeyboardInit(void)
Definition: SDL_keyboard.c:562
SDL_Point
The structure that defines a point (integer)
Definition: SDL_rect.h:49
SDL_IsTextInputActive
SDL_bool SDL_IsTextInputActive(void)
Return whether or not Unicode text input events are enabled.
Definition: SDL_video.c:3797
SDL_SysWMinfo::version
SDL_version version
Definition: SDL_syswm.h:203
SDL_GetDisplayDriverData
void * SDL_GetDisplayDriverData(int displayIndex)
Definition: SDL_video.c:660
SDL_Window::next
SDL_Window * next
Definition: SDL_sysvideo.h:115
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:701
SDL_sqrt
#define SDL_sqrt
Definition: SDL_dynapi_overrides.h:437
SDL_VideoDisplay
Definition: SDL_sysvideo.h:127
SDL_GL_STENCIL_SIZE
@ SDL_GL_STENCIL_SIZE
Definition: SDL_video.h:206
bootstrap
static VideoBootStrap * bootstrap[]
Definition: SDL_video.c:60
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:30
SDL_GL_CONTEXT_MINOR_VERSION
@ SDL_GL_CONTEXT_MINOR_VERSION
Definition: SDL_video.h:217
SDL_BYTESPERPIXEL
#define SDL_BYTESPERPIXEL(X)
Definition: SDL_pixels.h:128
SDL_VideoDevice::SetWindowInputFocus
int(* SetWindowInputFocus)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:223
SDL_VideoDevice::GL_MakeCurrent
int(* GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context)
Definition: SDL_sysvideo.h:260
SDL_VideoDevice::GL_LoadLibrary
int(* GL_LoadLibrary)(_THIS, const char *path)
Definition: SDL_sysvideo.h:256
SDL_Rect
A rectangle, with the origin at the upper left (integer).
Definition: SDL_rect.h:78
SDL_GetMouseFocus
#define SDL_GetMouseFocus
Definition: SDL_dynapi_overrides.h:245
SDL_VideoDevice::SetDisplayMode
int(* SetDisplayMode)(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
Definition: SDL_sysvideo.h:206
SDL_GL_MULTISAMPLEBUFFERS
@ SDL_GL_MULTISAMPLEBUFFERS
Definition: SDL_video.h:212
GL_ACCUM_GREEN_BITS
#define GL_ACCUM_GREEN_BITS
Definition: SDL_opengl.h:381
SDL_VideoDevice::GL_UnloadLibrary
void(* GL_UnloadLibrary)(_THIS)
Definition: SDL_sysvideo.h:258
SDL_VideoDevice::GL_CreateContext
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:259
SDL_Texture
Definition: SDL_sysrender.h:37
SDL_VideoDevice::GetDisplayBounds
int(* GetDisplayBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
Definition: SDL_sysvideo.h:183
SDL_VideoDevice::GetDisplayDPI
int(* GetDisplayDPI)(_THIS, SDL_VideoDisplay *display, float *ddpi, float *hdpi, float *vdpi)
Definition: SDL_sysvideo.h:193
SDL_GL_GetAttribute
int SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
Get the actual value for an attribute from the current context.
Definition: SDL_video.c:3265
SDL_WindowUserData::next
struct SDL_WindowUserData * next
Definition: SDL_sysvideo.h:70
left
GLint left
Definition: SDL_opengl_glext.h:1952
ShouldUseTextureFramebuffer
static SDL_bool ShouldUseTextureFramebuffer()
Definition: SDL_video.c:169
SDL_PIXELTYPE
#define SDL_PIXELTYPE(X)
Definition: SDL_pixels.h:124
VideoBootStrap::create
SDL_VideoDevice *(* create)(int devindex)
Definition: SDL_sysvideo.h:410
GLenum
unsigned int GLenum
Definition: SDL_opengl.h:176
SDL_PIXELFORMAT_UNKNOWN
@ SDL_PIXELFORMAT_UNKNOWN
Definition: SDL_pixels.h:173
SDL_Metal_CreateView
SDL_MetalView SDL_Metal_CreateView(SDL_Window *window)
Create a CAMetalLayer-backed NSView/UIView and attach it to the specified window.
Definition: SDL_video.c:4218
SDL_SetWindowIcon
void SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon)
Set the icon for a window.
Definition: SDL_video.c:1795
SDL_VideoInit
int SDL_VideoInit(const char *driver_name)
Initialize the video subsystem, optionally specifying a video driver.
Definition: SDL_video.c:464
SDL_VideoDevice::name
const char * name
Definition: SDL_sysvideo.h:153
GL_RED_BITS
#define GL_RED_BITS
Definition: SDL_opengl.h:513
SDL_EventState
#define SDL_EventState
Definition: SDL_dynapi_overrides.h:131
SDL_Vulkan_UnloadLibrary
void SDL_Vulkan_UnloadLibrary(void)
Unload the Vulkan loader library previously loaded by SDL_Vulkan_LoadLibrary().
Definition: SDL_video.c:4146
SDL_VideoDevice::framebuffer_srgb_capable
int framebuffer_srgb_capable
Definition: SDL_sysvideo.h:358
SDL_VideoDevice::GL_GetSwapInterval
int(* GL_GetSwapInterval)(_THIS)
Definition: SDL_sysvideo.h:263
SDL_SendWindowEvent
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
Definition: SDL_windowevents.c:74
UIKIT_bootstrap
VideoBootStrap UIKIT_bootstrap
SDL_VideoDevice::next_object_id
Uint32 next_object_id
Definition: SDL_sysvideo.h:328
SDL_GetDisplayOrientation
SDL_DisplayOrientation SDL_GetDisplayOrientation(int displayIndex)
Get the orientation of a display.
Definition: SDL_video.c:761
SDL_ShowSimpleMessageBox
int SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window)
Create a simple modal message box.
Definition: SDL_video.c:3990
SDL_HINT_FRAMEBUFFER_ACCELERATION
#define SDL_HINT_FRAMEBUFFER_ACCELERATION
A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
Definition: SDL_hints.h:65
SDL_Vulkan_LoadLibrary
int SDL_Vulkan_LoadLibrary(const char *path)
Dynamically load a Vulkan loader library.
Definition: SDL_video.c:4107
CHECK_DISPLAY_INDEX
#define CHECK_DISPLAY_INDEX(displayIndex, retval)
Definition: SDL_video.c:134
PrepareDragAndDropSupport
static SDL_INLINE void PrepareDragAndDropSupport(SDL_Window *window)
Definition: SDL_video.c:1383
SDL_strdup
#define SDL_strdup
Definition: SDL_dynapi_overrides.h:397
SDL_EnclosePoints
#define SDL_EnclosePoints
Definition: SDL_dynapi_overrides.h:296
SDL_VideoDevice::current_glwin
SDL_Window * current_glwin
Definition: SDL_sysvideo.h:371
SDL_VideoDevice::alpha_size
int alpha_size
Definition: SDL_sysvideo.h:338
SDL_strlen
#define SDL_strlen
Definition: SDL_dynapi_overrides.h:393
SDL_ORIENTATION_UNKNOWN
@ SDL_ORIENTATION_UNKNOWN
Definition: SDL_video.h:182
GL_INVALID_VALUE
#define GL_INVALID_VALUE
Definition: SDL_opengl.h:721
SDL_VideoDevice::Vulkan_GetInstanceExtensions
SDL_bool(* Vulkan_GetInstanceExtensions)(_THIS, SDL_Window *window, unsigned *count, const char **names)
Definition: SDL_sysvideo.h:274
SDL_GL_ACCUM_RED_SIZE
@ SDL_GL_ACCUM_RED_SIZE
Definition: SDL_video.h:207
SDL_CaptureMouse
#define SDL_CaptureMouse
Definition: SDL_dynapi_overrides.h:584
SDL_GL_CONTEXT_RELEASE_BEHAVIOR
@ SDL_GL_CONTEXT_RELEASE_BEHAVIOR
Definition: SDL_video.h:223
SDL_GL_ExtensionSupported
SDL_bool SDL_GL_ExtensionSupported(const char *extension)
Return true if an OpenGL extension is supported for the current context.
Definition: SDL_video.c:2975
SDL_ShowMessageBox
int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
Create a modal message box.
Definition: SDL_video.c:3892
SDL_FinishWindowCreation
static void SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
Definition: SDL_video.c:1404
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:162
SDL_VideoDevice::GL_SwapWindow
int(* GL_SwapWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:264
SDL_VideoDevice::MaximizeWindow
void(* MaximizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:227
GL_DEPTH
#define GL_DEPTH
Definition: SDL_opengl.h:525
SDL_VideoDevice::HideScreenKeyboard
void(* HideScreenKeyboard)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:302
SDL_RendererInfo::name
const char * name
Definition: SDL_render.h:80
SDL_pixels_c.h
SDL_ShowCursor
#define SDL_ShowCursor
Definition: SDL_dynapi_overrides.h:258
SDL_VideoDevice::SetWindowSize
void(* SetWindowSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:217
SDL_WINDOWEVENT_HIDDEN
@ SDL_WINDOWEVENT_HIDDEN
Definition: SDL_video.h:149
SDL_video.h
SDL_VideoDevice::GL_DefaultProfileConfig
void(* GL_DefaultProfileConfig)(_THIS, int *mask, int *major, int *minor)
Definition: SDL_sysvideo.h:266
SDL_WindowTextureData::texture
SDL_Texture * texture
Definition: SDL_video.c:162
Android_JNI_ShouldMinimizeOnFocusLoss
SDL_bool Android_JNI_ShouldMinimizeOnFocusLoss(void)
j
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 int in j)
Definition: SDL_x11sym.h:50
SDL_UninitializedVideo
static int SDL_UninitializedVideo()
Definition: SDL_video.c:440
SDL_VideoDevice::SetWindowOpacity
int(* SetWindowOpacity)(_THIS, SDL_Window *window, float opacity)
Definition: SDL_sysvideo.h:221
SDL_IsVideoContextExternal
SDL_bool SDL_IsVideoContextExternal(void)
Definition: SDL_video.c:668
SDL_HINT_RENDER_DRIVER
#define SDL_HINT_RENDER_DRIVER
A variable specifying which render driver to use.
Definition: SDL_hints.h:85
GL_GREEN_BITS
#define GL_GREEN_BITS
Definition: SDL_opengl.h:514
SDL_VideoDevice::GetWindowGammaRamp
int(* GetWindowGammaRamp)(_THIS, SDL_Window *window, Uint16 *ramp)
Definition: SDL_sysvideo.h:234
SDL_DisplayMode::driverdata
void * driverdata
Definition: SDL_video.h:59
SDL_GetWindowID
Uint32 SDL_GetWindowID(SDL_Window *window)
Get the numeric ID of a window, for logging purposes.
Definition: SDL_video.c:1738
SDL_WINDOWEVENT_RESTORED
@ SDL_WINDOWEVENT_RESTORED
Definition: SDL_video.h:160
SDL_GL_STEREO
@ SDL_GL_STEREO
Definition: SDL_video.h:211
SDL_ISPIXELFORMAT_ALPHA
#define SDL_ISPIXELFORMAT_ALPHA(format)
Definition: SDL_pixels.h:154
SDL_FALSE
@ SDL_FALSE
Definition: SDL_stdinc.h:163
SDL_Unsupported
#define SDL_Unsupported()
Definition: SDL_error.h:53
SDL_rect_c.h
QNX_bootstrap
VideoBootStrap QNX_bootstrap
Definition: video.c:361
GLuint
unsigned int GLuint
Definition: SDL_opengl.h:185
SDL_sysvideo.h
SDL_VideoDevice::accelerated
int accelerated
Definition: SDL_sysvideo.h:350
SDL_CalculateGammaRamp
#define SDL_CalculateGammaRamp
Definition: SDL_dynapi_overrides.h:290
SDL_VideoDevice::ShowWindow
void(* ShowWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:224
GL_CONTEXT_RELEASE_BEHAVIOR
#define GL_CONTEXT_RELEASE_BEHAVIOR
Definition: SDL_opengl_glext.h:2995
SDL_VideoDevice::CreateWindowFramebuffer
int(* CreateWindowFramebuffer)(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
Definition: SDL_sysvideo.h:237
SDL_GL_GetProcAddress
void * SDL_GL_GetProcAddress(const char *proc)
Get the address of an OpenGL function.
Definition: SDL_video.c:2928
SDL_GL_RED_SIZE
@ SDL_GL_RED_SIZE
Definition: SDL_video.h:199
SDL_VideoDisplay::current_mode
SDL_DisplayMode current_mode
Definition: SDL_sysvideo.h:133
SDL_Vulkan_GetVkGetInstanceProcAddr
void * SDL_Vulkan_GetVkGetInstanceProcAddr(void)
Get the address of the vkGetInstanceProcAddr function.
Definition: SDL_video.c:4133
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:374
SDL_VideoDevice::GL_GetProcAddress
void *(* GL_GetProcAddress)(_THIS, const char *proc)
Definition: SDL_sysvideo.h:257
SDL_GetWindowGammaRamp
int SDL_GetWindowGammaRamp(SDL_Window *window, Uint16 *red, Uint16 *green, Uint16 *blue)
Get the gamma ramp for a window.
Definition: SDL_video.c:2496
SDL_RendererInfo::texture_formats
Uint32 texture_formats[16]
Definition: SDL_render.h:83
SDL_CreateRenderer
#define SDL_CreateRenderer
Definition: SDL_dynapi_overrides.h:301
PND_bootstrap
VideoBootStrap PND_bootstrap
SDL_UpdateWindowSurface
int SDL_UpdateWindowSurface(SDL_Window *window)
Copy the window surface to the screen.
Definition: SDL_video.c:2349
SDL_VideoDevice::stencil_size
int stencil_size
Definition: SDL_sysvideo.h:341
SDL_HasScreenKeyboardSupport
SDL_bool SDL_HasScreenKeyboardSupport(void)
Returns whether the platform has some screen keyboard support.
Definition: SDL_video.c:3832
SDL_GL_SwapWindow
void SDL_GL_SwapWindow(SDL_Window *window)
Swap the OpenGL buffers for a window, if double-buffering is supported.
Definition: SDL_video.c:3627
SDL_TouchQuit
void SDL_TouchQuit(void)
Definition: SDL_touch.c:465
SDL_strcmp
#define SDL_strcmp
Definition: SDL_dynapi_overrides.h:417
void
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
Definition: SDL_dynapi_procs.h:89
SDL_SetWindowPosition
void SDL_SetWindowPosition(SDL_Window *window, int x, int y)
Set the position of a window.
Definition: SDL_video.c:1885
SDL_GL_CONTEXT_FLAGS
@ SDL_GL_CONTEXT_FLAGS
Definition: SDL_video.h:219
SDL_RecreateWindow
int SDL_RecreateWindow(SDL_Window *window, Uint32 flags)
Definition: SDL_video.c:1635
SDL_OnWindowResized
void SDL_OnWindowResized(SDL_Window *window)
Definition: SDL_video.c:2615
flags
GLbitfield flags
Definition: SDL_opengl_glext.h:1483
SDL_GL_CONTEXT_RESET_NOTIFICATION
@ SDL_GL_CONTEXT_RESET_NOTIFICATION
Definition: SDL_video.h:224
FULLSCREEN_MASK
#define FULLSCREEN_MASK
Definition: SDL_video.c:147
SDL_GetClosestDisplayModeForDisplay
static SDL_DisplayMode * SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay *display, const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
Definition: SDL_video.c:873
SDL_strstr
#define SDL_strstr
Definition: SDL_dynapi_overrides.h:403
SDL_WINDOWEVENT_FOCUS_GAINED
@ SDL_WINDOWEVENT_FOCUS_GAINED
Definition: SDL_video.h:164
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
@ SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
Definition: SDL_video.h:238
SDL_OnWindowHidden
void SDL_OnWindowHidden(SDL_Window *window)
Definition: SDL_video.c:2609
SDL_DestroyRenderer
#define SDL_DestroyRenderer
Definition: SDL_dynapi_overrides.h:348
SDL_TEXTUREACCESS_STREAMING
@ SDL_TEXTUREACCESS_STREAMING
Definition: SDL_render.h:104
VideoBootStrap
Definition: SDL_sysvideo.h:406
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:123
SDL_SendAppEvent
int SDL_SendAppEvent(SDL_EventType eventType)
Definition: SDL_events.c:972
SDL_VideoDevice::minor_version
int minor_version
Definition: SDL_sysvideo.h:352
SDL_WindowTextureData
Definition: SDL_video.c:160
GL_INVALID_ENUM
#define GL_INVALID_ENUM
Definition: SDL_opengl.h:720
SDL_Window::prev
SDL_Window * prev
Definition: SDL_sysvideo.h:114
SDL_VideoDevice::current_glctx
SDL_GLContext current_glctx
Definition: SDL_sysvideo.h:372
SDL_VideoDevice::RestoreWindow
void(* RestoreWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:229
SDL_SetTextInputRect
void SDL_SetTextInputRect(SDL_Rect *rect)
Set the rectangle used to type Unicode text inputs. This is used as a hint for IME and on-screen keyb...
Definition: SDL_video.c:3824
rects
EGLSurface EGLint * rects
Definition: eglext.h:282
SDL_TouchInit
int SDL_TouchInit(void)
Definition: SDL_touch.c:46
SDL_WarpMouseInWindow
#define SDL_WarpMouseInWindow
Definition: SDL_dynapi_overrides.h:248
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:84
SDL_VideoDevice::GL_DeleteContext
void(* GL_DeleteContext)(_THIS, SDL_GLContext context)
Definition: SDL_sysvideo.h:265
SDL_Surface::format
SDL_PixelFormat * format
Definition: SDL_surface.h:73
SDL_OnWindowFocusLost
void SDL_OnWindowFocusLost(SDL_Window *window)
Definition: SDL_video.c:2701
state
struct xkb_state * state
Definition: SDL_waylandsym.h:114
SDL_SetWindowFullscreen
int SDL_SetWindowFullscreen(SDL_Window *window, Uint32 flags)
Set a window's fullscreen state.
Definition: SDL_video.c:2280
SDL_VideoDisplay::orientation
SDL_DisplayOrientation orientation
Definition: SDL_sysvideo.h:134
GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE
Definition: SDL_opengl_glext.h:1002
SDL_GetNumDisplayModesForDisplay
static int SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay *display)
Definition: SDL_video.c:808
SDL_VideoDevice::suspend_screensaver
SDL_bool suspend_screensaver
Definition: SDL_sysvideo.h:322
SDL_WindowTextureData::bytes_per_pixel
int bytes_per_pixel
Definition: SDL_video.c:165
SDL_GetNumDisplayModes
int SDL_GetNumDisplayModes(int displayIndex)
Returns the number of available display modes.
Definition: SDL_video.c:819
SDL_GL_GetCurrentWindow
SDL_Window * SDL_GL_GetCurrentWindow(void)
Get the currently active OpenGL window.
Definition: SDL_video.c:3568
SDL_DROPFILE
@ SDL_DROPFILE
Definition: SDL_events.h:141
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY
@ SDL_GL_CONTEXT_PROFILE_COMPATIBILITY
Definition: SDL_video.h:231
SDL_GetWindowData
void * SDL_GetWindowData(SDL_Window *window, const char *name)
Retrieve the data pointer associated with a window.
Definition: SDL_video.c:1864
GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE
Definition: SDL_opengl_glext.h:1001
SDL_CreateTexture
#define SDL_CreateTexture
Definition: SDL_dynapi_overrides.h:306
SDL_GetWindowDisplayIndex
int SDL_GetWindowDisplayIndex(SDL_Window *window)
Get the display index associated with a window.
Definition: SDL_video.c:1050
button
SDL_Texture * button
Definition: testgamecontroller.c:67
SDL_OnWindowShown
void SDL_OnWindowShown(SDL_Window *window)
Definition: SDL_video.c:2603
SDL_MessageBoxData::numbuttons
int numbuttons
Definition: SDL_messagebox.h:101
SDL_EnableScreenSaver
void SDL_EnableScreenSaver()
Allow the screen to be blanked by a screensaver.
Definition: SDL_video.c:2819
ShouldMinimizeOnFocusLoss
static SDL_bool ShouldMinimizeOnFocusLoss(SDL_Window *window)
Definition: SDL_video.c:2674
i
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
GLint
int GLint
Definition: SDL_opengl.h:182
SDL_WINDOWPOS_ISUNDEFINED
#define SDL_WINDOWPOS_ISUNDEFINED(X)
Definition: SDL_video.h:130
SDL_VideoDisplay::fullscreen_window
SDL_Window * fullscreen_window
Definition: SDL_sysvideo.h:136
SDL_Metal_DestroyView
void SDL_Metal_DestroyView(SDL_MetalView view)
Destroy an existing SDL_MetalView object.
Definition: SDL_video.c:4231
SDL_Point::y
int y
Definition: SDL_rect.h:51
SDL_SYSWM_WINDOWS
@ SDL_SYSWM_WINDOWS
Definition: SDL_syswm.h:125
SDL_RendererInfo::num_texture_formats
Uint32 num_texture_formats
Definition: SDL_render.h:82
SDL_GL_CONTEXT_MAJOR_VERSION
@ SDL_GL_CONTEXT_MAJOR_VERSION
Definition: SDL_video.h:216
SDL_GetNumVideoDrivers
int SDL_GetNumVideoDrivers(void)
Get the number of video drivers compiled into SDL.
Definition: SDL_video.c:446
SDL_syswm.h
SDL_WINDOW_BORDERLESS
@ SDL_WINDOW_BORDERLESS
Definition: SDL_video.h:103
SDL_VideoDevice::windows
SDL_Window * windows
Definition: SDL_sysvideo.h:325
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:734
GL_SAMPLES
#define GL_SAMPLES
Definition: SDL_opengl.h:1840
SDL_GL_ACCUM_GREEN_SIZE
@ SDL_GL_ACCUM_GREEN_SIZE
Definition: SDL_video.h:208
SDL_GetSpanEnclosingRect
SDL_bool SDL_GetSpanEnclosingRect(int width, int height, int numrects, const SDL_Rect *rects, SDL_Rect *span)
Definition: SDL_rect.c:469
SDL_GetRendererInfo
#define SDL_GetRendererInfo
Definition: SDL_dynapi_overrides.h:304
SDL_WINDOW_VULKAN
@ SDL_WINDOW_VULKAN
Definition: SDL_video.h:121
GL_CONTEXT_RELEASE_BEHAVIOR_KHR
#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR
Definition: gl2ext.h:83