Commit Graph

5051 Commits

Author SHA1 Message Date
Frank Praznik
1de0c4e0f0 wayland: Attach EGL objects to custom and external surfaces during reconfiguration
They are required when using EGL with an external surface.

(cherry picked from commit 06795b00ad)
2026-06-18 10:58:24 -04:00
Frank Praznik
2dc9006711 wayland: External windows are never hidden
Needed for the GPU renderer to function properly.

(cherry picked from commit dbfddb6409)
2026-06-18 10:58:24 -04:00
Sam Lantinga
c548acee53 Added SDL_HINT_ENABLE_STEAM_SCREEN_KEYBOARD
(cherry picked from commit c9b6581210)
2026-06-17 16:49:17 -07:00
Frank Praznik
b7b1f7843d EGL: Always pass the platform type when available
Always pass the EGL platform type for Wayland and X11, or the driver could potentially select the wrong backend if certain envvars are misconfigured.

(cherry picked from commit 34af24276f)
2026-06-12 10:26:51 -04:00
expikr
2e604c2bbb don't fetch timestamp again
(cherry picked from commit ed43ec0277)
2026-06-10 06:27:29 -07:00
Rachel Blackman
f6f1376cbd OpenVR: Actually quit correctly if we get a close/quit message.
(cherry picked from commit a7ecd5f777)
2026-05-27 17:40:58 -07:00
Sam Lantinga
9fe4e5cc87 Revert "android: fixed a possible joystick-related deadlock on application termination"
This reverts commit 6b4ae68460.

It turns out this deadlock is possible for any joystick event delivery combined with an event watcher that locks joysticks. I'm reverting this change for now, and will be working on a better global solution for this problem.

(cherry picked from commit 76560f9e47)
2026-05-27 13:08:45 -07:00
Frank Praznik
5dc7a5daed x11: Fix boolean/enum comparison
This could set the pending flag even if there was no state change requested, which would cause errant sync timeouts in certain situations.

(cherry picked from commit 6a3b0413dc)
2026-05-27 12:16:01 -04:00
Ryan C. Gordon
eee7164d9d x11: SetupWindowData shouldn't add to videodata->windowlist until success.
Fixes #15676.

(cherry picked from commit 22fb9edd5c)
2026-05-27 11:45:31 -04:00
Frank Praznik
483d86588c video: Only ignore modes with a lower color depth in SDL_GetClosestFullscreenDisplayMode()
If a mode with a closer refresh was found, but it had the same color depth as the current best match, it was being dropped. Only ignore the new mode if the color depth is below the current best match.

(cherry picked from commit cd0b796a6e)
2026-05-26 18:28:41 -04:00
Jason Millard
efe6062cf4 iOS: Fix SDL_EVENT_DROP_FILE lost on cold start from URL open
(cherry picked from commit 290f0c831f)
2026-05-22 07:17:06 -07:00
Vittorio Romeo
e8eba4a406 emscripten: dedupe keyboard event listeners across multiple windows
(cherry picked from commit 7f03da9588)
2026-05-22 07:11:44 -07:00
Sam Lantinga
9a1ba9f811 android: fixed a possible joystick-related deadlock on application termination
(cherry picked from commit 6b4ae68460)
2026-05-21 12:20:50 -07:00
Sam Lantinga
5bd0eb068c Fixed a rare crash on Raspberry Pi when creating a window
(cherry picked from commit 19d73016e8)
2026-05-20 15:11:26 -07:00
Sam Lantinga
257de23efc Fixed a rare crash on Raspberry Pi when creating a window
(cherry picked from commit 0dbd9d2a65)
2026-05-20 14:58:41 -07:00
Frank Praznik
b94ffff046 x11: Ignore slave button presses when the window lacks keyboard focus
XInput2 can send slave button presses before FocusIn events, which can confuse the click-through suppression logic. A window must have keyboard focus to grab the mouse anyway, so ignore slave presses when lacking keyboard focus.

(cherry picked from commit ef9a5b7040)
2026-05-20 13:08:47 -04:00
Frank Praznik
6f9205a3c3 x11: Reject click-through button events based on serial
XInput2 may send mouse buttons presses on both the master and slave devices, and the click-through button event should be ignored on both if required.

(cherry picked from commit 8371c09aa7)
2026-05-20 13:08:40 -04:00
Sam Lantinga
69300875ec Allow setting NULL palette on any surface
Fixes https://github.com/libsdl-org/SDL/issues/15654

(cherry picked from commit cfed9b3aca)
2026-05-19 14:22:37 -07:00
Frank Praznik
3b73938b5f video: Windows keep any position set when in fullscreen after leaving fullscreen
Adds an automated test for the behavior as well.

(cherry picked from commit f31ca02723)
2026-05-18 09:10:25 -07:00
Susko3
edad1c5563 Properly fix cursor position in Korean IME
(cherry picked from commit b608108593)
2026-05-18 09:02:23 -07:00
7aGiven
89fa8a4c0c fix Korean caret position
(cherry picked from commit 8e6fed2cbf)
2026-05-18 09:02:23 -07:00
7aGiven
7a4cce82eb WM_IME_SETCONTEXT not set 0
(cherry picked from commit 296231e999)
2026-05-18 07:05:26 -07:00
Frank Praznik
bf7c5e2df2 wayland: Implement Wayland_AcceptDragAndDrop()
This simply toggles a flag that rejects DnD offers if false. Events were previously dropped silently, but rejecting the offer makes some desktops display a proper icon when the drop will not work.

(cherry picked from commit 336d07c2b7)
2026-05-17 11:52:58 -04:00
Ozkan Sezer
e03ee2f0d9 SDL_opengl_glext.h, src/video/directx/d3d12.h: revert unintended changes from commit d70578b9aa
(cherry picked from commit 75c94e9b31)
2026-05-17 16:30:30 +03:00
Anonymous Maarten
f00b0291b3 surface: cannot set a palette to a non-indexed surface
This fixes a UBSAN warning later in this function where it calculates
(1 << SDL_BITSPERPIXEL(surface->format)). The bpp might be >= 32 and
out of range for a bit shift.

(cherry picked from commit d5af35e3fb)
2026-05-14 20:55:02 -07:00
Brenton Bostick
775a8d0ef7 make sure #endif comment matches the macro name
(cherry picked from commit 3ac4e684ab)
2026-05-14 16:29:53 -07:00
Cameron Cawley
c9bdfd8fed Replace custom NEON cast macros with vreinterpret_*_*
(cherry picked from commit a3376acc2e)
2026-05-14 09:16:46 -07:00
Sam Lantinga
f37f4f06d5 Fixed windows getting the wrong size when setting size and aspect ratio back to back
(cherry picked from commit 0e5e772ba9)
2026-05-13 20:40:09 -07:00
Max Seidenstücker
088a0fc91c Static at beginning
GCC: 'static' is not at beginning of declaration [-Wold-style-declaration]

(cherry picked from commit 0c7d4d5a89)
2026-05-13 19:32:50 +03:00
RaceTheMaSe
9363ecc764 Fix warning: strict prototypes (#14992)
clang: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]

(cherry picked from commit 4f183506f6)
2026-05-13 19:32:50 +03:00
Cameron Cawley
17cf746550 Allow formats with alpha channels for window textures
Because the blend mode is explicitly set to SDL_BLENDMODE_NONE, it doesn't matter if there's a transparency channel in the texture format or not for opaque windows. This ensures that a 32-bit format is used with Metal instead of SDL_PIXELFORMAT_RGB565.

(cherry picked from commit b1f390255a)
2026-05-13 08:52:51 -07:00
Anonymous Maarten
2499e1a4c2 stb_image: use SDL_HasSSE2 and <SDL3/SDL_intrin.h> macro's for SSE2 detection
(cherry picked from commit 0457891d50)
2026-05-13 18:10:02 +03:00
Max Seidenstücker
1d8673a885 Void function return
Clang: void function should not return void expression [-Wpedantic]

(cherry picked from commit 144ab4ba99)
2026-05-13 18:10:02 +03:00
Cameron Cawley
08c33bb861 Fix switching modes on RISC OS
(cherry picked from commit 7071efb6a3)
2026-05-12 20:18:26 -07:00
Frank Praznik
321557f339 x11: Store the mouse button serial for emulated pointer events as well
Otherwise, filtered emulated button events, such as for mouse wheels, can slip through the core event handler.

(cherry picked from commit f48525aa70)
2026-05-10 14:18:06 -04:00
Frank Praznik
7cdf4fd7ee wayland: Ensure window dimensions are greater than zero after adjusting for aspect
Resizing to zero can cause a bad viewport size error.

(cherry picked from commit ba3577f584)
2026-05-07 13:17:29 -04:00
Frank Praznik
9257b7bc13 wayland: Queue the surface frame callback after the initial commit
Some compositors may dispatch this too early, during the initial empty commit, when subsurfaces are attached to a toplevel window, but a buffer has yet to be committed to the parent surface. Don't set the frame callback until the initial empty commit is done, so it will be called when the actual parent surface frame is committed.

(cherry picked from commit e3393e6304)
2026-05-06 12:29:11 -04:00
Frank Praznik
68082c7d15 wayland: Unconditionally send an exposure event on window shown status
Some compositors send the frame callback as part of the initial configuration sequence, so the window may already be past the "waiting for frame" state. Ensure that the exposure event is always sent.

(cherry picked from commit 1ac0ae9224)
2026-05-05 18:33:14 -04:00
Frank Praznik
85ebd16fb2 x11: Disable the X Synchronization Extension by default
Under the right conditions, this extension can result is smoother resizing when rendering with OpenGL, however, it is known to cause problems in certain cases, such as when handling presentation externally.

Gate it behind a hint, and disable it by default. Developers can selectively enable it when they verify that they meet the criteria for using it, and that it behaves correctly in their apps/games.

(cherry picked from commit b8545fce54)
2026-05-05 13:51:41 -04:00
Sam Lantinga
05d8af1a75 Fixed rare cursor corruption on Windows
If the cursor was created with a temporary surface that was pointing at external memory, then when the cursor is used it might be referencing memory that had already been freed.

(cherry picked from commit f6f4664ed1)
2026-05-05 08:55:45 -07:00
Frank Praznik
5c107908ff wayland: Pass the inverted flag for horizontal scroll events
Natural scrolling affects both axes, and the compositor may not send the vertical axis orientation if the frame has no vertical scroll motion, so purely horizontal events need to be flagged as inverted as well.

(cherry picked from commit 3ee0439ae5)
2026-05-03 17:45:46 -04:00
Igor
2dbfe0ead9 X11TK: fix late null-check causing segfault
The code is using `controls.window` before checking if it isn't null.

I found this bug by accident when I tried to run `SDL_ShowSimpleMessageBox`.

It first tried using Wayland with `zenity`, but since I don't have `zenity`, it fallbacked to `X11_ShowMessageBoxImpl`.

For some reason it couldn't create a window, maybe something related to XWayland, so `controls.window` was `NULL`.

(cherry picked from commit e70f1bfc29)
2026-05-01 19:13:54 -04:00
Sam Lantinga
259e4fe1a2 Fixed double-backspace with hardware keyboard on iOS
(cherry picked from commit b7726026f8)
2026-04-27 10:55:11 -07:00
Sam Lantinga
aef5dc0967 Use SDL_SendScreenKeyboardShown() and SDL_SendScreenKeyboardHidden() on iOS
We now have events for on-screen keyboard visibility, so we should use these instead of starting and stopping text input.

Fixes https://github.com/libsdl-org/SDL/issues/15437
Confirmed not to regress the fix in https://github.com/libsdl-org/SDL/pull/11845

(cherry picked from commit dcf05165d3)
2026-04-27 10:55:11 -07:00
Sam Lantinga
70d4363890 Ignore the first hover event with a stale position on iOS
Fixes https://github.com/libsdl-org/SDL/issues/15450

(cherry picked from commit 3c02de2f7c)
2026-04-25 07:26:25 -07:00
Frank Praznik
d240da419e wayland: Avoid excessive exposure events during interactive resizes
Only send the unblocking exposure event once per frame, so that clients using an event watcher won't redraw excessively.

Also ensure that the unblocking exposure is always sent on the libdecor path.

(cherry picked from commit 01a7588f8e)
2026-04-24 13:26:18 -04:00
Anders Jenbo
525842f2e7 Prefer higher color depths in SDL_GetClosestFullscreenDisplayMode()
(cherry picked from commit 9fa9edeadb)
2026-04-23 15:33:43 -07:00
Sam Lantinga
88102f8d3c Revert "(video) fix SDL_GetClosestFullscreenDisplayMode aspect ratio & refresh rate picking logic"
This reverts commit 0231ff03de.

This causes SDL to return 1024x768 when asking for a best fit to 640x480 (thanks @AJenbo), so I'm reverting this until we can investigate more.

(cherry picked from commit 7b23cd62ca)
2026-04-23 13:23:56 -07:00
som3a-dev
ab6bc13ef1 (video) fix SDL_GetClosestFullscreenDisplayMode aspect ratio & refresh rate picking logic
(cherry picked from commit 0231ff03de)
2026-04-20 10:51:53 -07:00
Frank Praznik
aadc6724d8 wayland: Fix scaled cursor image selection
When the pointer isn't being scaled, make sure the cursor scale factor is set to that of the window to avoid blurry cursors on high-DPI desktops, and use the inverse of the pointer scale value when selecting buffers for size-adjusted cursors. Fixes a regression from adjusting custom cursor sizes when using scale to display mode, and ensures that the best buffer size for the scaled cursor is always selected.

(cherry picked from commit 03f1a84302)
2026-04-20 10:21:53 -04:00