src/video/SDL_video.c


Log

Author Commit Date CI Message
Dean Herbert 6bcde52d 2022-07-24T20:19:16 Further adjust implementation of `Cocoa_GetWindowDisplayIndex` As discussed in PR review, there may be an off-chance that the index returned doesn't match up with SDL's display indexing. This change ensures that the indices match and adds a safety check for off-screen windows.
rohlem b085c182 2022-07-04T16:38:05 make SDL_SetTextInputRect take a pointer to const The documentation doesn't state that the argument is ever modified, and no implementation does so currently. This is a non-breaking change to guarantee as much to callers.
chalonverse f317d619 2022-07-01T13:59:14 Xbox GDKX support (#5869) * Xbox GDK support (14 squashed commits) * Added basic keyboard testing * Update readme * Code review fixes * Fixed issue where controller add/removal wasn't working (since the device notification events don't work on Xbox, have to use the joystick thread to poll XInput)
chalonverse 3b191580 2022-06-27T17:19:39 Windows GDK Support (#5830) * Added GDK * Simplfied checks in SDL_config_wingdk.h * Added testgdk sample * Added GDK readme * Fixed error in merge of SDL_windows.h * Additional GDK fixes * OpenWatcom should not export _SDL_GDKGetTaskQueue * Formatting fixes * Moved initialization code into SDL_GDKRunApp
Eric Wasylishen ab81a559 2022-06-07T02:01:27 Windows DPI scaling/highdpi support Adds hint "SDL_WINDOWS_DPI_SCALING" which can be set to "1" to change the SDL coordinate system units to be DPI-scaled points, rather than pixels everywhere. This means windows will be appropriately sized, even when created on high-DPI displays with scaling. e.g. requesting a 640x480 window from SDL, on a display with 125% scaling in Windows display settings, will create a window with an 800x600 client area (in pixels). Setting this to "1" implicitly requests process DPI awareness (setting SDL_WINDOWS_DPI_AWARENESS is unnecessary), and forces SDL_WINDOW_ALLOW_HIGHDPI on all windows.
Sam Lantinga 5669743a 2022-05-19T09:45:57 Make sure SDL_CaptureMouse() is only called on the main thread Windows handles mouse capture on a per-thread basis, and capture must be done on the thread used to create a window. Fixes https://github.com/libsdl-org/SDL/issues/5577
Sam Lantinga 0e6d4baa 2022-05-19T01:23:24 Fixed compile warning on gcc 11
Sam Lantinga e19a9a79 2022-05-18T15:29:59 Fixed a message box getting the mouse capture state out of sync
Cameron Cawley 0cca71a8 2022-05-18T22:12:05 Use SDLCALL for callbacks in public APIs
Sam Lantinga 06aca7ed 2022-05-18T10:09:24 Fixed warping back into the window when gaining focus with warp relative mode enabled
Alexander Kanavin adac3bd1 2022-05-03T12:31:50 video: restore ability to disable fb accel via hint Somewhere in code refactoring between .20 and .22 this check was lost, and so the hint had no effect anymore.
Michael Fitzmayer fbd230bb 2022-05-03T17:51:49 Add support for the Nokia N-Gage (#5597) * Add initial support for the Nokia N-Gage * N-Gage: disable clipping for the time being, issue needs to be resolved later * Move va_copy definition to SDL_internal.h * Move stdlib.h include to SDL_config_ngage.h, much cleaner this way * Remove redundant include, add HAVE_STDLIB_H * Revert "N-Gage: disable clipping for the time being, issue needs to be resolved later" This reverts commit 4f5f0fc36cc7f34fad05e45671dfa7b8dc32fd51. * N-Gage: fix clipping issue by providing proper math functions
Mirko Galimberti 76afb858 2022-04-25T10:35:56 Introduces Cocoa_GetWindowDisplayIndex. This enable a proper management for dpi when switching between retina and non-retina displays.
Frank Praznik 2b529461 2022-04-15T11:51:02 video: Don't minimize fullscreen windows on focus loss by default when mode switching is disabled When mode switching is disabled in a video backend, fullscreen windows are basically just fullscreen desktop windows with different internal scaling. As no mode switching occurs, there's no need to minimize them on focus loss by default. This can still be overridden by explicitly setting the internal hint for minimizing on focus loss. This has the side effect of fixing a bug on GNOME, where, when a fullscreen Wayland window has it's focus lost and restored via alt+tab followed by switching back to windowed mode, the top portion of the window won't end up being obstructed by GNOME's top bar.
Sam Lantinga 254fcc90 2022-04-18T09:03:14 Revert "video: Prefer Wayland over X11" This reverts commit 8ceba27d6291f1195e13608033ec439aec621fc6. SDL Wayland support is stable, but there are a number of issues with third-party software (NVIDIA drivers, libwayland event overflow, libdecor not handling plugin load failures, Steam overlay not working with Wayland, etc.) that make it better to default to X11 at this time. Games which would like to prefer wayland when available can use the following code before SDL_Init(): SDL_SetHint(SDL_HINT_VIDEODRIVER, "wayland,x11"); Fixes https://github.com/libsdl-org/SDL/issues/5527
Ryan C. Gordon c1336b21 2022-04-17T12:43:32 hints: Make SDL_VIDEODRIVER and SDL_AUDIODRIVER formal hints. They were just environment variables before. Fixes #5528.
pionere 01b14e14 2022-04-12T08:49:19 avoid NullPointer in SDL_GL_MakeCurrent
Frank Praznik 4d76c9cb 2022-03-25T20:35:07 video: wayland: Use wp-viewporter for fullscreen with non-native resolutions Wayland doesn't support mode switching, however Wayland compositors can support the wp_viewporter protocol, which allows for the mapping of arbitrarily sized buffer regions to output surfaces. Use this functionality, when available, for fullscreen output when using non-native display modes and/or when dealing with scaled desktops, which can incur significant overdraw without this extension. This also allows for the exposure of arbitrarily sized, emulated display modes, which can be useful for legacy compatability.
Ryan C. Gordon 4fe7b2cb 2022-03-24T11:00:43 static analysis: Fixed several complaints from codechecker. There are still some pending Objective-C specific issues. Reference issue #4600.
Charlie Birks 4b8d69a4 2022-03-22T17:09:44 Avoid trying to use texture framebuffers on emscripten
Sam Lantinga 34fd83ca 2022-03-22T06:50:10 Don't try to hide foreign windows when destroying the SDL window representation Fixes https://github.com/libsdl-org/SDL/issues/5432
Sam Lantinga e5f45455 2022-03-17T14:44:34 Added a hint to mark a foreign window as usable with OpenGL Fixes https://github.com/libsdl-org/SDL/issues/2942
Ethan Lee 0bf8ccfb 2022-02-08T22:15:11 video: Add a hint to allow Vulkan surfaces on foreign windows
Zach Reedy d14a1263 2022-03-11T17:45:17 IME Composition Truncation + SDL_IsTextInputShown + SDL_ClearComposition (#5398) * Fixes for IME Composition Truncation + Addition of SDL_ClearComposition, SDL_IsTextInputShown * Fixed: Documentation and code style issues raised during code review.
Sylvain 45833a14 2022-03-09T15:33:45 Prevent shadowing static variable '_this' with local paramter '_this' of SDL_CreateWindowTexture
Sylvain a4a80c86 2022-03-09T15:21:55 Fix variable may be uninitialized when used here [-Wconditional-uninitialized]
Cameron Cawley 2f7b885d 2022-02-28T16:30:34 Fix 'potentially uninitialized local pointer variable' error in UWP builds
Ryan C. Gordon b946e31e 2022-02-23T09:10:46 video: Allow unaccelerated SDL_HINT_FRAMEBUFFER_ACCELERATION renderers. If the app requested a specific renderer, even if it's not the optimal path, let them have it, because they might want to render with a specific GPU API on top of the framebuffer pixels. This fixes DosBox-X crashing on startup, which forces the hint to "opengl".
Ryan C. Gordon 60ddb74c 2022-02-02T12:19:37 video: rework how we prepare a texture framebuffer. Now we see if we can create an SDL_Renderer, and if that renderer reports itself as "accelerated," and added some initial heuristics to the OpenGL renderer to make better decisions about what qualifies as "accelerated." This adds some FIXMEs that might be merely hypothetical, and removes the old OpenGL checks from the video subsystem that probably weren't meaningful in modern times. This will definitely need to improve the existing list in the GL renderer, to catch things like llvmpipe, etc. Reference issue #4624.
pionere 60deadba 2022-01-17T17:22:30 re-use return value of SDL_SetError/WIN_SetErrorFromHRESULT/SDL_OutOfMemory
pionere ebdd5366 2022-01-17T16:26:02 use SDL_InvalidParamError or SDL_assert instead of custom SDL_SetError
pionere e11ba0f5 2022-01-08T12:03:57 do not load/unload opengl library when SDL_WINDOW_METAL flag is changed
Ryan C. Gordon 19ae71b2 2022-01-27T11:48:32 video: Don't add SDL_WINDOW_(METAL|OPENGL) to new windows if unsupported. Fixes #4656. (Better than the previous fix in 3044310518dbb2d4814b32c6521f332b8d69aae5.)
Ryan C. Gordon 30443105 2022-01-26T21:10:15 video: Don't add SDL_WINDOW_METAL to new windows if not using Cocoa or UIKit. Fixes #4656.
Ryan C. Gordon f37e4a94 2022-01-26T17:02:49 video: Don't check if we can use a "texture framebuffer" until needed. This prevents SDL from making an OpenGL context and maybe throwing it away immediately by default. It will now only do it when trying to request a window framebuffer directly, or creating an SDL_Renderer with the "software" backend, which makes that request itself. The way SDL decides if it should use a "texture framebuffer" needs dramatic updating, but this solves the immediate problem. Reference Issue #4624.
Ethan Lee 8ceba27d 2021-04-17T12:07:38 video: Prefer Wayland over X11
Mathieu Eyraud 2a0cde8f 2022-01-16T09:40:51 Always send SDL_WINDOWEVENT_SIZE_CHANGED when window is resized SDL_WINDOWEVENT_SIZE_CHANGED is now sent even if the resulting size of the window does not match the requested size.
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Ryan C. Gordon e4000c02 2021-12-31T10:30:51 video: SDL_GL_GetAttribute needs to operate on FBO 0. If a different FBO is bound, this would return incorrect results. Fixes #5082.
Erik Soma 71e3998d 2021-11-23T17:56:46 Make SDL_VideoInit cleanup when errors occur before video driver creation.
Sylvain 0445c13a 2021-11-22T16:49:17 Remove 'malloc' from comment
Sam Lantinga 98c98362 2021-11-10T11:04:51 Don't clobber the error in SDL_ShowMessageBox() if one has been set at the platform level Fixes https://github.com/libsdl-org/SDL/issues/4760
Sam Lantinga 6c4b4ee7 2021-11-10T09:41:43 Don't assert on API parameters This causes lots of spam in test automation and it's not clear it's useful to developers. If we need this level of validation, we should add a log category for it.
Sam Lantinga fed85778 2021-11-10T08:47:39 Update the orientation and display modes when the display settings change on Windows Fixes https://github.com/libsdl-org/SDL/issues/1061
Sam Lantinga d2f75636 2021-11-09T11:53:59 When making the window centered it should use windowed mode size since it doesn't affect fullscreen windows Fixes bug https://github.com/libsdl-org/SDL/issues/4750
Sam Lantinga fd79607e 2021-11-08T21:34:48 Added SDL_GetWindowMouseRect() Also guarantee that we won't get mouse movement outside the confining area, even if the OS implementation allows it (e.g. macOS)
Ethan Lee 4b42c05b 2021-11-08T13:52:48 video: Add SDL_SetWindowMouseRect. This API and implementation comes from the Unreal Engine branch of SDL, which originally called this "SDL_ConfineCursor". Some minor cleanup and changes for consistency with the rest of SDL_video, but there are two major changes: 1. The coordinate system has been changed so that `rect` is _window_ relative and not _screen_ relative, making it easier to implement without having global access to the display. 2. The UE version unset all rects when passing `NULL` as a parameter for `window`, this has been removed as it was an unused feature anyhow. Currently this is only implemented for X, but can be supported on Wayland and Windows at minimum too.
Cameron Cawley 25c71748 2020-02-13T21:55:08 Add a barebones RISC OS video driver
Cacodemon345 19dee1cd 2021-10-22T06:37:20 Add SDL_GetWindowICCProfile(). (#4314) * Add SDL_GetWindowICCProfile * Add new SDL display events * Implement ICC profile change event for macOS * Implement ICC profile notification for Windows * Fix SDL_GetWindowICCProfile() for X11 * Fix compile errors
Sam Lantinga 1c5b3e0e 2021-10-15T18:12:18 Don't center the mouse when gaining focus unless we're using relative mode warping This is necessary now that we actually change the mouse position when calling SDL_WarpMouseInWindow() in relative mode.
Lee Salzman 9fae8f70 2021-08-29T15:33:58 Treat empty SDL_VIDEODRIVER var to check all video drivers.
Sam Lantinga 629e9f82 2021-08-13T11:06:43 Fixed return value of SDL_GetGrabbedWindow() when we have an internal grab because of mouse relative mode
Sam Lantinga 6aa1498b 2021-08-13T11:03:19 This assert wasn't correct, we set the internal grab for mouse relative mode as well.
Sam Lantinga 016b02f2 2021-08-10T12:16:55 Fixed build, C89 doesn't allow non-constant static initializers
Sam Lantinga fcfd19db 2021-08-10T12:02:17 Added support for SDL_RENDERER_PRESENTVSYNC to the software renderer This fixes https://github.com/libsdl-org/SDL/issues/4612
Sebastian Krzyszkowiak b3a989d0 2021-08-10T13:08:27 video: Fix false positives in driver name comparison Without this change, driver names don't get matched correctly; for example "x" can get matched with "x11" since it only checks whether the string matches up to the length of the requested driver name.
Sam Lantinga 88674b4a 2021-08-04T13:17:35 Fixed build
Sam Lantinga c14813a8 2021-08-04T13:00:14 Fixed spacing
Sam Lantinga 3cad447e 2021-08-04T12:57:51 Only update the window size if setting the display mode succeeded
Daniel Gibson 0eb6f791 2021-05-21T13:48:14 SDL_SetWindowDisplayMode(): If already fullscreen, adjust window size Otherwise only the display resolution is changed, but the SDL window size (and for example the window-surface size) aren't adjusted accordingly and thus don't fill the whole screen. See #3313
Daniel Gibson 72d81285 2021-05-19T18:47:56 Improve SDL_CreateWindow() fullscreen support on Windows .. and maybe other platforms as well (though X11 was not affected)? The issue was that passing a higher resolution than the current desktop resolution to SDL_CreateWindow() with SDL_WINDOW_FULLSCREEN didn't switch to that resolution (even though it did switch to lower resolutions). When creating a fullscreen window, window->fullscreen wasn't even set at all (only zeroed out), setting it only happened if the user explicitly called SDL_SetWindowDisplayMode(). So without that, SDL_CreateWindow() -> SDL_UpdateFullscreenMode() -> SDL_GetWindowDisplayMode() used the resolution from window->windowed.w/h which were limited to the desktop size due to some weird combination of WIN_AdjustWindowRectWithStyle() and WIN_WindowProc() being called after a call to SetWindowPos(). fixes #3313
Sam Lantinga 69518b9e 2021-07-29T17:09:24 Make sure we don't send a resize event while a window is being destroyed This fixes https://github.com/libsdl-org/SDL/issues/3669
Sam Lantinga 8e35ff5c 2021-07-28T14:20:29 By default minimize real fullscreen windows when they lose focus so the desktop video mode is restored. This fixes https://github.com/libsdl-org/SDL/issues/4039
Ozkan Sezer d80ef3e5 2021-07-26T22:51:24 SDL_VideoInit: silence 'may be used uninitialized' warning src/video/SDL_video.c:475: warning: 'i' may be used uninitialized in this function
Luis Cáceres 5ec69285 2021-04-02T06:16:09 Support comma-separated lists in SDL_VIDEODRIVER
Sam Lantinga f1633127 2021-07-24T13:41:55 Added a window flash operation to be explicit about window flash behavior
Sam Lantinga e1c3a250 2021-07-24T12:11:27 Changed SDL_FlashWindow() so it doesn't take a flash count, and added the hint SDL_HINT_WINDOW_FLASH_COUNT to control behavior on Windows
Jupeyy 64724db0 2021-06-04T19:55:30 Implement bare minimum for SDL_FlashWindow
Joseph Lyncheski a0a5da5d 2021-04-19T07:13:38 Add SDL_SetWindowAlwaysOnTop()
Ethan Lee 27b74d33 2021-03-25T23:25:34 Implement Wayland_ShowMessageBox using Zenity
uyjulian c8abc88c 2021-01-29T01:26:35 Add support for message box
Ivan Epifanov 3c1fe9ce 2021-02-12T23:46:01 WTF
uyjulian b52e9459 2021-01-29T01:26:13 Add support for open URL
Ivan Epifanov 2d64e37e 2020-11-02T18:09:43 Initial rebase of xerpi's port
Alex Szpakowski 9b9d0d48 2021-02-15T11:49:09 mac/iOS: allow Metal in windows created without an explicit backend Fixes SDL_CreateWindowAndRenderer (and similar situations) not choosing a Metal backend. See #3991. Passing an explicit backend into CreateWindow, eg SDL_WINDOW_OPENGL or SDL_WINDOW_METAL, will still prevent the window from being used with other backend types.
Sam Lantinga a60af1e4 2021-02-04T07:00:06 Backed out changeset 1cde3dd0f44d - this breaks windows which are created and then set to FULLSCREEN_DESKTOP
Sam Lantinga e404b525 2021-02-03T21:31:50 KMSDRM doesn't have a window manager, so all windows are fullscreen
Cameron Gutman 6b057c67 2021-01-26T19:16:17 Expose separate keyboard and mouse grab support This adds SDL_SetWindowKeyboardGrab(), SDL_GetWindowKeyboardGrab(), SDL_SetWindowMouseGrab(), SDL_GetWindowMouseGrab(), and new SDL_WINDOW_KEYBOARD_GRABBED flag. It also updates the test harness to exercise this functionality and makes a minor fix to X11 that I missed in https://hg.libsdl.org/SDL/rev/02a2d609369b To fit in with this new support, SDL_WINDOW_INPUT_CAPTURE has been renamed to SDL_WINDOW_MOUSE_CAPTURE with the old name remaining as an alias for backwards compatibility with older code.
Cameron Gutman a0d3c6c6 2021-01-25T21:42:14 Rename SetWindowGrab() to SetWindowMouseGrab()
Cameron Gutman e1f73e64 2021-01-23T16:22:44 Refactor keyboard grab to be managed by the video core This gives us flexibility to add others hints to control keyboard grab behavior without having to touch all of the backends. It also allows us to possibly expose keyboard grab separately from mouse grab for applications that want to manage those independently.
Manuel Alfayate Corchete b2449473 2021-01-08T18:57:12 [KMS/DRM] Go back to the LEGACY interface only because using planes breaks compatibility with HW, so no advantage on using ATOMIC.
Sam Lantinga 393c8c1f 2021-01-03T10:32:55 Fixed bug 5440 - MacCatalyst build failures C.W. Betts I tested building commit http://hg.libsdl.org/SDL/rev/7adf3fdc19f3 on Mac Catalyst and found some issues: * MTLFeatureSet_iOS_* enums aren't available under Mac Catalyst. * OpenGL ES is unavailable under Mac Catalyst. * Some Metal features are available under Catalyst but not iOS, such as displaySyncEnabled. * Set Metal as the default renderer on Mac Catalyst Attaching a patch that will make SDL2 build for Mac Catalyst.
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Sam Lantinga f8839289 2020-12-15T12:22:48 Potential fix for bug 5393 - KMSDRM: using atomic mode setting breaks GPU compatibility Substring I was trying the KMSDRM video backend with some very simple programs that were working ok on 2.0.12. The same code won?t work on the current dev branch and I get: DEBUG: check_modesetting: probing ?/dev/dri/card0? DEBUG: /dev/dri/card0 connector, encoder and CRTC counts are: 4 5 6 DEBUG: check_modesetting: probing ?/dev/dri/card0? DEBUG: /dev/dri/card0 connector, encoder and CRTC counts are: 4 5 6 DEBUG: KMSDRM_VideoInit() DEBUG: Opening device /dev/dri/card0 DEBUG: Opened DRM FD (3) DEBUG: no atomic modesetting support. DEBUG: Video subsystem has not been initialized INFO: Using SDL video driver: (null) DEBUG: Video subsystem has not been initialized After carefully checking, the radeon driver doesn?t support atomic modesetting. That?s not the only problem : the same happens with the amdgpu driver if we disable Display Core (kernel parameter amdgpu.dc=0, which is required to get analogue outputs working). This is a major regression in the KMSDRM driver. Using atomic mode setting is great, but having no fallback to the "standard KMS" is bad.
Ozkan Sezer f1cab8ae 2020-12-10T11:20:56 fix bug #5253: handle NULL title or message fields in SDL_MessageBoxData - SDL_video.c (SDL_ShowMessageBox): replace messageboxdata, set title or message field to "" if either of them is NULL. - SDL_video.c (SDL_ShowSimpleMessageBox): set title or message to "" if either of them is NULL for EMSCRIPTEN builds. - SDL_bmessagebox.cc: add empty string check along with NULL check for title and message fields. - SDL_windowsmessagebox.c (AddDialogString): remove NULL string check - SDL_windowsmessagebox.c (AddDialogControl): add empty string check along with the NULL check. - SDL_x11messagebox.c: revert commit 677c4cd68069 - SDL_os2messagebox.c: revert commit 2c2a489d76e7 - test/testmessage.c: Add NULL title and NULL message tests.
Sam Lantinga d46dd103 2020-12-09T07:49:07 Fixed typo in Vulkan load logic
Sylvain Becker 035f8f23 2020-12-02T13:37:59 SDL_RecreateWindow: allow clearing VULKAN when recreating the window
Sylvain Becker 93fbab0f 2020-12-02T11:04:53 SDL_ReCreateWindow: allow to unload METAL window and switch back to OpenGL. On older mac, where METAL Renderer METAL fails to create, it allows to switch back to OpenGL SDL_Renderer by re-creating the window (METAL flags was previously persistent).
Sam Lantinga f1b603ac 2020-10-20T11:51:23 Fixed bug 5323 - SDL_SetWindowMaximumSize fails if Width or Height is equal to minimum Height or Width batyastudios Basicly there is problem and somewhat a solution: https://discourse.libsdl.org/t/setwindowmaximumsize-bug/28267 If you SDL_SetWindowMaximumSize() after SDL_SetWindowMinimumSize() with one of axes have the same value, function will have no effect. This: (line 2144@SDL_video.c) if (max_w <= window->min_w || max_h <= window->min_h) { SDL_SetError("SDL_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size"); return; } May be changed to this: if (max_w < window->min_w || max_h < window->min_h) { SDL_SetError("SDL_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size"); return; }
Ozkan Sezer d2723875 2020-10-14T23:01:06 os2: integrate the port into main tree.
Ozkan Sezer d86a7465 2020-10-09T02:55:00 SDL_video.c: fix whitespace
Sam Lantinga 76980e30 2020-10-08T16:42:20 Added events for dynamically connecting and disconnecting displays, with an iOS implementation
Ryan C. Gordon 092162ed 2020-09-10T15:02:51 video: Set up default before calling GL_DefaultProfileConfig(). This way, the implementation can opt to do nothing to accept SDL's defaults.
M Stoeckl 052a1373 2020-07-12T19:11:15 Merge VideoBootStrap::available into VideoBootStrap::create The two are only ever called together, and combining them makes it possible to eliminate redundant symbol loading and redundant attempts to connect to a display server.
Ryan C. Gordon 694fea8a 2020-06-26T21:37:29 video: Make SDL_CreateWindow use SDL_Init(SDL_INIT_VIDEO), not SDL_VideoInit. Otherwise, the video subsystem won't deinitialize during SDL_Quit(). Fixes Bugzilla #5067.
Ryan C. Gordon 1947ca70 2020-06-26T20:16:43 video: Changed SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS to default to FALSE. Fixes Bugzilla #5106. (and probably many others, too!)
Ryan C. Gordon 60435712 2020-06-03T16:42:19 video: Set window->surface NULL after freeing it. Otherwise, when SDL_CreateWindowFramebuffer() is called again, it will return the free'd surface instead of creating a new one.
Sam Lantinga f16e6bfa 2020-05-25T14:10:51 Fixed creating a metal renderer without specifying a metal window
Ryan C. Gordon 389c8995 2020-04-13T14:44:21 opengl: Allow SDL_GL_MakeCurrent() to accept a NULL window (thanks, Martin!). This allows you to bind surfaceless contexts on a background thread to, for example, load assets in a separate context, for platforms that have different requirements about sharing surfaces, etc. Martin's notes on the matter: "Here's a patch that enables passing NULL windows to SDL_GL_MakeCurrent, if the involved APIs allow it. Currently, this is only the case for EGL, and even then only if some specific extensions are present (which they usually are). If "surfaceless" contexts are not supported, SDL_GL_MakeCurrent continues to generate an error (albeit with a more specific error message than it used to), so this should not break anything that wasn't broken before." (Please see https://bugzilla.libsdl.org/show_bug.cgi?id=3695 for more discussion.) Fixes Bugzilla #3695.
Jay Petacat 8a5ee3fa 2020-04-12T00:55:52 video: NULL out pointer to freed window surface This behavior matches SDL_RecreateWindow and makes it less likely that another piece of code (e.g. a DestroyWindowFramebuffer implementation) will attempt to use or free the stale surface pointer.