Commit Graph

14354 Commits (5ddd97062e7be666f793750e155afc12b2dd8ded)

Author SHA1 Message Date
Sam Lantinga 64972b4184 Fixed build 2024-01-19 17:21:05 -08:00
Sam Lantinga 6a00ae7e58 Fixed rendering diagonal lines within a viewport
The drawing uses the origin of the viewport as the coordinate origin, so we only need to clip against the size of the viewport.

Also added a unit test to catch this case in the future
2024-01-19 16:29:38 -08:00
Sam Lantinga 8d9c7d8ebe SDL_UpdateFullscreenMode: Only restore mouse position when exiting fullscreen if the fullscreen mode actually changed
- Previously we would skip most of UpdateFullscreenMode if not entering fullscreen and the window was not set as fullscreen for any display
  which prevented running this.

This prevents warping the mouse when hiding a non-fullscreen window
2024-01-19 15:26:46 -08:00
Sam Lantinga a73132177d Make sure the render target isn't bound as a resource
Fixes https://github.com/libsdl-org/SDL/issues/3380
2024-01-19 15:17:30 -08:00
Sam Lantinga 09ba55b462 Fixed crash scaling very large surfaces
Fixes https://github.com/libsdl-org/SDL/issues/8878
2024-01-19 13:06:12 -08:00
Sam Lantinga aa3fc6e904 Fixed D-pad on Xbox One controllers using the HIDAPI driver 2024-01-19 11:43:01 -08:00
Sylvain Becker 3639743d89
Fixed bug #7614: Segmentation Fault in SDL_BlitSurface (#7808)
Update SDL_BlitSurface to use Intersect functions
2024-01-19 08:39:57 -08:00
Sam Lantinga bd5d4d61ed Fixed potential overflow in software triangle rendering 2024-01-19 08:31:56 -08:00
Sam Lantinga b566bfce07 Fixed warning C4152: nonstandard extension, function/data pointer conversion in expression 2024-01-19 06:49:53 -08:00
Sam Lantinga 9fc1135e3b Fixed warning C4127: conditional expression is constant 2024-01-19 06:44:32 -08:00
Sam Lantinga 1dbe54c4e6 Fixed warning C4244: 'function': conversion from 'SDL_ThreadID' to 'DWORD', possible loss of data 2024-01-19 06:28:54 -08:00
Sam Lantinga f86b3ac605 Fixed types used in documentation (thanks @Dragon-Baroque!) 2024-01-19 05:23:38 -08:00
yuanhecai 129b459b2c Fix compilation problems about yuv_rgb_lsx.c 2024-01-18 19:41:36 -08:00
Simon McVittie 81ac656b7c SDL_CalculateRGBSize, SDL_CalculateYUVSize: set the error indicator
These functions historically didn't set the error indicator on overflow.

Before commit 447b508a "error: SDL's allocators now call SDL_OutOfMemory
on error", their callers would call SDL_OutOfMemory() instead, which was
assumed to be close enough in meaning: "that's a silly amount of memory
that would overflow size_t" is similar to "that's more memory than
is available". Now that responsibility for calling SDL_OutOfMemory()
has been pushed down into SDL_calloc() and friends, the functions that
check for overflows might as well set more specific errors.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-18 13:21:50 -08:00
Simon McVittie e9a0edc847 testautomation_surface: Really make width * bpp overflow
A surface of width (0x7fff'ffff) / 2 = 0x3fff'ffff is not quite large
enough to make the pitch overflow in the way we wanted to test here:
with a 32-bit format, that makes each row 0xffff'fffc bytes, which
(just) fits in a 32-bit unsigned size_t. Increasing it to 0x4000'0000
pixels per row is enough to trigger the overflow we intended to test.

In SDL 2, this test bug was hidden by the fact that allocating
0xffff'fffc bytes on a 32-bit platform is very likely to fail, and SDL 2
reported both "malloc() failed" and "this amount of memory is too large
for a size_t" with the same error code.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-18 13:21:50 -08:00
Simon McVittie eb059538f8 testautomation_surface: Really make pitch + alignment overflow
Adding 3 bytes of alignment to 0x7fff'ffff is not enough to make it
overflow a 4-byte unsigned size_t, so this test was not exercising
the intended failure mode. We cannot actually make this overflow
with a signed 32-bit width and an 8-bit format: the maximum width is
not enough to achieve that. However, if we switch to a 24-bit format,
we can make the calculation overflow.

In SDL 2, this test bug was hidden by the fact that allocating
0x7fff'ffff bytes on a 32-bit platform will usually fail, and SDL 2
reported both "malloc() failed" and "this amount of memory is too large
for a size_t" with the same error code.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-18 13:21:50 -08:00
Ozkan Sezer 4fdc291f5d Add spaces around SDL_PRI??? to avoid potential compiler warnings. 2024-01-18 23:41:10 +03:00
Ryan C. Gordon 949b4fc349
x11: XI_Motion should mark the global mouse position as changed.
Otherwise we'll miss it when XWarpPointer() is used. x11vnc may do this to
manage mouse input in some circumstances, so it can be possible for _all_
mouse motion to go through this path, breaking SDL_GetGlobalMouseState().

Thanks to @chrismile for all the detective work to figure this out!

Fixes #8827.

(cherry picked from commit cc7fe8c255ca8f3b4f5407c0c70103b4c7ad8168)
2024-01-18 15:15:43 -05:00
Sam Lantinga 87f559e021 Updated Xcode projects after dbdc65fc95 2024-01-18 11:01:35 -08:00
Anonymous Maarten 49adb23ad9 Build yuv_rgb_lsx.c with -mlsx 2024-01-18 10:59:13 -08:00
Anonymous Maarten dbdc65fc95 video: move standard c, sse and lsx implementations of yuv2rgb to its own source 2024-01-18 10:59:13 -08:00
Sam Lantinga a31dc6dfcb Switched SDL_TouchID and SDL_FingerID to be Uint64 with 0 being an invalid value 2024-01-18 10:55:24 -08:00
Edoardo Lolletti b19d43a74d Add SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING to migration readme 2024-01-18 10:19:18 -08:00
Edoardo Lolletti b384973936 Remove no longer needed hint 2024-01-18 10:19:18 -08:00
Edoardo Lolletti 42d6cf9ce7 Update thread naming on windows 2024-01-18 10:19:18 -08:00
Sam Lantinga cda2bffeee Re-add SDL_HAPTIC_SQUARE for SDL 3.0
Fixes https://github.com/libsdl-org/SDL/issues/8753
Closes https://github.com/libsdl-org/SDL/pull/8831
Closes https://github.com/libsdl-org/SDL/pull/8783
2024-01-18 09:24:03 -08:00
Sam Lantinga df4b855af5 Updated SDL_TLSID to use the same type as other IDs in SDL 2024-01-18 08:18:37 -08:00
Sam Lantinga fc0c774976 Renamed SDL_ThreadID() to SDL_GetCurrentThreadID()
Also renamed SDL_threadID to SDL_ThreadID and made it Uint64 for consistency with other ID types
2024-01-18 08:18:37 -08:00
Sam Lantinga d6a41f8f31 Updated SDL_TimerID to use the same type as other IDs in SDL 2024-01-18 07:08:15 -08:00
SDL Wiki Bot bc3a71d400 Sync SDL3 wiki -> header 2024-01-18 15:01:21 +00:00
Sam Lantinga 464f4d19fe Removed obsolete XInput mapping hint 2024-01-18 07:00:21 -08:00
Sam Lantinga f8dfee01bb Made SDL_ReadSurfacePixel a public function
Fixes https://github.com/libsdl-org/SDL/issues/8320
2024-01-18 07:00:10 -08:00
Ozkan Sezer f7ba340999 remove several instances of unnecessary emptry str "" after SDL_PRI??? 2024-01-18 17:25:50 +03:00
Sam Lantinga c540c77756 Removed SDL_INIT_EVERYTHING
Fixes https://github.com/libsdl-org/SDL/issues/8709
2024-01-18 06:17:58 -08:00
Sam Lantinga 26996e2c02 We've decided to keep separate functions for creating a thread with and without stack size specified.
Fixes https://github.com/libsdl-org/SDL/issues/6652
2024-01-18 06:11:55 -08:00
Sam Lantinga a2665f54c8 Updated the atomic API for SDL 3.0 naming conventions
Fixes https://github.com/libsdl-org/SDL/issues/7388
2024-01-18 04:41:34 -08:00
SDL Wiki Bot 4e60fc9b2b Sync SDL3 wiki -> header 2024-01-18 12:07:19 +00:00
Sam Lantinga fb898d6df0 Clarify that desktop mode is the non-exclusive borderless fullscreen mode
Fixes https://github.com/libsdl-org/SDL/issues/8413
2024-01-18 04:06:32 -08:00
SDL Wiki Bot b5bcf45a65 Sync SDL3 wiki -> header 2024-01-18 12:02:08 +00:00
Sam Lantinga 4fee6cb274 Added documentation for custom event cleanup in SDL_FlushEvent() 2024-01-18 04:00:48 -08:00
Sam Lantinga fd34bc56f9 cocoa: Fix SDL_CocoaWindowData keyboard_focus being left pointing to a destroyed SDL window if input focus not previously reset for that window
- If a window being destroyed is a child of an inactive window and was the last keyboard focus of the window, that window will be left with a stale pointer
  to the destroyed window that it will attempt to restore the next time that window is focused. SDL_DestroyWindow will have already taken care of moving
  focus if this window is the current SDL keyboard focus so this change intentionally does not set focus.

- Like Cocoa_HideWindow, this attempts to move the focus to the closest parent window that is not hidden or destroying.
2024-01-18 03:36:54 -08:00
Sam Lantinga 0a99ad7a68 cocoa: Fix Cocoa_RaiseWindow not making child window key if SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED is true
- We intentionally don't raise the application when raising a child window to allow raising a child window to the top without setting the application active but the
  child window should still be set as key window for the application if desired.
2024-01-18 03:36:52 -08:00
SDL Wiki Bot 20e8411b12 Sync SDL3 wiki -> header 2024-01-18 11:27:24 +00:00
Sam Lantinga f4a0bc02d5 Re-added prototypes for stub API functions 2024-01-18 03:26:11 -08:00
Sam Lantinga f224af5ac5 Updated Haptic API for SDL 3.0 conventions
Also removed the XInput haptic support since using the haptic API for rumble is no longer supported.
2024-01-18 03:26:11 -08:00
Sam Lantinga 8ca9134115 Removed unnecessary NULL assignment 2024-01-18 03:26:11 -08:00
Sam Lantinga 75dd7e1658 Note that we only allow disabling major subsystems 2024-01-17 09:24:04 -08:00
Sam Lantinga 130b361904 Removed SDL_MISC_DISABLED 2024-01-17 09:24:04 -08:00
Sam Lantinga 20fa5e6ad0 Removed SDL_LOCALE_DISABLED 2024-01-17 09:24:04 -08:00
Sam Lantinga 6efadfdb77 Removed SDL_FILESYSTEM_DISABLED 2024-01-17 09:24:04 -08:00