Commit Graph

5038 Commits

Author SHA1 Message Date
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
Cameron Cawley
447ba0aa01 Improve constness with Clipboard APIs
(cherry picked from commit 43c928ee86)
2026-04-19 07:06:43 -04:00
William Horvath
350f873534 windowsrawinput: Add missing WIN_SetRawKeyboardFlag_Inputsink stub.
(cherry picked from commit 00f9a25879)
2026-04-17 14:48:05 -04:00
Frank Praznik
3dc844148c wayland: Fix some comments
Fix grammar, and remove a TODO that is no longer relevant with an event thread.

(cherry picked from commit c1bf0e9de9)
2026-04-16 10:15:26 -04:00
David Vanderson
d6f7b314b3 xinput2: correct horizontal touchpad scrolling direction
This fixes testmouse so when fingers move left the green line moves
left.

(cherry picked from commit 5e0f721fd4)
2026-04-13 19:44:58 -04:00
Frank Praznik
88acac053a wayland: Enable text input even when the text input protocol is not available.
Even without the text input protocol, basic text can still be obtained from individual keys and the composition system.

(cherry picked from commit dd6d49afbd)
2026-04-12 13:03:29 -04:00
Cameron Gutman
e54cc2b1fb kmsdrm: Fix order of GBM and EGL teardown
All locked front buffers must be released prior to destroying
the EGL surface to avoid causing a UAF in libnvidia-egl-gbm.so.

(cherry picked from commit 463b6be133)
2026-04-10 10:38:43 -07:00
Frank Praznik
e057712565 x11: Ignore slave button presses on non-focused windows
When a window has the pointer grabbed, the X server will grab all master device events, and XInput2 will continue to deliver slave events to the window immediately under the pointer, regardless of grab status. Only send slave pointer events to the focused window, and fall back to the core X events to catch button presses missed when the pointer is over another window.

(cherry picked from commit 0fc9db9b82)
2026-04-10 12:51:56 -04:00
Cameron Gutman
2d0ea900ba kmsdrm: Fix double-free of GBM surface buffer in atomic mode
(cherry picked from commit c2d0b59f29)
2026-04-10 00:06:49 -05:00
Frank Praznik
d07bd49a7d misc: Use the OpenURI D-Bus portal for opening URLs
This works inside of containers, and supports passing an activation token with the request, which is needed on Wayland to transfer focus to the browser.

(cherry picked from commit 682da4ee98)
2026-04-05 16:33:11 -04:00
Sam Lantinga
ce3cc80aca Send SDL_EVENT_SCREEN_KEYBOARD_HIDDEN when the keyboard is hidden on Android
(cherry picked from commit fc2f4fcc22)
2026-04-04 10:08:57 -07:00
Frank Praznik
2798ac07ea wayland: Retrieve the system minimum libdecor limits before overwriting them 2026-04-03 14:08:58 -04:00
Sam Lantinga
9403c6b43d Use the correct source rectangle when doing scaled blits
Fixes https://github.com/libsdl-org/SDL/issues/15309

(cherry picked from commit 5ae1308e5b)
2026-04-03 01:33:21 -07:00
nilFinx
48060320f6 haiku: Always assume that the URL is encoded (required on nightly) (#15305)
(cherry picked from commit f3a3b4b95a)
2026-04-03 00:01:41 -07:00