Commit graph

4511 commits

Author SHA1 Message Date
Ryan C. Gordon
5f5a73a8f6 blit: Check MSVC's _M_ARM64 define in addition to __aarch64__.
Reference Issue #14519.

(cherry picked from commit 7f0d0d0046)
2025-11-25 14:41:49 -08:00
Ryan C. Gordon
50be2a7e56 blit: Change ifdefs on NEON functions that use an aarch64-specific opcode.
Fixes #14519.

(cherry picked from commit 15f98b2a61)
2025-11-25 14:41:07 -08:00
Ethan Lee
4fdbac7207 video: Explicitly call DestroyWindowTexture when destroying a window.
This prevents some recursion issues with hashtables, as described in #14499.
2025-11-24 01:25:38 -05:00
Susko3
c49de41ef3 Fix WM_SYSKEYDOWN not being trapped by IME message handling
This would cause Alt + <something> not being trapped if handled by the system IME.

(cherry picked from commit 2ef005afe5)
2025-11-19 13:40:19 -08:00
Marcin Serwin
45b0460019 Don't divide by zero in slow blitter
Other blitters seem to handle zero width/height destinations correctly.

Signed-off-by: Marcin Serwin <marcin@serwin.dev>
(cherry picked from commit 53ee410d7a)
2025-11-09 07:26:37 -08:00
Sam Lantinga
6d2d283954 Fixed blitting bitmaps with a non-zero x offset
Also added basic testautomation coverage of bitmap blits

Fixes https://github.com/libsdl-org/sdl2-compat/issues/546

(cherry picked from commit a2ed1a4197)
2025-11-06 22:49:17 -08:00
Frank Praznik
49db06b604 x11: Only correct placement for border offset on the initial window mapping
Correcting it when it is subsequently hidden and re-mapped will cause the position to be double offset by the size of the borders.

(cherry picked from commit a71b2f0a93)
2025-11-06 19:35:51 -05:00
yuanhecai
85012b6074 loongarch: add SDL_FillSurfaceRect4LSX opt
(cherry picked from commit dc5b136930)
2025-11-06 07:29:51 -08:00
yuanhecai
14271c72f3 loongarch: add Blit8888to8888PixelAlphaSwizzleLSX opt
(cherry picked from commit 0b1eb4c841)
2025-11-06 07:29:50 -08:00
Simon McVittie
2bbd74b4b6 wayland: Fix compile with libdecor 0.2 and SDL_WAYLAND_LIBDECOR_SHARED=OFF
libdecor 0.3, which changes the signature of libdecor_new and
libdecor_decorate to use a const pointer to the interface struct, has
not yet been released. In the latest release, libdecor 0.2.4, the
interface struct is a mutable pointer.

This doesn't affect typical upstream builds with
SDL_WAYLAND_LIBDECOR_SHARED=ON, in which case we're casting a pointer
returned by dlsym(); but Linux distributions that want tighter control
over dependencies often prefer to link them in the normal way, in which
case the build will fail if the signature doesn't match.

Fixes: 33834360 "wayland: Fix libdecor incompatible pointer types"
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 8b64dd67d2)
2025-10-30 07:14:49 -07:00
Frank Praznik
a002a6313e wayland: Fix libdecor incompatible pointer types
(cherry picked from commit 3383436068)
2025-10-28 13:43:46 -04:00
Sam Lantinga
95977f41b7 Perform full rectangle intersection for empty rects
If we don't do that, we leave the x and y values uninitialized.

Fixes https://github.com/libsdl-org/sdl12-compat/issues/365

(cherry picked from commit ffd0ca4391)
2025-10-25 13:50:32 -07:00
DONGGEUN YOO
3302162ede Fix uninitialized length in X11_GetClipboardData causing test failures (#14322)
(cherry picked from commit 093fbfd867)
2025-10-25 07:42:24 -07:00
Sam Lantinga
492ed877ea Removed __FILE__ from source code
(cherry picked from commit f79ede100b)
2025-10-22 10:49:31 -07:00
Sylvain
92570af7d3 Fixed bug #14233 - Android fix Android_WaitActiveAndLockActivity() to make sure Android_Paused state is refreshed
(cherry picked from commit e4c60c05bf)
2025-10-19 07:44:15 -07:00
Sam Lantinga
04ceb2d4a0 Only pass UIPress from game controllers and remotes if the're not open
Fixes https://github.com/libsdl-org/SDL/issues/14080

(cherry picked from commit f844f3e10b)
2025-10-14 12:44:23 -07:00
Sam Lantinga
e6987e2452 Fixed emulated touch on Android
This also fixes laser pointer input on Meta Quest headsets

(cherry picked from commit 712ce16469)
2025-10-14 08:40:58 -07:00
Gustaf Alhäll
ec682cc794 Fix SDL_SetRelativeMouseMode failing with software framebuffer on Haiku
(cherry picked from commit 2c63bc7315)
2025-10-11 09:03:01 -07:00
Sam Lantinga
d6021b7d89 Only call clipboard callbacks with mime types they expect
Also clarified that returning NULL from a callback sends zero length data to the receiver, which should be able to handle that.

Fixes https://github.com/libsdl-org/SDL/issues/9586

(cherry picked from commit 23e3cbec20)
2025-10-09 12:23:30 -07:00
Sam Lantinga
8dcb6db823 Only return current clipboard data under X11
Fixes https://github.com/libsdl-org/SDL/issues/10192

(cherry picked from commit 9cf7cdf23a)
2025-10-09 12:23:30 -07:00
Sam Lantinga
d0cfcf10bb Fixed crash getting clipboard data processing clipboard events on X11
SDL_PumpEvents() was freeing the temporary memory in the clipboard event, so if the application was iterating over the mime types in the event and retrieving the clipboard data, it would crash after the first entry.

(cherry picked from commit 3c0a6c32d4)
2025-10-09 12:23:30 -07:00
Sam Lantinga
d69f658835 Make sure the current resolution is in the fullscreen mode list
Custom resolutions don't enumerate normally, but make sure the current resolution is in the mode list.

Fixes https://github.com/libsdl-org/SDL/issues/11551

(cherry picked from commit b1c2dd8433)
2025-10-02 16:01:17 -07:00
Frank Praznik
6519158ae5
wayland: Ignore bogus libdecor content sizes if an unmapped window is suspended
If a client takes a long time to present the first frame after creating the window, a configure event to set the suspended state may arrive with libdecor increasing the content size by the decoration dimensions, which should be ignored.

(cherry picked from commit 9d5d7010de)
2025-09-24 10:36:04 -04:00
Frank Praznik
00718d60d2
x11: Use the pending size for the min/max limits if a resize is in flight
Otherwise, an outdated size may be used, reverting the requested resize operation.

(cherry picked from commit 45480f5fe5)
2025-09-24 10:36:04 -04:00
Sam Lantinga
18c2e179ee Use the real window position on macOS
On newer MacBooks, the fullscreen window might be placed below the camera notch, so use the actual window position

Fixes https://github.com/libsdl-org/SDL/issues/10441

(cherry picked from commit 0a50058f7a)
2025-09-23 23:04:41 -07:00
Sam Lantinga
21ae008fc2 Use an empty bitmap for the blank cursor on macOS
Some macOS installations seem to have trouble decoding the GIF we were using

Fixes https://github.com/libsdl-org/SDL/issues/14012

(cherry picked from commit 221d1f12ea)
2025-09-22 19:16:01 -07:00
Sam Lantinga
97a8bb44e6 The default swap interval on EGL is 1, according to the spec
Fixes https://github.com/libsdl-org/SDL/issues/14014

(cherry picked from commit 137b0b2bee)
2025-09-22 11:28:46 -07:00
Andrei Sabalenka
482c5130eb wayland: fix typo in xdg_positioner_set_anchor_rect
(cherry picked from commit bb2b39b8ea)
2025-09-20 08:54:18 -07:00
Eddy Jansson
62c151d044
wayland: Silence unused variable warning
'vd' and 'd' are only used if SDL_USE_LIBDBUS is set.

(cherry picked from commit 21c9f5304d)
2025-09-15 10:27:51 -04:00
Sam Lantinga
11d38fc23b Only use a transparent cursor on Windows when connected via RDP
VMware relies on the cursor being set to NULL to optimize relative mouse motion for games.

We should also revisit whether current RDP works better with a NULL cursor or a transparent cursor.

Fixes https://github.com/libsdl-org/SDL/issues/13700

(cherry picked from commit dac6af4ba6)
2025-09-14 17:31:09 -07:00
Frank Praznik
56507a6122
x11: Use the SDL_WindowFlags type instead of Uint32
Uint32 can potentially truncate the flag value, as it is 64 bits in SDL3.

(cherry picked from commit 4561be89a5)
2025-09-13 15:45:43 -04:00
eafton
e8a5d07e5e X11: Check for invalid opcodes in SHM error handler
(cherry picked from commit b59d6d49c3)
2025-09-09 10:59:58 -07:00
Aleksey Melekh
e755f50072 xbox: fix build
(cherry picked from commit 129c97f610)
2025-09-05 09:20:34 -07:00
Cameron Cawley
ea362839b1 Remove unused PSP source files
(cherry picked from commit 42f571ea4b)
2025-09-03 15:20:00 -07:00
Sam Lantinga
e7dd5d841b Don't set SDL_SURFACE_LOCK_NEEDED until a surface is RLE encoded
Reference https://github.com/libsdl-org/sdl2-compat/issues/476

(cherry picked from commit 437d78499c)
2025-09-02 21:32:17 -07:00
Sam Lantinga
08c82a3781 Fixed build
(cherry picked from commit 3cf2350f21)
2025-08-30 10:15:48 -07:00
Frank Praznik
ae915c6516 wayland: Add a sigtimedwait() implementation for OpenBSD
sigtimedwait() is an optional part of POSIX.1-2001, and OpenBSD doesn't implement it. Add a replacement implementation based on https://comp.unix.programmer.narkive.com/rEDH0sPT/sigtimedwait-implementation

(cherry picked from commit 1049426a76)
2025-08-30 14:21:00 +03:00
Sylvain
94f9434564 Fixed bug #13493: Assertion failure at SDL_AddTouch with Android API 28
Java touch id should be -1 because it's reserved for internal SDL
synthetic events.
It should also not be 0, because this is SDL invalid value.

(cherry picked from commit 970c0bfe96)
2025-08-12 09:44:04 -07:00
Frank Praznik
5e77fb314c
win32: Use the current flags to determine if NCCALCSIZE is required
SDL_GetWindowFlags() also ORs in pending flags, whereas the current state is needed here, particularly when creating/showing a window.

(cherry picked from commit cd0c660dea)
2025-08-05 18:49:41 -04:00
Frank Praznik
1a2841deb1
win32: Use STYLE_BORDERLESS when showing a pending fullscreen window
In addition to hiding the border on bordered windows that will immediately become fullscreen, The combination of flags used in STYLE_BORDERLESS_WINDOWED will still show the borders on borderless windows if the initial window size exactly matches the desktop, so STYLE_BORDERLESS must be used instead.

(cherry picked from commit 90a023007f)
2025-08-05 15:59:06 -04:00
Mathieu Eyraud
688637eca8 Fix condition for setting HDR properties
(cherry picked from commit a05aca51ec)
2025-08-05 09:26:12 -07:00
Frank Praznik
85d1d70ca1
cocoa: Wait for fullscreen spaces transitions to complete if switching to an exclusive mode
If attempting to switch to an exclusive mode while a fullscreen spaces transition is active, wait until the transition is complete before trying to apply the changes, or the window can wind up in a weird, broken state if a mode switch occurs while in a fullscreen space.

(cherry picked from commit f44a98729c)
2025-08-05 12:17:01 -04:00
Frank Praznik
09356c709a Revert "cocoa: Don't re-enter a fullscreen space if leaving to enter an exclusive mode"
This reverts commit 07b9e86d02.

It turns out that the problem is elsewhere, related to needing to block mode changes until spaces transitions are complete.
2025-08-04 23:51:47 -04:00
Frank Praznik
07b9e86d02 cocoa: Don't re-enter a fullscreen space if leaving to enter an exclusive mode
Doing so can leave the window in a weird, offset state.

(cherry picked from commit ee8f2861e7)
2025-08-04 22:16:22 -04:00
Frank Praznik
ec45117f0f
x11: Filter mouse wheel events from "Master" devices
Discard wheel events from "Master" devices to avoid duplicates, as wheel events are stateless and can't be deduplicated.

(cherry picked from commit 51ce3f8c8d)
2025-08-02 18:57:44 -04:00
capehill
b1cadf0e99 Fix SDL_BlitSurfaceScaled crash
SDL_BlitSurfaceScaled could crash when passed large coordinates, due
to final_dst.w or final_dst.h getting negative values.

(cherry picked from commit 1c5c3b1479)
2025-08-01 09:22:38 -07:00
Frank Praznik
c1f67585e6
wayland: Cleanup an outdated conditional and comment
There may have been a reason for not attaching a null buffer when destroying a popup at some point in the past, but that is unnecessary now, as is the comment about ShowWindow crashing, as ShowWindow assures that a null buffer is attached before (re)creating the window.

(cherry picked from commit 550d95e04f)
2025-08-01 10:40:32 -04:00
A1029384756
93988e28c0
wayland: reorder surface destruction to avoid premature blanking
(cherry picked from commit 9034375d2f)
2025-08-01 10:40:32 -04:00
Frank Praznik
544eb2c5a9
wayland: Adjust popup adjoining check
The previous calculation could result in a window whose original position was positioned exactly corner-to-corner with the parent not being adjusted to be adjoining, and thus subject to spurious closure.

(cherry picked from commit b0cdb7143f)
2025-07-31 12:13:54 -04:00
Dan Andrus
c31ddf021e
Check NSWindow::isVisible before sending SDL_WINDOWEVENT_RESTORED during Cocoa_WindowListener::windowDidResize
(cherry picked from commit 30f0aeb26a)
2025-07-28 14:47:45 -04:00