Commit Graph

11462 Commits

Author SHA1 Message Date
Sam Lantinga e3d9f1172c Remove the reference to the thread when it is detached
Fixes https://github.com/libsdl-org/SDL/issues/12301
2025-02-16 07:56:30 -08:00
Petar Popovic c6a3b5b6ef src/test/SDL_test_harness.c: Free variables before returning 2025-02-15 21:00:04 -08:00
Ryan C. Gordon 84a236c92e hashtable: Redesign the hashtable API.
This was intended to make the API public, so SDL_hashtable.h got an extreme
documentation makeover, but for now this remains a private header.

This makes several significant interface changes to SDL_HashTable, and
improves code that makes use of it in various ways.

- The ability to make "stackable" tables is removed. Apparently this still
  worked with the current implementation, but I could see a future
  implementation struggle mightily to support this. It'll be better for
  something external to build on top of the table if it needs it, inserting a
  linked list of stacked items as the hash values and managing them separately.
  There was only one place in SDL using this, unnecessarily, and that has also
  been cleaned up to not need it.
- You no longer specify "buckets" when creating a table, but rather an
  estimated number of items the table is meant to hold. The bucket count was
  crucial to our classic hashtable implementation, but meant less once we
  moved to an Open Addressing implementation anyhow, since the bucket count
  isn't static (and they aren't really "buckets" anymore either). Now you
  can just report how many items you think the hash will hold and SDL will
  allocate a reasonable default for you...or 0 to not guess, and SDL will
  start small and grow as necessary, which is often the correct thing to do.
- There's no more SDL_IterateHashTableKey because there's no more "stackable"
  hash tables.
- SDL_IterateHashTable() now uses a callback, which matches other parts of SDL,
  and also lets us hold the read-lock for the entire iteration and get rid of
  the goofy iterator state variable.
- SDL_InsertIntoHashTable() now lets you specify whether to replace existing
  keys or fail if the key already exists.
- Callbacks now use SDL conventions (userdata as the first param).
- Other naming convention fixes.

I discovered we use a lot of hash tables in SDL3 internally. :) So the bulk
of this work is fixing up that code to use the new interfaces, and simplifying
things (like checking for an item to remove it if it already exists before
inserting a replacement...just do the insert atomically, it'll do all that
for you!).
2025-02-15 18:52:56 -05:00
Cameron Gutman 4a9b579195 joystick: remove dead udev code
SDL_USE_LIBUDEV is never even defined here and SDL_hid_init() already does this.
2025-02-15 14:17:13 -06:00
Sam Lantinga fd4e6d2949 Don't render 0 sized texture rectangles
Fixes https://github.com/libsdl-org/sdl2-compat/issues/355
2025-02-15 07:07:56 -08:00
Frank Praznik 6f3b14a6df audio/video: Fix uninitialized field warnings 2025-02-14 17:16:10 -05:00
Chen Steenvoorden 8a648dfd9b emscripten: Fixed unregistering of key event handlers 2025-02-14 10:15:15 -08:00
Petar Popovic c16b7bcb7a SDL_Get*Driver() functions: Set error message on failure 2025-02-13 16:10:37 -08:00
ImThour ed0a03e9b5 Fixed Cursor Icon State for SYSTEM_CURSOR_PROGRESS 2025-02-13 11:38:41 -08:00
Petar Popovic 5dce8c748f SDL_GetRelativeMouseState(): Get relative mouse position also when relative mouse mode is disabled 2025-02-13 11:34:24 -08:00
Sam Lantinga b9d018f2a2 Fixed wayland cursor use-after-free at shutdown 2025-02-12 20:47:31 -08:00
Semphris 3be67ced64 Fix GTK tray icon without menu + lifetime 2025-02-12 16:18:31 -08:00
Ryan C. Gordon 1354affd28
haiku: Fixed keyboard input.
_GetWinID() doesn't work with keyboard-related BMessages, because Haiku
assumes you know what window has keyboard focus at the time, so these events
don't have a `window-id` property. So when this call failed, the key event
handler would return early.

This was probably a copy/paste error that snuck in at some point, as SDL2
doesn't have this issue.
2025-02-12 17:17:14 -05:00
Sam Lantinga d2b7a84651 Fixed SDL_GetNumGamepadTouchpads() returning 1 for a NULL gamepad 2025-02-12 13:08:41 -08:00
Sam Lantinga ca29304ce1 Fixed continually resetting keyboard and mouse readings 2025-02-12 13:02:15 -08:00
Sam Lantinga f67c644649 Fixed reporting hat positions for GameInput controllers 2025-02-12 13:02:15 -08:00
Sam Lantinga 1b35ca9c32 Refactored GameInput initialization 2025-02-12 13:02:15 -08:00
Frank Praznik 706de78a9e audio/video: Skip preferred drivers when loading a driver on demand
Preferred driver entries have special conditions for initializing, which aren't relevant when a specific driver was explicitly requested.
2025-02-12 11:51:36 -05:00
Sam Lantinga 715c18739b Added an internal hint "SDL_VIDEO_X11_XINPUT2" for sdl2-compat 2025-02-11 15:11:33 -08:00
Sam Lantinga ce69e98989 Copy SDL2_SYSWMEVENT data into temporary memory for the event 2025-02-11 15:11:33 -08:00
coffeechriph 55fd205ba4
Add missing integer texture formats to SDL_GPUTextureFormatTexelBlockSize (#12151) 2025-02-11 14:21:30 -08:00
Semphris e6029401d9 Check for non-NULL icon for trays on Unix 2025-02-11 13:47:17 -08:00
Frank Praznik 78f816d74e x11: Apply the modifier state from key events
Use the modifier state supplied with key events to track the system modifier state instead of relying on the state returned by XQueryPointer(), which can be racy when used with automated text entry.
2025-02-11 14:14:12 -05:00
Sam Lantinga 6c37971521 Removed the mapping for the Sanwa Supply JY-P76USV
It turns out the mapping we include doesn't work for real controllers, and they're using a generic chipset and generic name and can't be generally distinguished from other controllers.

See https://github.com/libsdl-org/SDL/issues/8644 for details.
2025-02-11 07:59:25 -08:00
Edu Garcia 9b18e8438f [GPU] D3D12 backend debug markers were being cut
Code used wcslen that return number of characters, but D3D12 debug layer uses bytes + wide chars
2025-02-11 07:21:44 -08:00
Sam Lantinga 0bce19cf15 The 10-bit texture formats have alpha on Direct3D
A similar change was made for Vulkan in a036aeda3b
2025-02-10 19:45:02 -08:00
Sam Lantinga 3cfa476d3f Added support for SDL_PIXELFORMAT_ABGR8888 textures
This is the output format of stb_image for image decoding, so let's avoid a texture format conversion where possible.

Also standardized SDL_PIXELFORMAT_ARGB8888 as the default texture format for all renderers.
2025-02-10 19:45:02 -08:00
Sam Lantinga cf41ccc6ce Removed stb_image.h from SDL
This adds quite a bit of code size to SDL for a niche use-case. This is easily handled in the application instead.
2025-02-10 17:18:16 -08:00
Sam Lantinga 9308404e9a Removed functions not used by SDL 2025-02-10 17:18:16 -08:00
Sam Lantinga 5e31bbf05e Remove functions not used when STBI_NO_PNG and STBI_NO_HDR are defined 2025-02-10 17:18:16 -08:00
Sam Lantinga 84b0c13c44 Added support for Motion JPEG camera capture
Fixes https://github.com/libsdl-org/SDL/issues/12183
2025-02-10 17:18:16 -08:00
Frank Praznik 3bc53b9ade wayland: Don't set libdecor frame visibility before the first commit
This will be needed later, after libdecor passes through toplevel bounds, but for now it causes a crash in the Cairo plugin, so remove it.
2025-02-10 18:39:36 -05:00
Frank Praznik c032586262
wayland: Scale-to-display mode requires both viewports and xdg-output for proper functionality 2025-02-10 15:47:28 -05:00
Sam Lantinga 0bc1f87120 Added SDL_PROP_SURFACE_HOTSPOT_X_NUMBER and SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER 2025-02-10 12:15:03 -08:00
Frank Praznik da464e9e5f win32: Keep the window on the last maximized display when leaving fullscreen
A window may have been maximized by dragging it to the top of another display, in which case the floating position may be out-of-date. If the window is being restored to maximized, and the maximized and floating position are on different displays, try to center the window on the maximized display for restoration, which mimics native Windows behavior.
2025-02-10 15:05:54 -05:00
Mike Kosek bf01cc8ce7 Renamed "Dreamcast Controller Usb" to "DreamPort" 2025-02-10 10:33:47 -08:00
Sam Lantinga ecd089bb69 Don't return short waits from SDL_IOReady()
The Wayland keyboard repeat code assumes that if we have a certain timeout then we'll wait at least that long, and generate a key repeat event on timeout. If we wait a shorter time, we won't generate a key repeat event and then return 0, even if we were supposed to wait indefinitely.

Fixes https://github.com/libsdl-org/SDL/issues/12239
2025-02-10 10:29:30 -08:00
danginsburg 4fd0b2a85c Fix #12142 - the problem was if the size of the vertex buffer was exceeded, the currentVertexBuffer would be reset to zero and thus we'd leave it pointing to an in-use VB that would get overwritten on the next present before the vkQueueSubmit occurred. 2025-02-10 08:47:57 -08:00
Sam Lantinga f6126e9ea1 Centered joystick axis values should be 0
Fixes https://github.com/libsdl-org/sdl2-compat/issues/338
2025-02-10 08:36:00 -08:00
Neal Gompa d35bef64e9 pipewire: Ensure that the correct struct is used for enumeration APIs
PipeWire now requires the correct struct type is used, otherwise
it will fail to compile.

Reference: 188d920733

Fixes: https://github.com/libsdl-org/SDL/issues/12224
2025-02-10 11:03:01 -05:00
Stenzek 78721d720c joystick: Fix PS5 player LED hint change callback name
The LED hint was getting registered for SDL_HINT_JOYSTICK_ENHANCED_REPORTS
instead of SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED, which results in a
use-after-free followed by a crash.
2025-02-10 07:36:07 -08:00
ImThour 7aba6c4c73 Proper Resource Cleanup in WIN_UpdateWindowShape
mask is created but never deleted if SetWindowRgn() fails. This may lead to resource leaks.
2025-02-09 16:11:53 -08:00
ImThour ca9a044b3e Memory Leak in WIN_CreateHCursor When CreateColorBitmap Fails 2025-02-09 10:49:56 -08:00
Clint Kilmer 69d28027ad
Fix for 500ms hang after user clicks on the title bar, but before moving (#12217)
Reference: https://gamedev.net/forums/topic/672094-keeping-things-moving-during-win32-moveresize-events/5254386/
2025-02-08 11:21:10 -08:00
Guldoman a0b6c0fd8f
x11: Don't wait for events when the connection errored out (#8392)
Calling `X11_XIfEvent` after the X11 connection errored out can result in hangs.
2025-02-08 10:07:11 -08:00
Mike Kosek 864bb65ce9 Removed crc 2025-02-08 07:56:40 -08:00
Mike Kosek 006605c3bf Corrected alphabetical order 2025-02-08 07:56:40 -08:00
Mike Kosek dc035c5ca6 Added mapping for Dreamcast Controller USB 2025-02-08 07:56:40 -08:00
ds-sloth 2ced6b09fc Delete src/thread/n3ds/SDL_syscond.c
This PR removes the incorrect implementation of `SDL_cond` currently included with the 3DS port.

Pseudocode of the incorrect implementation of `SDL_CondWait` this PR removes:

* Receive an `SDL_cond` backed by a `libctru` `CondVar` and an `SDL_mutex` backed by a `libctru` `RecursiveLock`.
* Want to call `libctru` function `CondVar_Wait` which expects a `CondVar` and a `LightLock` (non-recursive lock)
* Do so by calling this function with the internal (inadequately protected) `LightLock` member of the `RecursiveLock` (`&mutex->lock.lock` on line 105), without updating any internal thread or lock count fields of the `RecursiveLock`.

Happy to discuss or test some examples. My own use case works much better with the generic cond logic, and this seems like a safe fix to me given that the generic logic is well-tested and this seems not to be.

If you like the PR I'll send another one for the SDL2 branch.
2025-02-06 18:02:03 -08:00
Sam Lantinga 982094c85c Updated to version 3.2.5 for development 2025-02-06 16:40:59 -08:00
Sam Lantinga b5c3eab6b4 Updated to version 3.2.4 for release 2025-02-06 16:03:43 -08:00
Sam Lantinga 48c00bfe6c Fixed creating a window with both software and hardware renderer attached 2025-02-06 15:35:38 -08:00
Sam Lantinga ad8429f1b0 Let the renderer always see window events
These are necessary for proper operation of the renderer and shouldn't be blocked by event filters, etc.
2025-02-06 14:38:20 -08:00
Sam Lantinga c59ac249d2 Revert "wayland: Don't send size events while the window is hidden"
This reverts commit 0825d07a43.

It turns out that resizing while hidden is fine, the real problem in https://github.com/libsdl-org/sdl2-compat/issues/268 is that SDL2 did not send an initial resize event and SDL3 does, which we're fixing in a better way in sdl2-compat.
2025-02-06 14:37:53 -08:00
Ryan C. Gordon 8730f6a569
dynapi: Don't use SDL_getenv; it might malloc before the app sets an allocator.
Use platform-specific code instead, so SDL's allocator never comes into play.

(cherry picked from commit d2693d4c7d)
2025-02-06 12:46:15 -05:00
Sam Lantinga 8397e1fcc0 Fix up SDL2 style mappings for HIDAPI controllers
Fixes https://github.com/libsdl-org/sdl2-compat/issues/316
2025-02-06 09:21:52 -08:00
Sam Lantinga 7691cabe4a Removed incorrect HIDAPI gamepad mapping 2025-02-06 08:37:10 -08:00
Evan Hemsley 86691d325b
GPU: Remove stencil bit from sampler aspect mask on Vulkan (#12196) 2025-02-05 17:52:35 -08:00
Sam Lantinga 6782cfe2c5 Don't use the HIDAPI driver for Thrustmaster wheels
Closes https://github.com/libsdl-org/SDL/pull/12173
2025-02-05 17:19:59 -08:00
Sam Lantinga 1c0e2b7f97 SDL_OpenHapticFromJoystick() returns a valid haptic object 2025-02-05 17:08:41 -08:00
Petar Popovic 68dabd48c4 SDL_GetTrayEntries(): Rename parameter `size` to `count` 2025-02-05 07:44:46 -08:00
Sam Lantinga b99e19c0a2 Fixed potential double-free 2025-02-05 00:04:45 -08:00
Sam Lantinga 8ba8cca69b Fixed memory leak looking up pen tool names 2025-02-04 23:59:08 -08:00
Sam Lantinga 2cd2834dfe Fixed memory leak in the pen cleanup
Fixes https://github.com/libsdl-org/SDL/issues/12099
2025-02-04 23:49:12 -08:00
Cameron Gutman c4c185283f dbus: fix spurious leak reports with SDL_SHUTDOWN_DBUS_ON_QUIT=0 2025-02-04 17:01:06 -08:00
Jean-Philip Desjardins 33c0654d54 Allow OpenGL initialization on XB1 and XSX. 2025-02-04 07:35:52 -08:00
WinterSquire eb5ab22032 Check nullptr before calling the windows message hook for WM_ENTERSIZEMOVE and WM_ENTERMENULOOP 2025-02-03 21:33:58 -08:00
Ryan C. Gordon e7f326a84e
bmp: Removed debug printf call. 2025-02-03 23:35:08 -05:00
Ryan C. Gordon 61b1c25eeb
x11: SDL_SetWindowPosition on an unmapped window will do the actual move later.
Fixes https://github.com/libsdl-org/sdl2-compat/issues/303
2025-02-03 22:52:13 -05:00
Sam Lantinga 07c22da464 Fixed decoding 4-bit RLE encoded BMP files
Also flipped the return value of readRlePixels() to match convention.

Fixes https://github.com/libsdl-org/sdl2-compat/issues/308
2025-02-03 19:34:38 -08:00
Petar Popovic 8ccf85c59e Formatting spaces around pointer symbol. 2025-02-03 17:03:26 -08:00
Sam Lantinga 94409d3504 Added Switch Input-only controller entries for Zuiki MasCon controller for Nintendo Switch.
The device string indicates RED on the one I have and is PIDs 0003 and some other posts online say 0001 for the normal model, so I'll try 0001-0003 to get all 3 color variants
2025-02-03 16:49:29 -08:00
Sam Lantinga a8a2874ef4 Added distinct VID/PIDs for the PS4 vs Xbox eSwap Pro controllers 2025-02-03 13:26:04 -08:00
Sam Lantinga 84bc2abdad Corrected the entry for the PXN V900 racing wheel 2025-02-03 13:11:02 -08:00
Sam Lantinga eac07bda0a Sort the controller lists by VID/PID 2025-02-03 12:39:53 -08:00
Sam Lantinga 6243a06539 Call the windows message hook for WM_ENTERSIZEMOVE and WM_ENTERMENULOOP
Fixes https://github.com/libsdl-org/SDL/issues/12169
2025-02-03 09:17:17 -08:00
Sam Lantinga 8e51b2468a Renamed SDL_SoftStretch() to SDL_StretchSurface()
Fixes https://github.com/libsdl-org/SDL/issues/12168
2025-02-03 08:51:32 -08:00
Sam Lantinga a98a4b8a68 Re-added SDL_SoftStretch() to the API
This is needed for sdl2-compat, since a blit is not quite equivalent.
2025-02-02 13:41:36 -08:00
Sam Lantinga c06172dc1c Track mouse button state by real mouse ID
We'll switch to the global mouse ID just once we are ready to deliver events.

This makes sure that any button events that come in for a specific mouse ID maintain that state if we switch to relative mode and start using that mouse ID for events.

Fixes https://github.com/libsdl-org/sdl2-compat/issues/263
2025-02-02 12:58:45 -08:00
Ozkan Sezer 73a8143581 timer, windows: allow building high resolution code with old SDKs. 2025-02-02 21:23:50 +03:00
Sam Lantinga be991239d9 Updated to version 3.2.3 for development 2025-02-01 17:43:38 -08:00
Sam Lantinga 2fa1e7258a Updated to version 3.2.2 for release 2025-02-01 17:01:45 -08:00
Em c922762791 proposed fix: set curr_src.h is to bottom_height before drawing bottom edges / corners in SDL_RenderTexture9Grid, to avoid issue where inadvertently using top height if the npatch existed on a larger texture than the drawn edge would cause too many pixels to be included in the bottom part of the render. 2025-02-01 16:09:08 -08:00
John Kvalevog dc13a6ae95 SDL_SaveBMP_IO: Write bitmap header v5 values
bV4CSType was changed to LCS_sRGB to work with Preview on macOS.

Fixes: #11903
2025-02-01 11:10:24 -08:00
Sam Lantinga bc3264130d Fixed mouse motion events while the mouse is grabbed
When the mouse is grabbed, the X server sends mouse events only to the grabbing client, and XInput2 events for the master device are not delivered.

We should consider using the window mouse rect confinement instead of a true X server grab for SDL mouse grab functionality.
2025-01-31 23:45:09 -08:00
Sam Lantinga 69d361dee1 Ignore SDL_HINT_RENDER_DRIVER set to software when creating a window surface
We handled the case where software was in a list of render drivers, but not when the hint was set to exactly "software".

Fixes https://github.com/libsdl-org/sdl2-compat/issues/266
2025-01-31 15:49:58 -08:00
Evan Hemsley 70a239210e
GPU: Describe "readonly storage" images as sampled images on Vulkan backend (#12149) 2025-01-31 15:07:33 -08:00
Sam Lantinga 4c6d949e6d wayland: make sure the desktop mode is in the fullscreen mode list
Fixes https://github.com/libsdl-org/SDL/issues/12079
2025-01-31 14:53:40 -08:00
Sam Lantinga ab5cb707a6 Fixed enabling call logging 2025-01-31 14:22:29 -08:00
Sam Lantinga 16f8122a0d Keep the simplest mapping of scancode + modifer for a given keycode
Fixes https://github.com/libsdl-org/sdl2-compat/issues/259
2025-01-31 12:07:08 -08:00
Timothee Besset 6beda34215 do not build camera drivers if camera support is disabled 2025-01-31 10:24:54 -08:00
Frank Praznik 0825d07a43 wayland: Don't send size events while the window is hidden
Some clients don't expect this, and it can cause issues, particularly if events are emitted while creating a hidden window.
2025-01-31 12:40:07 -05:00
Evan Hemsley 8e766c9252
GPU: Resource binding state shadowing (#12138)
---------

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
2025-01-31 08:34:10 -08:00
Ozkan Sezer e4fcc7b6e7 gpu/vulkan/SDL_gpu_vulkan.c: fix type redefinition error
src/gpu/vulkan/SDL_gpu_vulkan.c:763: error: redefinition of typedef 'VulkanUniformBuffer'
src/gpu/vulkan/SDL_gpu_vulkan.c:482: note: previous declaration of 'VulkanUniformBuffer' was here
2025-01-31 02:50:00 +03:00
John Alanbrook 14edb21aec check for backslashes as well as the forward slash 2025-01-30 12:41:48 -08:00
Ryan C. Gordon 943c4abcb4
pipewire: Report correct device default formats instead of hardcoding Float32.
The comment in the source wasn't true; PipeWire doesn't _have_ to work in
float format. It presumably does if it has to mix, but if a game is the only
thing making noise on the system--a common scenario--then it might be able to
pass, say, Sint16 data straight through to the hardware without conversion.

Fixes #12129.
2025-01-30 02:46:56 -05:00
Aki 943579a545 Fix inverted pen Y tilt on macOS and add tilt display to example
- Negate tilt.y in Cocoa pen handling to correct inverted Y tilt axis
- Update drawing example to display X/Y tilt values for visualization
- see 0f128fd7c5/src/plugins/platforms/cocoa/qnsview_tablet.mm (L63)
- see https://source.chromium.org/chromium/chromium/src/+/main:components/input/web_input_event_builders_mac.mm;drc=0af5ffa1e4cc4cc4f818725f8fee93ec57855e4b;l=421
2025-01-29 22:09:02 -08:00
Seth Anderson 2abc7735a4 Free XIDeviceInfo in X11_MaybeAddPenByDeviceID 2025-01-29 10:55:49 -08:00
Sam Lantinga 8298d60e4a Dynamically load CreateWaitableTimerExW and SetWaitableTimerEx
These functions are not available on Windows XP
2025-01-29 05:40:49 -08:00
Timothee Besset cf249b0cb2 fix -Wformat problem in 32 bit builds 2025-01-28 16:57:25 -08:00
Ryan C. Gordon ccd5fcef12
audio: Fix potential NULL dereference in AudioStream gain adjustment.
You can end up with a NULL scratch buffer, which is otherwise not needed on
this path, then ConvertAudio will end up needing that scratch space to move
to float32 to apply gain.

Fixes #12091.
(I assume.)
2025-01-28 13:14:25 -05:00
Frank Praznik 48f5550651
wayland: Don't send keyboard and mouse added events during initialization
Only send them when a device is added post-initialization, as is done on other platforms.
2025-01-28 13:02:29 -05:00
Adam Kewley 1c008d8ed0 Change DBUS introspection timer from INFINITE -> DEFAULT when introspecting available dialog services 2025-01-28 05:13:35 -08:00
Carl Åstholm c21bc48a70 Fix undefined behavior in SDL_windowsmouse.c
This fix prevents C undefined behavior from being invoked on Windows
if the user's configured cursor speed is below 6.
2025-01-28 05:12:16 -08:00
Sam Lantinga 1c7cc60286 Skip IsRegularFileOrPipe() check on Emscripten
The sandbox guarantees that this will be true.

Fixes https://github.com/libsdl-org/SDL/issues/12108
2025-01-27 22:25:12 -08:00
Ryan C. Gordon 8f958953f1
audio: Fix audio stream gain going wrong in certain scenarios.
Fixes #12091.
2025-01-27 20:20:17 -05:00
Ryan C. Gordon 3b3af7105b
audio: Fix a minor code style thing. 2025-01-27 20:20:17 -05:00
Petar Popovic 6f098a920e Avoid a crash when a tray without a menu is clicked on Windows. 2025-01-26 23:27:28 -08:00
Ryan C. Gordon 09f900f66e
audio: Remove resampling limits.
Audio streams used to accept audio with a src or dest frequency between
4000Hz and 384000Hz. It was arbitrary (or perhaps a relic of older
resampler revisions), and testing shows unnecessary, so remove it.

Fixes #12098.
2025-01-27 01:13:54 -05:00
Sam Lantinga 5f8e0ebf58 Fixed memory leak at shutdown 2025-01-26 19:30:29 -08:00
nightmareci 2e381a717f Fix possible integer overflow of size + 1 2025-01-23 15:57:23 -08:00
Petar Popovic a336b62d8b Remove newlines from error messages 2025-01-23 11:45:04 -08:00
Frank Praznik d0ae093681 x11: Don't force position windows with an undefined position
An undefined position means that the window manager can handle placement, so SDL shouldn't override that by forcing a position when showing a window.

Allows for removing a fair bit of now-unnecessary code as well.
2025-01-23 14:36:26 -05:00
hspir404 72a3eae0da Fix buffer overrun in ConvertAudio with different src/dst channel count
- Source or destination format also has to not be F32 to trigger bug
2025-01-23 13:52:31 -05:00
Petar Popovic 983cfe8b1c Remove even more newlines from log messages 2025-01-23 09:32:50 -08:00
nightmareci 718034f5fa Remove newlines from log messages 2025-01-22 20:25:04 -08:00
Sam Lantinga 6f3d0b3cdb Fixed build when using an older Xcode SDK
Fixes https://github.com/libsdl-org/SDL/issues/12048
2025-01-21 18:17:02 -08:00
Sam Lantinga 77b520e93e Updated to version 3.2.1 for development 2025-01-21 14:02:06 -08:00
Sam Lantinga b775135b4f Removed temporary debug code 2025-01-21 08:57:08 -08:00
Sam Lantinga a52fc209bb Updated to version 3.2.0 for release 2025-01-21 08:52:28 -08:00
Ryan C. Gordon 90bda6548f
video: Don't let SDL_CreateWindowTexture use the software renderer.
It used to check for "software" in the hint, but now it has to parse a
comma-separated list.

If it tries to use the software renderer here, you'll end up in an infinite
recursion.
2025-01-21 11:29:00 -05:00
Ryan C. Gordon c45c4a5e51
render: SDL_HINT_RENDER_DRIVER now accepts a comma-separated list.
Fixes #11077.
2025-01-21 11:29:00 -05:00
Sam Lantinga 8526868563 dialog: cleaned up D-Bus portal implementation
Fixes https://github.com/libsdl-org/SDL/issues/12036
2025-01-20 22:57:42 -08:00
Ryan C. Gordon 071bebf235
coreaudio: Add a note about why this uses 3 buffers instead of 2. 2025-01-20 23:29:53 -05:00
Katelyn Gadd c0a9d220b9
vulkan: Fixes for swapchain resize crash on X11.
Fixes #11075.
2025-01-20 23:17:38 -05:00
Ryan C. Gordon 6d5815db52
vulkan: Deal with VK_ERROR_OUT_OF_DATE_KHR returns from vkAcquireNextImageKHR.
Fixes #11075.
2025-01-20 22:32:23 -05:00
Katelyn Gadd 6b7dad7d82
vulkan: move temporary pointer to its own field to prevent a bad dereference.
Reference Issue #11075.
2025-01-20 22:32:23 -05:00
Tomasz Pakuła 10c9fbf411 Use proper polar direction when creating FF_RUMBLE effect
Uses proper polar direction of 90 degrees. Previous value probably came from mistakenly using spherical system default.
2025-01-20 16:52:40 -08:00
Tomasz Pakuła c6c7469708 Translate conditional effect direction instead of hardcoding it to 0
Provious code wrongly assumed that direction is not an important part
of conditional effect. Moreover, if there's need to hardcode polar
direction, the default should be 0x4000 (north).

For one axis affects, a direction of 0 means complete lack of force, if
a FFB-enabled device takes direction into force calculation. A sine function
graph can be used to represent the resulting forces where X is the input
direction and Y is the force multiplier (360 degrees equals to 1).

This fixes conditional effect playback on Moza Racing devices, which do
not ignore direction field.
2025-01-20 16:52:40 -08:00
Sam Lantinga b476695e67 Call the windows message hook while inside a modal message loop
Fixes https://github.com/libsdl-org/SDL/issues/12029
2025-01-20 15:56:23 -08:00
Ryan C. Gordon b6d0bc0431 coreaudio: Use three buffers for the audioqueue, not two.
This doesn't affect latency much, but it makes the system usable if the system
drops you down from the bluetooth a2dp profile (headphones) to the handsfree
(I think...?) profile because the bluetooth audio device is also recording,
which would be extremely common in a VoIP app, but also if you're talking
in a different app while also playing audio.

Fixes #8192.
2025-01-20 18:35:04 -05:00
Ryan C. Gordon aa10e51c74 audio: Added some minor missing comments in struct SDL_AudioDevice. 2025-01-20 18:35:04 -05:00
Frank Praznik 10a5b388df win32: Retain the WS_MAXIMIZEDBOX style while in fullscreen
This needs to be preserved while in fullscreen, or leaving fullscreen for the maximized state can cause the taskbar to disappear with borderless windows.
2025-01-20 17:01:58 -05:00
Frank Praznik 6449339ae3 win32: Restore the base size of a window when leaving fullscreen
Always restore the base floating size of a window before possibly entering the maximized state, as base size can be lost during the fullscreen transition, resulting in the window de-maximizing to the wrong size.
2025-01-20 17:01:58 -05:00
Sam Lantinga 075c0337cd Removed debug print statement 2025-01-20 13:11:19 -08:00
Sam Lantinga a036aeda3b The Vulkan renderer doesn't actually support RGB texture formats
Fixes https://github.com/libsdl-org/SDL/issues/10400
2025-01-20 13:09:49 -08:00
Sam Lantinga 9b454a762c Revert "testautomation: don't validate alpha values on XRGB formats"
This reverts commit 759e01bd64.

It's better to return the expected format from SDL_RenderReadPixels() than skip alpha testing.
2025-01-20 12:57:48 -08:00
Ryan C. Gordon dcadd23ba1 render: Prevent division by zero if logical presentation is 0 pixels. 2025-01-20 15:52:33 -05:00
Ryan C. Gordon adb91fd3db process: Don't use vfork() on Apple platforms.
They want you to use fork(), which is almost-identical in their implementation.
They mark vfork() usage with a big scary deprecation warning.
2025-01-20 15:51:02 -05:00
Sam Lantinga c698c61f03 renderer: initialize the surface colorspace correctly
Fixes https://github.com/libsdl-org/SDL/issues/12027
2025-01-20 10:48:13 -08:00
Sam Lantinga c975f77b0f Update joysticks and so forth during live resize
Fixes https://github.com/libsdl-org/SDL/issues/12022
2025-01-20 10:11:31 -08:00
Sam Lantinga f8040b2e01 Use UIKeyboardTypeDecimalPad for number fields on iOS
Fixes https://github.com/libsdl-org/SDL/issues/12025
2025-01-20 09:09:57 -08:00
Ryan C. Gordon 642262e30e
cocoa: Fix mousegrab when going fullscreen.
When going into a fullscreen space, update mouseConfinementRect once the
transition is done. When going exclusive fullscreen, force a window sync so
the transition is complete before we do the update.

Fixes #9088.
2025-01-20 01:02:30 -05:00
William Hou 7133969e3a
Feature add hint to remap option as alt key (#12021) 2025-01-19 20:34:04 -08:00
Sam Lantinga 5f2dd5f04e tray: fixed multi-threading issues with GTk implementation
GTK+ documentation states that all GDK and GTK+ calls should be made from the main thread.

Fixes https://github.com/libsdl-org/SDL/issues/11984
2025-01-19 18:53:55 -08:00
Sam Lantinga dfdc120268 tray: document thread-safety 2025-01-19 18:53:55 -08:00
Sam Lantinga d4cda51057 tray: renamed SDL_HasNoActiveTrays() to SDL_HasActiveTrays() 2025-01-19 18:53:55 -08:00
Sam Lantinga a974888aad tray: fixed icon colors on Windows 2025-01-19 18:53:55 -08:00
Sam Lantinga 7570ab106d tray: improved error checking
Also clean up any existing trays when the program quits

Fixes https://github.com/libsdl-org/SDL/issues/11893
2025-01-19 18:53:55 -08:00
Sam Lantinga 3afd1e7eaa windows: use WIN_UTF8ToStringW() for dialog titles 2025-01-19 18:53:55 -08:00
Semphris 43b54b3d72 Fix Windows dialog folder titles
Same fix as in cf946e32ba, which was not done for the folder implementation.
2025-01-19 08:19:40 -08:00
Ryan C. Gordon 32965b4bf1
pen: Send virtual mouse motion without a button press when a pen is hovering.
Fixes #11470.
2025-01-18 21:51:03 -05:00
Ryan C. Gordon 5da9d4ecc2 cocoa: Slightly better display hotplugging detection.
Fixes #12016.
2025-01-18 17:02:37 -05:00
Semphris 19f42094bb Fix Windows fie dialog args freeing 2025-01-18 13:53:56 -08:00
Semphris 721fc7de0b Correct spacing of pointers ('a* b;' -> 'a *b;') 2025-01-18 13:53:56 -08:00
Semphris cd269730eb Fix Windows dialog memory management 2025-01-18 13:53:56 -08:00
Sam Lantinga 049a8f0e52 Use SDL_calloc() instead of SDL_malloc()
This automatically initializes memory to zero so you don't have uninitialized memory bugs
2025-01-18 13:41:23 -08:00
Semphris 354d2c390c Initialize invalid parent_{tray,entry} to NULL
The API states that the related functions must return NULL if the function
called (get the parent tray, or get the parent entry) is invalid for this
menu. Initialising the fields to NULL makes that API correct for Windows.
2025-01-18 16:17:16 -05:00
Semphris b79ada6aa5 Windows trays: Fix ParentEntry & Enabling
The test/testtray program would crash on Windows when adding any item and then removing it, because a submenu's parent_entry field was not set.

Additionally, I noticed that some extraneous code copied from the {G,S}etTrayEntryChecked made {G,S}etTrayEntryEnabled work only for checkboxes, which is not the desired behavior.

Both issues were fixed in this commit.
2025-01-18 16:17:16 -05:00
Sam Lantinga ba95c54f99 macOS: get the correct display name on macOS 10.15+ 2025-01-18 09:42:37 -08:00
Frank Praznik 42e0fb10f8
wayland: Set the mouse state before calling the hit test callback
Update the mouse state before entering the hit test, in case the global state is queried, or the system menu opened, while in the client hit testing callback.
2025-01-18 12:10:25 -05:00
Sam Lantinga cd0db8d35e Added Linux evdev mappings for the Wireless HORIPAD For Steam 2025-01-18 08:09:25 -08:00
Ryan C. Gordon 1d7a681e4d
Revert "emscripten: resizable windows take whole page, resize with browser window."
This reverts commit d317fc9c08.

This has some issues, we'll revisit it for 3.4.0.

Reference Issue #11949.
2025-01-18 10:15:43 -05:00
Sam Lantinga c7d1fd90ea Added support for the 8BitDo Ultimate 2C Wireless in Bluetooth mode
Closes https://github.com/libsdl-org/SDL/pull/11415
2025-01-18 07:06:46 -08:00
Sam Lantinga 923123a527 emscripten: Let SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT accept "#none"
This is used to say "don't even try to listen for keypresses," for apps that
are managing this outside of SDL.

Fixes #10292.
2025-01-18 06:19:27 -08:00
Sam Lantinga c603a9c94a Moved flag documentation 2025-01-18 06:16:10 -08:00
Sam Lantinga 90b7174a7d Respect the SDL_BORDERLESS_RESIZABLE_STYLE hint, but default it to true. 2025-01-18 06:07:06 -08:00
Ryan C. Gordon 6a72d32d41
emscripten: Let SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT accept "".
This is used to say "don't even try to listen for keypresses," for apps that
are managing this outside of SDL.

Fixes #10292.
2025-01-18 08:43:55 -05:00
Ryan C. Gordon f3a39074b0
windows: use WS_THICKFRAME style on borderless windows.
This is apparently necessary in newer Windows releases (Windows 10 and later?)
to allow hit-testing to resize the window.

Fixes #8406.
2025-01-18 08:38:49 -05:00
Ryan C. Gordon 010f27dc70
storage: enumerate and glob on storage can accept a NULL path.
This will be treated as the root of the storage tree.
2025-01-17 20:11:50 -05:00
Ryan C. Gordon a6a8598b98
storage: deal with paths with Windows '\\' path separators appended.
Reference Issue #11986.
2025-01-17 20:11:50 -05:00
Sam Lantinga 7c6adc1ca7 gpu renderer: removed unused sampler slots
There used to be 3 scale modes, now there are only 2.
2025-01-17 16:31:40 -08:00
Ryan C. Gordon d317fc9c08
emscripten: resizable windows take whole page, resize with browser window.
This also implements the SetWindowResizable interface, so this can be now
toggled after window creation, too.

Fixes #11949.
2025-01-17 17:59:28 -05:00
Sam Lantinga 59ea078ee2 x11: check to see if displays moved when connected/disconnected
Fixes https://github.com/libsdl-org/SDL/issues/9738
2025-01-17 13:14:16 -08:00
Frank Praznik 1848ce680b win32: Use the window coordinates to get the monitor when de-minimizing a maximized window
MonitorFromWindow can fail if called on a window being de-minimized, so fall back to using the monitor from the last window coordinates if initial retrieval fails.
2025-01-17 15:46:18 -05:00
Sam Lantinga 656c519cca Fixed warning C6313: Incorrect operator. Use an equality test to check for zero-valued flags. 2025-01-17 12:08:58 -08:00
ROllerozxa cdc5483cf9 Vita: Fix off-by-one error for synthetic mouse events 2025-01-16 11:58:01 -08:00
Sam Lantinga eb168e410c Updated to version 3.1.11 for development 2025-01-16 11:41:28 -08:00
Frank Praznik b96bb152c2
wayland: Don't redundantly set the border state when showing a window
They are now set before the initial configure.
2025-01-16 13:54:39 -05:00
Frank Praznik 5a564a718d
wayland: Add a dummy function for the libdecor dismiss popup callback
This was never added, and we've been lucky that it's never called as libdecor doesn't check the function pointer for null before doing so.
2025-01-16 13:48:16 -05:00
Frank Praznik 9f6eeb1095
wayland: Set the border state before the initial configure
This allows the toplevel bounds to be set correctly on borderless windows.
2025-01-16 13:40:31 -05:00
Ethan Lee 326ce9bb8d gpu: D3D12 buildfix for Xbox 2025-01-16 12:19:59 -05:00
Ethan Lee c95b842b30 video: Xbox does not use CreateIconFromSurface 2025-01-16 12:19:46 -05:00
Frank Praznik 7ee2ab3830
wayland: Fix return value check from int-to-bool conversion 2025-01-16 11:52:16 -05:00
Sam Lantinga 1dd8fadca2 Updated to version 3.1.10 for the release candidate 2025-01-16 08:33:18 -08:00
Ryan C. Gordon 3ffb1a8cbd storage: generic title storage allows override paths without '/' appended.
Fixes #11299.
2025-01-16 08:19:28 -05:00
Ryan C. Gordon 874c07f8de storage: Don't allow "." and ".." paths, enforce '/' dir separators.
Also clarify what characters are valid for Storage paths in the category docs.

Fixes #11079.
Fixes #11370.
Fixes #11369.
2025-01-16 08:19:28 -05:00
Ryan C. Gordon eb793dede7 filesystem: SDL_GetCurrentDirectory() should add a path separator at the end. 2025-01-16 08:19:28 -05:00
Ryan C. Gordon 87e1b0eb89 filesystem: SDL_EnumerateDirectory() gives dirs with path seperators appended.
Fixes #11065.
Fixes #11427.
2025-01-16 08:19:28 -05:00
Ramez Ragaa e98ee9bb04 Adjust testgl.c to test gl_release_behavior 2025-01-16 08:19:05 -05:00
Ryan C. Gordon 3424ec948c video: SDL_GL_GetAttribute gets correct SDL_GL_CONTEXT_RELEASE_BEHAVIOR value.
Original patch was from @ramezgerges (thanks!).

Fixes #11697.
2025-01-16 08:19:05 -05:00
Ryan C. Gordon 4d63a2b882 io: Renamed src/file to src/io
Fixes #11980.
2025-01-16 08:18:40 -05:00
Sam Lantinga ea642fe9ff
cocoa: clear mouse focus based on NSEventTypeMouseExited events (#11991)
We can't directly set the mouse focus since we may get spammed by entered/exited events,
but we can process the current focus later in the mouseMoved handler in line with the
mouse motion event sequence.

Fixes https://github.com/libsdl-org/SDL/issues/8188
2025-01-15 23:34:20 -08:00
Sam Lantinga 2c7b7d1d33 Keep the lifecycle observer active while there are windows active
Fixes https://github.com/libsdl-org/SDL/issues/11627
2025-01-15 17:10:49 -08:00
cosmonaut 355f69ebfe GPU: Ensure thread safety of Vulkan resource creation 2025-01-15 13:45:43 -08:00
Frank Praznik c9d602307c cocoa: Only process hit tests on left clicks
Otherwise, right-click events over drag areas will be eaten.
2025-01-15 15:44:01 -05:00
Frank Praznik dd0bdc2561 win32: Pass through non-left mouse button presses when over draggable areas
Returning anything other an HTCLIENT result will cause windows to eat the button press, so ensure that non-left presses are passed through to the client over draggable areas.
2025-01-15 15:44:01 -05:00
Ryan C. Gordon 84d35587ee
filesystem: SDL_SYS_EnumerateDirectory inexplicably takes the same arg twice. 2025-01-15 14:09:33 -05:00
Sam Lantinga fc9b2478d8 windows: don't set focus click pending if SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH is set
Fixes https://github.com/libsdl-org/SDL/issues/11976
2025-01-15 10:54:12 -08:00
Sam Lantinga 18d21b36fe windows: use the initial rect to anchor fixed aspect ratio resizing
Fixes https://github.com/libsdl-org/SDL/issues/11688
2025-01-15 10:33:22 -08:00
Sam Lantinga 1995471927 cocoa: fixed resizing windows with fixed aspect ratio
The existing algorithm works well for min-max ratios, but didn't allow edge expansion of fixed aspect ratio windows. Use NSWindow setContentAspectRatio instead.
2025-01-15 10:05:34 -08:00
Sam Lantinga 67382e9c83 Fixed detection of function keys on Emscripten
Fixes https://github.com/libsdl-org/SDL/issues/11973
2025-01-15 08:07:38 -08:00
Sam Lantinga 23410debf7 SDL_GetKeyboardNameForID(): Set an error message for invalid keyboard IDs 2025-01-15 00:01:06 -08:00
Petar Popovic 8ce176b59a SDL_GetMouseNameForID(): Set an error message for invalid mouse IDs. 2025-01-14 23:59:49 -08:00
Sam Lantinga 51fa076fdc Don't send normal keyboard events if no application window has focus
This can happen if all the windows shown have the SDL_WINDOW_NOT_FOCUSABLE flag. We'll still accept modifier state changes though, so you can do Control-click actions.
2025-01-14 23:44:43 -08:00
Sam Lantinga a446381ea9 Tooltips and unfocusable windows can't become main windows 2025-01-14 23:44:43 -08:00
Ryan C. Gordon ebb24eedc8 mouse: Clean up virtual touch devices as appropriate. 2025-01-15 02:19:59 -05:00
Ryan C. Gordon dabc93a631 pen: Send virtual mouse and touch events for pen input.
Fixes #11948.
2025-01-15 02:19:59 -05:00
ImThour 169c8d5140 Fix incorrect hotspot calculation for cursor positioning
Corrected the calculation of the vertical hotspot position in the `GetCachedCursor` function.

Changed the variable from `data->hot_x` to `data->hot_y` to ensure the correct vertical position of the cursor's hotspot is used when scaling.
2025-01-14 22:37:24 -08:00
Sam Lantinga 8e9c44bc3b Fixed accidental removal of optional delegate interface check
Fixes https://github.com/libsdl-org/SDL/issues/11970
2025-01-14 22:35:13 -08:00
Sam Lantinga 4dd585fb62 coreaudio: convert MPEG channel layout to WAVE channel layout 2025-01-14 22:26:16 -08:00
Sam Lantinga 81e57147f8 Child windows shouldn't take focus if the parent window is in relative mouse mode
Fixes https://github.com/libsdl-org/SDL/issues/11807 on Windows
2025-01-14 21:27:06 -08:00
Sam Lantinga 1ab61635a9 Use SDL_Log() for keyboard debugging. 2025-01-14 19:05:07 -08:00
Sam Lantinga 0eaa6197c5 Removed unnecessary __builtin_available check 2025-01-14 17:00:30 -08:00
Sam Lantinga ffe194c52e Fixed build when SDL_JOYSTICK_MFI isn't enabled 2025-01-14 17:00:30 -08:00
Sam Lantinga 49dd24e195 Fixed potentially overlapping memcpy() to use memmove() 2025-01-14 14:31:20 -08:00
Green Sky 191a6417d5 events: use SDL_memmove instead of SDL_memcpy for overlapping memory 2025-01-14 14:20:32 -08:00
Ryan C. Gordon 9e60a8994f
audio: Allow streams to change the device-side channels maps.
Fixes #11881.
2025-01-14 16:42:53 -05:00
Sam Lantinga 5ca735b40f Only use WAVE surround sound channel layouts on macOS 10.15+ 2025-01-14 12:03:07 -08:00
Sam Lantinga cdde6dd7bb Bumped deployment requirements for Apple platforms
We require at least Xcode 12.2 and macOS SDK 11 to build. We support deploying to macOS 10.13, iOS 11.0, and tvOS 11.0.

This cleans up the code significantly
2025-01-14 12:03:07 -08:00
cosmonaut 4294c06836 GPU: Check texture format support in pipeline creation 2025-01-14 10:16:20 -08:00
Scrooge86x 0aa319e4f9 Added support for custom tray icon on Windows via SDL hints.
SDL_CreateTray now respects SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL
and SDL_HINT_WINDOWS_INTRESOURCE_ICON hints and uses the specified icon
as the tray icon.
2025-01-13 18:35:49 -08:00
cosmonaut d590e1f122 GPU: Align D3D12 clear properties to naming convention 2025-01-13 17:38:21 -08:00
Evan Hemsley fb6df93384
GPU: Add name properties to resources (#11946) 2025-01-13 17:29:08 -08:00
Ryan C. Gordon 3766a39409
emscripten: double the audio buffer size.
Some systems seem to not keep up with the smaller buffer.

Reference Issue #11930.
2025-01-13 16:26:18 -05:00
Ryan C. Gordon 4bddf521dd
emscripten: Override emscripten's fullscreen button with SDL's implementation.
Fixes #6798.
Fixes #7913.
Fixes #9044.
2025-01-13 14:17:36 -05:00
Sam Lantinga e5a4f09363 Call SDL_UDEV_Quit() if we don't end up using it 2025-01-13 10:22:10 -08:00
Frank Praznik b4562c0243 cocoa: Add a hint to control menu visibility in fullscreen spaces windows
Adds SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY to control whether or not the menu can be accessed when the cursor is moved to the top of the screen when a window is in fullscreen spaces mode.

The three values are true, false, and 'auto' (default), with auto resulting in a hidden menu if fullscreen was toggled programmatically, and the menu being accessible if fullscreen was toggled via the button on the window title bar, so the user has an easy way back out of fullscreen if the client app/game doesn't have a readily available option to toggle it.
2025-01-13 12:37:16 -05:00
Sam Lantinga 611f132fd0 Don't use a hint callback for SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY
This was originally intended to make sure that nativeAllowRecreateActivity() could be called from another thread safely, but the hint system is now thread-safe, so we don't need to use a callback here.

Fixes https://github.com/libsdl-org/SDL/issues/11938
2025-01-13 07:49:09 -08:00
Ryan C. Gordon 307e6f2ca6
emscripten: simulate mouse autocapture.
This is just enough to delay MOUSE_LEAVE events until a drag ending outside
the canvas is released, and make sure the MOUSE_UP event has the canvas's
SDL_WindowID, which it wouldn't when mouse focus is was lost by this point.

Fixes #10033.
2025-01-13 02:39:39 -05:00
Ethan Lee 3df0767e34 gpu: Initialize Metal stencil format even if stencil test is disabled 2025-01-12 13:05:27 -08:00
Sam Lantinga 21cc1878f1 Reset enhanced mode state when closing a controller
Fixes https://github.com/libsdl-org/SDL/issues/11912
2025-01-12 10:45:54 -08:00
expikr 9a83fa026d apply multiplier scale after system scale 2025-01-12 08:24:41 -08:00
Sam Lantinga 551510c0eb SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE can be combined with SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE 2025-01-12 08:05:51 -08:00
Ryan C. Gordon f0af6c348a
emscripten: Add SDL_EVENT_DISPLAY_ORIENTATION support.
Reference Issue #11389.
2025-01-12 02:23:00 -05:00
Ryan C. Gordon 3ad9c38a46
emscripten: Don't set OpenGL swap intervals until first PumpEvents.
Any requested swap interval will be saved and set on the first PumpEvents.
Once PumpEvents has been called at least once, swap intervals are set
immediately.

This assumes that events won't be pumped until after an Emscripten main loop
has been defined, and so prevents a warning on the javascript console:

"emscripten_set_main_loop_timing: Cannot set timing mode for main loop since
a main loop does not exist! Call emscripten_set_main_loop first to set one
up."

Fixes #9969.
2025-01-11 15:19:09 -05:00
Ryan C. Gordon 82125ec1d8
x11: Be more aggressive about finding _any_ usable messagebox font.
Fixes #4800.
Fixes #11910.
2025-01-11 00:35:39 -05:00
Sam Lantinga 4231848791 Revert "Separate android initialization from Activity (#11891)"
This reverts commit d14c93c4b1.

This is a major breaking change for activities that inherit SDLActivity
2025-01-10 15:27:08 -08:00
Xander d14c93c4b1
Separate android initialization from Activity (#11891) 2025-01-10 15:05:58 -08:00
Sam Lantinga 042898995c Added SDL_ClickTrayEntry()
Also removed the app delegate from the tray code on Cocoa and folded that into SDL3AppDelegate.

Fixes https://github.com/libsdl-org/SDL/issues/11906
2025-01-10 12:55:50 -08:00
Ryan C. Gordon fb0f6a1196 cocoa: Display mode changes set Desktop display mode, not current. 2025-01-10 15:35:43 -05:00
Ryan C. Gordon 38176bfe9a cocoa: Implemented display hotplugging support.
Fixes #7764.
2025-01-10 13:25:34 -05:00
Frank Praznik 0e2ca934b5
events: Remove unused function declaration 2025-01-10 11:23:54 -05:00
Sam Lantinga 715897aea7 Added support for displaying XIM composition strings
Fixes https://github.com/libsdl-org/SDL/issues/6437
2025-01-10 03:26:42 -08:00
Sam Lantinga a8a65b6fca Use XIM for IME input on X11
Tested with fcitx5 and ibus on Xorg and Xwayland
* Used US English with dead keys and verified that ` followed by a results in à
* Used Hangul to enter Korean and got text in the expected order
* Used the mozc IM to enter Japanese and was able to generate candidates and so forth

Fixes https://github.com/libsdl-org/SDL/issues/3907
Fixes https://github.com/libsdl-org/SDL/issues/6164
Fixes https://github.com/libsdl-org/SDL/issues/11894
2025-01-10 03:26:42 -08:00
Ethan Lee 90aff306c1 gpu: Show a debug error when pipelines are not given the right shader stages 2025-01-09 20:17:21 -05:00
Frank Praznik 6b776a9989 keyboard: Add some SDL keycodes for common Xkb keys
Add SDL keycodes for keys found commonly found in the default Xkb layout, such as left tab and compose, and keys frequently used for custom modifiers such as Meta, Hyper, and Level5 Shift.

As these keys aren't Unicode code points and don't have associated scancodes (at least on modern keyboards), they are placed in the new extended key code space, with bit 30 set as a flag.
2025-01-09 17:26:41 -05:00
Frank Praznik e5966bbdb1 x11: Add support for Mod3 and more esoteric Xkb configurations
Adds support for Mod3, which is usually Level 5 shift, as well as not altering the functionality of the more esoteric modifier keys, such as meta and hyper.

Also use the system modifier state instead of setting them based on key presses, which may be incorrect due to remapping, or toggled in some other manner.
2025-01-09 17:26:41 -05:00
Frank Praznik 73ee99978d wayland: Add support for Mod3 and more esoteric Xkb configurations
Adds support for Mod3, which is usually Level 5 shift, but can vary, as well as not altering the functionality of the more esoteric modifier keys, such as meta and hyper.
2025-01-09 17:26:41 -05:00
Anonymous Maarten a78104a47f Disable long long support in the headers with SDL_NOLONGLONG
Some older toolchains don't support 'long long'.
2025-01-09 16:04:14 -05:00