Commit Graph

1471 Commits (f9f7db4e086036bd8ef3bce0f303e9057ee63040)

Author SHA1 Message Date
Alex Szpakowski f871c178b9 macOS: remove dead code for supporting 10.6 at runtime. 2022-05-10 14:04:14 -07:00
Simon McVittie 8ab3ae98f0 stdinc: Add a comment to clarify why inline functions are needed here
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-10 06:50:54 -07:00
Alex Szpakowski d35c737f1c macOS: change min supported OS from 10.6 to 10.7. 2022-05-09 21:53:40 -07:00
Simon McVittie f661654fad stdinc: Add overflow-checking add and multiply for size_t
This can be used to check whether untrusted sizes would cause overflow
when used to calculate how much memory is needed.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-09 21:31:39 -07:00
Simon McVittie cd7c2f1de7 Switch versioning scheme to be the same as GLib and Flatpak
For stable releases, this gives us the ability to make bugfix-only point
releases such as 2.24.1 if we want to, and distinguish between them
programmatically. For example, this ability could have been useful after
2.0.16 to fix Xwayland regressions, and after 2.0.18 to fix event loop
regressions.

For development releases, this gives us the ability to make multiple
prereleases during the same feature cycle, and distinguish between them
programmatically. For example, this would have been useful during 2.0.22
development, which went through three prereleases before reaching the
final release.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 09:55:35 -07:00
Simon McVittie ba6f96275e Document SDL_VERSIONNUM as able to encode larger minor versions
Now that we've said this will be removed from SDL 3, we're free to use
any encoding that is compatible with existing SDL versions and will still
compare correctly for all SDL 2 version numbers. This allows the SDL 2
minor version to go beyond 1 digit, limited only by the size of
SDL_version.minor (which is 8 bits), making the largest possible version
number 2.255.99.

The patchlevel (micro version) is still limited to 2 digits.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 09:55:35 -07:00
Simon McVittie e0daa2a530 Deprecate SDL_COMPILEDVERSION and SDL_VERSIONNUM, to be removed in 3.x
The encoding used in SDL_VERSIONNUM (e.g. 2.0.22 -> 2022) cannot
represent 2-digit minor versions without overflowing from the hundreds
digit into the thousands digit, which produces confusing version
numbers that will compare incorrectly when the major version is increased
to 3.

However, we can sidestep this problem by declaring that SDL_VERSIONNUM
will no longer be present in SDL 3, which means it only needs to be able
to represent SDL 2 version numbers losslessly.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 09:55:35 -07:00
Simon McVittie f9a5cf77b8 Make SDL_VERSION_ATLEAST future-proof against larger version numbers
This comparison normally happens at compile-time, not at runtime, so
it doesn't matter if it isn't optimal. This avoids incorrect comparison
if the minor version in SDL_COMPILEDVERSION and SDL_VERSIONNUM has more
than one digit, which would cause it to overflow from the hundreds place
into the thousands place.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 09:55:35 -07:00
Cameron Cawley b398a847be Add SDL_FLOATWORDORDER for older ARM toolchains 2022-05-04 09:52:11 -07:00
atfrase db9e14e504 disabled linux joystick debugging outputs and reverted unnecessary comment edit 2022-05-03 10:44:09 -07:00
atfrase 3696e23d09 added hints SDL_HINT_LINUX_DIGITAL_HATS and SDL_HINT_LINUX_HAT_DEADZONES to control the new Linux hat handling; added define DEBUG_GAMEPAD_MAPPINGS to log messages when generating default gamepad mapings for Linux joysticks 2022-05-03 10:44:09 -07:00
Michael Fitzmayer fbd230bb6c
Add support for the Nokia N-Gage (#5597)
* Add initial support for the Nokia N-Gage

* N-Gage: disable clipping for the time being, issue needs to be resolved later

* Move va_copy definition to SDL_internal.h

* Move stdlib.h include to SDL_config_ngage.h, much cleaner this way

* Remove redundant include, add HAVE_STDLIB_H

* Revert "N-Gage: disable clipping for the time being, issue needs to be resolved later"

This reverts commit 4f5f0fc36cc7f34fad05e45671dfa7b8dc32fd51.

* N-Gage: fix clipping issue by providing proper math functions
2022-05-03 08:51:49 -07:00
Susko3 6150245d65 Add new verbosity level for logging of `SDL_SysWMEvent`s
Now logged only if SDL_HINT_EVENT_LOGGING is set to "3" or above.
2022-05-02 15:33:13 -07:00
Sam Lantinga 829f6b3d7d These headers are system headers, not local headers 2022-04-30 11:33:03 -07:00
Sam Lantinga f81419702e Document that SDL_MAX_LOG_MESSAGE is no longer meaningful 2022-04-29 11:28:59 -07:00
Ryan C. Gordon 7d7ec9c951
x11: Remove XVidMode and Xinerama support.
Fixes #1782.
2022-04-26 23:17:13 -04:00
Sam Lantinga e551384a99 Added functions to get the platform dependent name for a joystick or game controller 2022-04-26 14:54:14 -07:00
Ozkan Sezer e9ff4fdd49 add SDL_bsearch 2022-04-26 04:03:25 +03:00
meyraud705 3dcfe86082 Add joystick battery event 2022-04-25 15:46:17 -07:00
Sam Lantinga fa29e2d7f7 Updated to version 2.0.23 for development 2022-04-25 13:45:51 -07:00
Eddy Jansson 0288de8529 SDL_Rect: Add \sa documentation block to SDL_FRect 2022-04-22 12:09:13 -04:00
Eddy Jansson fc944859d1 SDL_Rect: Use a default epsilon in SDL_FRectEquals()
Add SDL_FRectEqualsEpsilon() for when more control over
equality test is required.
2022-04-20 08:38:53 -07:00
Eddy Jansson 00feca27b0 Add SDL_FLT_EPSILON. 2022-04-20 08:38:53 -07:00
Ethan Lee c37090f9a4 wayland: Add support for TOOLTIP/POPUP_MENU 2022-04-18 12:31:02 -04:00
Ryan C. Gordon c1336b21ed hints: Make SDL_VIDEODRIVER and SDL_AUDIODRIVER formal hints.
They were just environment variables before.

Fixes #5528.
2022-04-17 11:31:55 -07:00
David Gow 9c2f46b0d5 Wayland: Add SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR
This hint allows libdecor to be used even when xdg-decoration is
available. It's mostly useful for debugging libdecor, but could in
theory be used by applications which want to (for example) bundle their
own libdecor plugins.
2022-04-12 11:52:41 -04:00
Sam Lantinga 505d6a4a05 Update version to 2.0.22 for release 2022-04-08 18:18:56 -07:00
Sam Lantinga 6d7d142b70 Fixed typo 2022-04-08 18:10:38 -07:00
Connor Clark 6dbca7c911 Compile with recursive mutexes for emscripten
Emscripten actually does support recursive mutexes, so no need to use SDL's fake recursive code.

Background: #5428, #5479
2022-04-06 18:51:35 -07:00
Ozkan Sezer c0bb39e5e9 check for HAVE_ROAPI_H in cmake and autotools, and
update SDL_config_windows.h and SDL_config_winrt.h
2022-04-02 02:50:02 +03:00
Jaylon Gowie 8c542a3591 Desktop OpenGL 1.X/2.X PSVita Support 2022-03-31 00:02:56 -04:00
Ryan C. Gordon 3425e9950e
stdinc: SDL_COMPILE_TIME_ASSERT defines shouldn't have a semicolon. 2022-03-30 10:13:47 -04:00
Ivan Epifanov 96be9cddcc Vita: add hint to select which touchpad generates mouse events 2022-03-28 08:36:32 -07:00
Cameron Gutman a60986caa8 Correct default structure packing on Windows ARM64
See issue #5454 for details
2022-03-27 19:03:54 -05:00
SDL Wiki Bot 6d1c3cd691 Sync wiki -> header 2022-03-27 17:11:05 +00:00
SDL Wiki Bot 2591f7e39c Sync wiki -> header 2022-03-27 16:52:04 +00:00
SDL Wiki Bot 7ba4d24c25 Sync wiki -> header 2022-03-27 16:49:05 +00:00
Ryan C. Gordon 7bc498d325
direct3d: Implement missing blend operations.
This is only for Direct3D 9; Direct3D 11 already had this implemented.

Fixes #5375.
2022-03-27 09:14:07 -04:00
SDL Wiki Bot 2a4e0f8fd0 Sync wiki -> header 2022-03-23 16:09:05 +00:00
Sylvain Becker c23a7ad38a
Add SDL_RenderGetWindow() API to get the window associated with a renderer (#5440)
Add SDL_RenderGetWindow() API to get the window associated with a renderer
2022-03-23 17:07:56 +01:00
Ryan C. Gordon f782abe5f0
hints: Added SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE.
Fixes #2349.
2022-03-22 09:54:29 -04:00
Ryan C. Gordon 2b3c16eb5b
Sync wiki -> headers. 2022-03-20 23:17:14 -04:00
Ryan C. Gordon d81fee7623
SDL_Rect: Added floating point versions of all the rectangle APIs.
Fixes #5110.
2022-03-19 10:35:24 -04:00
SDL Wiki Bot aef1e56737 Sync wiki -> header 2022-03-18 17:30:05 +00:00
Sam Lantinga 40b7326b38 Added a note that SDL_RenderReadPixels() should be called before SDL_RenderPresent() 2022-03-18 10:28:38 -07:00
Sam Lantinga 6c96217727 Added the hint SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, controlling whether the mouse should be constrained to the center of the window or the whole window in relative mode.
For further info about the pros and cons, check out the discussion in https://github.com/libsdl-org/SDL/issues/5271
2022-03-18 10:07:59 -07:00
Sam Lantinga 5ff42438e3 Added a hint to capture the mouse when mouse buttons are pressed, defaulting on
Fixes https://github.com/libsdl-org/SDL/issues/5301
2022-03-17 17:39:46 -07:00
Sam Lantinga e5f45455c9 Added a hint to mark a foreign window as usable with OpenGL
Fixes https://github.com/libsdl-org/SDL/issues/2942
2022-03-17 14:44:34 -07:00
Ethan Lee 0bf8ccfb60 video: Add a hint to allow Vulkan surfaces on foreign windows 2022-03-17 14:25:55 -07:00
Ozkan Sezer f0d2747df1 use _Static_assert for SDL_COMPILE_TIME_ASSERT(), when available 2022-03-17 08:43:27 -07:00
Ozkan Sezer ecc1c871e6 SDL_endian.h: use endian predefs from newer gcc and clang versions.
Closes: https://github.com/libsdl-org/SDL/pull/5403
2022-03-14 10:10:40 +03:00
SDL Wiki Bot 229297d97f Sync wiki -> header 2022-03-11 22:47:04 +00:00
Zach Reedy d14a126383
IME Composition Truncation + SDL_IsTextInputShown + SDL_ClearComposition (#5398)
* Fixes for IME Composition Truncation + Addition of SDL_ClearComposition, SDL_IsTextInputShown

* Fixed: Documentation and code style issues raised during code review.
2022-03-11 14:45:17 -08:00
SDL Wiki Bot 232c3556ac Sync wiki -> header 2022-03-04 17:30:05 +00:00
Sam Lantinga ae73ea9c07 Clarified documentation for the trigger rumble API
Fixes https://github.com/libsdl-org/SDL/issues/5372
2022-03-04 09:27:46 -08:00
SDL Wiki Bot 669a7f8552 Sync wiki -> header 2022-02-23 16:18:05 +00:00
Phillip Stephens 94d43186f2 GameCubeAdapter: Add suppport for all rumble modes
This adds support for all 3 of the gamecube controller's rumble modes
Rumble: 1
Stop: 0
StopHard: 2
This is useful for applications that need the full range of support
This also adds a hint to control rumble behavior, defaults 0 to maintain compatibility
2022-02-23 07:03:02 -08:00
Sam Lantinga 18032979d8 Added the hint SDL_HINT_JOYSTICK_ROG_CHAKRAM to control whether ROG Chakram mice show up as joysticks
This hint defaults off, but when it is enabled the mice will have a game controller mapping set up for Profile 3 (set in the Armoury Crate software)
2022-02-15 13:07:51 -08:00
Ozkan Sezer 67f12ede3b move bug #5333 fix to headers 2022-02-08 21:32:50 +03:00
SDL Wiki Bot 580d231822 Sync wiki -> header 2022-02-08 10:37:04 +00:00
Sylvain 34d4f5b14e
Fixed bug #2032: add SDL_GetTouchName to expose the driver name of the device (Thanks @mgerhardy!) 2022-02-08 11:32:20 +01:00
Ozkan Sezer 050a5e1a15 removed unused SDL_config_wiz.h 2022-02-04 20:02:20 +03:00
Francisco Javier Trujillo Mata daea9fa19e Remove SDL_config_psp and references 2022-02-02 08:36:39 -05:00
SDL Wiki Bot e1cf8d8748 Sync wiki -> header 2022-02-01 16:58:05 +00:00
SDL Wiki Bot 4fa21dd65b Sync wiki -> header 2022-02-01 10:37:05 +00:00
Sylvain d46cc18afc
Fix function comment 2022-02-01 11:35:26 +01:00
SDL Wiki Bot 61b6a2cad4 Sync wiki -> header 2022-02-01 10:33:04 +00:00
Sylvain fe2ed6cf6f
Fixed bug #5221 - Add SDL_AndroidSendMessage() 2022-02-01 11:30:43 +01:00
pionere 3939ef72f8 cleanup SDL_GetAudioDeviceSpec
- drop unnecessary hascapture check
- call SDL_InvalidParamError and return -1 in case the index is out of range
- do not zfill SDL_AudioSpec
- adjust documentation to reflect the behavior
2022-01-28 20:40:19 -05:00
pionere 014e2bbdb2 use SDL_COMPILE_TIME_ASSERT instead of SDL_STATIC_ASSERT 2022-01-28 20:40:19 -05:00
pionere 65e9415b98 sync handling of subsystems
- add DUMMY-define in case the subsystem is enabled but not available (filesystem/misc/locale)
- add missing PSP/VITA-filesystem defines
- sync the order of filesystems in SDL_config.h.cmake/in
- add option to disable locale subsystem in configure
2022-01-28 20:40:19 -05:00
pionere 998117b3ff add 'Misc' subsystem 2022-01-28 20:40:19 -05:00
pionere 942b01a54c do not use RWOps in WIN_SetWindowIcon 2022-01-28 20:40:19 -05:00
pionere 739f350f45 add SDL_LOCALE_DISABLED to SDL_config.h 2022-01-28 20:40:19 -05:00
ulatekh 57bc90403e Add hint to optionally forcibly raise the window under MS Windows. 2022-01-24 11:10:57 -08:00
Sam Lantinga a0e3c884d4 Updated to version 2.0.21 for development 2022-01-17 15:32:27 -08:00
Ryan C. Gordon 42302d0a59
x11: Let apps specify a custom _NET_WM_WINDOW_TYPE.
Fixes #5185.
2022-01-11 21:17:21 -05:00
SDL Wiki Bot b424665e08 Sync wiki -> header 2022-01-10 20:40:05 +00:00
SDL Wiki Bot 5e3f4ccc34 Sync wiki -> header 2022-01-10 20:35:04 +00:00
Ozkan Sezer f14c7bb443 added missing hidapi stuff for os/2 with libusb 2022-01-09 20:33:32 +03:00
Sam Lantinga 09ece861d1 Added the hint SDL_HINT_RENDER_LINE_METHOD to select the line rendering method 2022-01-08 11:36:52 -08:00
Ozkan Sezer 21914b4e2f updated Makefile.psp and SDL_config_psp.h 2022-01-08 11:55:10 +03:00
Sam Lantinga 9294634840 Updated to version 2.0.20 for release 2022-01-07 18:29:40 -08:00
Sam Lantinga 4b38d4c96b Leave the Metal view active on the window when recreating the Metal renderer
Fixes https://github.com/libsdl-org/SDL/issues/5140

Also move the metal tag definition to SDL_syswm.h so it can be used by applications
2022-01-07 12:38:45 -08:00
Ozkan Sezer 75ac944b9c check for tpcshrd.h and define HAVE_TPCSHRD_H if it's available. 2022-01-06 22:24:00 +03:00
Sam Lantinga 120c76c84b Updated copyright for 2022 2022-01-03 09:40:21 -08:00
Francisco Javier Trujillo Mata 13a9cd4797 Adding sysfilesystem driver to PSP 2022-01-02 08:06:04 -08:00
Alex Szpakowski 7f5339e6c4 Document the packed integer formats SDL_Color is bit-compatible with. 2021-12-14 12:19:16 -08:00
Sam Lantinga 086c74556d Fixed build warning on iOS 2021-12-14 12:08:36 -08:00
Sylvain b7885abc44
Fixed bug #5087: SDL_RenderGeometryRaw() passes colors as int* instead of SDL_Color* 2021-12-14 10:31:55 +01:00
Ozkan Sezer 8d14e6ea44 replaced use of _MAX_PATH with CCHMAXPATH in os/2 code,
it now compiles without HAVE_LIBC
2021-12-08 14:01:02 +03:00
Wouter Wijsman da5dbb4763
Fix SDL2main on PSP (#5076)
- Fix SDL2main on PSP
  SDL2main was not working for PSP, because it wasn't being activated and
  it wasn't unsetting the main. Besides that a debug screen being started
  was causing issues with joystick input and the sceKernelExitGame calli
  is no longer needed with the current PSPDEV SDK.
- Clean up imports in PSP main
- Set PSP GPU and user modes in main
- Fix exit callback in PSP main
2021-12-07 18:43:50 +03:00
Wouter Wijsman 897c7cfa8b Make sure SDL_VIDEO_RENDER_PSP is set 2021-12-07 14:03:00 +03:00
Wouter Wijsman 21fd0047e3 Initial for building PSP version with CMake 2021-12-07 14:03:00 +03:00
Ozkan Sezer 70c5e91d0f os/2 optionally builds against libiconv. 2021-12-01 01:20:10 +03:00
Sam Lantinga 5fc901d4f3 Updated to version 2.0.19 for development 2021-11-30 09:58:21 -08:00
Sam Lantinga 976328bb0f Fixed ABI break in SDL test header 2021-11-28 08:54:18 -08:00
Sam Lantinga 110e4e1334 Use WGI instead of XInput for Windows 10 UWP apps
Fixes https://github.com/libsdl-org/SDL/issues/5017
2021-11-27 10:24:32 -08:00
Ozkan Sezer 5a0ea7fb17 Check for O_CLOEXEC definition in fcntl.h at configuration time,
If not available, define it internally as 0 (in SDL_internal.h).
Define it as available for macOS >= 10.7 in SDL_config_macosx.h.
2021-11-27 19:23:10 +03:00
Sam Lantinga 7242075b2b Updated version to 2.0.18 for release 2021-11-26 08:12:45 -08:00
Ozkan Sezer eb39e20588 SDL_endian.h: remove aarch64 asm.
The asm has been reported broken in at least optimized Apple M1 builds;
and besides, the compiler builtins have precedence over the asm anyway.

Closes https://github.com/libsdl-org/SDL/issues/3943
2021-11-25 17:00:50 +03:00
Ozkan Sezer 53aa8eec5f minor cleanup for watcom _inline keyword. 2021-11-25 17:00:24 +03:00
SDL Wiki Bot 3c71f8939b Sync wiki -> header 2021-11-25 13:53:04 +00:00
Cameron Gutman 57520cbde6 Improve documentation for input grabbing functions 2021-11-25 16:49:57 +03:00
Ozkan Sezer f8900583e5 removed windows winmm joystick driver 2021-11-23 17:04:40 +03:00
Sylvain e5467af7c8
Minor change comment 2021-11-23 09:42:07 +01:00
Sam Lantinga c97b721868 Added SDL_PremultiplyAlpha() to premultiply alpha on a block of SDL_PIXELFORMAT_ARGB8888 pixels 2021-11-21 12:18:10 -08:00
Ryan C. Gordon aeff8748a5
configure: Allow building of the "offscreen" video target.
It was CMake-only before this.
2021-11-20 13:35:56 -05:00
Ozkan Sezer 990fb668f7 tests: several -Wwrite-strings fixes. 2021-11-20 01:02:02 +03:00
Ozkan Sezer 3ed0c62672 SDL_RWsize: updated description 2021-11-19 01:24:40 +03:00
SDL Wiki Bot 0fddda6e57 Sync wiki -> header 2021-11-18 21:51:05 +00:00
SDL Wiki Bot e526830996 Sync wiki -> header 2021-11-18 20:58:04 +00:00
Ryan C. Gordon 3f978c0f93
include: Improved documentation of SDL_RegisterApp and SDL_UnregisterApp. 2021-11-18 15:56:16 -05:00
Ryan C. Gordon 7f70f6e1e2
include: Note that several rwops functions used to be macros before 2.0.10. 2021-11-18 15:31:02 -05:00
SDL Wiki Bot 319d2b3e05 Sync wiki -> header 2021-11-18 20:29:04 +00:00
SDL Wiki Bot 16a1721e9d Sync wiki -> header 2021-11-18 20:25:05 +00:00
hgs3 c2464653d0 Remove unnecessary clang-cl check since Clang has __builtin_bswap. 2021-11-18 03:28:00 +03:00
hgs3 6b66542e7b Fixing compilation errors for VS2019 Clang toolset (fixes #4702) 2021-11-18 03:28:00 +03:00
Ozkan Sezer dd6269b1e0 SDL_endian.h: added proper version check (VS2005+) to MSVC functionality 2021-11-17 17:55:00 +03:00
Cameron Gutman 43d1b42a5a cmake: Sync build config options with autotools
- SDL_CLOCK_GETTIME now defaults to ON to match autotools build
- Add detection of float.h and Xdbe
- Fix detection of pthread_setname_np() (requires _GNU_SOURCE)
- Move SDL_USE_IME definition into SDL_config.h.cmake
2021-11-16 16:51:38 -08:00
Sam Lantinga 66058bbbd5 Fixed exception accessing Bluetooth devices on Android 12
Since accessing Bluetooth prompts the user for permission on both Android and iOS, and we only need it for Steam Controller support, we'll leave it off by default. You can enable it by setting the hint SDL_HINT_JOYSTICK_HIDAPI_STEAM to "1" before calling SDL_Init()

Fixes https://github.com/libsdl-org/SDL/issues/4952
2021-11-15 16:52:56 -08:00
Sam Lantinga fb6aba1938 Updated SDL_egl.h with the latest Khronos headers
https://www.khronos.org/registry/EGL/api/
2021-11-14 15:35:49 -08:00
Ozkan Sezer 8a6e48d46d constified SDL_RegisterApp() 2021-11-14 04:40:50 +03:00
Ozkan Sezer acb602d607 minor style adjustment 2021-11-12 07:28:00 +03:00
Misa 3bf7994fe2 Add and use `SDL_FALLTHROUGH` for fallthroughs
Case fallthrough warnings can be suppressed using the __fallthrough__
compiler attribute. Unfortunately, not all compilers have this
attribute, or even have __has_attribute to check if they have the
__fallthrough__ attribute. [[fallthrough]] is also available in C++17
and the next C2x, but not everyone uses C++17 or C2x.

So define the SDL_FALLTHROUGH macro to deal with those problems - if we
are using C++17 or C2x, it expands to [[fallthrough]]; else if the
compiler has __has_attribute and has the __fallthrough__ attribute, then
it expands to __attribute__((__fallthrough__)); else it expands to an
empty statement, with a /* fallthrough */ comment (it's a do {} while
(0) statement, because users of this macro need to use a semicolon,
because [[fallthrough]] and __attribute__((__fallthrough__)) require a
semicolon).

Clang before Clang 10 and GCC before GCC 7 have problems with using
__attribute__ as a sole statement and warn about a "declaration not
declaring anything", so fall back to using the /* fallthrough */ comment
if we are using those older compiler versions.

Applications using SDL are also free to use this macro (because it is
defined in begin_code.h).

All existing /* fallthrough */ comments have been replaced with this
macro. Some of them were unnecessary because they were the last case in
a switch; using SDL_FALLTHROUGH in those cases would result in a compile
error on compilers that support __fallthrough__, for having a
__attribute__((__fallthrough__)) statement that didn't immediately
precede a case label.
2021-11-12 07:26:14 +03:00
Sam Lantinga 9c3bcf8e8a Added SDL_hid_ble_scan() for pairing Steam Controllers on iOS and tvOS 2021-11-11 17:31:14 -08:00
Sam Lantinga abc12a832c Revert "Add and use `SDL_FALLTHROUGH` for fallthroughs"
This reverts commit 66a08aa391.

This causes problems with older compilers:
https://github.com/libsdl-org/SDL/pull/4791#issuecomment-966630997
2021-11-11 15:58:44 -08:00
SDL Wiki Bot cfbae8b967 Sync wiki -> header 2021-11-11 23:12:04 +00:00
Cameron Gutman fe09a4930a joystick: Add APIs to query rumble support 2021-11-11 15:10:08 -08:00
Ozkan Sezer 1ba695dc94 whitespace between '#' and 'cmakedefine' does not seem to work..
at least with my version of cmake-3.9.6.
2021-11-12 02:00:04 +03:00
SDL Wiki Bot a3648e26df Sync wiki -> header 2021-11-11 21:52:04 +00:00
Sam Lantinga b15e880e73 Fixed open functions in the SDL_hidapi.h header 2021-11-11 13:50:16 -08:00
Sam Lantinga 1e159bc6fa Include standard wrapping for SDL public headers in SDL_hidapi.h 2021-11-11 13:46:07 -08:00
SDL Wiki Bot 76e3bb55bb Sync wiki -> header 2021-11-11 20:48:04 +00:00
Sam Lantinga c9ada1c142 Made HIDAPI device change notifications available via SDL_hid_device_change_count() 2021-11-11 12:46:10 -08:00
Misa 66a08aa391 Add and use `SDL_FALLTHROUGH` for fallthroughs
Case fallthrough warnings can be suppressed using the __fallthrough__
compiler attribute. Unfortunately, not all compilers have this
attribute, or even have __has_attribute to check if they have the
__fallthrough__ attribute. [[fallthrough]] is also available in C++17
and the next C2x, but not everyone uses C++17 or C2x.

So define the SDL_FALLTHROUGH macro to deal with those problems - if we
are using C++17 or C2x, it expands to [[fallthrough]]; else if the
compiler has __has_attribute and has the __fallthrough__ attribute, then
it expands to __attribute__((__fallthrough__)); else it expands to an
empty statement, with a /* fallthrough */ comment (it's a do {} while
(0) statement, because users of this macro need to use a semicolon,
because [[fallthrough]] and __attribute__((__fallthrough__)) require a
semicolon).

Applications using SDL are also free to use this macro (because it is
defined in begin_code.h).

All existing /* fallthrough */ comments have been replaced with this
macro. Some of them were unnecessary because they were the last case in
a switch; using SDL_FALLTHROUGH in those cases would result in a compile
error on compilers that support __fallthrough__, for having a
__attribute__((__fallthrough__)) statement that didn't immediately
precede a case label.
2021-11-11 07:23:25 -08:00
Sam Lantinga 1c78b08007 Added support for /dev/input/js* on Linux
Added the hint SDL_HINT_LINUX_JOYSTICK_CLASSIC to control whether /dev/input/js* or /dev/input/event* are used as joystick devices

Added the hint SDL_HINT_JOYSTICK_DEVICE to allow the user to specify devices t
hat will be opened in addition to the normal joystick detection

Fixes https://github.com/libsdl-org/SDL/issues/1314
Fixes https://github.com/libsdl-org/SDL/issues/1727
Fixes https://github.com/libsdl-org/SDL/issues/1981
Closes https://github.com/libsdl-org/SDL/pull/4727
2021-11-10 20:02:25 -08:00
Ryan C. Gordon cb4491ca60
Sync wiki -> header 2021-11-10 16:05:03 -05:00
Ryan C. Gordon b42ae3dbfe
Sync wiki -> header 2021-11-10 15:21:01 -05:00
Sam Lantinga 6f9909b609 These functions made it into 2.0.18 2021-11-09 21:11:19 -08:00
Eric Wasylishen 0d98793693
testwm2: Fix video modes menu hit detection when highdpi or logical size used (#4936)
* SDLTest_CommonDrawWindowInfo: log SDL_RenderGetScale, SDL_RenderGetLogicalSize

* testwm2: fix video modes menu hit detection in High DPI cases

- also when logical size is specified, e.g.
  `--logical 640x480 --resizable --allow-highdpi`

* add function to determine logical coordinates of renderer point when given window point

* change since to the targeted milestone

* fix typo

* rename for consistency

* Change logical coordinate type to float, since we can render with floating point precision.

* add function to convert logical to window coordinates

* testwm2: use new SDL_RenderWindowToLogical

* SDL_render.c: alternate SDL_RenderWindowToLogical/SDL_RenderLogicalToWindow

Co-authored-by: John Blat <johnblat64@protonmail.com>
Co-authored-by: John Blat <47202511+johnblat64@users.noreply.github.com>
2021-11-09 21:03:42 -08:00
Ryan C. Gordon 04f42e0468 metal: Deal better with -[CAMetalLayer nextDrawable] returning nil.
Fixes #4863.
2021-11-09 12:03:12 -05:00
Sam Lantinga fd79607eb0 Added SDL_GetWindowMouseRect()
Also guarantee that we won't get mouse movement outside the confining area, even if the OS implementation allows it (e.g. macOS)
2021-11-08 21:34:48 -08:00
Ethan Lee 4b42c05ba1 video: Add SDL_SetWindowMouseRect.
This API and implementation comes from the Unreal Engine branch of SDL, which
originally called this "SDL_ConfineCursor".

Some minor cleanup and changes for consistency with the rest of SDL_video, but
there are two major changes:

1. The coordinate system has been changed so that `rect` is _window_ relative
   and not _screen_ relative, making it easier to implement without having
   global access to the display.
2. The UE version unset all rects when passing `NULL` as a parameter for
   `window`, this has been removed as it was an unused feature anyhow.

Currently this is only implemented for X, but can be supported on Wayland and
Windows at minimum too.
2021-11-08 14:16:54 -08:00
Ryan C. Gordon 1a98dcb6aa
Revert "include: Updated SDL_config_emscripten.h from emscripten-ports."
Apparently we already had the newer version, sorry!

This reverts commit 6657cbce8d.

Reference issue #4623.
2021-11-08 15:16:18 -05:00
Ozkan Sezer 84138b7719 minor update to os2 config file. 2021-11-08 21:15:04 +03:00
Sam Lantinga 5dbbc8e61f Added mouse wheel deltas with floating point precision
Fixes https://github.com/libsdl-org/SDL/issues/4888
2021-11-08 09:44:31 -08:00
Sam Lantinga b8327a4a48 Added SDL_HIDAPI_DISABLED so it can be disabled like other SDL subsystems 2021-11-08 07:19:45 -08:00
Ozkan Sezer 2a904aa1c9 os2: remove SDL_hidapi duplications in makefile, disable it in config. 2021-11-08 17:00:28 +03:00
Sam Lantinga 5b646cd19e Build hidapi code into SDL as a new public API
This prevents conflicts with hidapi linked with applications, as well as allowing applications to make use of HIDAPI on Android and other platforms that might not normally have an implementation available.
2021-11-07 23:00:59 -08:00
Ryan C. Gordon 6657cbce8d
include: Updated SDL_config_emscripten.h from emscripten-ports.
Reference issue #4623.
2021-11-07 20:45:31 -05:00
Sam Lantinga 74f35a7cbd Fixed documentation 2021-11-07 14:10:04 -08:00
Sam Lantinga e14358265e Cleanup sfSymbolName support and add them to the dynamic API functions 2021-11-07 11:16:48 -08:00
Patrick Hogan 149e5c656a Support returning sfSymbolsName for gamepad controls on macOS / iOS / tvOS 2021-11-07 10:58:37 -08:00
Eric Wasylishen a0e055a7f9 testwm2: add mode menu, click on a mode to call SDL_SetWindowDisplayMode 2021-11-07 08:42:09 -08:00
Cameron Gutman 5de723749f SDL_config_windows.h: detect winsdkver.h using __has_include()
__has_include() was added in VS 2017 15.3, so this works out to essentially
the same _MSC_VER >= 1911 check we had before for MSVC but works for non-MSVC
compilers also.
2021-11-05 21:06:58 -05:00
Kevin Colour 6cbee0634e include: Swap parameter names in atan2 functions 2021-11-05 17:04:00 +03:00
Cameron Gutman d8b53e821e direct3d11: fix SDK version requirement for non-CMake build
The D3D11 renderer requires Direct3D 11.1 (d3d11_1.h), not Direct3D 11.0
(d3d11.h). In terms of SDKs, that's the Windows 8 SDK or later.

We should probably rename HAVE_D3D11_H...
2021-11-03 20:10:02 -05:00
Ozkan Sezer 802e17aad9 autotools: added windows.gaming.input.h (and SDL_JOYSTICK_WGI) detection 2021-11-03 20:35:20 +03:00
Cameron Gutman 2371b247ff windows: improve feature detection consistency between CMake and non-CMake builds 2021-11-03 08:41:36 -07:00
Sam Lantinga c948b9366c Added note for Android 12 API level 2021-11-02 15:58:54 -07:00
Frank Praznik 43ddc59fa8
Export SDL_LinuxSetThreadPriorityAndPolicy() function (#4877)
It's marked as being a public symbol internally, however, it was missing from the header files and not visible in the shared library.  This adds it to the necessary headers and to the DynAPI list to expose it for use by applications.

Co-authored-by: Frank Praznik <frank.praznik@oh.rr.com>
2021-11-02 13:56:14 -07:00
Ryan C. Gordon 228219dcd4 include: Improved SDL_GetTicks*() documentation a little. 2021-11-01 14:28:00 -04:00
Ryan C. Gordon 99c9727dc0 timer: Added SDL_GetTicks64(), for a timer that doesn't wrap every ~49 days.
Note that this removes the timeGetTime() fallback on Windows; it is a
32-bit counter and SDL2 should never choose to use it, as it only is needed
if QueryPerformanceCounter() isn't available, and QPC is _always_ available
on Windows XP and later.

OS/2 has a similar situation, but since it isn't clear to me that similar
promises can be made about DosTmrQueryTime() even in modern times, I decided
to leave the fallback in, with some heroic measures added to try to provide a
true 64-bit tick counter despite the 49-day wraparound. That approach can
migrate to Windows too, if we discover some truly broken install that doesn't
have QPC and still depends on timeGetTime().

Fixes #4870.
2021-11-01 14:28:00 -04:00
Cameron Cawley 25c71748ad Add a barebones RISC OS video driver 2021-10-30 21:25:01 -07:00
Ybalrid (Arthur Brainville) 81fe2ccb9c cmake: Add missing SDL_JOYSTICK_WGI in config step
SDL_config.h *can* define SDL_JOYSTICK_WGI. On builds with the Windows
10 SDK available, this allow implementing trigger rumbling on Xbox One
controllers. The files included in the Visual Studio Solution in
VisualC\SDL.sln *do* have this define set.

fix #4859
2021-10-30 21:21:54 -07:00
SDL Wiki Bot c7dafb1556 Sync wiki -> header 2021-10-27 01:36:05 +00:00
SDL Wiki Bot 1c6414603c Sync wiki -> header 2021-10-26 15:30:06 +00:00
Ryan C. Gordon dbe55350ce
include: Improve doxygen text on SDL_GetRevisionNumber(). 2021-10-23 14:41:22 -04:00
Sam Lantinga 8f58bb9cf8 Added SDL_USE_BUILTIN_OPENGL_DEFINITIONS to avoid system OpenGL headers 2021-10-21 20:48:08 -07:00
SDL Wiki Bot 6c134cf148 Sync wiki -> header 2021-10-22 00:39:04 +00:00
Cacodemon345 19dee1cd16
Add SDL_GetWindowICCProfile(). (#4314)
* Add SDL_GetWindowICCProfile

* Add new SDL display events

* Implement ICC profile change event for macOS

* Implement ICC profile notification for Windows

* Fix SDL_GetWindowICCProfile() for X11

* Fix compile errors
2021-10-21 17:37:20 -07:00
Sylvain 8b1a2fe860
backout SDL_AndroidSetInputType() 2021-10-17 23:47:59 +02:00
Sylvain ccb12457f9
Fixed bug #4843 - Can not get the ime candidatelist like chinese/japaness input method 2021-10-17 23:17:54 +02:00
Ozkan Sezer 7f728f3eb6 enabled os2 joystick code (if anyone has actually a use for it...) 2021-10-15 08:51:02 +03:00
SDL Wiki Bot 8a48ce00c8 Sync wiki -> header 2021-10-15 05:28:04 +00:00
Brick 8bf32e12d8
Improved SDL_PollEvent usage (#4794)
* Avoid unnecessary SDL_PumpEvents calls in SDL_WaitEventTimeout

* Add a sentinel event to avoid infinite poll loops

* Move SDL_POLLSENTINEL to new internal event category

* Tweak documentation to indicate SDL_PumpEvents isn't always called

* Avoid shadowing event variable

* Ignore poll sentinel if more (user) events have been added after

Co-authored-by: Sam Lantinga <slouken@libsdl.org>
2021-10-14 22:26:10 -07:00
Sam Lantinga 43da35b567 Back out documentation changes in favor of https://github.com/libsdl-org/SDL/pull/4794 2021-10-14 22:22:59 -07:00
Sam Lantinga 0dc57b0f08 Remove slightly misleading comment in the example code 2021-10-14 19:42:36 -07:00
Sam Lantinga ddf1d5c553 Update documentation to reflect that a single SDL_PumpEvents() each frame is the recommended way to handle events 2021-10-14 19:10:30 -07:00
Rémy Tassoux 0789610cfb Add SDL_HINT_WINDOW_NO_ACTIVATION_WHEN_SHOWN 2021-10-14 08:39:48 -07:00
Sam Lantinga 227c33b8ec Add note about SDL_TICKS_PASSED hitting int overflow problems with large timeouts 2021-10-13 09:33:57 -07:00
Cameron Cawley 3db898c5b6 riscos: Implement SDL_GetPrefPath() 2021-10-12 13:07:52 -07:00
Ryan C. Gordon 1b49f09243
include: manually ran wikiheaders.pl and cleaned up the obvious issues. 2021-10-08 20:50:30 -04:00
Ryan C. Gordon 194657a2c6
include: Fix indentation on SDL_SoftStretch doxygen comment.
Otherwise wikiheaders.pl doesn't think it's valid.
2021-10-08 15:58:01 -04:00
Ryan C. Gordon 2f93fbbb75
include: Fix markdown in a doxygen comment. 2021-09-30 10:04:09 -04:00
SDL Wiki Bot 8b23029d23 Sync wiki -> header 2021-09-28 17:03:06 +00:00
Cacodemon345 b592e78f93 wayland: Expose xdg_toplevel to SysWM 2021-09-26 05:53:21 -04:00
SDL Wiki Bot 7a1690eb63 Sync wiki -> header 2021-09-26 02:32:05 +00:00
SDL Wiki Bot 7becc41495 Sync wiki -> header 2021-09-25 17:36:04 +00:00
Cameron Cawley 25a614bc3e Add SDL_asprintf and SDL_vasprintf 2021-09-22 11:53:46 -07:00
Sam Lantinga b687c0ff2c Integrate fix for Source 2's Win32 build that does '#define __i386__ 1' which causes it to hit the __i386__ case instead of the _MSC_VER case. 2021-09-21 18:15:10 -07:00
Ryan C. Gordon f5e636a621
config: Try to use stdint.h with Borland C.
(This probably isn't right on truly ancient versions of Borland C, but it
should cover things from the last decade or so, I hope.)

(possibly) Fixes #1673.
2021-09-20 20:45:58 -04:00
Ryan C. Gordon 478f9eed28
x11: Don't include X11/extensions/extutil.h
We don't use it, it was a leftover from 1.2, I think, and it doesn't exist
on Solaris, so this should hopefully fix the build there.

This also means we don't need the configure/cmake checks for
SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY, so that was removed also.

Fixes #1666.
2021-09-20 10:22:50 -04:00
Ryan C. Gordon b8da02e6ef
include: Fix triggering of Clang's -Wexpansion-to-defined in SDL_endian.h
It doesn't like #if statements that uses a macro that uses defined(x).
2021-09-18 10:44:32 -04:00
Ryan C. Gordon 8f41412327
cmake: Patched to compile.
Too fast on the git push!!
2021-09-18 10:35:36 -04:00
Ryan C. Gordon bf1d7a3a15
cmake: Don't trust the HAVE_IMMINTRIN_H check on Apple targets.
Otherwise universal builds might try to include an Intel-specific header
on ARM builds, etc.

Fixes #4753.
2021-09-18 10:33:51 -04:00
SDL Wiki Bot ba9e2299b3 Sync wiki -> header 2021-09-18 14:19:04 +00:00
Cameron Cawley 2d44bf7dcf Update description of SDL_SetWindowAlwaysOnTop 2021-09-18 10:17:32 -04:00
Cameron Gutman 5dccffd7e4 Allow usage of the new Condition Variable code with Critical Sections
Vista and later provide the SleepConditionVariableCS() function for this.

Since SDL_syscond_srw.c doesn't require SRW locks anymore, rename it to
SDL_syscond_cv.c which better reflects the implementation of condition
variables rather than the implementation of mutexes.

Fixes #4051.
2021-09-17 19:38:09 -04:00
SDL Wiki Bot 44ab04fc63 Sync wiki -> header 2021-09-17 19:19:06 +00:00
SDL Wiki Bot 4d0c3cb2a8 Sync wiki -> header 2021-09-17 19:17:05 +00:00
SDL Wiki Bot 192538357b Sync wiki -> header 2021-09-17 19:14:05 +00:00
SDL Wiki Bot d856478f70 Sync wiki -> header 2021-09-17 19:12:05 +00:00
SDL Wiki Bot 74a1eb2106 Sync wiki -> header 2021-09-17 19:10:07 +00:00
Alex R eb8f332c26
fix: allow builtins for all archs (#4756)
* fix: allow builtins for all archs

* fix: typo
2021-09-16 17:34:49 -07:00
Misa 4a9947336c `SDL_RenderSetVSync()`: Restrict `vsync` to 0 or 1
In the future, we might want to support special swap intervals. To
prevent applications from expecting nonzero values of vsync to be the
same as "on", fail with SDL_Unsupported() if the value passed is neither
0 nor 1.
2021-09-14 16:18:02 -07:00
Misa 4549769d7d Add `SDL_RenderSetVSync()`
Currently, if an application wants to toggle VSync, they'd have to tear
down the renderer and recreate it. This patch fixes that by letting
applications call SDL_RenderSetVSync().

This is the same as the patch in #3673, except it applies to all
renderers (including PSP, even thought it seems that the VSync flag is
disabled for that renderer). Furthermore, the renderer flags also change
as well, which #3673 didn't do. It is also an API instead of using hint
callbacks (which could be potentially dangerous).

Closes #3673.
2021-09-14 09:56:29 -07:00
Cameron Cawley 67aacfe5c0 cmake: Retrieve the git revision on platforms without bash 2021-09-09 22:34:42 -04:00
Ivan Epifanov 134dd46819 Add pvr gles/gles2 context support 2021-09-09 07:22:01 -07:00
Zach Reedy 6f97205229 Added: Support for showing the IME Candidate Window on Windows 2021-09-02 02:28:54 -10:00
Ryan C. Gordon e260c80472
Fix the wiki/headers bridge.
I'm tweaking this manually to remove some whitespace that confused it, but
if this happens again I'll make improvements to wikiheaders.pl instead.
2021-08-30 23:50:47 -04:00
David Gow a1ffeda0ed Add SDL_HINT_APP_NAME and DBUS inhibition hint
See SDL bug #4703. This implements two new hints:
- SDL_APP_NAME
- SDL_SCREENSAVER_INHIBIT_ACTIVITY_NAME

The former is the successor to SDL_HINT_AUDIO_DEVICE_APP_NAME, and acts
as a generic "application name" used both by audio drivers and DBUS
screensaver inhibition. If SDL_AUDIO_DEVICE_APP_NAME is set, it will
still take priority over SDL_APP_NAME.

The second allows the "activity name" used by
org.freedesktop.ScreenSavver's Inhibit method, which are often shown in
the UI as the reason the screensaver (and/or suspend/other
power-managment features) are disabled.
2021-08-30 09:15:11 -04:00
SDL Wiki Bot b9bf7ffec7 Sync wiki -> header 2021-08-28 18:17:05 +00:00
Sam Lantinga 503ea8e89f Don't modify the Nintendo Switch home LED state by default 2021-08-25 14:42:16 -07:00
Ethan Lee 524964f966 Add SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY 2021-08-25 16:40:02 -04:00
SDL Wiki Bot ca39f6d6cd Sync wiki -> header 2021-08-18 22:13:05 +00:00
Sylvain 93fb5a223e Remove '\brief' markup in header 'SDL_render.h' 2021-08-19 00:10:59 +02:00
Sylvain a8f89a01aa Change 'size_indice' to 'size_indices' 2021-08-19 00:10:59 +02:00
Sylvain cc37c38e30 Add SDL_RenderGeometry based on SDL_RenderGeometryRaw 2021-08-19 00:10:59 +02:00
Sylvain e481261173 Move to SDL_RenderGeometryRaw prototype with separate xy/uv/color pointer parameters 2021-08-19 00:10:59 +02:00
Sylvain f73c1eff10 Use normalized texture coordinates 2021-08-19 00:10:59 +02:00
Sylvain f22fc4ca35 Add API: SDL_Vertex type and SDL_RenderGeometry 2021-08-19 00:10:59 +02:00
e bfbab53660 remove warnings from Wundef in SDL_config.h.cmake 2021-08-17 10:00:50 +03:00
YuGiOhJCJ 966728db2a include/SDL_video.h: Remove a comma at end of enumerator list 2021-08-17 10:00:28 +03:00
Zack Middleton 83bb136619 Restore KMOD_RESERVED for backward compatibility
Some applications check for KMOD_RESERVED but it was replaced with
KMOD_SCROLL in cb1e20b058.
2021-08-17 10:00:14 +03:00
Brick 72f41d1fb1 Added missing parenthesis around SDL_clamp 2021-08-14 17:24:33 -07:00
Charlie Birks 0a87075662 Update SDL_config_emscripten.h for upstream 2021-08-14 17:04:46 +01:00
Sam Clegg d448896234 Add SDL_config_emscripten.h
Currently we maintain a config file in the emscripten
repo, but this seems like what other embedded/cross
platforms do.
2021-08-14 17:04:46 +01:00
David Gow 35c1bbfa49 SDL_stdinc.h: Add an SDL_clamp() function
Add a function to clamp a value to a range.

SDL_clamp(x, a, b) is equivalent to SDL_min(a, SDL_max(x, b)): it
ensures that x is not smaller than a, nor larger than b.

While, as best I can tell, this isn't actually standardised anywhere,
it's a very useful function/macro to have.
2021-08-14 09:01:14 -07:00
Joshua Root 9bf6557585 Correctly check for bswap builtins before using
The __clang_major__ and __clang_minor__ macros provide a marketing
version, which is not necessarily comparable for clang distributions
from different vendors[1]. In practice, the versioning scheme for
Apple's clang is indeed completely different to that of the llvm.org
releases. It is thus preferable to check for features directly rather
than comparing versions.

In this specific case, __builtin_bswap16 was being used with older
Apple clang versions that don't support it.

[1] https://clang.llvm.org/docs/LanguageExtensions.html#builtin-macros
2021-08-12 16:03:44 -07:00
Sam Lantinga cb1e20b058 Added KMOD_SCROLL to track the scroll lock state
Fixes https://github.com/libsdl-org/SDL/issues/4566
2021-08-10 17:50:17 -07:00
Sam Lantinga 609cea1eb8 Enable SSE3 intrinsics when building with Visual Studio
Fixes https://github.com/libsdl-org/SDL/issues/4530
2021-08-10 17:14:06 -07:00
Sam Lantinga d5ad6f6e6a Clarified that you should never have side-effects in the parameters to SDL_min/SDL_max 2021-08-10 16:51:52 -07:00
SDL Wiki Bot 056a42f199 Sync wiki -> header 2021-08-10 22:20:06 +00:00
Sam Lantinga f5794f9eeb Added SDL_SetTextureUserData() and SDL_GetTextureUserData() to associate a user-specified pointer with an SDL texture 2021-08-10 15:17:59 -07:00
Sam Lantinga 3f6ebffff4 Updated to version 2.0.17 for development 2021-08-10 15:02:36 -07:00
Sam Lantinga 6810399352 Enable AAUDIO driver for Android
I thought this was already enabled for 2.0.16, but apparently not.

Fixes https://github.com/libsdl-org/SDL/issues/3710
2021-08-10 14:50:43 -07:00
Ozkan Sezer 77c8d11137 configuration updates for dlopen:
- cmake, configure (CheckDLOPEN): --enable-sdl-dlopen is now history..
  detach the dl api discovery from SDL_LOADSO_DLOPEN functionality.
  define HAVE_DLOPEN. also define DYNAPI_NEEDS_DLOPEN (CheckDLOPEN is
  called only for relevant platforms.)
- update SDL_config.in and SDL_config.cmake accordingly.
- SDL_dynapi.h: set SDL_DYNAMIC_API to 0 if DYNAPI_NEEDS_DLOPEN is
  defined, but HAVE_DLOPEN is not.
- pthread/SDL_systhread.c: conditionalize dl api use to HAVE_DLOPEN
- SDL_x11opengl.c, SDL_DirectFB_opengl.c, SDL_naclopengles.c: rely
  on HAVE_DLOPEN, not SDL_LOADSO_DLOPEN.
- SDL_config_android.h, SDL_config_iphoneos.h, SDL_config_macosx.h,
  SDL_config_pandora.h, and SDL_config_wiz.h: define HAVE_DLOPEN.

Closes: https://github.com/libsdl-org/SDL/pull/4351
2021-08-10 12:07:32 -07:00
Sebastian Krzyszkowiak 2e6dac870f wayland: Add a hint to allow disabling libdecor use
Useful for testing xdg-shell path with compositors like Weston.
2021-08-08 18:05:47 -07:00
Ryan C. Gordon 8104c9e3eb
doxygen: manually move SDL_CloseAudioDevice docs from wiki.
Apparently we don't fill these in from the wiki if the function doesn't
have _any_ documentation already. That's a bug, I think.
2021-08-04 00:02:39 -04:00
Ozkan Sezer 5b18ae29b7 improvements to libdecor support in cmake
this makes it consistent with wayland support, and makes cmake side
in line with autotools' libdecor support.
2021-08-03 14:01:02 +03:00
Sam Lantinga cb1fd30e9a Updated to version 2.0.16 for release 2021-07-31 13:28:54 -07:00
Jessica Clarke e4411505ab Don't pack SDL_AudioCVT on CHERI architectures
This is needed to support CHERI, and thus Arm's experimental Morello
prototype, where pointers are implemented using unforgeable capabilities
that include bounds and permissions metadata to provide fine-grained
spatial and referential memory safety, as well as revocation by sweeping
memory to provide heap temporal memory safety.

The referential safety is enforced through the use of tagged memory, and
there is only a single tag bit per capability-sized word, meaning it is
impossible to store capabilities at unaligned locations, either getting
a trap on load/store or the validity tag being stripped when
round-tripepd through memory.

Since this is a new ABI for which SDL has never been compiled before, we
do not need to be concerned with this compatibility measure, so just
don't pack the struct for CHERI architectures.

This code is inherently rather dubious anyway; if MSVC and GCC disagree
on struct layout when targeting Windows then that is a bug in GCC, but
likely extends from the bogus #pragma pack directives for MSVC in
begin_code.h, which will force types to be *underaligned* (and is
attempting to work around something that is fundamentally a broken idea
to be doing). In particular 8-byte-aligned types will be underaligned to
4 bytes, but only on MSVC.  Since that code is not used for GCC that is
probably the cause of the struct layout discrepancy, and there are
likely other instances of that throughout SDL. Moreover, the supposed
fix here is not in fact a fix, as now GCC will think SDL_AudioCVT is
only 1-byte-aligned but MSVC will think it's 4-byte or 8-byte-aligned,
meaning ABI incomatibility is introduced by this change. However,
removing it would break ABI compatibility for purely-GCC-compiled code
(as old binaries would see the struct as 1-byte-aligned and new binaries
would see the struct as 8-byte-aligned) so SDL is stuck with this until
it bumps its ABI.
2021-07-29 14:42:15 -07:00
Jessica Clarke c8b4edf3d0 Fix SDL_Event definition to support systems with pointers larger than 8 bytes
This is needed to support CHERI, and thus Arm's experimental Morello
prototype, where pointers are implemented using unforgeable capabilities
that include bounds and permissions metadata to provide fine-grained
spatial and referential memory safety, as well as revocation by sweeping
memory to provide heap temporal memory safety.
2021-07-29 14:42:15 -07:00
SDL Wiki Bot 72ee0ccdd5 Sync wiki -> header 2021-07-29 13:46:05 +00:00
Sam Lantinga a186a503e7 Added SDL_GameControllerGetSensorDataRate() to get the sensor update rate for a controller. 2021-07-29 06:43:39 -07:00
SDL Wiki Bot 5346cf842c Sync wiki -> header 2021-07-28 17:13:05 +00:00
SDL Wiki Bot 46919b1e8e Sync wiki -> header 2021-07-28 16:11:06 +00:00
Sam Lantinga 14d58dc890 Fixed the parameter documentation 2021-07-27 14:23:40 -07:00
Simon Zeni 6aae5b44f8
Remove wl-shell and xdg-shell-unstable-v6 support (#4323)
* wayland-protocol: update wayland.xml to 1.19.0

* wayland: remove shell_surface field from SDL_SysWMinfo

* wayland: remove wl_shell support

* waypand-protocols: update xdg-shell.xml to 1.20

* wayland: remove xdg-shell-unstable-v6 support

* wayland: deprecate wl shell surface syswm info, add xdg surface
2021-07-27 14:12:26 -07:00
Ryan C. Gordon 736a424ff4
pulseaudio: Optionally add "monitor" sources to device list.
There's a new hint to enable this.

Fixes #2917.
2021-07-27 13:12:57 -04:00
Ozkan Sezer e16fb60323 tweak HAVE_IMMINTRIN_H in SDL_config_windows.h, add to SDL_config_macosx.h 2021-07-27 17:10:24 +03:00
SDL Wiki Bot e94d4b8c9b Sync wiki -> header 2021-07-27 00:08:05 +00:00
Christian Rauch 9e6fcbe72c wayland: client-side decoration 2021-07-25 14:54:12 -07:00
Sam Lantinga f1633127d1 Added a window flash operation to be explicit about window flash behavior 2021-07-24 13:42:19 -07:00
Joel Linn 20eea021c6 Windows: set HAVE_IMMINTRIN_H for AVX intrinsics 2021-07-24 15:39:17 -04:00
Sam Lantinga e1c3a25034 Changed SDL_FlashWindow() so it doesn't take a flash count, and added the hint SDL_HINT_WINDOW_FLASH_COUNT to control behavior on Windows 2021-07-24 12:11:27 -07:00
Sam Lantinga 2147e7bfea Sorted the hints alphabetically 2021-07-24 11:01:58 -07:00
SDL Wiki Bot 856c87fc2e Sync wiki -> header 2021-07-24 17:32:05 +00:00
Sam Lantinga d89f4b3ae4 Note that mouse warping doesn't work over Microsoft Remote Desktop
Fixes the documentation portion of bug https://github.com/libsdl-org/SDL/issues/4206
2021-07-24 10:29:34 -07:00
Sam Lantinga 94b7a87645 Added SDL_GameControllerType enumerations for the Amazon Luna and Google Stadia controllers
Fixes bug https://github.com/libsdl-org/SDL/issues/4019
2021-07-24 09:10:18 -07:00
SDL Wiki Bot 7edffc5798 Sync wiki -> header 2021-07-23 18:29:04 +00:00
SDL Wiki Bot c06448fe39 Sync wiki -> header 2021-07-23 16:39:05 +00:00
SDL Wiki Bot 48993a7f2a Sync wiki -> header 2021-07-23 16:14:49 +00:00
Ryan C. Gordon 37d4f003b7
doxygen: Removed some cruft that accumulated during wiki migration. 2021-07-14 17:09:05 -04:00
Ryan C. Gordon c88eb7a896
Sync wiki -> header. 2021-07-14 17:07:04 -04:00
Ryan C. Gordon f8c1fc49d9
doxygen: Fix all the "\returns" so they work as part of complete sentences. 2021-07-14 14:15:30 -04:00
Ryan C. Gordon 17b4a67aa3
doxygen: We use "\returns" as part of the sentence. 2021-07-14 11:45:06 -04:00
Ryan C. Gordon 04196a46a5
doxygen: wrap some game controller code examples in "```c" blocks. 2021-07-14 11:03:00 -04:00
Ryan C. Gordon 0ac13dc27f
doxygen: Tweak SDL_FlashWindow brief description.
So "e.g." doesn't look like the end of the sentence to wikiheaders.pl.
2021-07-14 11:02:59 -04:00
Cameron Cawley 0f1079456d Remove outdated comment about SDL_SoftStretch 2021-07-13 15:44:31 -07:00
Ozkan Sezer a809d62605 cmake: set SDL_JOYSTICK_RAWINPUT for windows builds
Fixes: https://github.com/libsdl-org/SDL/issues/4412
2021-07-10 10:01:40 +03:00
Sam Lantinga 24059a19c5 The RAWINPUT driver is no longer tied to HIDAPI in any way 2021-07-09 18:11:42 -07:00
Sam Lantinga d135c0762f Added SDL_GameControllerSendEffect() and SDL_JoystickSendEffect() to allow applications to send custom effects to the PS4 and PS5 controllers
See testgamecontroller.c for an example of a custom PS5 trigger effect
2021-07-08 13:22:41 -07:00
Ozkan Sezer 073cbc40cb SDL_platform.h: define TARGET_OS_SIMULATOR as 0 if not already defined.
c.f.: https://github.com/libsdl-org/SDL/issues/4475
2021-07-08 21:20:02 +03:00
Ozkan Sezer 97d4fe9433 removed extra whitespace. 2021-07-08 20:55:10 +03:00
Sam Lantinga 170924278d Fixed https://github.com/libsdl-org/SDL/issues/4475
-Wundef errors from clang-11.1 when targeting macOS

Targeting i386 against 10.8 SDK:

In file included from src/SDL_assert.c:21:
In file included from src/./SDL_internal.h:52:
In file included from include/SDL_config.h:33:
include/SDL_platform.h:73:5: error: 'TARGET_OS_TV' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
    ^
1 error generated.

src/joystick/iphoneos/SDL_mfijoystick.m:38:5: error: 'TARGET_OS_IOS' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
    ^
src/joystick/iphoneos/SDL_mfijoystick.m:460:5: error: 'TARGET_OS_TV' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
    ^
2 errors generated.

src/filesystem/cocoa/SDL_sysfilesystem.m:83:6: error: 'TARGET_OS_TV' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
     ^
1 error generated.

Targeting x86_64 against 10.12 SDK:

src/video/SDL_video.c:1492:25: error: 'TARGET_OS_MACCATALYST' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
                        ^
1 error generated.
2021-07-08 09:24:54 -07:00
Dimitriy Ryazantcev 17ed8d8085 Added HIDAPI backend for Amazon Luna Controller Model T28B69 connected via Bluetooth LE (VID:0171, PID:0419).
To enter Bluetooth pairing mode hold B and Action (button with circle) buttons for 3 seconds.

It works via usual HIDAPI if special filter driver is not installed:
https://www.amazon.com/gp/help/customer/display.html?nodeId=GZCT4CTFHXLHEB9T

With that driver installed it mimics Xbox One controller and works via XInput under Windows.

Under DInput this controller is not usable at all.
2021-07-07 08:31:12 -07:00
Ivan Epifanov 89015b9c35 Vita: default window size for tests 2021-07-01 15:14:49 -07:00
Ozkan Sezer bfdea60572 avoid -Wundef warning from SDL_config_windows.h 2021-06-26 05:56:10 +03:00
nia 98f2e38b26 Use <sys/endian.h> for endian detection on NetBSD
Signed-off-by: Nia Alarie <nia@NetBSD.org>
2021-06-12 15:49:36 +03:00
Ivan Epifanov bbdd08e0b2 Build without PIB support by default and add flag to enable it 2021-06-11 13:21:07 -04:00
Ryan C. Gordon 25fc40b0bd
stdinc: Silence clang warning for -Wimplicit-fallthrough.
In a more ideal world, we'd use the appropriate `__attribute__` here, but
it's one thing in a public header that probably shouldn't be there at all, so
this is good enough for now.

Fixes #4307.
2021-06-10 13:59:01 -04:00
Ryan C. Gordon e65a658320
x11: Add a hint to force override-redirect.
Fixes #3776.
2021-06-09 22:10:20 -04:00
Eric Wasylishen c33e3c15fb testwm2: draw various debug logging into the window itself
Renderer output size, window position/size, display bounds, etc.
Uses new SDLTest_CommonDrawWindowInfo function in test_common.
2021-06-08 05:29:29 +03:00
Jupeyy 64724db0a1 Implement bare minimum for SDL_FlashWindow 2021-06-04 15:07:55 -07:00
Cacodemon345 ded023870d Make CMake script more accurate to autoconf script
DBus, IBus and inotify is now able to be used outside Linux like in configure.
KMSDRM input is now working on FreeBSD with CMake compilation.
2021-06-01 15:34:52 -07:00
Ozkan Sezer 75725608f3 SDL_thread.h: move libc header includes before begin_code.h. 2021-05-25 14:56:56 +03:00
Ethan Lee f309d0649d include: Document timing issue with SDL_GetWindowBordersSize 2021-05-04 13:16:13 -04:00
Ryan C. Gordon c54c16d353
wayland: don't hang in SDL_GL_SwapBuffers if the compositor is ghosting us.
If you hide a window on Mutter, for example, the compositor never requests
new frames, which will cause Mesa to block forever in eglSwapBuffers to
satisfy the swap interval.

We now always set the swap interval to 0 and manage this ourselves, handing
the frame to Wayland when it requests a new one, and timing out at 10fps just
to keep apps moving if the compositor wants no frames at all.

My understanding is that other protocols are coming that might improve upon
this solution, but for now it solves the total hang.

Fixes #4335.
2021-04-30 13:20:35 -04:00
Ivan Epifanov ca969eb2be Remove gles2 vita render 2021-04-24 14:13:09 -07:00
Joseph Lyncheski a0a5da5d91 Add SDL_SetWindowAlwaysOnTop() 2021-04-20 08:45:28 -07:00
Sylvain 859230ec82
Android: add AAudio entry in CMake SDL_config 2021-04-16 13:04:36 +02:00
Sylvain d4e96e1153
Android: enable audio driver OpenSLES when building with CMake 2021-04-16 09:44:07 +02:00
Sylvain 146656cfe6
AAudio: add compilation to Android.mk, but not activated in SDL_config_android.h 2021-04-15 21:03:10 +02:00
Vladislav Dmitrievich Turbanov 50db4a59b8 * Support for intrinsics in MSW + Clang scenario.
Utility polyfill is provided, removed the no-longer-needed
conditionals.
2021-04-09 22:28:07 -07:00
Ryan C. Gordon e006872355
hints: SDL_HINT_TIMER_RESOLUTION applies to all versions of Windows.
Fixes #3654.
2021-04-04 00:24:40 -04:00
Ryan C. Gordon 95e5f0586e
audio: make SDL_OpenAudioDevice declaration look less squashed. 2021-04-03 13:24:10 -04:00
Xing Ji fb283a732a Squashed commit of the following:
commit 6b8f933589aa3925978a23e77a305a7e89c6ae4a
Author: Xing Ji <jixingcn@gmail.com>
Date:   Wed Mar 24 22:31:29 2021 +0800

    update the dynapi by `gendynapi.pl`

commit ebd1790c19983b652713f40ab1e139e485e1a2b7
Author: Xing Ji <jixingcn@gmail.com>
Date:   Wed Mar 24 22:17:48 2021 +0800

    revert the change in src/dynapi

commit 734b5f85c1613070081e39238e84198128971b53
Merge: 5a56e5a8 5ac6bd54
Author: Xing Ji <jixingcn@gmail.com>
Date:   Wed Mar 24 22:14:40 2021 +0800

    Merge remote-tracking branch 'libsdl/main' into jixingcn

commit 5a56e5a8227d9cff6b497b681c618a76bec1cae1
Author: Xing Ji <jixingcn@gmail.com>
Date:   Mon Mar 22 23:55:10 2021 +0800

    Fix #3596, can call the `SDL_TLSCleanup` to cleanup the TLS data when closing the application
2021-03-29 08:54:41 -07:00