Sam Lantinga
4ccc53edfe
Fixed warning C6011: Dereferencing NULL pointer 'display'.
2023-12-05 09:31:13 -08:00
Sam Lantinga
3db4695ac7
warning C6340: Mismatch on sign: 'unsigned int' passed as _Param_(3) when some signed type is required in call to 'SDL_LogDebug_REAL'.
2023-12-05 09:31:13 -08:00
Sam Lantinga
c7d81d936a
Fixed warning C6031: Return value ignored: 'GetKeyboardState'.
2023-12-05 09:31:13 -08:00
Sam Lantinga
69b9d44bdc
Fixed warning C26451: Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).
2023-12-05 09:31:13 -08:00
Sam Lantinga
a9b87ee201
Fixed warning C28159: Consider using 'GetTickCount64' instead of 'GetTickCount'. Reason: GetTickCount overflows roughly every 49 days. Code that does not take that into account can loop indefinitely. GetTickCount64 operates on 64 bit values and does not have that problem
2023-12-05 09:31:13 -08:00
Sam Lantinga
21f273ecc7
Fixed warning C6255: _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead.
2023-12-05 09:31:13 -08:00
Sam Lantinga
0c4cb3d153
Fixed warning C26451: Arithmetic overflow: Using operator '<<' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '<<' to avoid overflow (io.2).
2023-12-05 09:31:13 -08:00
Sam Lantinga
06f8f9a891
Fixed warning C6326: Potential comparison of a constant with another constant.
...
Also fixed warning C6239: (<non-zero constant> && <expression>) always evaluates to the result of <expression>. Did you intend to use the bitwise-and operator?
2023-12-05 09:31:13 -08:00
Sam Lantinga
3e54061fa8
Fixed warning C6011: Dereferencing NULL pointer 'SDL_disabled_events[hi]'.
2023-12-05 09:31:13 -08:00
Sam Lantinga
226f8fde09
Fixed warning C28182: Dereferencing NULL pointer. 'streams[j]' contains the same NULL value as 'stream' did.
2023-12-05 09:31:13 -08:00
Sam Lantinga
fe6b3ab0b0
Fixed warning C6031: Return value ignored: 'CLSIDFromString'.
2023-12-05 09:31:13 -08:00
Sam Lantinga
f3b0149756
Fixed warning C26451: Arithmetic overflow: Using operator '*' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '*' to avoid overflow (io.2).
2023-12-05 09:31:13 -08:00
Sam Lantinga
6cfce101fb
Don't call the property cleanup function if setting the property fails
...
Fixes https://github.com/libsdl-org/SDL/issues/8659
2023-12-04 07:48:13 -08:00
Sam Lantinga
14380ec48a
Fixed signed/unsigned comparison warning
2023-12-03 15:07:08 -08:00
Sam Lantinga
ac0751a652
Added SDL_strnstr()
2023-12-03 15:06:46 -08:00
Sylvain
7c71e72193
SDL_render: Call InvalidateCachedState to initialise some of driverdata values (eg '*_dirty' to 1).
...
At the earliest place, immediatly after driverdata is set.
(Doing it in SDL_render.c, after creation, would be too late, because there're renderers that already use/change those values in the CreateRender() function).
2023-12-02 21:42:17 +01:00
Sam Lantinga
058213366b
Make sure we use alpha of 0 when clearing a transparent window with no content
2023-12-01 10:51:54 -08:00
Sam Lantinga
ecd56bb8f0
Removed SDL_GetErrorMsg(), trivially implemented in application code
2023-12-01 09:08:23 -08:00
Sam Lantinga
66e532fa61
Handle out of memory errors without any allocation
2023-12-01 09:05:04 -08:00
foobit
579681a372
fixed SDL_SCANCODE_LEFT array position in scancodes_windows.h
2023-12-01 08:24:13 -08:00
Dimitriy Ryazantcev
744a29b88f
WGI: Cleanup code a bit ( #8647 )
2023-11-30 11:53:00 -08:00
Ryan C. Gordon
f184dea16c
uikit: Patched to compile.
2023-11-30 00:27:17 -05:00
Ryan C. Gordon
447b508a77
error: SDL's allocators now call SDL_OutOfMemory on error.
...
This means the allocator's caller doesn't need to use SDL_OutOfMemory directly
if the allocation fails.
This applies to the usual allocators: SDL_malloc, SDL_calloc, SDL_realloc
(all of these regardless of if the app supplied a custom allocator or we're
using system malloc() or an internal copy of dlmalloc under the hood),
SDL_aligned_alloc, SDL_small_alloc, SDL_strdup, SDL_asprintf, SDL_wcsdup...
probably others. If it returns something you can pass to SDL_free, it should
work.
The caller might still need to use SDL_OutOfMemory if something that wasn't
SDL allocated the memory: operator new in C++ code, Objective-C's alloc
message, win32 GlobalAlloc, etc.
Fixes #8642 .
2023-11-30 00:14:27 -05:00
Ryan C. Gordon
70b65d4170
cocoa: Resync modifier keypressed on NSEventTypeFlagsChanged event.
...
Fixes #7507 .
2023-11-29 21:38:41 -05:00
Ryan C. Gordon
daa38dc793
touch: Replace GetNumTouchDevices/GetTouchDevice with a single function.
...
Now it returns an array and optional count, to match other SDL3 APIs.
SDL_GetTouchName() was replaced with a function that takes an instance ID
instead of an index, too.
2023-11-29 20:50:44 -05:00
Ryan C. Gordon
dd47da8a5c
gamepad: Replace GetNumMappings/GetMappingByIndex with a single function.
...
Now it returns an array and optional count, to match other SDL3 APIs.
2023-11-29 20:50:44 -05:00
Ryan C. Gordon
dfee3f9e92
render: Replaced SDL_RenderFlush with SDL_FlushRenderer.
...
This uses the same `SDL_VerbNoun` format as the rest of SDL3, and also
adds stronger effort to invalidate cached state in the backend, so cooperation
improves with apps that are using lowlevel rendering APIs directly.
Fixes #367 .
2023-11-29 14:24:26 -05:00
Ozkan Sezer
63d4bd4e57
SDL_SendKeyboardText: remove workaround from 1e12d7c, fix use of iscntrl
2023-11-29 00:39:24 +03:00
Dimitriy Ryazantcev
9faa7977bd
UWP: Add support for supplementary Unicode characters input
...
Characters outside Basic Multilingual Plane (BMP) are coded as so called "surrogate pair" in two separate UTF-16 character events.
2023-11-28 12:33:21 -08:00
Dimitriy Ryazantcev
7b628ea4d5
Win32: Simplify Unicode text input code
2023-11-28 12:33:21 -08:00
Sam Lantinga
1e12d7cfb6
Make sure we don't pass UTF-8 to SDL_iscntrl()
...
This function is only valid for values <= 127.
Closes https://github.com/libsdl-org/SDL/pull/8637
2023-11-28 11:39:35 -08:00
Dimitriy Ryazantcev
9a206adbee
UWP: Use Windows.UI.Core.CoreDispatcher.AcceleratorKeyActivated event for keyboard
...
Only in this case we can see Left Alt and Right Alt keys.
Stole the idea from DirectXTK12 repo:
https://github.com/microsoft/DirectXTK12/blob/main/Src/Keyboard.cpp
2023-11-28 11:31:19 -08:00
Dimitriy Ryazantcev
309ea2d5f9
UWP: Simplify Win32 scan code to SDL scan code mapping
2023-11-28 11:31:19 -08:00
Dimitriy Ryazantcev
acc5bb89f8
[Win32] Better keyboard button mapping to SDL scan codes
...
Using official mappings from the Microsoft docs:
https://learn.microsoft.com/windows/win32/inputdev/about-keyboard-input#scan-codes
2023-11-28 11:31:19 -08:00
Dimitriy Ryazantcev
6b28065e9e
Reformat Win32 scan code table
2023-11-28 11:31:19 -08:00
Dimitriy Ryazantcev
7e86b6aef2
Win32: Fix keymap for keyboard layouts that can print UTF-16 surrogates and ligatures
...
Old implementation with `MapVirtualKey(..., MAPVK_VK_TO_CHAR) & 0x7FFFF` simply returned `A`..`Z` for VK_A..VK_Z and
completely useless <U+0002 START OF TEXT> (`WCH_LGTR 0xF002` without high-order bit) in case of ligature.
See https://kbdlayout.info/features/ligatures for a list of affected keyboard layouts.
More info on `MAPVK_VK_TO_CHAR`: https://stackoverflow.com/a/72464584/1795050
2023-11-28 11:11:33 -08:00
Ryan C. Gordon
08c6ac1b16
test: SDLTest_PrintEvent now reports key event mod state.
...
(cherry picked from commit d42fa25a9e )
2023-11-28 13:11:57 -05:00
Sam Lantinga
571e9796b9
Fixed the GameCube HIDAPI controller mapping
...
Fixes https://github.com/libsdl-org/SDL/issues/8617
Closes https://github.com/libsdl-org/SDL/pull/8623
Closes https://github.com/libsdl-org/SDL/pull/7930
2023-11-28 10:07:06 -08:00
Sam Lantinga
dd984dcd9f
Removed HIDAPI controller mappings
...
These are already provided internally by SDL
2023-11-28 09:54:35 -08:00
Ryan C. Gordon
3817f5126e
cocoa: Use -[NSApplicationDelegate applicationSupportsSecureRestorableState].
...
This prevents warnings at startup on macOS Sonoma (14.0).
(cherry picked from commit 7d25a443c4 )
2023-11-28 12:41:35 -05:00
Ryan C. Gordon
c5b0ff77d7
test: testwm2 now displays keyboard mod state.
...
(cherry picked from commit 258849c9bc )
2023-11-28 12:10:57 -05:00
Jake S. Del Mastro
ceac93ade2
Set framebuffer_srgb_capable to the actual value obtained ( #8634 )
...
(cherry picked from commit 594a79c2f9 )
2023-11-28 05:49:40 -08:00
Sylvain
6bb40f1d8d
SDL_VideoCapture: allow add/remove device at runtime on linux
2023-11-27 16:01:10 -05:00
Sam Lantinga
f0e47f8ee0
Added support for the NACON Revolution 5 Pro controller
2023-11-27 12:10:00 -08:00
Ozkan Sezer
2f806c89b5
initial import of hidapi netbsd uhid native backend from mainstream
...
c19ae126d8
https://github.com/libusb/hidapi/pull/612
2023-11-26 20:20:28 +03:00
Christoph Reichenbach
1b284cd415
X11 pen detection: fix misclassification due to improper init
...
xinput2_device_is_pen() was testing against default-zero values
in the X11 Atom cache on at least the first round of
detections, leading to imprecise detection.
The patch fixes two aspects of initialisation:
1. Ensure that the selector cache is always initialised in
xinput2_device_is_pen().
2. Ensure that all X11 Atoms used in SDL_x11pen.c are instantiated if
missing. This ensures that they are never None and avoids potential
failures to detect hot-plugged tablet devices.
Acknowledgements: @tilman3 for narrowing down the issue and an
initial fix
2023-11-26 14:10:04 +03:00
Ryan C. Gordon
42a8139fd6
render: Clip bresenham lines against a real viewport thing.
...
You can't just use renderer->view->viewport, because it might be (0,0), -1x-1.
I _think_ this is more right?
Fixes #8609 .
2023-11-25 01:51:35 -05:00
Ryan C. Gordon
4a40a272bd
render: Patched to compile.
...
Bad cherry-pick on my part, sorry!
Fixes #8609 .
2023-11-24 22:47:44 -05:00
Ryan C. Gordon
983f178b7d
render: Clip lines before Bresenham algorithm generates points.
...
Otherwise, a massive line might generate gigabytes worth of points to render,
which the backend would simply throw away anyhow.
Fixes #8113 .
(cherry picked from commit 4339647d90 )
2023-11-24 19:34:47 -05:00
Ryan C. Gordon
db7f6425d0
rect: Avoid numeric overflow on massive lines in SDL_IntersectRectAndLine.
...
Reference Issue #8301 .
Reference Issue #8113 .
(cherry picked from commit a391dd5fef )
2023-11-24 19:34:20 -05:00