Sam Lantinga
ef23ebfb5a
Fixed the cursor clip rect when toggling window borders on macOS
2025-02-28 11:57:34 -08:00
Sam Lantinga
281f0fae1c
Include the VID/PID of generic keyboard/mouse devices on Windows
2025-02-27 14:03:39 -08:00
Sam Lantinga
eb89d0c8c3
Don't put wired Switch Pro controllers into simple report mode
...
This stops the controller from sending input or responding to queries until it's unplugged.
2025-02-26 17:54:43 -08:00
Sam Lantinga
1ea99bc904
Early out if setting a duplicate window title
...
Setting the window title is an expensive windowing operation, so short circuit it if possible.
2025-02-26 17:10:41 -08:00
Sam Lantinga
cc984c9735
Added a mapping for the 8BitDo SN30 Pro+ controller on macOS
...
This mapping is for Android mode (Start + B at startup)
Fixes https://github.com/libsdl-org/SDL/issues/12126
2025-02-26 12:24:47 -08:00
Sam Lantinga
ba88b6aa06
Fixed reliability of initializing Switch controllers on macOS
...
It looks like both macOS (15.1.1) and SDL are trying to talk to the controller at the same time, which can cause interleaved replies or even locking up the controller. Waiting a bit before talking to the controller seems to take care of this.
2025-02-26 12:24:47 -08:00
Sam Lantinga
66ecdc69ac
Don't update the report mode until the related hint is set
...
Fixes https://github.com/libsdl-org/SDL/issues/12404
2025-02-26 12:24:47 -08:00
Sam Lantinga
cf819ca818
Don't allow further operations on properties while we're destroying them
...
Fixes https://github.com/libsdl-org/SDL/issues/12407
2025-02-26 08:34:14 -08:00
Sam Lantinga
e012573766
Don't fixup mappings for Joy-Con controllers
...
They don't have a D-pad mapping, so look at the paddles instead to see whether we need to fix up the mapping.
Fixes https://github.com/libsdl-org/SDL/issues/12232
2025-02-25 19:14:18 -08:00
Sam Lantinga
34c3734953
Fixed opening one Joy-Con when the other is visible but disconnected
...
This can happen on Windows when the controller is turned off directly. It still shows up in the device list and you can send packets to it, but it's off and doesn't respond. We'll mark this device as broken and open the other as a single Joy-Con.
2025-02-25 19:14:18 -08:00
Sam Lantinga
049a7a04de
Wake the main thread for main function dispatch
...
Also added a test case to catch the main thread waiting indefinitely when a function is pending.
Fixes https://github.com/libsdl-org/SDL/issues/12390
2025-02-25 12:50:41 -08:00
Sam Lantinga
85a302550d
Set an error message if the rect passed to SDL_RenderReadPixels() is entirely outside the viewport
2025-02-25 10:28:57 -08:00
Sam Lantinga
29df99ee38
Clarified SDL_RenderReadPixels() documentation
...
Clarified that the rect to be read is clipped against the current viewport, not actually relative to it.
Also added a note for people using SDL_SetRenderLogicalPresentation() so they know they have to map between logical space and render space if they want to read back.
2025-02-25 10:28:57 -08:00
Sam Lantinga
1c2189c7c9
strings.h isn't available in Windows environments
...
I believe this header isn't necessary for clang-tidy, string.h has all the functions we care about.
Fixes https://github.com/libsdl-org/SDL/issues/12238
2025-02-25 09:41:50 -08:00
Sam Lantinga
ac5fca4ae5
Clarify the expected usage of SDL_StorageReady()
...
Fixes https://github.com/libsdl-org/SDL/issues/12201
2025-02-25 08:56:56 -08:00
Sam Lantinga
ad840e8796
Better document that main functionality is in SDL_main.h
...
Fixes https://github.com/libsdl-org/SDL/issues/12159
2025-02-25 08:38:39 -08:00
Sam Lantinga
6980325310
Added support for the "%n" sscanf format specifier
2025-02-24 20:02:59 -08:00
Sam Lantinga
e6a24fcbb5
fix stbi__parse_png_file() reading too much bytes (thanks @miniupnp!)
...
just "rewind" the bytes that have been read past the IEND chunk.
2025-02-24 17:29:25 -08:00
Sam Lantinga
db4e6c1931
Cocoa metal layers need their size updated before renderer updates
...
Also refactored event watch code so it can be shared between internal window event dispatch and public event watchers.
Fixes https://github.com/libsdl-org/SDL/issues/12376
2025-02-24 15:37:13 -08:00
Sam Lantinga
52e64f816c
Use SDL C runtime functions in OpenVR driver
...
Fixes link errors when building with -DSDL_LIBC=OFF
2025-02-22 12:41:03 -08:00
Sam Lantinga
7224b40407
Fix errors when building stb_image with -DSDL_LIBC=OFF
...
I integrated changes from SDL_image and updated as needed for JPEG memory loading functionality.
Fixes https://github.com/libsdl-org/SDL/issues/12364
2025-02-22 12:41:03 -08:00
Sam Lantinga
e50db698e2
Disable all camera drivers if SDL_CAMERA_DISABLED is defined
...
Fixes https://github.com/libsdl-org/SDL/issues/12182
2025-02-22 09:48:49 -08:00
Sam Lantinga
1ddba3ad55
Replace "8BitDo Tech Ltd" with "8BitDo" in the manufacturer string
...
Fixes the 8BitDo Micro gamepad so it shows up as "8BitDo Bluetooth Wireless Controller" in keyboard mode over Bluetooth.
2025-02-22 09:19:59 -08:00
Sam Lantinga
fdf72d1e45
Use the keyboard/mouse vendor if available
...
Fixes the 8BitDo Micro gamepad so it shows up as "8BitDo HID-compliant mouse" and "8BitDo HID Keyboard Device" in keyboard mode over USB.
2025-02-22 09:19:59 -08:00
Sam Lantinga
a811e0ef0f
Added support for the 8BitDo Micro gamepad
2025-02-22 09:19:59 -08:00
Sam Lantinga
bc85c55350
testcontroller: create window with high pixel density
...
This improves the picture quality when running on an iPhone.
2025-02-22 09:02:01 -08:00
Sam Lantinga
75bbcbf87b
Added support for Motion JPEG pipewire camera capture
2025-02-22 00:23:03 -08:00
Sam Lantinga
fcd41c1d2c
Check desired window area when checking zoom state
...
isZoomed returns true if the window has the size and position that it would if it were maximized, so we need to check to see if our floating state matches that before saying we're zoomed.
This fixes calling zoom:nil on a borderless resizable window that was created with the same size as the usable desktop area, which happens to also be the maximized state.
Fixes https://github.com/libsdl-org/SDL/issues/12228
2025-02-21 18:38:12 -08:00
Sam Lantinga
911e53dece
Retain mouse focus as long as we're getting mouse events
...
Fixes https://github.com/libsdl-org/SDL/issues/12218
Fixes https://github.com/libsdl-org/SDL/issues/12323
2025-02-21 15:35:28 -08:00
Sam Lantinga
3b8cb62283
Make it easier to enable IME debug logs
2025-02-21 15:24:45 -08:00
Sam Lantinga
2e346d7166
Added 32-bit texture formats to Texture_GetBlockWidth() and Texture_GetBlockHeight()
...
Fixes https://github.com/libsdl-org/SDL/issues/12335
2025-02-21 09:29:18 -08:00
Sam Lantinga
5d776c070a
Refactored SDL_CreateJoystickName() into a general SDL_CreateDeviceName()
2025-02-21 09:10:54 -08:00
Sam Lantinga
9267930fea
Added a fast path for converting the same format and pitch
2025-02-20 12:16:26 -08:00
Sam Lantinga
f24f9d3bed
Revert "testcamera: added support for Motion JPEG camera frames"
...
This reverts commit 5ccee77190 .
2025-02-20 12:16:26 -08:00
Sam Lantinga
2e89c53ebc
Added support for decoding MJPG into NV12 textures
2025-02-20 12:16:26 -08:00
Sam Lantinga
06602f4e80
Document that the pitch is the length of the image data for SDL_PIXELFORMAT_MJPG
2025-02-20 12:16:26 -08:00
Sam Lantinga
a792434a37
Added initial MJPG support using stb_image
2025-02-20 12:16:26 -08:00
Sam Lantinga
1a38960eee
Call SDL_DiscardAllCommands() for the software renderer as well
2025-02-20 09:53:11 -08:00
Sam Lantinga
8f4c5e15f1
Finish any drawing when destroying a software renderer
...
Fixes the SDL3 version of https://github.com/libsdl-org/sdl2-compat/issues/373
2025-02-20 08:49:47 -08:00
Sam Lantinga
6ef687c864
Simplified and fixed media foundation buffer handling
2025-02-17 08:14:30 -08:00
Sam Lantinga
de12cb92dc
Fixed crash at shutdown with new hashtable code
2025-02-17 08:14:30 -08:00
Sam Lantinga
1754943596
Fixed camera frame acquisition on Windows 7
...
Fixes https://github.com/libsdl-org/SDL/issues/12210
2025-02-16 08:13:35 -08:00
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
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
Sam Lantinga
5b98c4a524
Fixed motion events with TOOL_TYPE_UNKNOWN
...
This happens using hand tracking on a VR headset, and should be treated like normal touch interaction.
2025-02-14 11:50:43 -08:00
Sam Lantinga
3de975884a
Document the "trace" log priority
2025-02-12 21:37:30 -08:00
Sam Lantinga
b9d018f2a2
Fixed wayland cursor use-after-free at shutdown
2025-02-12 20:47:31 -08: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
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
Sam Lantinga
99cf16287a
Fixed the name of SDL_SYSWMEVENT
2025-02-11 09:48:40 -08: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
Sam Lantinga
0bce19cf15
The 10-bit texture formats have alpha on Direct3D
...
A similar change was made for Vulkan in https://github.com/libsdl-org/SDL/commit/a036aeda3b27ce7e115ebf25e717adf0bdabe91e
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
5ccee77190
testcamera: added support for Motion JPEG camera frames
2025-02-10 17:18:16 -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
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
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
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
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
Sam Lantinga
a646dc89e5
Note that SDL_GUIDToString() and SDL_StringToGUID() are thread-safe.
2025-02-06 10:44:21 -08: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
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
Sam Lantinga
c4550d906a
testcontroller: show the gamepad device type
2025-02-05 08:27:26 -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
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
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
8848f86560
Corrected the version where SDL_SoftStretch() was added
2025-02-02 14:13:13 -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
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
Sam Lantinga
235022fe2f
Fixed error C2059: syntax error: '}'
...
Fixes https://github.com/libsdl-org/SDL/issues/12155
2025-02-01 15:32:58 -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
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
Sam Lantinga
8298d60e4a
Dynamically load CreateWaitableTimerExW and SetWaitableTimerEx
...
These functions are not available on Windows XP
2025-01-29 05:40:49 -08:00
Sam Lantinga
409f3ade88
Removed SDF test program
...
There's a much better example of SDF support in testgputext in SDL_ttf
2025-01-29 04:15:27 -08:00
Sam Lantinga
4176e188bf
Enable testgles2 on all platforms
...
We use SDL's headers so we're not dependent on system OpenGL header availability.
2025-01-29 04:03:31 -08:00