Commit Graph

10970 Commits

Author SHA1 Message Date
Frank Praznik 5579010b6a wayland: Adjust the scaled popup position even if the dimensions didn't change
Otherwise, the unscaled position will be sent.
2025-01-03 17:17:16 -05:00
Ryan C. Gordon 2d37903323 pen: implement pen support for Windows.
Fixes #10516.
2025-01-03 12:58:49 -05:00
Sam Lantinga ef21ccf080 Create a separate metal shader for NV12 textures
Also unify the color output function so it works with the various combinations of input and output colorspaces.

Fixes https://github.com/libsdl-org/SDL/issues/11727
2025-01-03 09:30:47 -08:00
Sam Lantinga 49663bfb58 Make Windows dialogs DPI aware
Fixes https://github.com/libsdl-org/SDL/issues/4775
Fixes https://github.com/libsdl-org/SDL/issues/9691
2025-01-03 09:25:10 -08:00
Sam Lantinga efc390d7e2 Don't log SDL errors by default
There are many recoverable errors that may happen internally and can be safely ignored if the public API doesn't return an error code. Seeing them causes lots of developer anxiety and they generally aren't helpful.

Fixes https://github.com/libsdl-org/SDL/issues/11813
2025-01-02 17:32:10 -08:00
Sam Lantinga 2c0a8363a5 Added SDL_HINT_JOYSTICK_ENHANCED_REPORTS
This hint defaults on, enabling advanced controller features.

This replaces SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE and SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, and is supported by PlayStation and Nintendo Switch controllers.

Fixes https://github.com/libsdl-org/SDL/issues/10086
2025-01-02 17:18:09 -08:00
Sam Lantinga ecf8dd054d Show the display content scale in SDLTest_CommonDrawWindowInfo() 2025-01-02 10:58:15 -08:00
Sam Lantinga 4797970bfa Enable SDL_HINT_JOYSTICK_THREAD by default
If you're not using SDL for video you won't get raw input messages without this hint, and this is tripping up enough people it makes sense to have this enabled by default. There isn't much downside to this, other than having another thread processing Xbox controller input.

Fixes https://github.com/libsdl-org/SDL/issues/10576
2025-01-02 10:25:18 -08:00
Sam Lantinga 6b4b9b5f2b Improved XInput controller detection
Sometimes we'll get a Windows.Gaming.Input callback before the raw input device is even in the list, so try some other methods to better detect XInput devices.
2025-01-02 10:25:18 -08:00
Frank Praznik 8ea4b326b3 video: Fix focus when non-focused popup windows are hidden
Fix focus issues when a popup that is the child of a window that does not currently have keyboard focus is hidden or destroyed.
2025-01-02 13:24:24 -05:00
Katelyn Gadd 67ea67f191 Fix mip generation for 2x1 textures on D3D12 2025-01-02 13:17:06 -05:00
Erik Soma c6b5c21aaf clipboard: Ensure SDL_ClearClipboardData clears data even when no data has been set 2025-01-02 07:23:27 -08:00
Anonymous Maarten b713e7581b stdlib: fix SDL_strtol of "0" with base 0
SDL_strtol("0") skipped the "0" octal prefix
and returned a failure because the remainder of the string was empty.
2025-01-02 01:15:28 +01:00
Ozkan Sezer 54752f8d1c SDL_malloc.c: replace FORCEINLINE usage with SDL_FORCE_INLINE 2025-01-02 01:15:28 +01:00
Anonymous Maarten 3842384a38 dynapi: trigger a breakpoint on a fatal error when SDL is built in debug mode 2025-01-02 01:15:28 +01:00
Anonymous Maarten 6cf6b160cd SDL_hashtable: don't use assert from libc
Co-authored-by: Ozkan Sezer <sezeroz@gmail.com>
2025-01-02 01:15:28 +01:00
Anonymous Maarten 62bc2c4c92 SDL_malloc: don't define FORCEINLINE
The FORCEINLINE macro is also used by Windows SDK headers.
When it is an empty macro, FORCEINLINE-d functions will
get global visibility error and cause duplicate symbol link errors.

HRESULT_FROM_WIN32 is such a function.
2025-01-02 01:15:28 +01:00
Anonymous Maarten 4fbf59ac3a Implement __chkstk for arm64
Lifted from a previously built SDL3.dll
2025-01-02 01:15:28 +01:00
Anonymous Maarten 578ac0ef52 SDL_malloc: disable malloc stats
This avoids bringing in stdio.
2025-01-02 01:15:28 +01:00
Sam Lantinga 02e85a153f Use the expected plane size when capturing Android camera frames
On the Samsung Galaxy A52 the camera plane size is (pitch * (h - 1) + w) instead of (pitch * h). This led to us copying off the end of the plane when uploading the texture, so we pad out to our expected size.
2025-01-01 15:58:27 -08:00
Sam Lantinga 0281071243 Lock joysticks when they are connected/disconnected on emscripten
Fixes https://github.com/libsdl-org/SDL/issues/11499
2025-01-01 13:51:47 -08:00
Frank Praznik 2b1d809b21 video: Fix positioning and focusing popups parented to child toplevel windows
Find the toplevel parent window, not the absolute highest toplevel window in the hierarchy, when positioning and adjusting the focus of popup windows.

Fixes a leftover case from when toplevel windows couldn't be parented to other toplevels.
2025-01-01 14:40:29 -05:00
Sam Lantinga f2074d7af3 Updated copyright for 2025 2025-01-01 07:45:52 -08:00
Sam Lantinga 54d4e48539 Get the initial clipboard state at startup 2024-12-31 19:27:11 -08:00
Sam Lantinga 6575b8157b Synchronize clipboard mime types with external clipboard updates
Fixes https://github.com/libsdl-org/SDL/issues/8338
Fixes https://github.com/libsdl-org/SDL/issues/9587
2024-12-31 19:27:11 -08:00
Sam Lantinga 30a22d3fed Allow a NULL size parameter to retrieve null terminated text 2024-12-31 19:27:11 -08:00
Sam Lantinga d666c2d189 Use a consistent error message when video isn't initialized 2024-12-31 19:27:11 -08:00
Sam Lantinga 196e2c6662 Fixed crash if num_mime_types is NULL 2024-12-31 19:27:11 -08:00
Sam Lantinga b902b0527b Renamed n_mime_types to num_mime_types 2024-12-31 19:27:11 -08:00
Sam Lantinga a767952617 Fixed spacing 2024-12-31 19:27:11 -08:00
Sam Lantinga 54c555e394 Send supported mime types for external clipboard contents on Windows 2024-12-31 19:27:11 -08:00
Sam Lantinga 8b155708ff Fixed clipboard memory leak on shutdown 2024-12-31 19:27:11 -08:00
Frank Praznik 1d417ab27f win32: Set the WS_THICKFRAME style on popup windows
Without it, programmatically resizing the window seems to fail. As popup windows are implicitly borderless, calculations taking the frame size into account need to be avoided.
2024-12-31 18:29:59 -05:00
Frank Praznik 643281d022 Revert "win32: Use the size in the WINDOWPOS data while handling popup windows in the WM_WINDOWPOSCHANGED message"
This reverts commit 4f0a056b95.
2024-12-31 18:29:59 -05:00
Frank Praznik dd83908109 keyboard: Check for both caps lock and shift when looking up a keycode by name 2024-12-31 15:17:32 -05:00
Frank Praznik df97ccf283
win32: Return 0 from WM_WINDOWPOSCHANGING if a resize is expected
This was accidentally removed while deleting some associated dead code.
2024-12-31 14:02:44 -05:00
Frank Praznik 4f0a056b95 win32: Use the size in the WINDOWPOS data while handling popup windows in the WM_WINDOWPOSCHANGED message
GetClientRect() returns old, incorrect size data for popup windows when called while processing the WM_WINDOWPOSCHANGED message, so use the WINDOWPOS data instead.

Popups can't be maximized or fullscreen, so no need to worry about a move event resizing them.
2024-12-31 13:33:11 -05:00
Ethan Lee 3cd3c9317e storage: Add error messages when ReadIO/WriteIO lengths mismatch 2024-12-31 12:34:12 -05:00
Ryan C. Gordon fa9c3331d5 main: Adjust how SDL_HINT_MAIN_CALLBACK_RATE works.
Now (only in the generic backend, where it is implemented), this hint is
always respected. Previously it would only be used if no windows were created,
to help reduce CPU load on things like loopwave.

Since it's always used now, the default has changed from 60 (Hz) to 0 (run as
fast as possible). Things like loopwave should still likely force this way
lower than the previous default (and already do: loopwave explicitly sets it
to 5).

The hint can now also be set to "waitevent" which will cause SDL_AppIterate
to only be called after new events have arrived, for apps that are entirely
driven by input and want to consume (almost) no power or CPU time until then.

Fixes #11093.
Fixes #11387.
2024-12-31 08:19:38 -08:00
Végh Márton 0be5b8070d Update SDL_asyncio.c 2024-12-30 23:29:21 -08:00
Sam Lantinga 1c04ebe423 Renamed SDL_ASYNCIO_CANCELLED to SDL_ASYNCIO_CANCELED 2024-12-30 19:13:02 -08:00
Sam Lantinga d4d5faedab Added SDL_EVENT_FINGER_CANCELED
Fixes https://github.com/libsdl-org/SDL/issues/10528
2024-12-30 19:13:02 -08:00
Sam Lantinga 8704ab8422 Wait for a display resize event before sending orientation changes
Fixes https://github.com/libsdl-org/SDL/issues/9585
2024-12-30 15:49:10 -08:00
Sam Lantinga 60deaf5f0f Send display mode change events when the orientation changes 2024-12-30 15:24:38 -08:00
Sam Lantinga e91c37f4dd Added support for inset handling on Android 15 2024-12-30 12:23:00 -08:00
Petar Popovic 5f25691c85 Fix C23 empty initializer warning. 2024-12-29 18:17:24 -08:00
Frank Praznik 8cc4735d74
wayland: Don't override the min/max values when scaling to the screen
The point/pixel conversion functions should return zero when passed zero, or the min/max calculations can break.
2024-12-29 18:01:13 -05:00
Semphris 2d91f096ca Remove libc function from Windows tray 2024-12-30 01:20:12 +03:00
Sam Lantinga 0410328b15 Fixed warning: ordered comparison of pointer with integer zero 2024-12-29 12:05:34 -08:00
Sam Lantinga 6e1177ac03 Include tray function prototypes 2024-12-29 08:15:30 -08:00