Commit Graph

7064 Commits

Author SHA1 Message Date
Sylvain
af5bda5ef3 Fix warnings 'macro argument should be enclosed in parentheses' 2022-12-05 09:06:44 -08:00
Frank Praznik
8cafde5ecc wayland: Add high-resolution event timestamp support
Add the protocol for high-resolution timestamp events and subscribe to them if available.

Event timestamps are now handled natively in nanoseconds as much as possible to avoid error-prone conversions.

Variables have been appended with _ms or _ns where appropriate, to avoid ambiguity.
2022-12-04 16:56:26 -08:00
Ozkan Sezer
d6327a00fb re-applied the SDL_NewAudioStream deconstification, including to its definition
we should keep this to SDL3 only.
2022-12-04 20:50:20 +03:00
Sam Lantinga
d3ba6529e6 Fixed windows build 2022-12-04 09:39:55 -08:00
Cameron Cawley
ee0e9e979c Move intrinsic includes into a private header 2022-12-04 09:34:10 -08:00
Sam Lantinga
b4da4ed95a Removed SDL_SensorGetDataWithTimestamp() and SDL_GameControllerGetSensorDataWithTimestamp()
If you care about timestamps you'll also want to catch all of the sensor events instead of just polling the current state. For example, Nintendo Switch controllers generate 3 sensor events with distinct values for each polling interval.
2022-12-04 09:29:28 -08:00
Sam Lantinga
b8760a3ffe The timestamp_us member of the sensor events has been renamed sensor_timestamp and now represents nanoseconds. 2022-12-04 09:29:28 -08:00
Sam Lantinga
73f4aeee6a Pass the event timestamp for joystick events
This allows the application to get more fine grained information about controller event timing, and group events that happened together.
2022-12-04 09:29:28 -08:00
Sam Lantinga
f32cdfa096 Fixed presentation reset calculation (thanks @zturtleman!) 2022-12-04 09:28:03 -08:00
Ozkan Sezer
25e62193f4 just revert the const removal from SDL_NewAudioStream in commit d0bbfdb 2022-12-04 12:56:50 +03:00
Ozkan Sezer
202eaeea11 replace windows timeapi.h with mmsystem.h for better compatibility. 2022-12-04 12:50:04 +03:00
Ozkan Sezer
36a43eac00 apply const removal changes from SDL_NewAudioStream to dynapi side too. 2022-12-04 12:47:20 +03:00
Frank Praznik
1f40b9de96 wayland: Pass event timestamps to SDL
SDL events support system timestamps now, so pass them through.
2022-12-03 21:17:35 -08:00
Sylvain Becker
4ffa7f868d Fixed bug libsdl-org#6745 - Check for overflow in SDL_CalculateYUVSize (#6747)
Fixed bug #6745 - Check for overflow in SDL_CalculateYUVSize
2022-12-03 21:22:14 +01:00
Max Bachmann
5650046f93 Detect Logitech PRO Racing Wheel as wheel 2022-12-03 08:21:18 -08:00
Sylvain
021d0b7300 Fix wrong clang-tidy modification. This is an integer division. Thanks @meyraud705 (see PR #6725) 2022-12-03 13:36:09 +01:00
Ozkan Sezer
0f9482ebc3 reran gendynapi.pl to add SDL_GetTicksNS / SDL_DelayNS to SDL_dynapi.sym 2022-12-03 00:33:50 +03:00
Jan Engelhardt
1878674477 build: add symbol versioning for SDL
If a program built against one version of SDL is run in an
environment where there is an earlier version of the SDL .so library
installed, the result varies depending on platform configuration; in
the best case, it won't start at all, at worst it aborts in the
middle of the user doing "something important" (systems implementing
lazy symbol resolution). verdefs on the other hand are always checked
on startup.

The dependency information present in programs and shared libraries
is not only of value to the dynamic linker, but also to a
distribution's package management. If the dynamic linker is able to
tell that a program is not runnable per the above, a package manager
is able to come to the same conclusion — and block the installation
of a nonfunctional program+library ensemble.

Because there are a lot more symbols than there are libraries (I am
going to throw in "10^4 to 1 or worse"), package managers generally
do not evaluate symbols, but only e.g. the SONAME, NEEDED and VERNEED
fields/blocks. Because the SONAME is the same between two SDL
versions like 2.0.24, and 2.0.26, everything rests on having verdefs.

This patch proposes the addition of verdefs.
2022-12-02 13:05:37 -08:00
Sylvain Becker
92cd2c0a74 Enable creation of yuv SDL_Surfaces (#6735) 2022-12-02 12:53:48 -08:00
Sam Lantinga
0a3262e819 Pass the OS event timestamp for keyboard, mouse, and touch events where possible
Currently implemented for Windows and Apple platforms
2022-12-02 12:37:41 -08:00
Sam Lantinga
1f4cc733a1 Removed the nanosecond versions of event and thread primitive waits from the public API
It's not clear applications need this level of precision yet, so let's leave these private for now.
2022-12-02 12:37:41 -08:00
Sam Lantinga
8121bbd083 Convert ticks to 64-bit, added nanosecond precision to the API
Fixes https://github.com/libsdl-org/SDL/issues/5512
Fixes https://github.com/libsdl-org/SDL/issues/6731
2022-12-02 12:37:41 -08:00
Sylvain
764b899a13 Fix Conditional jump or move depends on uninitialised value(s)
eg ./testsprite2 --trackmem
2022-12-02 21:11:33 +01:00
Ozkan Sezer
a3d7dd2464 SDL_sysfilesystem.c (SDL_GetBasePath): fixed the solaris code path.
Reference issue: https://github.com/libsdl-org/SDL/pull/6681
2022-12-02 06:23:30 +03:00
Ozkan Sezer
ab916e8a61 fixed corrupted (zero-sized) SDL3-WinRTResource_BlankCursor.cur.
(copied from SDL2 branch with renaming.)
2022-12-02 03:32:00 +03:00
Frank Praznik
378b1c286a Fix formatting on Wayland and Pipewire function signatures
Fixes the formatting on some function signatures that clang-format missed.
2022-12-01 15:13:28 -08:00
Sylvain Becker
ab1f4172e3 Remove SDL_GL_CONTEXT_EGL #6657 (#6683) 2022-12-01 14:53:37 -08:00
Sam Lantinga
7237c56499 Detect the G923 (Xbox style) and PXN V900 (PS3 mode) as wheels 2022-12-01 14:43:34 -08:00
Pierre Wendling
3c501b963d Clang-Tidy fixes (#6725) 2022-12-01 13:07:03 -08:00
Sylvain Becker
932f61348d Remove mask versions of SDL_CreateRGBSurface* #6701 (#6711)
* Rename SDL_CreateRGBSurface{,From} to SDL_CreateSurface{,From}, which now takes a format parameter
2022-12-01 08:04:02 -08:00
Sylvain
778b8926b4 Small format changed (using clang-format 15.0.2-1) 2022-12-01 09:39:08 +01:00
Ozkan Sezer
45025799b7 restore SDL_malloc.c original formatting. 2022-11-30 17:28:26 -08:00
Sam Lantinga
36c5d5cc65 Added support for the Logitech Cordless Precision PS3 controller 2022-11-30 17:18:00 -08:00
Sam Lantinga
4f9c2b3e2e Added support for the HORIPAD Pro for Xbox Series X 2022-11-30 17:17:44 -08:00
Sam Lantinga
e2df0a9d5a Re-enabled support for third party PS3 controllers 2022-11-30 17:17:15 -08:00
Sam Lantinga
27e8eb4ca8 Fixed Victrix FS Pro V2 controller hang on reboot
(cherry picked from commit 9e997cc787)
2022-11-30 15:39:48 -08:00
Sam Lantinga
f8c3528c55 Fixed crash if GetRectDisplayIndex() is called before SDL_VideoInit()
(cherry picked from commit d87048fd5a)
2022-11-30 14:38:25 -08:00
Sam Lantinga
1e2dfdb019 Removed the OpenGL ES 1.0 2D render implementation
In SDL3 we plan to make more use of shaders in the 2D render API, and this minimizes the number of platforms we have to consider for new features. OpenGL ES 2.0 or newer is supported on all modern iOS and Android devices.
2022-11-30 13:39:37 -08:00
Sam Lantinga
5750bcb174 Update for SDL3 coding style (#6717)
I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base.

In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted.

The script I ran for the src directory is added as build-scripts/clang-format-src.sh

This fixes:
#6592
#6593
#6594
2022-11-30 12:51:59 -08:00
Sam Lantinga
c5790359fd Added precompiled header support for Visual Studio and Xcode (#6710)
Fixes https://github.com/libsdl-org/SDL/issues/6704
2022-11-29 18:34:15 -08:00
Sam Lantinga
6ca7212b75 Fixed unreachable code warning 2022-11-29 18:03:58 -08:00
Ethan Lee
f9f7db4e08 video: Prefer Wayland over X11 (take 2!) 2022-11-29 16:35:36 -05:00
David Edmundson
6d2b74db66 Support wayland fractional scale protocol
The new protocol adds support for more native communication of
fractional scaling.

Everything in the wayland backend already existed only our fractional
scale was calculated implicitly through a combination of output size
guesswork for fullscreen windows.

This new protocol makes that explicit, providing a more robust solution
and a solution for non-fullscreen surfaces. The fallback code is still
left in place for now whilst compositors gain support.
2022-11-29 16:35:12 -05:00
Ryan C. Gordon
a3225ae6de dynapi: Abstract out the environment variable name. 2022-11-29 14:13:07 -05:00
pionere
cf0cb44df8 video: fix error messages
- do not overwrite error message set by SDL_InitFormat (SDL_AllocFormat)
- set proper error message (Cocoa_Metal_CreateView)
- protect against allocation failure (UIKit_Metal_CreateView)
2022-11-29 10:59:40 -08:00
Sylvain Becker
fc4fc5295f Remove depth field from SDL_CreateRGBSurfaceWithFormat and SDL_Create… (#6685)
* Remove depth field from SDL_CreateRGBSurfaceWithFormat and SDL_CreateRGBSurfaceWithFormatFrom
* Removed unused 'flags' parameter from SDL_CreateRGBSurface and SDL_CreateRGBSurfaceWithFormat
* Removed unused 'flags' parameter from SDL_ConvertSurface and SDL_ConvertSurfaceFormat
2022-11-29 09:40:09 -08:00
Sam Lantinga
6873082c34 Fixed building on Windows with SDL_VIDEO=OFF
Fixes https://github.com/libsdl-org/SDL/issues/6562
2022-11-29 09:29:42 -08:00
Sam Lantinga
f077c69193 Fixed bug #6698 - VISA: wrong check sceKernelPollSema 2022-11-29 08:50:51 -08:00
pionere
461a38ff1a thread: code style 2022-11-29 08:44:10 -08:00
Sylvain
38c281fbc0 Fixed bug #6698 - VISA: wrong check sceKernelPollSema 2022-11-29 16:14:23 +01:00