Commit Graph

20222 Commits

Author SHA1 Message Date
Simon McVittie
40b941c826 hints: Rephrase documentation to improve grammar
"This thing allows to do something" is not really grammatically correct.
The closest rephrasing would be "allows one to do something" or "allows
the user to do something", but I think the passive voice reads more
naturally here.

Detected by Debian's lintian QA tool.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2025-08-07 13:55:15 -07:00
cosmonaut
fe6b2161bf GPU: Fix uninitialized value in Vulkan command buffer structure 2025-08-07 13:42:03 -07:00
Sam Lantinga
6981522cd6 Revert "Support Google Play 16 KB Page Size Requirement (#13470)"
This reverts commit dc2c83c383

If you need to support the Google Play 16 kiB page size requirement, the recommendation is to use NDK r28c or newer, which automatically aligns binaries correctly.
2025-08-07 11:44:45 -07:00
Frank Praznik
33c8998598 video: Use additional checks for determining on which display a window should be fullscreen
Trying to determine where a window should be made fullscreen from the size and position can be unreliable if the window exceeds the display bounds. Add additional checks with the following priority:

- If the window was positioned with a macro that explicitly passes a display ID, store and use the requested display as the explicit fullscreen target.
- Check if the window position is an exact match for any display origins, and use that display if found, as positioning a fullscreen window by moving it to the origin of the destination display is common behavior.
- Fall back to the existing center point check if the previous checks were not successful, as it is known behavior, and won't risk breaking existing clients that rely on it.
2025-08-07 14:30:39 -04:00
Pino Toscano
561c99ee11 SDL_endian.h: extend Linux way for GNU libc
The currently used way to determine the endianness (i.e. include
<endian.h> and use the __BYTE_ORDER macro) is provided in general by
GNU libc. Thus, extend that to any platform/OS based on GNU libc.
2025-08-06 16:13:26 -07:00
Frank Praznik
f439e44771 x11: Modernize and optimize key handling
- Use modern Xkb functions where appropriate and cleanly separate the modern and legacy paths.
- Remove the deprecated XKeycodeToKeysym function in favor of directly querying the keymap on the legacy path.
- Look up virtual modifiers by name on the Xkb path to better handle remapping (equivalent to the modifier handling under Wayland).
- Optimize keymap creation on the Xkb path to cut keymap build times and enable fast group switching  (equivalent to keymap handling on Wayland).
- Enable and handle Xkb events to handle changes to the group, mapping, and modifier states. This is more reliable than using the legacy events (group changes may not arrive if the window lacks pointer focus), and better handles cases where modifiers are latched, locked, or activated externally rather than physically pressed.
2025-08-06 13:35:32 -07:00
Frank Praznik
67e5130441 x11: Check axis labels when searching for relative axes
Prefer axes with the 'Rel X'/'Rel Y' labels, followed by 'Abs X'/'Abs Y', and only fall back to the old behavior of using the first two enumerated axes if no others are found.

Fixes a FIXME when determining which axes to use for relative motion.
2025-08-06 14:15:00 -04:00
Sam Lantinga
91be1b054a x11: Fix xsettings pointer not being reset in X11_QuitXsettings 2025-08-06 09:22:33 -07:00
Sam Lantinga
31ba7efa48 x11: Refactor dpi hooks, removing GTK dependency and fixing XSettings watcher
- Removed GTK signal handler in x11settings. XSettings events are now properly dispatched to X11_XsettingsNotify.
  Previously events were not being passed to xsettings-client as no SDL xsettings_window was created. Now all events
  are filtered through xsettings_client_process_event allowing it to process the external window events that are selected.
  Global content scale is updated for changes to any recognized dpi settings.

- X11_GetGlobalContent now reads the current RESOURCE_MANAGER prop off of the root window to ensure it sees the
  current value. XResourceManagerString is now only used if getting the current prop fails as it caches the current resource
  manager value per-display connection.

- Clean up some warnings in SDL_gtk.
2025-08-06 09:22:15 -07:00
A1029384756
b139821903 tray: linux - use .cache directory for temporary icon paths 2025-08-05 23:35:11 -07:00
Frank Praznik
cd0c660dea 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.
2025-08-05 18:01:16 -04:00
Frank Praznik
90a023007f 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.
2025-08-05 15:57:52 -04:00
Sam Lantinga
aae7736ec6 Added additional examples of paddle and misc buttons (thanks @AL2009man!) 2025-08-05 12:01:31 -07:00
Frank Praznik
f44a98729c 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.
2025-08-05 11:38:54 -04:00
Frank Praznik
3163e0cc9f Revert "cocoa: Don't re-enter a fullscreen space if leaving to enter an exclusive mode"
This reverts commit ee8f2861e7.

It turns out that the problem is elsewhere, related to needing to block mode changes until spaces transitions are complete.
2025-08-04 23:49:15 -04:00
Alexander Batalov
b6fa89ea74 Fix directory globbing on Android 2025-08-04 23:12:54 -04:00
Mathieu Eyraud
a05aca51ec Fix condition for setting HDR properties 2025-08-04 23:02:25 -04:00
Frank Praznik
ee8f2861e7 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.
2025-08-04 22:09:53 -04:00
Sam Lantinga
293b8b9fd6 x11: Fix regression reading GNOME content scale
- Removed gtk-xft-dpi read from GetGlobalContentScale. Xrm either returns either the same value as gtk-xft-dpi or the integer
  scale value in cases where gtk-xft-dpi is 1.

- Refactor SDL_x11settings handlers to defer to GetGlobalContentScale

- GetGlobalContentScale is now exported and the XSettings and Gtk signal handlers now use it for consistency. This involves
  a bit of extra work reading from Xrm rather than the setting notification but ensures consistent handling based on signal
  origin and hints enabled.

- Hook both gtk-xft-dpi in SDL_x11settings. This should generally result in only one being called based on which is updated.
  Since both signal handlers defer to X11_GetGlobalContentScale this will cause the same content scale to be applied multiple
  times. The gtk-xft-dpi signal is now only used to trigger content scale updates when the XSettings notification does not occur.
2025-08-04 16:53:09 -07:00
Sam Lantinga
7bb045ca22 Fixed Windows build 2025-08-04 13:04:17 -07:00
Sam Lantinga
9a71e3fd50 Revert "Add SDL_IsTraySupported"
This reverts commit 47d8bdd1c3.

There are runtime reasons why creating a tray can fail, so the correct approach is not to assume that just because a platform supports a tray that trays are available. Instead, you should create a tray at application startup, for the lifetime of the application, and handle failures at that point.

Closes https://github.com/libsdl-org/SDL/pull/13632
2025-08-04 10:42:43 -07:00
Sam Lantinga
bba6555bf1 Enable background input when using Microsoft GameInput 2025-08-04 10:21:58 -07:00
Frank Praznik
483b8d4d98 x11: Implement precision/pixel scrolling
Manual rebase of #5382 with some changes for SDL3 (thanks @wooosh).
2025-08-04 12:50:06 -04:00
Petar Popovic
23e08f7807 SDL_LoadWAV_IO(): On error, set *audio_buf to NULL and *audio_len to 0 2025-08-03 13:44:10 -04:00
Petar Popovic
faf3bd9991 SDL_enabled_assert(): Use NULL istead of 0 to explicity initialize the pointer members of SDL_AssertData 2025-08-03 13:33:48 -04:00
Sam Lantinga
8dedf44929 Fixed warning: initialization of pointer of type 'VkSampler' (aka 'struct VkSampler_T *') to null from a constant boolean expression
Fixes https://github.com/libsdl-org/SDL/issues/13628
2025-08-03 07:24:51 -07:00
Hayden Gray
cb5436045d tray: linux fix tray menu elements not running callbacks (#13626) 2025-08-03 07:22:32 -07:00
Ryan C. Gordon
e1a623f129 SDL_migration.cocci: Fixed a few incorrect function names. 2025-08-02 22:54:03 -04:00
mitchellcairns
e8b5d90c41 SInput: ABXY Style Application and Code Cleanup (#13624)
ABXY Face Style Application

- The abxy face style extraction now applies to any SInput device.
- The use-case here is that gamepads that allow for changing styles can dynamically adjust the button labels firmware-side to have the physical location better represent the actual button being pressed.

SInput Sub-Type Clarification

- The code has been updated to better reflect the intention behind the sub-type field of the GUID byte 15.
- Any SInput device may utilize the Sub-Type field to indicate variants of the same device (Same device that has rear paddles or additional physical features but is otherwise identical, etc.).

"Firebird" Company Name Clarification

- "Bonjiri" was a wrong translation. Got clarification from the company and official PID registration for the official English spelling (See 0c5234cd92).
- Fixed this spelling for all references (official mapping strings still pending and this will return NULL until this is provided).

Code Notes
- Various notes have been updated to have more clear indications.
- I have moved the face-type and sub-type debug messages to be paired with the extraction for easier location.
- I've removed an incorrect note left-over from a previous commit regarding command response information.
2025-08-02 19:11:18 -07:00
Frank Praznik
51ce3f8c8d 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.
2025-08-02 18:56:41 -04:00
Frank Praznik
42463569d5 GPU: Vulkan backend flags command buffer for cleanup when swapchain is requested
When skipping presentation due to the window being hidden, presentDataCount is not incremented on the command buffer, and subsequently the submitted command buffers will not be cleaned up as long as the window is hidden. This results in a lag spike when showing the window due to all previously submitted command buffers suddenly being cleaned up at once, and lag at shutdown due to an equivalent number of fences needing to be destroyed.

Instead of relying on presentDataCount to determine whether a command buffer should be cleaned up, use a flag, which is set under the appropriate circumstances.
2025-08-02 09:24:02 -07:00
Petar Popovic
ae5ce258cf Fix double-free warning in src/hidapi/linux/hid.c 2025-08-02 07:08:35 -07:00
Antheas Kapenekakis
2b94062482 sinput: fix compiling with debug output on 2025-08-02 06:37:27 -07:00
Anonymous Maarten
5dc801506b ci: Haiku does not need -DSDL_UNIX_CONSOLE_BUILD=ON
Haiku has a native video system
2025-08-02 03:39:38 +02:00
Anonymous Maarten
2190705754 ci: configure with -DCMAKE_SYSTEM_NAME=Haiku for Haiku
Fixes ci regression introduced in e8b69b03fe
2025-08-02 03:08:03 +02:00
Sam Lantinga
8796f0a8ed SDL_gtk: Prevent loading GTK-3 if a different version of GTK is already loaded
- gtk_init_check claims it will not terminate the program on failure, however this is does
  not apply to the internal check it performs to see whether another GTK library is already
  loaded, the detection of which triggers a g_error which glib treats as fatal.

- gtk_progress_get_type and gtk_misc_get_type are checked to match the checks done
  by _gtk_module_has_mixed_deps.

- Clean up gtk/gdk loading. There are no library fallbacks so the one option available can
  be loaded rather than iterating through a list of one item.
2025-08-01 17:44:22 -07:00
Ozkan Sezer
f241e8e8fd windows: replace shobjidl_core.h usage with shobjidl.h except for when targeting xbox
Closes https://github.com/libsdl-org/SDL/pull/13571
2025-08-01 17:11:49 -07:00
capehill
1c5c3b1479 Fix SDL_BlitSurfaceScaled crash
SDL_BlitSurfaceScaled could crash when passed large coordinates, due
to final_dst.w or final_dst.h getting negative values.
2025-08-01 09:22:20 -07:00
Antheas Kapenekakis
d04899fcfd Fix setting RGB without a player led (#13524)
There is a bug where SInput checks for player led capability before
setting RGB. This means that if a controller does not have a player led,
RGB commands are not sent.
2025-08-01 09:15:54 -07:00
Petar Popovic
1749aba641 Fixed a few "-Wredundant-decls" warnings 2025-08-01 18:35:02 +03:00
Frank Praznik
550d95e04f 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.
2025-08-01 10:33:55 -04:00
A1029384756
9034375d2f wayland: reorder surface destruction to avoid premature blanking 2025-08-01 10:20:19 -04:00
Ozkan Sezer
83818eeb95 tests: c90 fixes (#endif comments) for consistency after commit 9e37839 2025-08-01 06:28:02 +03:00
Anonymous Maarten
9e3783996b Fix testnative C90 compatibility 2025-08-01 02:27:54 +02:00
Anonymous Maarten
7b501ae71f Add a few include guards to private headers 2025-08-01 02:00:08 +02:00
Anonymous Maarten
06cafa3040 cmake: explicitly disable UNITY_BUILD property for SDL3 libraries 2025-08-01 01:59:18 +02:00
Petar Popovic
09221820f6 Fix potential memory leak in SDL_render_gles2.c 2025-07-31 16:18:47 -07:00
Matthew Zavislak
dc2c83c383 Support Google Play 16 KB Page Size Requirement (#13470)
- See: https://developer.android.com/guide/practices/page-sizes#update-packaging
- Also, make min API uniform at 21 (from 16 and 23 in a few places)
2025-07-31 16:12:54 -07:00
cosmonaut
c5edf4bd5b GPU: Bail out of aquiring Vulkan swapchain if window is hidden 2025-07-31 16:02:58 -07:00
mitchellcairns
6d580d74f2 Fix Axis Inputs for Generic SInput Device (#13489)
- Implement correct SInput generic mapping string to map analog axes
- Implement 6 axis count fallback for generic SInput Device
2025-07-31 15:36:10 -07:00