src/video


Log

Author Commit Date CI Message
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 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.
Ryan C. Gordon b9e1d1b4 2022-10-09T19:49:34 events: Rename SDL_SendKeyboardKeyComplete to SDL_SendKeyboardKeyAndKeycode.+
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.
Frank Praznik 4223e6ac 2022-10-26T13:14:50 wayland: Early-out sooner when requesting fullscreen on a popup Exit the fullscreen sequence sooner if it is requested that a popup window be fullscreen. The surface commit formerly in this path is irrelevant and can be removed as previous changes made it so that SetFullscreen() is no longer called from anywhere except Wayland_SetWindowFullscreen().
Ryan C. Gordon 41d38c0f 2022-10-26T09:43:04 shape: More robust handling of failure cases in CreateShaper.
Ryan C. Gordon c8d20f96 2022-10-25T23:13:34 shape: Free platform-specific shaped window data. Fixes #2128.
Frank Praznik 30c2dac7 2022-10-25T20:00:38 wayland: Remove duplicate #include statement
Sam Lantinga b6cf889a 2022-10-25T15:09:43 Use ScreenCount() instead of SDL_GetNumVideoDisplays() The limitation appears to be specific to multi-screen setups
Sam Lantinga e3f5744d 2022-10-25T12:14:00 Don't use XIWarpPointer() on multi-display configurations
Ozkan Sezer 20beed30 2022-10-25T14:56:32 SDL_EGL_GetProcAddress: remove unnecessary underscore-prepended search. Closes https://github.com/libsdl-org/SDL/issues/6236.
Steven Noonan 053b5f85 2022-08-25T20:18:03 SDL_windowsevents: minimize white screen flash on window creation Clear the window to black on the initial window draw, to avoid a really obnoxious white flash. This doesn't always eliminate it, but it definitely minimizes it.
Steven Noonan d2300516 2022-09-07T06:49:02 cocoa: set sRGB colorspace on nswindow This makes the colorspace match across different graphics APIs. By default, OpenGL was getting a much more saturated colorspace (maybe Display P3?) and it was looking very different from the rendering done by Metal or MoltenVK.
Steven Noonan 019e9d4c 2022-08-25T23:15:58 SDL_cocoavideo.m: add missing SDL_cocoaopengles.h include
Thomas Cashman 8db3a338 2022-10-23T15:45:20 #6433 Fix WINRT_IsScreenKeyboardShown on Xbox
Sam Lantinga 413500ab 2022-10-22T09:37:34 Replaced mouseWheelGesture with GCMouse support on iOS (thanks @russelltg!) Fixes https://github.com/libsdl-org/SDL/issues/6411
Deve 2ebaafa6 2022-10-18T21:02:49 Use translationInView for mouse wheel event
Ozkan Sezer 0e1d19cf 2022-10-22T18:56:40 fix build errors resulting from -Wmisleading-indentation
Sam Lantinga a905a786 2022-10-22T08:50:18 Clear the previous bitmap when calculating a new window shape Fixes https://github.com/libsdl-org/SDL/issues/6428
Deve 7e108816 2022-10-18T01:07:54 Fixed command modifier on macOS
Deve cdf312c8 2022-10-18T00:48:55 Fixed mouse warp after resizing window on macOS.
David Jacewicz 7c7cd2a6 2022-10-17T14:04:29 Fix issue #6037 (incorrect modifier flags on Wayland)