src/video


Log

Author Commit Date CI Message
Matt Durgavich dfc56cfc 2023-01-05T11:54:27 Fix For issue #6948 (#6991) MessageBoxes attached to a window in macOS should use modal APIs and not use a poll/sleep pattern on the main thread. Sleeping the main thread makes the NSWindow message loop sluggish and interferes with external applications that need to send messages to that window, such as VoiceOver.
Anonymous Maarten 33ec2a5e 2023-01-23T20:41:23 vita: fix reformatting error in SDL_vtagl_pvr.c
Frank Praznik ea179abd 2023-01-16T13:39:26 wayland: Enforce or override libdecor minimum window size libdecor plugins can change the min/max window size values internally to enforce a minimum window size, and errors and crashes can result if the window size is below the internal limit. On versions of libdecor >= 0.1.1, the minimum width and height can be queried and the minimum required window size will be enforced. The application requested window size is still respected, however, the actual window may be slightly larger than the drawable area to accommodate the required libdecor minimum size. On version 0.1.0 of libdecor, which lacks the function to retrieve the minimum size, the internal limits are overridden before committing a frame, so that the internal limits always match the window size as a workaround, even if the window is technically smaller than the plugin would normally allow. (cherry picked from commit 423a82cd4b65cf72668551093bfdf58d49bce9ce)
raphasamp eabd88ed 2023-01-22T08:09:24 Update SDL_vitagles_pvr.c This was broken unintentionally during #6545.(cherry picked from commit 9211c0b639ad32865efa4980d07fc24f3f4a1577)
Guldoman 7b8f0ba8 2023-01-19T21:12:51 wayland: Set `APPLICATION` scancode name to `Menu` This mimics the behavior of the other platforms. (cherry picked from commit 6c06f5ce93c55fe0f5779d5aeb68bec1bd935455)
Frank Praznik f836b465 2023-01-12T20:44:16 Revert "wayland: Don't try to restore non-resizable windows" This reverts commit e35c3872dc6a8f7741baba8b786b202cef7503ac. (cherry picked from commit 180afcdf3998e5175b744d3f2d87147802809450)
Frank Praznik a47a0451 2023-01-12T16:32:04 wayland: Don't try to restore non-resizable windows Libdecor can crash if attempting to un-maximize a window that was not set as resizable. (cherry picked from commit e35c3872dc6a8f7741baba8b786b202cef7503ac)
Frank Praznik e8ae1555 2023-01-12T15:36:35 wayland: Perform a round trip when maximizing and restoring windows Perform a round trip when maximizing and restoring windows so the changes have already taken effect when the associated functions return. (cherry picked from commit 50f2eb7d41fbba7c82630e55ead4ecf9c32f4c69)
Sam Lantinga 0479df53 2023-01-09T09:48:21 Updated copyright for 2023
Guldoman ad0d1e2a 2023-01-04T18:47:16 wayland: Fallback to default cursor if chosen one wasn't found (cherry picked from commit 5a4283134542d4bdb3d968a836387a750ce80517)
Sylvain 7bf4319e 2023-01-06T21:24:24 fix computation of alpha in BlitRGBtoRGBPixelAlphaMMX3DNOW (see #6990) ( same as BlitRGBtoRGBPixelAlphaMMX )
Sylvain 0ebda874 2023-01-06T13:27:53 Fixed bug #6990: fix computation of alpha in BlitRGBtoRGBPixelAlphaMMX
Sylvain 0a9f61fb 2023-01-03T16:35:51 Wayland / Drag and Drop: find the current window
Sylvain Becker d234f7a4 2023-01-02T18:09:57 SDL2: backport SDL_CalculateYUVSize() that checks for YUV size overflow (#6972)
João Henrique af54c821 2022-12-23T09:52:45 kmsdrm: Fix wrong check on KMSDRM_CreateWindow. A previous cleanup commit inverted a statement that checked the return value of a KMSDRM_CreateSurfaces call during KMSDRM_CreateWindow, which causes the video backend to always fail despite success. This commit restores the intended behavior. Fixes: 3c501b963dd8 ("Clang-Tidy fixes (#6725)"). (cherry picked from commit 0187209f461b84d22fc49a03369506e06448f47f)
Rudolf-Walter Kiss-Szakacs 232ed540 2022-12-02T07:22:31 Add SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS.
Caleb Cornett c542aef6 2022-12-20T23:22:55 Fix GDK OpenGL build error
Caleb Cornett 3b3c141f 2022-12-19T17:38:44 gdk: Add support for building with OpenGL on Xbox
Sam Lantinga c7097418 2022-12-12T20:26:17 Detect display change when fullscreen desktop windows move displays This happens when using Win+Alt+Left/Right on a resizable fullscreen desktop window on Windows (cherry picked from commit 650e16a8245f3fb5056fc7f6b398fb88244b3477)
Frank Praznik dfd7efaf 2022-12-05T15:33:01 wayland: Set xdg surface geometry It was previously thought that these function calls were unnecessary as the initial bug and reproduction case that necessitated their addition seemed to be fixed, but apparently there are still cases where this needs to be set explicitly. Set the xdg surface geometry at creation time and when the window size changes. Partially reverts #6361. This is not needed in the libdecor path, as libdecor calls this for the content surface internally. (cherry picked from commit 90a964f132c63b07cf85e5687041d214fdea60f6)
Sam Lantinga ab479b49 2022-12-08T17:01:18 Make sure the display list is up to date for window placement
Sam Lantinga 264da8c1 2022-12-08T12:46:13 Added SDL_DISPLAYEVENT_MOVED to detect when display positioning changes
Sam Lantinga cfc7cac3 2022-12-08T12:43:23 Fixed memory leak when removing existing displays
Frank Praznik 8b74be46 2022-12-08T10:56:55 wayland: Handle the Num Lock and Caps Lock modifiers via modifier events Num Lock and Caps Lock always need to be explicitly handled by the modifier handler function, or they won't be correctly set if active at application startup, or if the lock state is changed while the application lacks focus since a key press for these keys will never be received. In these cases, the internal SDL modifier state can end up the inverse of the actual modifier state. (cherry picked from commit 653e484da17d773f40bff94121a23a3b38f47a0a)
Frank Praznik b5483f2c 2022-12-01T18:03:36 Fix formatting on Wayland and Pipewire function signatures Fixes the formatting on some function signatures that clang-format missed. (cherry picked from commit 378b1c286a9c3206e827a47f0147384e92c4c2b2)
Ozkan Sezer b990e914 2022-12-02T02:13:59 build fixes after d0bbfdbfb881e5407911d84c12899bd5b442a130
Sam Lantinga 42238f88 2022-12-01T13:28:48 Fixed build after d0bbfdbfb881e5407911d84c12899bd5b442a130
Pierre Wendling d0bbfdbf 2022-12-01T16:07:03 Clang-Tidy fixes (#6725) (cherry picked from commit 3c501b963dd8f0605a6ce7978882df39ba76f9cd)
Sylvain 09ee811f 2022-12-01T09:39:08 Small format changed (using clang-format 15.0.2-1) (cherry picked from commit 778b8926b4808f0642a331ed84a9e8e19899b6db)
Sam Lantinga 7b100001 2022-11-30T15:51:17 Reverted code formatting for Apple platforms We didn't get the merge right, and rather than tease out exactly what happened, I'm just reverting for now.
Sam Lantinga d87048fd 2022-11-30T14:37:34 Fixed crash if GetRectDisplayIndex() is called before SDL_VideoInit()
Sam Lantinga 6926d046 2022-11-30T13:05:57 Fixed build after cherry-pick of 5750bcb174300011b91d1de20edb288fcca70f8c from SDL3
Sam Lantinga b8d85c69 2022-11-30T12:51:59 Update for SDL3 coding style (#6717) I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base. In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted. The script I ran for the src directory is added as build-scripts/clang-format-src.sh This fixes: #6592 #6593 #6594 (cherry picked from commit 5750bcb174300011b91d1de20edb288fcca70f8c)
David Edmundson d7664a6e 2022-07-11T19:28:37 Support wayland fractional scale protocol The new protocol adds support for more native communication of fractional scaling. Everything in the wayland backend already existed only our fractional scale was calculated implicitly through a combination of output size guesswork for fullscreen windows. This new protocol makes that explicit, providing a more robust solution and a solution for non-fullscreen surfaces. The fallback code is still left in place for now whilst compositors gain support.
pionere 72484511 2022-11-29T18:43:36 video: fix error messages - do not overwrite error message set by SDL_InitFormat (SDL_AllocFormat) - set proper error message (Cocoa_Metal_CreateView) - protect against allocation failure (UIKit_Metal_CreateView) (cherry picked from commit cf0cb44df88a4293805fdc926880155d58a46bea)
Sylvain Becker fb0ce375 2022-11-27T17:38:43 Cleanup add brace (#6545) * Add braces after if conditions * More add braces after if conditions * Add braces after while() conditions * Fix compilation because of macro being modified * Add braces to for loop * Add braces after if/goto * Move comments up * Remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements after merge * Fix inconsistent patterns are xxx == NULL vs !xxx * More "{}" for "if() break;" and "if() continue;" * More "{}" after if() short statement * More "{}" after "if () return;" statement * More fix inconsistent patterns are xxx == NULL vs !xxx * Revert some modificaion on SDL_RLEaccel.c * SDL_RLEaccel: no short statement * Cleanup 'if' where the bracket is in a new line * Cleanup 'while' where the bracket is in a new line * Cleanup 'for' where the bracket is in a new line * Cleanup 'else' where the bracket is in a new line (cherry picked from commit 6a2200823c66e53bd3cda4a25f0206b834392652 to reduce conflicts merging between SDL2 and SDL3)
Joshua Root 2df39e64 2022-11-27T11:27:19 Fix build with Xcode < 7 The _Nullable attribute is not available in older versions. (cherry picked from commit 9a64aa6f95298bf459f8b9dca583df7064956cd9)
Ryan C. Gordon 3f5593d6 2022-11-26T13:57:12 cocoa: Patched to compile on macOS SDK < 10.10. Fixes #6586. (cherry picked from commit fa5adcafd52303fde86c64094462303404259d75)
Michael Fitzmayer e19c532e 2022-11-24T21:53:17 Add bitdraw.h, remove non-working stub class (cherry picked from commit 67f31a19a8eb06ee80bccb9ec8cc8c34aa635b3d)
Frank Praznik 66bd1555 2022-11-23T23:11:25 wayland: Fix build when not using the shared Wayland libraries Explicitly include the Wayland protocol headers when statically linking against the Wayland libraries or older system headers might be used instead of the local versions. (cherry picked from commit 836eb224428aca3bdab2a6bf56d347262e475b15)
Joshua Root 33e5de31 2022-11-24T11:06:37 vulkan_metal.h: Make compatible with ObjC ARC Fixes #6598 (cherry picked from commit 239423e205496997a387b4f265b1cdaf5acd18cb)
Frank Praznik 3eaf5689 2022-11-23T18:11:50 wayland: Fix libdecor_dispatch signature The function returns an int, not a bool. (cherry picked from commit f47169fcba8a27bb0740b6b4993989ff9262c21f)
Joshua Root f52e7199 2022-08-28T00:52:19 Check build-time SDK in LoadMainMenuNibIfAvailable Fixes building against OS X 10.7 SDK. (cherry picked from commit f8cebeea599ae65f36d388257a9d9a8ed8ada576)
Joshua Root e12c831b 2022-11-24T06:32:49 SDL_cocoaopengl.h: ensure CVDisplayLinkRef is defined The typedef seems to be pulled in coincidentally with newer SDKs, but older ones need to import the header explicitly. (cherry picked from commit d2910904fb4062c313636c7595e971f1bf248075)
Frank Praznik fe396e30 2022-11-19T11:28:31 wayland: Use the cached window size when switching from non-floating to floating window state When changing the window state from non-floating to floating (e.g. leaving fullscreen), libdecor can send bogus content sizes that are +/- the height of the window title bar and start 'walking' the window height in one direction or the other with every transition. The floating window size is known, so use the cached value instead of the size reported by libdecor when restoring the floating state.
Sam Lantinga ff99e56d 2022-11-18T12:54:55 Fixed KMSDRM window creation failing if OpenGL libraries are not available, but GLES 2.0 libraries are
Sam Lantinga da9ba3a2 2022-11-18T12:17:27 If a CRTC doesn't have a mode configured, use the preferred or largest mode as the default mode Fixes https://github.com/libsdl-org/SDL/issues/6421
David Gow 81479d87 2022-11-18T21:08:36 wayland: keyboard: Cache text input parameters. Some applications (and embarrassingly, testime is one of them) call SDL_StartTextInput() or SDL_SetTextInputRect() every frame. On KDE/KWin with fcitx5, this causes there to be several preedit events every frame (particularly given some of the workarounds in Wayland_StartTextInput), which slows testime down to an unusable crawl. Instead, make SDL_StartTextInput() a no-op if text input is already enabled, and cache the input rect, only changing it when the new rect is actually different. With these changes, we only get preedit events (and hence SDL_TEXTEDITING events) when the preedit string actually changes. This matches the behaviour under XWayland, and works very smoothly.
Sylvain 16824865 2022-11-18T11:01:21 Cleanup of SDL_SetError that already return -1 value
Sylvain 3e70553c 2022-11-18T11:06:49 Unneed test before calling SDL_FreeSurface
Sylvain ddad901c 2022-11-17T10:43:45 Remove unneeded semicolon
Sam Lantinga 77bcd269 2022-11-16T22:23:16 Allow creating an empty surface with pitch 0 This fixes Maelstrom, which creates an empty staging surface and then uses it for transfer to texture
Sam Lantinga 913e403f 2022-11-16T18:03:29 Fixed error message when trying to create an OpenGLES2 renderer on macOS Testing: testsprite2 --renderer opengles2 OpenGLES2 isn't available by default, and we want to see the error "Could not load EGL library"
Sam Lantinga fcc994e1 2022-11-16T17:39:55 ensure that SDL2 does not set conflicting window flags (thanks @pionere!)
Sylvain ce5da5d5 2022-11-16T21:47:43 Don't compare pointer against '0', but NULL
Sylvain 1d7966df 2022-11-16T21:27:16 Remove un-needed check for NULL pointer. They were previously checked just before.
Ryan C. Gordon 389ffab7 2022-11-16T12:53:48 Code style fixes, etc. Reference PR #6345.
ulatekh ec58a817 2022-10-05T19:26:09 Fixes made in response to running a static code analyzer under MS Windows. Most of these are probably harmless, but the changes to SDL_immdevice.c and SDL_pixels.c appear to have fixed genuine bugs. SDL_audiocvt.c: By separating the calculation of the divisor, I got rid of the suspicion that dividing a double by an integer led to loss of precision. SDL_immdevice.c: Added a missing test, one that could have otherwise led to dereferencing a null pointer. SDL_events.c, SDL_gamecontroller.c, SDL_joystick.c, SDL_malloc.c, SDL_video.c: Made it clear the return values weren't used. SDL_hidapi_shield.c: The size is zero, so nothing bad would have happened, but the SDL_memset() was still being given an address outside of the array's range. SDL_dinputjoystick.c: Initialize local data, just in case IDirectInputDevice8_GetProperty() isn't guaranteed to write to it. SDL_render_sw.c: drawstate.viewport could be null (as seen on line 691). SDL.c: SDL_MostSignificantBitIndex32() could return -1, though I don't know if you want to cope with that (what I did) or SDL_assert() that it can't happen. SDL_hints.c: Replaced boolean tests on pointer values with comparisons to NULL. SDL_pixels.c: Looks like the switch is genuinely missing a break! SDL_rect_impl.h: The MacOS static checker pointed out issues with the X comparisons that were handled by assertions; I added assertions for the Y comparisons. SDL_yuv.c, SDL_windowskeyboard.c, SDL_windowswindow.c: Checked error-result returns.
Ryan C. Gordon 7ebdae5d 2022-11-16T11:45:41 cocoa: Fix OpenGL deprecation warning.
Ryan C. Gordon 7c760f7f 2022-11-16T11:32:08 cocoa: Update CVDisplayLink timing when screen changes. This handles both the window moving to a new display and changing the current display's refresh rate in System Preferences Reference Issue #4918.
Ryan C. Gordon 1fd66cc8 2022-11-16T10:15:21 Revert "cocoa: Backed out CVDisplayLink code for macOS vsync." This reverts commit 04b50f6c6bef67b744b192c78775771b51ff2141. It turns out OpenGL vsync has broken again in macOS 12, so we're reintroducing our CVDisplayLink code to deal with it, again. Reference Issue #4918.
Frank Praznik 903301c6 2022-11-16T02:04:59 wayland: Always use integer scaling for cursors. Cursors don't get fractionally scaled, so always scale system cursor sizes to the next whole integer.
Frank Praznik c8551847 2022-11-04T12:41:46 wayland: Handle virtual keyboards that don't fit the X mapping SDL is built around the concept of keyboards having a fixed layout with scancodes that correspond to physical keys no matter what linguistic layout is used. Virtual keyboards don't have this concept and can present an arbitrary layout of keys with arbitrary scancodes and names, which don't fit the SDL model. When one of these keyboards is encountered, it requires special handling: use the keysym of the pressed keys to derive their ANSI keyboard scancode equivalents for control keys and ASCII characters. All other characters are passed through as text events only.
Frank Praznik 0e446c54 2022-11-04T12:27:36 events: Factor out the xkb keysym to scancode conversion from the X11 driver
Ryan C. Gordon 44d7b8b9 2022-11-15T13:57:01 egl: Check for a NULL pointer in SDL_EGL_GetProcAddress. This happens on kmsdrm if you try to GetProcAddress before creating a window. Fixes #5399.
Ethan Lee f3cc99fb 2022-11-15T13:56:44 x11: Minor style fixes for recent OSK changes
Sam Lantinga 70656b13 2022-11-15T10:18:41 Don't recreate the window when creating a Metal renderer on an OpenGL window. It turns out that we can safely create a Metal view on an existing window, and that avoids issues with the window being recreated with the wrong orientation in iOS 16. Fixes https://github.com/libsdl-org/SDL/issues/6289
Pierre Wendling 80ff20f6 2022-11-14T23:56:20 N3DS: Set keyboard focus to newly created windows. This fixes polling issues with Joystick subsystem where `SDL_PrivateJoystickShouldIgnoreEvent` would always return true, thus ignoring all inputs.
Sam Lantinga a40b7cde 2022-11-14T13:03:52 Workaround for views being in portrait instead of landscape mode on iOS 16 Fixes https://github.com/libsdl-org/SDL/issues/6289
pionere dad8df3e 2022-11-14T08:20:31 video: check graphics flags the same way in SDL_RecreateWindow as in SDL_CreateWindow - single check to validate the graphics flags - check it before tearing down the window
Frank Praznik eef4d3c8 2022-11-13T16:56:04 wayland: Clamp wl_seat version on older versions of libwayland Clamp the wl_seat max version to 5 if being built against a version of libwayland below 1.21.0, or containers that bundle newer versions of SDL with older versions of libwayland can break if the compositor advertises support for a protocol version above 5.
Sam Lantinga 67498926 2022-11-13T11:09:20 Fixed warning Fixes https://github.com/libsdl-org/SDL/issues/5842
Ethan Lee c4b9f621 2022-11-13T12:45:13 x11: Add support for the Steam Deck on-screen keyboard
pionere 5f2a1231 2022-11-13T08:00:03 video: check graphics flags the same way as the type flags
pionere 22354b41 2022-11-12T08:29:15 video: simplify window-type check in SDL_CreateWindow
Michael Fitzmayer 875e9b35 2022-10-26T15:19:28 N-Gage: additional cleanup
Michael Fitzmayer afbafc2a 2022-10-21T08:11:48 Remove redundant dependency to bitdraw.h, minor cleanup
pionere d09edcbc 2022-11-11T12:10:27 video: sync Metal_CreateView with GL_CreateContext and Vulkan_CreateSurface no need to check if _this->Metal_CreateView, since it is already checked in Re(create)Window
pionere b71d9274 2022-11-11T12:09:15 video: add NOT_AN_OPENGL_WINDOW define (similar to NOT_A_VULKAN_WINDOW)
pionere 36c6ed4b 2022-11-11T08:33:55 video: add SDL_DllNotSupported - add SDL_DllNotSupported and use it to sync the behavior of SDL_GL_LoadLibrary with SDL_Vulkan_LoadLibrary
Sam Lantinga f430ef5d 2022-11-10T17:27:48 Don't change the window position when creating it on iOS, it is already placed on the correct display
pionere 29cafa9c 2022-11-10T08:23:16 add SDL_ContextNotSupported and validate flags in SDL_RecreateWindow similar to SDL_CreateWindow
Ryan C. Gordon 1008cc8e 2022-11-09T12:55:27 video: Add some braces to match SDL coding style.
pionere ac3349fa 2022-11-09T09:11:04 solve FIXMEs in SDL_video.c
Hubert Maier 5dc93451 2022-11-06T20:49:37 JANITORIAL : Correct some more spelling mistakes (#6489)
Sam Lantinga c2675d74 2022-11-06T10:52:20 Revert "cocoa: Discard the IME Candidate Window immediately when Escape is pressed" This reverts commit 0d76e2a8a1a8e6a2801123587c2205a288d49406, as it introduced other issues: https://github.com/libsdl-org/SDL/pull/6486#issuecomment-1304684865
Edward Li 0d76e2a8 2022-11-06T04:59:02 cocoa: Discard the IME Candidate Window immediately when Escape is pressed
David Edmundson 689218eb 2022-11-04T12:07:20 Fix wayland reconnection paths Most of this code is disabled out for now. - For mouse cursors we have a wl_surface for both system and custom cursors which needs recreating. - The other patch is about nullification after deletions
Guldoman 084fa4c3 2022-11-01T10:55:17 cocoa: Reset IME when sending composed text This will send an empty `TEXTEDITING` event that is used to signal the end of the composition.
Guldoman 70a41f9b 2022-11-01T09:59:16 wayland: Read `window` data only if `window` is valid
Frank Praznik 33a43005 2022-10-31T12:23:51 wayland: Don't modify the mouse capture flag in relative mode If relative mouse mode is explicitly enabled, don't modify the capture flag on button events or the window might report having lost mouse focus if a button is pressed while moving the cursor.
Hubert Maier 678ef797 2022-10-30T08:53:34 SDL_KMSDRMOPENGLES.H: Correct spelling mistakes begining -> beginning beggining -> beginning
Ethan Lee 571ff1a3 2022-10-30T00:19:09 wayland: Prepare cursor implementation for reconnect support Co-authored-by: David Edmundson <kde@davidedmundson.co.uk>
Ethan Lee 9c8b1fd8 2022-10-29T22:34:05 wayland: Cleanup work to aid reconnect support Co-authored-by: David Edmundson <kde@davidedmundson.co.uk>
Sam Lantinga 4556074e 2022-10-29T09:35:07 Re-set the maximize state if we were maximized while fullscreen
Sam Lantinga ab06a307 2022-10-29T09:21:17 Don't report windows being maximized when fullscreen on X11 This is a functional state for some window managers (tested using stock Ubuntu 22.04.1), and removing that state, e.g. using SDL_RestoreWindow(), results in a window centered and floating, and not visually covering the rest of the desktop.
Ryan C. Gordon b9e1d1b4 2022-10-09T19:49:34 events: Rename SDL_SendKeyboardKeyComplete to SDL_SendKeyboardKeyAndKeycode.+
Ryan C. Gordon 92215481 2022-10-09T19:33:52 emscripten: Make an attempt at correct keyboard scancode/keycodes. This uses a newer browser API to get physical scancodes, but still uses the (deprecated) event field that we were already using for scancodes, but for keycodes instead now, which appears to be more accurate. Since keyboard layout isn't (generally) available to web apps, this adds an internal interface to send key events with both scancode and keycode to SDL's internals, instead of sending just scancodes and expecting SDL to use its own keymap to generate keycodes. Future work in this area would be to use the keyboard layout APIs on browsers that support them, which would allow us to use SDL's usual keymap code and not rely on a deprecated browser API, but until we get there, this patch gives significantly more correct results than we would have before. Fixes #2098.
Sam Lantinga f500c147 2022-10-28T08:39:02 Fixed DirectFB build
Ryan C. Gordon 9e8d2f39 2022-10-27T13:54:53 video: Don't use texture framebuffer on Windows Subsystem for Linux. Reference Issue #6333.