Commit Graph

2237 Commits (2adbcce864cc3ee1d697f0edae2f4d6aafcbb422)

Author SHA1 Message Date
Steven Noonan b6e7c743db SDL_cpuinfo: define __ARM_ARCH=8 for _M_ARM64
Microsoft's compiler doesn't define __ARM_ARCH, but we have several
places that use it.
2022-10-24 10:39:14 -07:00
Simon McVittie 4ca5ea5b7e build: Add a mechanism to mark builds with vendor info
Downstream distributors can use this to mark a version with their
preferred version information, like a Linux distribution package version
or the Steam revision it was built to be bundled into, or just to mark
it with the vendor it was built by or the environment it's intended to
be used in.

For instance, in Debian I'd use this by configuring with:

    --enable-vendor-info="${DEB_VENDOR} ${DEB_VERSION}"

to get a SDL_REVISION like:

    release-2.24.1-0-ga1d1946dc (Debian 2.24.1+dfsg-2)

which gives a Debian user enough information to track down the patches
and build-time configuration that were used for package revision 2.

In Autotools and CMake, this is a configure-time option like any other,
and will go into both SDL_REVISION (via SDL_revision.h) and
SDL_GetRevision().

In other build systems (MSVC, Xcode, etc.), defining the
SDL_VENDOR_INFO macro will get it into the output of SDL_GetRevision(),
although not SDL_REVISION.

Resolves: https://github.com/libsdl-org/SDL/issues/6418
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-22 09:27:10 -07:00
Simon McVittie 2dc788cb9f build: Expand version info in SDL_REVISION and SDL_GetRevision()
Instead of using a URL and git sha1, this uses `git describe` to
describe the version relative to the nearest previous git tag, which
gives a better indication of whether this is a release, a prerelease,
a slightly patched prerelease, or a long way after the last release
during active development.

This serves two purposes: it makes those APIs more informative, and it
also puts this information into the binary in a form that is easy to
screen-scrape using strings(1). For instance, if the bundled version of
SDL in a game has this, we can see at a glance what version it is.

It's also shorter than using the web address of the origin git
repository and the full git commit sha1.

Also write the computed version into a file ./VERSION in `make dist`
tarballs, so that when we build from a tarball on a system that doesn't
have git available, we still get the version details.

For the Perforce code path in showrev.sh, output the version number
followed by the Perforce revision, in a format reminiscent of
`git describe` (with p instead of g to indicate Perforce).

For the code path with no VCS available at all, put a suffix on the
version number to indicate that this is just a guess (we can't know
whether this SDL version is actually a git snapshot or has been
patched locally or similar).

Resolves: https://github.com/libsdl-org/SDL/issues/6418
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-22 09:27:10 -07:00
Sam Lantinga c6e8961979 Define _USE_MATH_DEFINES for Visual Studio (thanks @pionere!)
Fixes https://github.com/libsdl-org/SDL/issues/3790
2022-10-19 08:05:47 -07:00
Sam Lantinga 0bc852ce53 Revert "Disable the RAWINPUT joystick driver by default"
Disabling RAWINPUT on Windows 10 causes these issues:
* All Xbox controllers are named "XInput Controller".
* Trigger rumble no longer works.
* "XInput Controllers" are now also listed as separate haptic devices
2022-10-17 17:43:06 -07:00
Sam Lantinga 47ba997f06 Disable the RAWINPUT joystick driver by default
It's only needed to support more than 4 Xbox controllers, and adds significant complexity to the joystick processing, and we regularly get bugs from people who aren't using an SDL window who need to turn on SDL_HINT_JOYSTICK_THREAD.
2022-10-17 07:39:52 -07:00
Brad Smith f4e3af15a1 Simplify OSS test by removing OpenBSD specific location of the soundcard.h header
OpenBSD has long since stopped using OSS. Remove checking for OpenBSD specific header.
2022-10-17 07:18:47 -07:00
Daniel Bomar 22461383c6 SDL_audiocvt: Respct the SDL_HINT_AUDIO_RESAMPLING_MODE hint
This implements using libsamplerate for the SDL_AudioCVT API.
This library was already being used for audio streams when this hint is
set.
2022-10-15 14:31:00 -07:00
Sam Lantinga 6bb0c2a5c2 Added documentation for some scancodes 2022-10-14 06:33:38 -07:00
Sam Lantinga 99f2a50394 X11 scancode mapping cleanup
* Consolidated scancode mapping tables into a single location for all backends
* Verified that the xfree86_scancode_table2 is largely identical to the Linux scancode table
* Updated the Linux scancode table with the latest kernel keycodes (still unmapped)
* Route X11 keysym -> scancode mapping through the linux scancode table (which a few hand-written exceptions), which will allow mappings to automatically get picked up as they are added in the Linux scancode table
* Disabled verbose reporting of missing keysym mappings, we have enough data for now
2022-10-13 22:41:47 -07:00
Pierre Wendling 392f3882d0 N3DS: Use SDL_Sensor instead of Joystick sensors. 2022-10-10 08:50:59 -07:00
Pierre Wendling f9785702a6 N3DS: Deduce screen from window's display.
This removes the need for a dedicated window creation flag.
2022-10-10 08:50:59 -07:00
Pierre Wendling 655275378d N3DS port (squashed)
A dedicated renderer using Citro3D would likely allow for better
much better graphical performances.
2022-10-10 08:50:59 -07:00
Sam Lantinga efdb390caa Disable the HIDAPI Wii driver by default as it doesn't work with the dolphinbar 2022-10-09 09:11:33 -07:00
SDL Wiki Bot 9df1af352f Sync SDL wiki -> header 2022-10-09 15:44:07 +00:00
Sam Lantinga b18c361b0f Updated variable name for mouse coordinates in mouse wheel events 2022-10-08 13:18:00 -07:00
Sam Lantinga 4f318c904a Add cursor position to mouse wheel event (thanks @meyraud705!)
Fixes https://github.com/libsdl-org/SDL/pull/6351
2022-10-08 12:01:42 -07:00
Kamil Ševeček 31991ab851 Fix \sa to a valid function in SDL_metal.h. 2022-10-07 07:15:53 -07:00
SDL Wiki Bot 4ca86dae2f Sync SDL wiki -> header 2022-10-05 23:26:14 +00:00
David Gow ad29875ee6 Wayland: Emulate mouse warp using relative mouse mode
Several games (including Source and GoldSrc games, and Bioshock
Infinite) attempt to "fake" relative mouse mode by repeatedly warping
the cursor to the centre of the screen. Since mouse warping is not
supported under Wayland, the viewport ends up "stuck" in a rectangular
area.

Detect this case (mouse warp while the cursor is not visible), and
enable relative mouse mode, which tracks the cursor position
independently, and so can Warp successfully.

This is behind the SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP hint, which
is enabled by default, unless the application enables relative mouse
mode itself using SDL_SetRelativeMouseMode(SDL_TRUE).

Note that there is a behavoural difference, in that relative mouse mode
typically doesn't take mouse accelleration into account, but the
repeated-warping technique does, so mouse movement can seem very slow
with this (unless the game has its own mouse accelleration option, such
as in Portal 2).
2022-10-03 19:11:18 -07:00
SDL Wiki Bot 34b28002d9 Sync SDL wiki -> header 2022-10-03 00:20:15 +00:00
Sam Lantinga 64ea6cefaf SDL_ResetHint() no longer clears the callbacks associated with a hint
Also added SDL_ResetHints() to reset all callbacks, and clarified that SDL_ClearHints() is just used for cleanup at shutdown.

Fixes https://github.com/libsdl-org/SDL/issues/6313
2022-10-02 17:17:31 -07:00
Happy Harry 6c8bf3af4c
Add vertical mode for Nintendo Joy-Con (#6303)
* Added support for vertical mode for Joy-Con controllers
* Added the hint SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS for switching to this mode
* Added support for SL/SR buttons in combined/vertical mode and L/ZL/R/ZR buttons in mini-gamepad mode
2022-10-02 09:19:34 -07:00
SDL Wiki Bot 36e7670143 Sync SDL wiki -> header 2022-09-27 16:57:17 +00:00
Sam Lantinga 2c518747b9 Added microsecond timestamp to sensor values for PS4 and PS5 controllers using the HIDAPI driver 2022-09-27 09:56:49 -07:00
Sam Lantinga 61201e06ef Removed obsolete extension definitions
Fixes https://github.com/libsdl-org/SDL/issues/6231
2022-09-15 06:19:18 -07:00
Ozkan Sezer 6dec78ed11 fix permissions of SDL_opengl_glext.h 2022-09-15 11:55:04 +03:00
SDL Wiki Bot c49faabb6d Sync SDL wiki -> header 2022-09-14 16:29:16 +00:00
DS ac5b9bc4ee
Add support for X11 primary selection (#6132)
X11 has a so-called primary selection, which you can use by marking text and middle-clicking elsewhere to copy the marked text.

There are 3 new API functions in `SDL_clipboard.h`, which work exactly like their clipboard equivalents.

## Test Instructions

* Run the tests (just a copy of the clipboard tests): `$ ./test/testautomation --filter Clipboard`
* Build and run this small application:
<details>
```C
#include <SDL.h>
#include <unistd.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void print_error(const char *where)
{
	const char *errstr = SDL_GetError();
	if (errstr == NULL || errstr[0] == '\0')
		return;
	fprintf(stderr, "SDL Error after '%s': %s\n", where, errstr);
	SDL_ClearError();
}

int main()
{
	char text_buf[256];

	srand(time(NULL));

	SDL_Init(SDL_INIT_VIDEO);
	print_error("SDL_INIT()");
	SDL_Window *window = SDL_CreateWindow("Primary Selection Test", SDL_WINDOWPOS_UNDEFINED,
			SDL_WINDOWPOS_UNDEFINED, 400, 400, SDL_WINDOW_SHOWN);
	print_error("SDL_CreateWindow()");
	SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
	print_error("SDL_CreateRenderer()");

	bool quit = false;
	unsigned int do_render = 0;
	while (!quit) {
		SDL_Event event;
		while (SDL_PollEvent(&event)) {
			print_error("SDL_PollEvent()");
			switch (event.type) {
			case SDL_QUIT: {
				quit = true;
				break;
			} case SDL_KEYDOWN: {
				switch (event.key.keysym.sym) {
				case SDLK_ESCAPE:
				case SDLK_q:
					quit = true;
					break;
				case SDLK_c:
					snprintf(text_buf, sizeof(text_buf), "foo%d", rand());
					SDL_SetClipboardText(text_buf);
					print_error("SDL_SetClipboardText()");
					printf("clipboard: set_to=\"%s\"\n", text_buf);
					break;
				case SDLK_v: {
					printf("clipboard: has=%d, ", SDL_HasClipboardText());
					print_error("SDL_HasClipboardText()");
					char *text = SDL_GetClipboardText();
					print_error("SDL_GetClipboardText()");
					printf("text=\"%s\"\n", text);
					SDL_free(text);
					break;
				} case SDLK_d:
					snprintf(text_buf, sizeof(text_buf), "bar%d", rand());
					SDL_SetPrimarySelectionText(text_buf);
					print_error("SDL_SetPrimarySelectionText()");
					printf("primselec: set_to=\"%s\"\n", text_buf);
					break;
				case SDLK_f: {
					printf("primselec: has=%d, ", SDL_HasPrimarySelectionText());
					print_error("SDL_HasPrimarySelectionText()");
					char *text = SDL_GetPrimarySelectionText();
					print_error("SDL_GetPrimarySelectionText()");
					printf("text=\"%s\"\n", text);
					SDL_free(text);
					break;
				} default:
					break;
				}
				break;
			} default: {
				break;
			}}
		}
		// create less noise with WAYLAND_DEBUG=1
		if (do_render == 0) {
			SDL_RenderPresent(renderer);
			print_error("SDL_RenderPresent()");
		}
		do_render += 1;
		usleep(12000);
	}

	SDL_DestroyRenderer(renderer);
	SDL_DestroyWindow(window);
	SDL_Quit();
	print_error("quit");
	return 0;
}
```
</details>

* Use c,v,d,f to get and set the clipboard and primary selection.
* Mark text and middle-click also in other applications.
* For wayland under x:
  * `$ mutter --wayland --no-x11 --nested`
  * `$ XDG_SESSION_TYPE=wayland SDL_VIDEODRIVER=wayland ./<path_to_test_appl_binary>`
2022-09-14 09:28:35 -07:00
Sam Lantinga 72fe6cc8f1 Updated to the latest version of OpenGL and Vulkan headers from the Khronos registry
Fixes https://github.com/libsdl-org/SDL/issues/6193
2022-09-14 09:14:47 -07:00
Sam Lantinga 4018f35ef2 Added left and right sensors for Nintendo Joy-Con and Wii controllers 2022-09-07 00:00:27 -07:00
Cameron Cawley fd93f817ba Assume that stdint.h is available on Windows with compilers other than MSVC <= 2008 2022-09-05 09:01:31 -07:00
Sam Lantinga c887cb02af Added the hint SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED to control whether the player LED should be lit on the Nintendo Wii controllers
Also fixed the Y axes on the Wii U Pro controller, and various formatting cleanup
2022-09-01 16:30:55 -07:00
Sam Lantinga c72e14e8f4 Added initial support for Wii controllers (thanks @tellowkrinkle!) 2022-09-01 15:29:41 -07:00
Ozkan Sezer 4ebf34857a updated os2 config file after commit 3f89d1704d 2022-09-01 21:56:50 +03:00
Sam Lantinga 3f89d1704d Fixed building with libusb not dynamicaly loaded 2022-09-01 11:30:02 -07:00
Sam Lantinga 6c2c01e0d1 Fixed documentation to match function parameter 2022-08-31 15:04:12 -07:00
Sam Lantinga 0e4baf1c4e Don't crash if SDL functions are passed a closed joystick or gamecontroller 2022-08-30 12:39:23 -07:00
SDL Wiki Bot 3fe6768caf Sync SDL wiki -> header 2022-08-30 18:47:15 +00:00
Sam Lantinga 40bd4feedc Revamped joystick locking
This makes the joystick locking more robust by holding the lock while updating joysticks.

The lock should be held when calling any SDL joystick function on a different thread than the one calling SDL_PumpEvents() and SDL_JoystickUpdate().

It is now possible to hold the lock while reinitializing the joystick subsystem, however any open joysticks will become invalid and potentially cause crashes if used afterwards.

Fixes https://github.com/libsdl-org/SDL/issues/6063
2022-08-30 11:42:13 -07:00
Francisco Javier Trujillo Mata f1e4685806 Adding specific SDL_Hint for the dynamic VSYNC 2022-08-30 07:20:36 -04:00
SDL Wiki Bot 644a4e5b31 Sync SDL wiki -> header 2022-08-28 02:01:12 +00:00
Sam Lantinga 3cbfd75d0f Re-added the CRC to the joystick guid
This is now used as a crc field in the mapping rather than directly in mapping guids, for better mapping compatibility between versions of SDL.

Added SDL_GetJoystickGUIDInfo() to get device information encoded in a joystick GUID, so that mapping programs can clear the CRC from the GUID when generating mappings.

sort_controllers.py has been updated to extract the CRC from mappings created by older mapping programs and convert it into the new crc field. It will also take the CRC into account when checking for duplicate mappings.

Also regenerated the GUIDs for the PS2/PSP/Vita controller mappings, fixing https://github.com/libsdl-org/SDL/issues/6151
2022-08-27 19:00:31 -07:00
Charlie Birks d75fb0995d emscripten: Add a hint for specifying the canvas selector
Now that we're not going through EGL, this is easy
2022-08-26 15:20:24 +01:00
SDL Wiki Bot 111626f4cf Sync SDL wiki -> header 2022-08-25 17:17:12 +00:00
Sam Lantinga e4b85091fd Document the range of trigger axes for virtual joysticks
Fixes https://github.com/libsdl-org/SDL/issues/6130
2022-08-25 10:15:45 -07:00
Noel Berry 00452e47fa
Adding SDL_GetWindowSizeInPixels for window size in pixels (#6112) 2022-08-24 11:25:13 -07:00
Sam Lantinga 1fc7f68118 Document that it's not possible to use the HIDAPI driver for PS3 controllers on Windows 2022-08-24 06:38:36 -07:00
Sam Lantinga b6f96b69aa Initial HIDAPI driver support for the PS3 controller 2022-08-23 22:45:37 -07:00
Sam Lantinga 92b3c53c92 Added a hint SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE to control whether to use system mouse acceleration on raw relative motion.
This is currently only implemented on Windows, and "Enhanced pointer
precision" mode is not quite correct.
2022-08-22 16:48:09 -07:00
SDL Wiki Bot a7066c527a Sync SDL wiki -> header 2022-08-21 14:05:04 +00:00
SDL Wiki Bot 8fb1b50a9e Sync SDL wiki -> header 2022-08-20 17:50:04 +00:00
Oleg Derevenetz a204ef50bb Use __ARM_ARCH instead of __ARM_ARCH__ 2022-08-19 13:15:28 -07:00
Sam Lantinga 5a3adbfdb2 Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED to control whether the player LED is set on Xbox 360 controllers 2022-08-19 11:11:25 -07:00
Sam Lantinga 52b6899a6b Added hints for more fine grained control over HIDAPI Xbox controller support 2022-08-19 11:11:23 -07:00
Sam Lantinga 6e9c14e550 Updated to version 2.25.0 for development 2022-08-19 09:38:42 -07:00
Sam Lantinga 8c9beb0c87 Updated to version Updated to version 2.24.0 for release 2022-08-19 08:44:09 -07:00
Sam Lantinga f6b81125b3 Always define SDL_COMPILE_TIME_ASSERT as static_assert() in C++
Apparently some versions of gcc will define __STDC_VERSION__ even when compiling in C++ mode.

Fixes https://github.com/libsdl-org/SDL/issues/6078
2022-08-18 16:06:42 -07:00
Sam Lantinga f1416ef2ba Updated to version 2.23.2 for release candidate 2022-08-12 20:27:22 -07:00
SDL Wiki Bot f35bbe0c3f Sync SDL wiki -> header 2022-08-11 21:11:11 +00:00
Sam Lantinga 3861c557da Added the hint SDL_HINT_MOUSE_RELATIVE_WARP_MOTION
This hint controls whether mouse warping generates motion events in relative mode, and defaults off.

Fixes https://github.com/libsdl-org/SDL/issues/6034
Fixes https://github.com/libsdl-org/SDL/issues/5741
2022-08-11 14:02:03 -07:00
Sam Lantinga b4c4dd84c2 Added SDL_crc16() to be used in joystick GUIDs after 2.24.0 2022-08-11 09:53:25 -07:00
SDL Wiki Bot 6ecfc40697 Sync SDL wiki -> header 2022-08-10 15:02:11 +00:00
Sam Lantinga d4192850c1 Added SDL_ResetHint() to reset a hint to the default value
Resolves question of how to clear an override hint raised by @pionere in https://github.com/libsdl-org/SDL/pull/5309
2022-08-10 08:01:24 -07:00
Ryan C. Gordon 3119d58ff5
cocoa: Change the new sync_dispatch hint to async_dispatch.
This is so the default is safer.
2022-08-10 10:48:23 -04:00
Ryan C. Gordon bdc7f958fd cocoa: Added hint to treat MacBook trackpads as touch devices, not mice.
Fixes #5511.
2022-08-10 00:42:31 -04:00
Salman Ahmed b4660e9d8b
macOS: Add hint for blocking thread on OpenGL context update dispatch (#5708) 2022-08-09 20:40:00 -04:00
Sam Lantinga 824f2d4650 Added a second hint SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED to control the Home button LED on Nintendo Joy-Con controllers separately from Nintendo Switch Pro controllers 2022-08-09 13:41:58 -07:00
SDL Wiki Bot 523bedac1a Sync SDL wiki -> header 2022-08-09 15:48:12 +00:00
Sam Lantinga aad2df7f0d Document passing -1 to clear the player index for a controller 2022-08-09 08:47:49 -07:00
Ryan C. Gordon 07b0ec539f
SDL_video.h: Added \since info to new APIs. 2022-08-09 09:05:08 -04:00
Ryan C. Gordon a35cff634b
Sync wiki -> headers.
(bridge got stuck, I'm just kicking it to get it working again, idk.)
2022-08-08 16:07:31 -04:00
Sam Lantinga 98bac00dcc Add `SDL_GetPointDisplayIndex` and `SDL_GetRectDisplayIndex` and re-implement `SDL_GetWindowDisplayIndex` in terms of `SDL_GetRectDisplayIndex`
- This allows looking up the display index for an arbitrary location rather than requiring an active window to do so.

- This change also reimplements the fallback display lookup that found the display with center closest to the window's center to instead find the display rect edge
  closest to the window center (this was done in the almost identical display lookup used in SDL_windowsmodes.c, which now uses `SDL_GetPointDisplayIndex`). In
  practice this should almost never be hit as it requires the window's center to not be enclosed by any display rect.
2022-08-08 11:26:52 -07:00
Francisco Javier Trujillo Mata d355ea9981 Add a way to avoid IOP reset 2022-08-08 08:32:38 -07:00
Sam Lantinga 878259722f Added SDL_GameControllerType enumeration for Nintendo Switch Joy-Con controllers 2022-08-08 08:22:20 -07:00
Sam Lantinga 52bf5b1de9 Added the hint SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED to control whether the player LED is set on Nintendo Switch controllers 2022-08-06 10:34:19 -07:00
SDL Wiki Bot bdaf9a92a6 Sync SDL wiki -> header 2022-08-06 13:25:12 +00:00
Ryan C. Gordon e2452ede66
include: Added documentation to SDL_CaptureMouse about auto-capture. 2022-08-06 09:19:10 -04:00
David Carlier 16e699a761 Proposing exposing as public api the various arch dependent
pause instructions so could be used in app infinite loops.
A handful of games do already so we unify it in one place.
2022-08-04 08:47:39 -07:00
Sam Lantinga bcdef4aaf9 Added separate hints for Nintendo Online classic controllers and Joy-Cons
This allows them to be enabled/disabled separately from Switch Pro HIDAPI support
2022-08-03 13:07:47 -07:00
Shootfast 60d1944e46 SDL_video: Added SDL_GL_FLOATBUFFERS to allow Cocoa GL contexts to use EDR 2022-08-02 15:45:30 -07:00
Daniel Santos 147a71b976 Finish dummy driver 2022-08-02 11:40:31 -07:00
Francisco Javier Trujillo Mata 46f95a7a5f Create dummy PS2 Video driver 2022-08-02 11:40:31 -07:00
SDL Wiki Bot 75f34fc5bf Sync SDL wiki -> header 2022-08-02 14:52:12 +00:00
Ryan C. Gordon 307b0b7813
video: Add a warning to the docs about using SDL_GetDisplayDPI.
Fixes #5647.
2022-08-02 10:51:31 -04:00
Sam Lantinga ce5a23bd57 Applied DragonFly BSD patch
https://raw.githubusercontent.com/DragonFlyBSD/DeltaPorts/master/ports/devel/sdl20/dragonfly/patch-include_SDL__endian.h
2022-07-30 16:32:21 -07:00
Sam Lantinga 2241bd669f Added a command line option `--info event_motion` to show mouse and finger motion events 2022-07-29 20:37:38 -07:00
SDL Wiki Bot 47265f377f Sync SDL wiki -> header 2022-07-29 13:24:05 +00:00
Anonymous Maarten f8aa00d198 cmake: add HAVE_STDDEF_H to SDL_config.h.cmake 2022-07-29 15:05:19 +02:00
Sam Lantinga 2fa2f9ff77 Greatly improved Nintendo Joy-Con support using the HIDAPI driver
* Added support for mini-gamepad mode for Joy-Con controllers, matching the mapping for hid-nintendo on Linux and iOS 16
* Added the ability to merge left and right Joy-Con controllers into a single Pro-style controller
* Added the hint SDL_HINT_JOYSTICK_HIDAPI_SWITCH_COMBINE_JOY_CONS to control this merging functionality
* Removed the hint SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS
2022-07-28 19:22:27 -07:00
Ryan C. Gordon 5d85c7d300
kmsdrm: Added a hint to specify device index.
Fixes #2811.
2022-07-26 00:19:54 -04:00
Sam Lantinga cbb3f4ca37 Add SDL_guid.h to the global SDL header 2022-07-25 19:53:04 -07:00
Frank Praznik 41b89aec19 video: Improve the SDL_WINDOW_ALLOW_HIGHDPI flag documentation
Extend the SDL_WINDOW_ALLOW_HIGHDPI flag documentation to stress the importance of querying the window drawable size after every window event to avoid rendering issues in a mixed-DPI environment.
2022-07-22 13:01:57 -04:00
Ryan C. Gordon f73d07da5f audio: Headers said 5 channel is quad+center, but it's 4.1. 2022-07-20 18:41:53 -04:00
Ozkan Sezer b8f30c021b SDL_endian.h: check for __powerpc__ and __PPC__ in big endian decision.
Also remove the _M_PPC check from there.
Reference issue: https://github.com/libsdl-org/SDL/issues/5907
2022-07-12 00:55:00 +03:00
SDL Wiki Bot 5d09b63155 Sync SDL wiki -> header 2022-07-11 17:35:11 +00:00
Ethan Lee 2f0816adb7 Add SDL_GetDefaultAudioInfo.
This API is supported on pipewire, pulseaudio, wasapi, and directsound.

Co-authored-by: Frank Praznik <frank.praznik@gmail.com>
2022-07-11 13:34:35 -04:00
Sam Lantinga 2373da5d94 Exposed SDL_ResetKeyboard() as a public function
This will be used by Source 2 titles to reset keyboard state before showing assertion dialogs
2022-07-11 09:49:00 -07:00
Sam Lantinga 2c22d7204c Fixed typo in description 2022-07-11 08:44:49 -07:00
Cameron Gutman 6e712d2440 joystick: Add HIDAPI driver for NVIDIA SHIELD 2017 controller
Basic input already works using the OS HID driver, but this enables
force feedback and battery state reporting.
2022-07-10 10:53:26 -07:00
SDL Wiki Bot 6187edd41e Sync SDL wiki -> header 2022-07-04 23:57:05 +00:00
rohlem b085c18251 make SDL_SetTextInputRect take a pointer to const
The documentation doesn't state that the argument is ever modified,
and no implementation does so currently.
This is a non-breaking change to guarantee as much to callers.
2022-07-04 09:38:01 -07:00
SDL Wiki Bot fcb99d7830 Sync SDL wiki -> header 2022-07-04 13:42:05 +00:00
Anthony Heathcoat 2a25b69ba5 Check if GNC is defined before checking its value to solve warns in msvc 2022-07-03 00:56:09 -07:00
Sam Lantinga cd79e9c4e2 Removed comment text that looks like doxygen commands 2022-07-01 14:04:07 -07:00
chalonverse f317d619cc
Xbox GDKX support (#5869)
* Xbox GDK support (14 squashed commits)

* Added basic keyboard testing

* Update readme

* Code review fixes

* Fixed issue where controller add/removal wasn't working (since the device notification events don't work on Xbox, have to use the joystick thread to poll XInput)
2022-07-01 13:59:14 -07:00
Sam Lantinga e9d5060c4c checkkeys will now render text that is input
Also added test functions for multi-line debug text display

Currently this only supports ASCII, as the font doesn't have the correct Latin-1 characters
2022-07-01 12:56:47 -07:00
Jade Macho 6a2e6c82a0 Add SDL_HINT_DIRECTINPUT_ENABLED (on by default) 2022-06-28 15:59:05 -07:00
Sam Lantinga cbd0187475 Removed the limit on the size of the SDL error message
Also added SDL_GetOriginalMemoryFunctions()

Fixes https://github.com/libsdl-org/SDL/issues/5795
2022-06-27 16:59:50 -07:00
Francisco Javier Trujillo Mata e4a8087551 Initial Audio driver 2022-06-27 15:18:48 -07:00
SDL Wiki Bot 0a9a0a79e0 Sync SDL wiki -> header 2022-06-27 17:20:12 +00:00
chalonverse 3b191580c3
Windows GDK Support (#5830)
* Added GDK

* Simplfied checks in SDL_config_wingdk.h

* Added testgdk sample

* Added GDK readme

* Fixed error in merge of SDL_windows.h

* Additional GDK fixes

* OpenWatcom should not export _SDL_GDKGetTaskQueue

* Formatting fixes

* Moved initialization code into SDL_GDKRunApp
2022-06-27 10:19:39 -07:00
Francisco Javier Trujillo Mata 7fd46ec581 Initial PS2_Joystick implementation 2022-06-27 00:32:43 -07:00
Francisco Javier Trujillo Mata 84d69da4e1 Initial SDL_ps2_main implementation 2022-06-27 00:32:43 -07:00
Ryan C. Gordon ff735b3c0f
SDL_Surface: don't implicitly declare struct SDL_BlitMap.
It's just an opaque type, but it's more clear to have it typedef'd outside
the containing struct.

Fixes #5828.
2022-06-20 18:31:39 -04:00
Ozkan Sezer a8d41b3b45 check for shellscalingapi.h presence instead of WINVER >= 0x0603 2022-06-18 13:00:44 -07:00
Alex Richardson d51a8f530e cmake: freebsd: Fix -Wformat warning during tests build
Without using <inttypes.h>, SDL_PRIx64 will expand to llx, but on 64-bit
FreeBSD platforms (u)int64_t is `(usigned) long`:
SDL_test_memory.c:261:77: error: format specifies type 'unsigned long long' but the argument has type 'Uint64' (aka 'unsigned long') [-Werror,-Wformat]

This commit updates config_minimal.h to also assume presence of inttypes.h
for everything except old MSVC.
2022-06-18 07:37:57 -07:00
Sam Lantinga adc6875870 Added SDL_copyp to avoid size mismatch when copying values (thanks @1bsyl!)
Closes https://github.com/libsdl-org/SDL/pull/5811
2022-06-17 10:22:28 -07:00
Sam Lantinga b004133f08 Updated to version 2.23.1 for pre-release checkpoint 2022-06-16 12:50:19 -07:00
Francisco Javier Trujillo Mata 6b03c1adf6 Add filesystem driver 2022-06-15 15:15:26 -07:00
Francisco Javier Trujillo Mata 52f00833b0 Add Thread drivers 2022-06-15 15:15:26 -07:00
Francisco Javier Trujillo Mata 217d3a6dab Add systimer support 2022-06-15 15:15:26 -07:00
Francisco Javier Trujillo Mata f0a05ed476 Add some PS2 flags 2022-06-15 15:15:26 -07:00
Anonymous Maarten b5f1fe5004 cmake: Allow integers for SDL_ASSERTIONS + fix -DSDL_ASSERTIONS=0 2022-06-15 11:11:49 -07:00
Sam Lantinga c95edd9450 Fixed spacing 2022-06-13 06:36:48 -07:00
SDL Wiki Bot 33f8a4ddca Sync wiki -> header 2022-06-13 13:29:04 +00:00
Sam Lantinga 6258f2ef3f Fixed spacing 2022-06-13 06:27:14 -07:00
Matthew Morrison b84ce0d484 Fix typo
platform was spelled like plattform
2022-06-11 18:13:10 -07:00
Eric Wasylishen ab81a559f4 Windows DPI scaling/highdpi support
Adds hint "SDL_WINDOWS_DPI_SCALING" which can be set to "1" to
change the SDL coordinate system units to be DPI-scaled points, rather
than pixels everywhere.

This means windows will be appropriately sized, even when created on
high-DPI displays with scaling.

e.g. requesting a 640x480 window from SDL, on a display with 125%
scaling in Windows display settings, will create a window with an
800x600 client area (in pixels).

Setting this to "1" implicitly requests process DPI awareness
(setting SDL_WINDOWS_DPI_AWARENESS is unnecessary),
and forces SDL_WINDOW_ALLOW_HIGHDPI on all windows.
2022-06-11 14:19:01 -07:00
Eric Wasylishen 51ebefeeee Support PMv2 DPI awareness, add SDL_HINT_WINDOWS_DPI_AWARENESS
The hint allows setting a specific DPI awareness ("unaware", "system", "permonitor", "permonitorv2").

This is the first part of High-DPI support on Windows ( https://github.com/libsdl-org/SDL/issues/2119 ).
It doesn't implement a virtualized SDL coordinate system, which will be
addressed in a later commit. (This hint could be useful for SDL apps
that want 1 SDL unit = 1 pixel, though.)

Detecting and behaving correctly under per-monitor V2
(calling AdjustWindowRectExForDpi where needed) should fix the
following issues:

https://github.com/libsdl-org/SDL/issues/3286
https://github.com/libsdl-org/SDL/issues/4712
2022-06-11 14:19:01 -07:00
Frank Praznik e1c8350439 wayland: Add a hint to disable video mode emulation under Wayland
Add the hint "SDL_VIDEO_WAYLAND_MODE_EMULATION", which can be used to disable mode emulation under Wayland. When disabled, only the desktop and/or native display resolution is exposed.
2022-06-10 14:24:12 -07:00
Guldoman 74bcc5a0a3 stdlib: Add `SDL_utf8strnlen` 2022-06-09 15:18:50 -07:00
chalonverse b9c2ad8395 Added additional check for HAVE_D3D12_H and missing SDL_VIDEO_RENDER_D3D12 in SDL_config.h.cmake 2022-06-07 22:36:06 -07:00
SDL Wiki Bot ef4e0e921a Sync wiki -> header 2022-06-07 00:44:04 +00:00
chalonverse 4082821822
DirectX 12 Renderer (#5761)
* DirectX 12 Renderer (27 squashed commits)

* Add missing SDL_hidapi.h of merge of SDL.vcxproj.filters

* Fixed OpenWatcom build failure

* Dynapi fix

Co-authored-by: Ryan C. Gordon <icculus@icculus.org>
2022-06-06 17:42:30 -07:00
SDL Wiki Bot 7cd165e2d9 Sync wiki -> header 2022-06-06 15:51:04 +00:00
yuanhecai 17f63e53f8 Add loongarch support
LSX and LASX are enabled by default if compiler supports them.
2022-06-06 08:49:09 -07:00
SDL Wiki Bot 3807e95029 Sync wiki -> header 2022-06-05 00:24:04 +00:00
Christoph Reichenbach 3a20274ddf Refactoring: move GUID operations out of Joystick
- SDL_JoystickGUID -> SDL_GUID (though we retain a type alias)
- Operations for GUID <-> String ops are now in
  src/SDL_guid.c and include/SDL_guid.h
- The corresponding Joystick operations delegate to SDL_guid.c
- Added test/testguid.c
2022-06-04 17:22:13 -07:00
SDL Wiki Bot 3604ae1d1b Sync wiki -> header 2022-06-04 01:52:04 +00:00
Sam Lantinga 423141bfca Added a function to get the controller firmware version 2022-06-03 18:50:00 -07:00
SDL Wiki Bot 4ddf85b1d5 Sync wiki -> header 2022-05-30 14:31:05 +00:00
Ryan C. Gordon 195ca499ca
include/SDL_video.h: You can google it.
This looks bad when reading Markdown as plain text, as one would do when
reading the headers directly.
2022-05-25 10:46:06 -04:00
Ryan C. Gordon 7ce311bead
include/SDL_system.h: Fixed a link that was still hg.libsdl.org 2022-05-25 10:43:14 -04:00
SDL Wiki Bot a8e7548797 Sync wiki -> header 2022-05-24 22:57:04 +00:00
SDL Wiki Bot 179765561c Sync wiki -> header 2022-05-24 18:26:05 +00:00
Sam Lantinga e97b506242 Need SDL_stdinc.h for _SDL_HAS_BUILTIN 2022-05-21 10:06:05 -07:00
Sam Lantinga 626a3c5ef7 Use _SDL_HAS_BUILTIN() instead of __has_builtin 2022-05-21 09:58:39 -07:00
David Carlier 1f48f8cd28 SDL_TriggerBreakPoint update using builtin instead of assembly versions if available 2022-05-21 09:50:04 -07:00
Simon McVittie b0a27cb1de Avoid unintended float -> double conversion in SDL_FRectEqualsEpsilon
Resolves: https://github.com/libsdl-org/SDL/issues/5691
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-19 11:47:03 -07:00
Cameron Cawley 9dfa000bc0 Initial support for building for Windows with OpenWatcom 2022-05-19 20:11:10 +03:00
Ozkan Sezer efa2e6a1ea SDL_thread.h: use SDL_ThreadFunction for SDL_CreateThreadWithStackSize 2022-05-19 18:55:02 +03:00
Cameron Cawley 0cca71a846 Use SDLCALL for callbacks in public APIs 2022-05-18 15:01:27 -07:00
Ivan Epifanov 8c5bda6acd Vita: remove Vita-specific RWOps code 2022-05-18 08:29:25 -07:00
Sam Lantinga f0bc5c9cbf Added effects support for virtual controllers 2022-05-16 07:21:28 -07:00
SDL Wiki Bot 5953422c09 Sync wiki -> header 2022-05-16 03:52:04 +00:00
Sam Lantinga bfac54b59c Added the ability to specify which buttons and axes are present for virtual controllers 2022-05-15 20:34:44 -07:00
SDL Wiki Bot 49ca8bf520 Sync wiki -> header 2022-05-16 03:03:04 +00:00
Sam Lantinga 94eeb587c1 First pass at extending virtual controller functionality
Added the ability to specify a name and the product VID/PID for a virtual controller

Also added a test case to testgamecontroller, if you pass --virtual as a parameter
2022-05-15 20:01:12 -07:00
Cameron Cawley e0f3da497f Remove unused SDL_ASSEMBLY_ROUTINES define 2022-05-12 14:37:00 +03:00
SDL Wiki Bot f93e810780 Sync wiki -> header 2022-05-12 07:39:04 +00:00
Sylvain 6b9884d40a
Fixed bug #4213 - update documentation to reflect SDL2 behavior of SDL_RenderGetLogicalSize 2022-05-12 09:36:49 +02:00
Michael Fitzmayer 9b75fa0165
N-Gage port: add changes from code reviews, overall cleanup (#5618)
* Add changes from code review by @ccawley2011, #5597, overall cleanup

* Update N-Gage README, minor cleanup and rephrasing

* Call SDL_SetMainReady() before calling SDL_main, return SDL_main instead of main
2022-05-11 09:31:34 -07:00
Sam Lantinga 2c2cbbe664 Fixed function reference for SDL_SIMDGetAlignment() 2022-05-11 09:04:23 -07:00
Cameron Cawley 2f924020e8 Add SDL_SCANCODE_CALL and SDL_SCANCODE_ENDCALL 2022-05-10 16:12:10 -07:00
Cameron Cawley 2bc373622b Add SDL_SCANCODE_SOFTLEFT and SDL_SCANCODE_SOFTRIGHT 2022-05-10 16:12:10 -07:00
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
Sam Lantinga 40b0509ef6 Fixed header documentation errors 2021-03-26 14:34:58 -07:00
Ryan C. Gordon c486959e71
headers: Fix up bullet lists, now that wikiheaders.pl can handle them. 2021-03-24 10:48:45 -04:00
Ryan C. Gordon 7c08b049e8
headers: a few minor documentation corrections. 2021-03-23 15:36:26 -04:00
Ryan C. Gordon 3f40396d33
First shot at merging the wiki documentation into the headers. 2021-03-21 14:19:53 -04:00
Esme 8ba735c208 Include arm_neon.h in mingw targeting ARM Windows.
The llvm-mingw project includes cross-compilers targeting ARM: https://github.com/mstorsjo/llvm-mingw/releases

Currently, compilation fails with this configuration, because neon features are used as long as __ARM_NEON is defined, but arm_neon.h was not included.
2021-03-15 10:11:51 +03:00
Ivan Epifanov 091288ac4e Vita port builds with cmake 2021-03-08 09:07:12 -08:00
uyjulian abcfb22b7d Add support for Vita file API in SDL_rwops 2021-03-08 09:07:12 -08:00
Ivan Epifanov ff5f98b87b Fix platform 2021-03-08 09:07:12 -08:00
Ivan Epifanov 8e4271fa45 Fix timers 2021-03-08 09:07:12 -08:00
Ivan Epifanov e928b92f1a CMake support 2021-03-08 09:07:12 -08:00
Ivan Epifanov ca5e5d6154 VITASDK compatibility 2021-03-08 09:07:12 -08:00
Ivan Epifanov e812ca529d Enable ARM SIMD/NEON optimized blitters 2021-03-08 09:07:12 -08:00
Ivan Epifanov 6c3bf56503 Unified build with both renderers 2021-03-08 09:07:12 -08:00
Ivan Epifanov a1adc8a9d6 Add sensor support 2021-03-08 09:07:12 -08:00
Ivan Epifanov bd14aa633f Autobuild 2021-03-08 09:07:12 -08:00
Ivan Epifanov 6ba8497518 Remove vita2d render, add raw gxm render 2021-03-08 09:07:12 -08:00
Ivan Epifanov ef0bbfd6c6 Include anf fix vita2d renderer 2021-03-08 09:07:12 -08:00
Ivan Epifanov dbb730d395 Separate vita piglet renderer. Add proper render initialization and window re-creation. 2021-03-08 09:07:12 -08:00
Ivan Epifanov 41d6c80b07 Filesystem module 2021-03-08 09:07:12 -08:00
Ivan Epifanov 2d64e37e41 Initial rebase of xerpi's port 2021-03-08 09:07:12 -08:00
Ozkan Sezer a7938107ae fix SDLK_DELETE after commit 2f5beac190 2021-03-06 11:28:04 +03:00
Lokathor 2f5beac190 Change octal char literals to hex char literals
This should not change anything at all within the compiled library, but it does make the header file easier to read for non-C programmers who don't expect an octal value.
2021-03-05 17:18:41 -08:00
Ethan Lee 67e8522d31 Add SDL_GetAudioDeviceSpec.
This API is supported by pipewire, pulseaudio, coreaudio, wasapi, and disk.
2021-03-05 12:03:07 -08:00
Ozkan Sezer e228d15261 SDL_config_windows.h: added clang to list of toolchains having stdint.h
from a patchset by Vladislav Dmitrievich Turbanov:
https://github.com/libsdl-org/SDL/pull/4062
2021-03-04 18:27:37 +03:00
Ozkan Sezer 0a68322170 add missing PIPEWIRE defines to SDL_config.h.in
also specify 'audio' in Pipepire configuration enable messages.
2021-03-01 15:11:50 +03:00
Frank Praznik 2f0b99a774 audio: Add Pipewire playback/capture sink 2021-02-28 19:40:09 -08:00
Cameron Gutman dfa64eadd3 KMSDRM: Add hint to enable the backend without DRM master
In some cases, it can be useful to have the KMSDRM backend even if it cannot
be used for rendering. An app may want to use SDL for input processing while
using another rendering API (such as an MMAL overlay on Raspberry Pi) or
using its own code to render to DRM overlays that SDL doesn't support.

This also moves the check for DRM master to an earlier point where we can fail
initialization of the backend, rather than allowing the backend to initialize
then failing the creation of a window later.
2021-02-25 18:48:36 -08:00
Ozkan Sezer 55a385a333 removed a useless restriction from Watcom version of SDL_Swap32()
also did a little whitespace tidy-up.
2021-02-24 20:03:50 +03:00
Ozkan Sezer b8d2185277 added Watcom i386 inline asm for SDL_Swap64() 2021-02-23 17:37:20 +03:00
Ozkan Sezer b3498a5dc2 make SDL_syswm.h work with apple's older gcc versions
c.f. https://bugzilla.libsdl.org/show_bug.cgi?id=2694
2021-02-22 15:50:02 +03:00
Amir 360740ac76 correct dynapi 2021-02-20 23:05:09 -08:00
Amir 5696582e1d add SDL_AndroidShowToast for https://developer.android.com/reference/android/widget/Toast 2021-02-20 23:05:09 -08:00
Amir 1a924bc0bb add SDL_AndroidShowToast for https://developer.android.com/reference/android/widget/Toast 2021-02-20 23:05:09 -08:00
Ozkan Sezer a2fbc452ca replace i386 checks with __i386__ 2021-02-15 03:02:32 +03:00
Misa dfe219ec71 Add all missing "is characteristic" stdlib functions
SDL has been missing a bunch of these 'isX' functions for some time,
where X is some characteristic of a given character.

This commit adds the rest of them to the SDL stdlib, so now we have:
- SDL_isalpha()
- SDL_isalnum()
- SDL_isblank()
- SDL_iscntrl()
- SDL_isxdigit()
- SDL_ispunct()
- SDL_isprint()
- SDL_isgraph()
2021-02-13 11:42:13 -08:00
Ryan C. Gordon 4ff51d29c3 Deprecate SDL_GetRevisionNumber and update things for git instead of hg.
Fixes #4063
2021-02-12 14:31:38 -05:00
Sam Lantinga ee25a1e6e2 The revision defaults to the empty string 2021-02-12 08:54:08 -08:00
Jay Petacat f443a6fc7a Fix format string warnings for width-based integers
The DJGPP compiler emits many warnings for conflicts between print
format specifiers and argument types. To fix the warnings, I added
`SDL_PRIx32` macros for use with `Sint32` and `Uint32` types. The macros
alias those found in <inttypes.h> or fallback to a reasonable default.

As an alternative, print arguments could be cast to plain old integers.
I opted slightly for the current solution as it felt more technically correct,
despite making the format strings more verbose.
2021-02-11 19:41:41 -08:00
Sam Lantinga ef52560a24 Fixed bug 5539 - Clang 11 fails to compile a CMake build with conflicting types for _m_prefetchw
vladius

In SDL_cpuinfo.h it seems like <intrin.h> is not included when __clang__ is defined, as the comment in the file explicitly reads:
"Many of the intrinsics SDL uses are not implemented by clang with Visual Studio"

However, the SDL_endian.h header does include <intrin.h> without any precautions like:
>#ifdef _MSC_VER
>#include <intrin.h>
>#endif

Maybe it should be changed to something like:
>#ifdef _MSC_VER
>#ifndef __clang__
>#include <intrin.h>
>#endif
>#endif
2021-02-10 10:22:20 -05:00
Ozkan Sezer bb9e049d1d minor updates to libc function checks 2021-02-10 10:22:19 -05:00
Sam Lantinga 2426949a18 Removed support for clock_gettime_nsec_np()
SDL_GetTicks() was broken and it's not adding any real value here.
2021-02-10 10:22:19 -05:00
Manuel Alfayate Corchete 2c76433151 [KMS/DRM] Merge patch for bug 5522#: Implement KMSDRM_GetWindowWMInfo(). 2021-02-10 10:22:18 -05:00
Cameron Gutman 79cd8cab08 Add default handler for Alt+Tab while keyboard grab is enabled
By default, we will minimize the window when we receive Alt+Tab with a
full-screen keyboard grabbed window to allow the user to escape the
full-screen application.

Some applications like remote desktop clients may want to handle Alt+Tab
themselves, so provide an opt-out via SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED=0.
2021-02-10 10:22:18 -05:00
Ozkan Sezer 431b79cf34 SDL_config_os2.h: remove some duplicated lines. 2021-02-10 10:22:17 -05:00
Cameron Gutman 6b057c6783 Expose separate keyboard and mouse grab support
This adds SDL_SetWindowKeyboardGrab(), SDL_GetWindowKeyboardGrab(),
SDL_SetWindowMouseGrab(), SDL_GetWindowMouseGrab(), and new
SDL_WINDOW_KEYBOARD_GRABBED flag. It also updates the test harness to exercise
this functionality and makes a minor fix to X11 that I missed in
https://hg.libsdl.org/SDL/rev/02a2d609369b

To fit in with this new support, SDL_WINDOW_INPUT_CAPTURE has been renamed to
SDL_WINDOW_MOUSE_CAPTURE with the old name remaining as an alias for backwards
compatibility with older code.
2021-02-10 10:22:17 -05:00
Sam Lantinga ac72a2ba8e Fixed bug 5493 - Hint to let the user opt out of having Switch controllers' Home button lit when opened
jibb

New hint to let the user opt out of having Switch controllers' Home button lit when opened.

This is more consistent with the Switch itself (which doesn't light the button normally) and may be preferred by users who may disconnect their controller without letting the application close it.

I think this warrants a Switch-specific hint because the default behaviour is unusual (inconsistent with using a Switch controller on a Switch itself or with some other programs on PC), and because of that it's distinct from other lights (the player number on Switch controllers and the player colour on PlayStation controllers).
2021-02-10 10:22:16 -05:00
Ozkan Sezer aa4a6b0b88 better check for clock_gettime_nsec_np() -- cf. bug #5467. 2021-02-10 10:22:16 -05:00
Sam Lantinga 1981d23f4b Fixed bug 5466 - Add haptic support for Stadia Controller
Dimitriy Ryazantcev

Consider adding support for Stadia Controller haptics.

Here is example code how to deal with it:
99314be815/device/gamepad/hid_haptic_gamepad.cc (L45)
2021-01-24 00:51:26 -05:00
Sam Lantinga 96cfb81232 Fixed bug 5467 - SDL sys timer Mac OS update proposal
David Carlier

Change of api from 2016 which reduce code complexity a bit.
2021-01-24 00:51:25 -05:00
JibbSmart 0f57864c9e Hint SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS added so we can recognise a Joy-Con as half a Pro Controller, so we can read its analog input and read its sensors just like we do a Pro Controller. 2021-01-24 00:51:25 -05:00
Ozkan Sezer 2376458841 renamed SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H to SDL_HAVE_MACHINE_JOYSTICK_H 2021-01-24 00:51:25 -05:00
Ozkan Sezer 02e61a88fb added SDL_JOYSTICK_OS2 to SDL_config.h.in and SDL_config.h.cmake 2021-01-24 00:51:25 -05:00
Ozkan Sezer 4a776557af old os2 analogue joystick code ported from SDL-1.2. disabled by default,
build-tested only.
2021-01-24 00:51:25 -05:00
Cameron Gutman 6e97170e96 Use PS4 rumble hint as the default for the PS5 rumble hint
Existing SDL applications may not know about the need to set a specific
hint to enable rumble on PS5 controllers, even though they may already
set the equivalent SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE hint for PS4
controller rumble support.

Rather than requiring those developers update their apps, let's use the
SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE value as an indication of the behavior
they are expected for all PlayStation controllers.
2021-01-24 00:51:24 -05:00
Sam Lantinga 69bd7ebbca Fixed build 2021-01-15 00:02:33 -08:00
Sam Lantinga 6a342954e8 Fixed bug 5451 - Can't create EGLSurface in Wayland from SDLWindow (no EGLNativeWindow pointer)
sashikknox

In some cases, need create EGLWindow with SDLWindow. In X11 i can get pointer to NativeWindow from **struct SDL_SysWMinfo wmInfo**
```C++
struct SDL_SysWMinfo wmInfo;
SDL_GetWindowWMInfo(ptSDLWindow, &wmInfo)
#if defined(__unix__) && defined(SDL_VIDEO_DRIVER_X11)
nativeWindow=(EGLNativeWindowType)wmInfo.info.x11.window;
nativeDisplay=(EGLNativeDisplayType)wmInfo.info.x11.display;
#endif
```
than i can create EGLSurface
```
eglCreateWindowSurface(nativeDisplay, EGL_CONFIG, nativeWindow, SURFACE_ATTRIBUTES);
```
in Wayland i can do it with same way, just need pointer to **EGLWindow**, we already have pointer to **wl_display** from **SDL_sysWMInfo**, need add to **wl** struct in SDL_SysWMInfo another pointer to **struct wl_egl_window *egl_window;**. And in wayland backend, in function **Wayland_GetWindowWMInfo** return pointer to **egl_window** from **SDL_WindowData**
Now i use patched statically built SDL2 in port of Quake 2 GLES2 for SailfishOS (it use QtWayland):
link to SDL2 commit and changed string for patch:
- 6858a618cd
- b1e29e87b9/SDL2/src/video/wayland/SDL_waylandwindow.c (L463)

link to use in Quake2 port:
1. here i get pointer to EGLNativeWindowType:  6d94fedb1b/Engine/Sources/Compatibility/OpenGLES/EGLWrapper.c (L319)
2. then use it for create EGLSurface: 6d94fedb1b/Engine/Sources/Compatibility/OpenGLES/EGLWrapper.c (L391)
2021-01-14 14:42:53 -08:00
Sam Lantinga b2aaab3d53 Fixed bug 5462 - debug trap update/fix of assembly for Apple devices
David Carlier

updating preprocessor constant and proposing 32 bits variant.
2021-01-14 14:34:24 -08:00
Sam Lantinga 82aafa9aa8 Fixed bug 5461 - Add rewritten WSCONS driver for OpenBSD
wahil1976

This patch adds a written-from-scratch WSCONS driver for OpenBSD. It does not have hardcoded keymaps, and it features mouse support when wsmux is available.

For this to work, it needs access to the /dev/wskbd* devices which are not available to non-root users by default. Access to those can be granted by changing /etc/fbtab to give the logging user the ownership of those devices.
2021-01-14 14:32:11 -08:00
Cameron Gutman 0f0946702d Use Clang/GCC builtins for SDL byteswapping functions
__builtin_bswap32/64 were introduced in GCC 4.3. __builtin_bswap16 was
not available on x86 until GCC 4.8 due to a bug.

__builtin_bswap32/64 were introduced in Clang 2.6. __builtin_bswap16
was introduced in Clang 3.2.
2021-01-04 19:51:56 -06:00
Sylvain Becker be4cfd51c3 Add SDL_UpdateNVTexture() to update NV12/21 Texture (bug #5430)
for renderer software, opengl, and opengles2
2021-01-05 11:56:22 +01:00
Ozkan Sezer f414a43632 simplify Watcom implementation of SDL_MostSignificantBitIndex32() 2021-01-04 03:00:10 +03:00
Cameron Gutman 91a831e2d0 Implement SDL_MostSignificantBitIndex32 using MSVC intrinsics 2021-01-03 14:02:55 -06:00
Sam Lantinga 393c8c1f16 Fixed bug 5440 - MacCatalyst build failures
C.W. Betts

I tested building commit http://hg.libsdl.org/SDL/rev/7adf3fdc19f3 on Mac Catalyst and found some issues:

* MTLFeatureSet_iOS_* enums aren't available under Mac Catalyst.
* OpenGL ES is unavailable under Mac Catalyst.
* Some Metal features are available under Catalyst but not iOS, such as displaySyncEnabled.
* Set Metal as the default renderer on Mac Catalyst

Attaching a patch that will make SDL2 build for Mac Catalyst.
2021-01-03 10:32:55 -08:00
Cameron Gutman 115d66e756 Use MSVC _byteswap intrinsics for SDL byteswapping functions
This generates bswap on x86/x64 and rev on ARM
2021-01-02 12:50:01 -06:00
Cameron Gutman 6cbd4417f0 Add a hint for D3D9Ex to avoid having to choose at compile-time 2021-01-02 14:45:15 -06:00
Sam Lantinga 6f9e18da2a Fixed bug 5441 - Add support for endianness check on FreeBSD: Fixes endianness checking on at least powerpc64le, maybe also other architectures
VVD

Patch based on patch from FreeBSD port devel/sdl20:
https://svnweb.freebsd.org/ports/head/devel/sdl20/files/patch-include_SDL__endian.h?view=log
2021-01-03 10:18:39 -08:00
Sam Lantinga 9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Sam Lantinga 223af86c62 Added SDL_RenderGetD3D11Device() to get access to the device associated with the D3D11 renderer 2021-01-01 11:12:30 -08:00
Ozkan Sezer 5b2e011e6d SDL_endian.h: minor fixes from SDL-1.2 branch
( forward-port of changesets 3909:6832b00d3594 and 5657:529d23724144 )
2020-12-30 23:55:02 +03:00
Ozkan Sezer 92edee2324 SDL_config_android.h: update SIZEOF_VOIDP define to respect __LP64__ 2020-12-30 01:28:02 +03:00
Ozkan Sezer 7c105f12d5 updates to SDL_config_os2.h 2020-12-30 01:21:10 +03:00
Ozkan Sezer 1cdc1d4890 SDL_config.h.cmake, SDL_config.h.in: update for SIZEOF_VOIDP define 2020-12-30 01:00:24 +03:00
Ozkan Sezer 9fc139dfb5 SDL_config_windows.h: add missing HAVE_STRTOULL along side HAVE_STRTOLL 2020-12-30 01:00:24 +03:00
Ozkan Sezer b76b81b0e4 SDL_config.h.cmake, SDL_config.h.in: add os/2 driver defines
in case autofoo or cmake is used for it some day..
2020-12-30 01:00:24 +03:00
Ozkan Sezer 8a32ee24db removed MSVC strtok_s use from SDL_strtokr().
no other ??_s are used elsewhere in SDL_stdinc. besides, C11 has a
strtok_s with a different signature.
2020-12-30 01:00:24 +03:00
Sam Lantinga 0684572ccc Added a hint to control whether the player LEDs should be lit to indicate which player is associated with a PS5 controller. 2020-12-29 12:13:10 -08:00
Joel Linn 8fc0baad98 Add SDL_cond implementation using Windows Condition Variables
Is automatically used when the SRW SDL_mutex implementation is active.
Otherwise falls back to the generic implementation.

v2: - Rebase onto master fa3ea1051a4b
2020-12-28 11:43:11 -08:00
Joel Linn 2443e51e0e Add optional suffix `_generic` to generic SDL_cond impl
Allows for runtime selectable implementation
2020-12-28 11:42:49 -08:00
Ozkan Sezer 9e22f62e0d arm64 implementations of SDL_Swap16/32 (bug #5419.)
patch from David Carlier.
2020-12-28 11:50:02 +03:00
Ozkan Sezer 2355dea448 revert 'arm64 implementations of SDL_Swap16/32' for now (bug #5419) 2020-12-28 08:00:50 +03:00
Ozkan Sezer 2f99bc07e7 arm64 implementations of SDL_Swap16/32 (bug #5419.)
patch from David Carlier.
2020-12-28 07:20:20 +03:00
Sam Lantinga 93ccdee8c1 Fixed bug 5404 - stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf
Cameron Cawley

stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf

The default implementation is based on the one used in the Windows RT video driver.
2020-12-23 13:47:49 -08:00
Joel Linn d0b8295c0d Add SDL_sem implementation using Atomics and WaitOnAddress API.
Keep Semaphore Kernel Object impl for Windows 7 and older - choose at runtime

v2: - Fix mixed int/LONG types
    - Reorder definitions
    - Add missing include

v3: - Use `GetModuleHandle()` to load the API Set
2020-12-23 13:36:46 -08:00
Joel Linn 548cb90893 Add SDL_mutex implementation using Windows Slim Reader/Writer Locks Keep Critical Section impl for Windows XP/Vista - choose at runtime
v2: - Add SRW definitions as suggested by Ozkan Sezer
      Allows building against older platform headers.
    - Rename "hidden" function parameter `mutex_` to `_mutex`

v3: - Use GetModuleHandle instead of LoadLibrary
    - Fix typo in comment
2020-12-23 13:33:36 -08:00
Sylvain Becker ae8a270f61 Add SDL_SoftStretchLowerLinear() (Bug 5313) 2020-12-23 21:37:40 +01:00
Sam Lantinga 4ec776c334 Don't switch the PS5 controller out of DirectInput mode by default 2020-12-22 13:29:23 -08:00
Sam Lantinga 350f1b0d16 Updated SDL to version 2.0.15 for development 2020-12-22 10:36:15 -08:00
Sam Lantinga 5f7cd1fa88 Added hints to control whether SDL updates joystick and sensor state in the main event loop 2020-12-18 10:08:59 -08:00
Sam Lantinga 6bd4c717a1 Fixed bug 5402 - ARM support little update proposal
David Carlier

No fix but mostly an update for ARM architecture.
2020-12-17 21:41:23 -08:00
Ozkan Sezer b6e63625c8 fix bug #5395: handle old systems where inotify_init1 is not available 2020-12-13 15:32:24 +03:00
Sam Lantinga ce7c751c2c Document that the joystick deadzone hint defaults off 2020-12-12 23:54:40 -08:00
Sam Lantinga 13a4caf1d7 Fixed bug 4286 - Joystick subsystem causes "not responding" when app is in the background
Added a hint to control whether a separate thread should be used for joystick events.
This is off by default because dispatching messages in other threads appears to cause problems on some versions of Windows.
2020-12-12 22:08:02 -08:00
Ozkan Sezer bca9decbda fix bug #5394 - define _DARWIN_C_SOURCE only if not already defined 2020-12-12 23:28:10 +03:00
Sam Lantinga 7fa5e95b62 Fixed bug 5213 - Add support to metal in iOS/tvOS simulator
Vincent Hamm

Xcode11 and ios13 added support for metal simulator.
Here is a quick and dirty patch to enable it. Pretty early and only tested on a few samples for now. Required mostly to enable metal support on correct version of ios, generate simulator compatible shaders and enforce buffer alignments on simulator (same as osx).
2020-12-09 07:23:47 -08:00
Ozkan Sezer 250a055727 fix bug #5384 -- define DLL_EXPORT in DLL builds and adjust begin_code.h 2020-12-09 12:01:10 +03:00
Sam Lantinga a2098a47b6 Updated SDL to 2.0.14 in preparation for release candidate 2020-12-08 18:56:06 -08:00
Mikhail Paulyshka 146d9b8201 win32: fix symbols leakage for static libraries 2017-09-24 14:32:30 +03:00
Sam Lantinga 7f1c6e82b9 Accepted patch https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/enable-winrt-cmake.patch 2020-12-08 09:13:08 -08:00
Sam Lantinga 7854f43b6d Disable SDL_JOYSTICK_HIDAPI on iOS and tvOS by default
It's only needed for Steam Controller support, and introduces a Bluetooth framework dependency which requires additional permissions on the App Store.
2020-12-01 14:43:15 -08:00
Sam Lantinga a0c5bfa3bd Moved raw input event processing from the main thread to the joystick thread
This allows fast joystick event delivery regardless of what the main thread is doing.
2020-11-27 13:08:40 -08:00
Sam Lantinga 845b903324 Implemented trigger rumble for raw input controllers 2020-11-25 16:46:42 -08:00
Ozkan Sezer e5783e1179 cmake: add missing checks for wcscasecmp, _wcsicmp, wcsncasecmp, _wcsnicmp 2020-11-25 14:51:56 +03:00
Ozkan Sezer 7c18088f00 SDL_config_os2.h: define HAVE__WCSICMP and HAVE__WCSNICMP 2020-11-25 14:51:56 +03:00
Sam Lantinga 46a844786b Added SDL_wcscasecmp() and SDL_wcsncasecmp() 2020-11-24 12:43:01 -08:00
Sam Lantinga c63bbb06e9 Including SDL_config_iphoneos.h enables MFI controller code 2020-11-24 06:55:33 -08:00
Sam Lantinga 1e943e2ad2 Fixed building with an older SDK and macOS target 2020-11-23 22:59:22 -08:00
Sam Lantinga 1fc5ca6484 Fixed building with an older SDK and macOS target 2020-11-23 22:24:54 -08:00
Sam Lantinga e9869e07bf Fixed bug 5335 - enable joystick/haptic/evdev support by default on FreeBSD
Alex S

Evdev headers aren't actually included in the base system (well, it has a private copy), they are available through the devel/evdev-proto port instead. We also have devel/libinotify and devel/libudev-devd shims, I didn't verify whether they work with SDL.
2020-11-23 21:08:19 -08:00
Sam Lantinga 38ab8bf74b Fixed bug 5362 - Mac OS ARM doesn't build Metal/Vulkan back-end/renderers
C.W. Betts

As it is, SDL2's built-in config on macOS for Metal excludes Apple Silicon. This is due to thinking that the 64-bit Mac platform would always be x86_64. My patch fixes this by using the catch-all of 64-bit platforms.
2020-11-23 21:03:43 -08:00
Sam Lantinga 62e39b5fa7 Fixed building with an older SDK and macOS target 2020-11-23 20:57:14 -08:00
Ozkan Sezer 4c96faee57 remove non-existing tslib support from autofoo and cmake 2020-11-23 20:37:10 +03:00
Sam Lantinga fd89446782 Fixed building on Mac OS X on the command line and with an older macOS SDK 2020-11-21 14:13:26 -08:00
Sam Lantinga 1df593fb16 Fixed bug 5355 - Add GameController Framework support to macOS
C.W. Betts

This patch adds support to the GameController framework on macOS Big Sur and later, adding support for MFi controllers as well as rumble support for PS4 and Xbox One. There is some code to make sure that the IOKit joystick handler doesn't include two controllers at once.

While the GameController framework is present in earlier versions of macOS, there was no public, approved way of checking if a specific IOHIDDevice is a controller that GameController could handle. This was changed in Big Sur.
2020-11-21 13:15:33 -08:00
Sam Lantinga fcb21aa883 Added API for sensors on game controllers
Added support for the PS4 controller gyro and accelerometer on iOS and HIDAPI drivers

Also fixed an issue with the accelerometer on iOS having inverted axes
2020-11-17 10:30:20 -08:00
Sam Lantinga d140d88744 Added SDL_JoystickGetSerial() and SDL_GameControllerGetSerial() 2020-11-16 17:36:47 -08:00
Sam Lantinga 71e32f5e1b Added SDL_crc32() 2020-11-16 15:00:15 -08:00
Ozkan Sezer bbbec723e5 SDL_config_windows.h: define HAVE_TRUNC[F] for Visual Studio >= 2013 2020-11-14 14:03:40 +03:00
Ozkan Sezer 3e40b87f56 SDL_config_os2.h: undefine HAVE_TRUNC
trunc() exists only in OpenWatcom 2.0 fork, and its implementation
already is the same as the fallback we have here..
2020-11-14 14:03:40 +03:00
Ryan C. Gordon bee8db3b04 config: Make sure HAVE_TRUNC and HAVE_TRUNCF are defined as appropriate.
The configure/cmake scripts were checking for these functions but we didn't
have the SDL_config.h.* pieces in place. The other config headers are best
guesses.
2020-11-14 02:16:41 -05:00
Sam Lantinga 9f51fad361 Added support for the touchpad on PS4 and PS5 controllers 2020-11-13 18:01:29 -08:00
Sam Lantinga 0500c04468 Fix SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL also applying to HIGH priorities
As the name suggests, the hint should only apply to SDL_THREAD_PRIORITY_TIME_CRITICAL

The resulting priorities for my current distro result in these values:

     | High         | Time Critical
Hint |--------------|-----------------
 0   |  P=10 N=-10  | P=5   N=-15
 1   |  P=10 N=-10  | P=-21 N=0
2020-11-12 07:53:05 -08:00
Ozkan Sezer 52486d018a SDL_keycode.h (SDL_Keymod): remove comma at end of enumerator list 2020-11-12 15:10:00 +03:00
Sam Lantinga 1822f97e5f Fixed bug 5346 - Add FreeBSD evdev KBIO keyboard input driver
wahil1976

This patch adds the KBIO text input driver for FreeBSD, which allows text input to fully work without text spilling out into the console. It also supports accented input, AltGr keys and Alt Lock combinations.

Tested with US accent keys layout and various AltGr layouts.
2020-11-11 19:37:47 -08:00
Sam Lantinga 1e2caac58b Added SDL_JoystickRumbleTriggers() and SDL_GameControllerRumbleTriggers() 2020-11-11 18:57:37 -08:00
Sam Lantinga 07eae7d670 Fix process randomly getting killed when SDL_THREAD_PRIORITY_HIGH/TIME_CRITICAL is set
When we request realtime priority from rtkit, we have a rttime limit. If we exceed
that limit, the kernel will send SIGKILL to the process to terminate it.

This isn't something that most high priority processes will want, only processes
that selectively opt into SCHED_RR/FIFO through SDL_HINT_THREAD_PRIORITY_POLICY
should be subject to this level of scrutiny.

This change:
  * Switches non-apple posix OSs to use SCHED_OTHER instead of SCHED_RR
for SDL_THREAD_PRIORITY_HIGH/SDL_THREAD_PRIORITY_TIME_CRITICAL.
  * Fixes using a hardcoded RLIMIT_RTTIME, instead queries it from rtkit
  * Only sets RLIMIT_RTTIME for MakeRealtime rtkit requests
  * Adds a note regarding the possible SIGKILL with SDL_HINT_THREAD_PRIORITY_POLICY
  * Introduces SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL to allow apps to acquire realtime scheduling policies on Linux
2020-11-11 08:47:18 -08:00
Sam Lantinga f656d8456e Fixed typo in the documentation 2020-11-09 10:29:10 -08:00
Sylvain Becker b198febb62 Documentation: fix minor gamecontroller parameter warning 2020-11-08 10:22:27 +01:00
Sam Lantinga 009b62f1c2 Be explicit about mapping the new game controller paddle buttons 2020-11-07 02:22:15 -08:00
Sam Lantinga 3a4388489a Document the Xbox One Elite paddle buttons 2020-11-06 17:06:41 -08:00
Sam Lantinga 9a446aa92e Note that SDL_CONTROLLER_BUTTON_AUX1 is sent for the PS4/PS5 touchpad button on the HIDAPI driver. 2020-11-06 13:55:51 -08:00
Sam Lantinga 3a3aaac221 Added 4 auxiliary buttons to the game controller API
Xbox Elite controllers use AUX1-AUX4 to represent the paddle buttons when using the HIDAPI driver
PS4 and PS5 controllers use AUX1 to represent the touchpad button
Nintendo Switch Pro controllers use AUX1 to represent the capture button
2020-11-06 11:30:52 -08:00
Sam Lantinga a22beef402 Moved the PS5 controller driver to a separate file, as the advanced feature protocol is very different from that of the PS4 2020-11-05 17:03:28 -08:00
Sam Lantinga 4d79f9662f Added initial support for the Sony PS5 Controller 2020-11-05 15:02:54 -08:00
Sam Lantinga e555d45331 Added SDL_JoystickHasLED
Currently, this is only supported by the PS4 HIDAPI driver.
2020-11-05 11:07:54 -08:00
Ethan Lee 83cddd2ebc Add SDL_JoystickSetLED.
Currently, this is only supported by the PS4 HIDAPI driver.
2020-04-30 11:57:29 -04:00
Ozkan Sezer 79221e85a0 SDL_stdinc.h: define _DARWIN_C_SOURCE on macOS for memset_pattern4()
hopefully fixes https://bugzilla.libsdl.org/show_bug.cgi?id=5107
2020-10-29 20:00:20 +03:00
Ozkan Sezer fbbc4ab33b os2: can build with libsamplerate support if wanted to. 2020-10-24 20:12:50 +03:00
Sylvain Becker ffb307e4dc Fixed bug 5304 - add SDL_HasSurfaceRLE() (Thanks Rene Dudfield and Dan Lawrence) 2020-10-18 09:52:56 +02:00
Sam Lantinga b8ed432c3e Added a note about Android 11 2020-10-16 12:35:30 -07:00
Ozkan Sezer 52b319fec9 minor update to os/2 config file and update.
binary (dll) output doesn't change.
2020-10-16 02:50:10 +03:00
Ozkan Sezer d27238751f os2: integrate the port into main tree. 2020-10-14 23:01:06 +03:00
Ozkan Sezer fc795f89d3 SDL_cpuinfo.h: add missing const to size parameter of SDL_SIMDRealloc()
so that the declaration matches the definition.
2020-10-13 05:20:00 +03:00
Ozkan Sezer 196cda69f2 build: fix / update sensors (windows) configuration
- SDL_config.h.in: add missing defines SDL_SENSOR_COREMOTION
  and SDL_SENSOR_WINDOWS (configure did set SDL_SENSOR_WINDOWS
  but it never went in SDL_config.h or Makefile.)
- SDL_config.h.cmake: remove duplicated SDL_SENSOR_XXX cmake
  defines.
- autofoo, cmake: check for sensorsapi.h header before enabling
  windows sensors.
2020-10-12 01:02:28 +03:00
Ozkan Sezer e58cc5fa0e minor whitespace fix 2020-10-09 03:28:30 +03:00
Ozkan Sezer 3aa418f451 SDL_video.h (SDL_DisplayEventID): remove comma at end of enumerator list 2020-10-09 02:50:15 +03:00
Sam Lantinga 76980e30f2 Added events for dynamically connecting and disconnecting displays, with an iOS implementation 2020-10-08 16:42:20 -07:00
Ryan C. Gordon 77c9d73b63 Removed SDL_AndroidOpenURL, added SDL_OpenURL.
Still needs to be wired into Xcode and Visual Studio projects.
2020-10-05 11:30:33 -04:00
Sylvain Becker dd55bfe89c Android: add helper function to open an URL/URI (see bug 2783) 2020-10-01 14:41:09 +02:00
Sylvain Becker 955f3184f9 Fixed bug 5239 - Play audio on Android while backgrounded (Thanks Superfury)
Add hint SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO not to pause audio when
the app goes to background.
(It requires SDL_ANDROID_BLOCK_ON_PAUSE as "Non blocking")
2020-09-25 10:14:42 +02:00
Sylvain Becker ebc12a2fd2 SDL_Surface refcount: destination surface keep track of surfaces
that are mapped to it and automatically invalidate them when it is freed

- refcount is kept so that an external application can still create a reference
to SDL_Surface.

- lock_data was un-used and is now renamed and used as a list keep track of the blitmap
2020-09-07 18:50:30 +02:00
Sylvain Becker 97fad04551 Fixed bug 5278 - export SDL_AndroidRequestPermission() (Thanks Huki!) 2020-09-02 19:38:03 +02:00
Sylvain Becker 965b466ee8 Fixed bug 4297 - Android StrictMode policy. Remove APK expansion support
"In the second half of 2021, new apps will be required to publish with the Android App Bundle on Google Play"
(see https://developer.android.com/guide/app-bundle)
And "Android App Bundles don't support APK expansion (*.obb) files".
2020-08-17 19:50:20 +02:00
Kai Krakow c3ecf18cc4 Linux: Add hint for disabling deadzones 2020-07-21 23:38:42 +02:00
Sam Lantinga 86517d3eda Fixed bug 5242 - KMOD_* flags unnecessarily macros; breaks OGRE
Rainer Deyke

While most of the KMOD_* flags are enums, the combination flags KMOD_CTRL, KMOD_ALT, KMOD_SHIFT and KMOD_GUI are defined as macros.  This breaks third-party code that uses these KMOD_* names for local identifiers, such as OGRE.  The correct thing to do is to make them all enums.
2020-08-10 08:42:35 -07:00
Ryan C. Gordon af71510cca assert: Implement SDL_TriggerBreakpoint for Apple ARM hardware. 2020-07-16 04:43:08 -04:00
Ryan C. Gordon 6aec6da4c3 stdinc: Let Clang static analysis see more C runtime functions.
For systems without strlcpy and strlcat, just declare them as if they exist;
the analyzer possibly still knows the details of these functions and can
utilize that in its analysis.

Most of this patch was from meyraud705 at gmail and Martin Gerhardy. Thanks!

Fixes Bugzilla #5163.
2020-06-28 17:45:07 -04:00
Sylvain Beucler e594a6738a emscripten: Introduce SDL_HINT_EMSCRIPTEN_ASYNCIFY
See https://github.com/emscripten-core/emscripten/issues/10746

and

https://github.com/emscripten-ports/SDL2/pull/112

Fixes Bugzilla #4997.
2020-06-27 16:25:47 -04:00
Ryan C. Gordon 1947ca7028 video: Changed SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS to default to FALSE.
Fixes Bugzilla #5106.  (and probably many others, too!)
2020-06-26 20:16:43 -04:00
Sam Lantinga 7c0986fba4 Fixed bug 4938 - Suggestion: rename SDL_PIXELFORMAT_BGR888 to SDL_PIXELFORMAT_XBGR8888
Ellie

I just tripped over this: stb_image when requesting 3 channels with 8-bit actually returns them as 3 bytes per pixel with no alignment, so basically 4 pixels are 12 bytes with no padding (0...2, 3...5, 6...8, and 9...11). This I would have naively expected to be called RGB888 or BGR888, since there is no "dead" unused byte as I would expect for something called e.g. RGBX8888.

However, SDL2's SDL_PIXELFORMAT_BGR888 uses 4 bytes, same as SDL_PIXELFORMAT_BGRX8888, even though the latter appears to be a longer storage format - which it isn't, internally. It's just swapped, in byte order X, B, G, R (instead of BGRX). So why isn't the macro name also swapped, as "XBGR888" instead of just "BGR888"?

I find the formats therefore named inconsistently, and unless there is a reason for this I suggest these changes:

1. deprecate SDL_PIXELFORMAT_BGR888 in favor of a new SDL_PIXELFORMAT_XBGR8888

and

2. deprecate SDL_PIXELFORMAT_RGB888 in favor of a new SDL_PIXELFORMAT_XRGB8888
2020-06-12 10:30:46 -07:00
Ethan Lee 2aa8974f97 Add SDL_SIMDRealloc 2020-06-11 12:03:33 -04:00
Sam Lantinga 06267f5028 Fixed whitespace in SDL_vulkan.h 2020-06-02 16:59:54 -07:00
Sam Lantinga 2303d92188 Fixed bug 5145 - Fix whitespace in SDL_vulkan.h
Colin Caine

Everywhere else seems to use spaces.

See patch diffed from a fresh hg checkout yesterday.
2020-05-29 16:28:56 -07:00
Sam Lantinga abd5841850 Make some changes to SDL_SetThreadPriority to try and have SDL transparently handle more of the work.
1. Comment that SDL_SetThreadPriority will make any necessary system changes when applying priority.
2. Add a hint to override SDL's default behavior for scheduler policy.
3. Modify the pthreads SDL_SetThreadPriority so that instead of just using the current thread scheduler policy it will change it to a policy that should work best for the requested priority.
4. Add hint checks in SDL_SetThreadPriority so that #3 can be overridden if desired.
5. Modify the Linux SDL_SetThreadPriority so that in the case that policy, either by SDL defaults or from the hint, is a realtime policy it uses the realtime rtkit API.
6. Prior to calling rtkit on Linux make the necessary thread state changes that rtkit requires.  Currently this is done every time as it isn't expected that SDL_SetThreadPriority will be called repeatedly for a thread.
2020-05-26 13:19:19 -07:00
Sam Lantinga eadc8693dd Fixed bug 5103 - Port fcitx support to both fcitx 4 & 5
wengxt

Due to the new major fcitx version is coming close, the existing code need to be ported to use new Fcitx dbus interface.

The new dbus interface is supported by both fcitx 4 and 5, and has a good side effect, which is that it will work with flatpak for free. Also the patch remove the dependency on fcitx header. Instead, it just hardcodes a few enum value in the code so need to handle the different header for fcitx4 or 5.
2020-05-11 14:31:04 -07:00
Ryan C. Gordon fa23e3d00b locale: Implemented SDL_GetPreferredLocales().
This was something I proposed a long time ago, Sylvain Becker did
additional work on it, then back to me.

Fixes Bugzilla #2131.
2020-05-04 02:27:29 -04:00
Sam Lantinga 65ad45340d Improvement for bug 3446 - The haptic API does not allow to select the direction axes
meyraud705

I see how the documentation is confusing. I think that the choice of the axis is an implementation detail. The documentation should state the goal of this value, so I propose this wording:

    "Use this value to play an effect on the steering wheel axis. This provides
     better compatibility across platforms and devices as SDL will guess the
     correct axis."

Value could even be renamed 'SDL_HAPTIC_STEERING_AXIS'.

For Linux, sending an effect on the X axis with a Logitech wheel works. Others brands don't have driver for Linux as far as I know.
2020-05-04 13:17:43 -07:00
Ryan C. Gordon 8601996fbc hints: Allow specifying audio device metadata.
This is only supported on PulseAudio. You can set a description when opening
your audio device that will show up in pauvcontrol, which lets you set
per-stream volume levels.

Fixes Bugzilla #4801.
2020-05-03 22:13:48 -04:00
Ryan C. Gordon 11fef299d1 hints: Fixed a doxygen comment. 2020-05-03 20:56:18 -04:00
Sam Lantinga 0f374b069b Fixed build on older Visual Studio, enable new features on newer Visual Studio 2020-04-22 15:42:32 -07:00
Sam Lantinga 116b8c17f2 Note which Windows SDK version is required for Windows Gaming Input support 2020-04-19 00:05:54 -07:00
Sam Lantinga aba2792896 Added a Windows Gaming Input joystick driver
This driver supports the Razer Atrox Arcade Stick

Some of the quirks of this driver, inherent in Windows Gaming Input:
* There will never appear to be controllers connected at startup. You must support hot-plugging in order to see these controllers.
* You can't read the state of the guide button
* You can't get controller events in the background
2020-04-18 21:41:37 -07:00
Sam Lantinga ed1d855865 Fixed bug 4299 - A recent change requires Core Bluetooth framework on iOS
Caleb Cornett

Just ran into this, and from my testing, whatever re-added the dependency is a _major_ regression. Not only is your app forced to link with CoreBluetooth, but iOS has apparently tightened up security and won't even let you _test_ your app unless it specifies the NSBluetoothAlwaysUsageDescription in an Info.plist. It doesn't even pop up an error message, it just straight up crashes.

Adding the permission isn't a good solution either, since I'd really, really rather not have my app request users' bluetooth to always be enabled, especially if the only apparent reason is for Steam Controller support.
2020-04-14 07:41:00 -07:00
Sam Lantinga e6c640f314 Enable the virtual joystick API by default 2020-04-13 08:18:16 -07:00
Sam Lantinga bd7b4f39ed Partial fix for bug 5086 - CMake builds on Windows broken by sensor support (thanks DominikD!) 2020-04-13 08:05:29 -07:00
hmk 0918903f3c render: add a hint for toggling relative scaling
Fixes Bugzilla #4811.
2019-09-30 22:54:16 +03:00
Ryan C. Gordon d292f6bd4f stdlib: Add SDL_trunc and SDL_truncf 2020-04-10 12:17:14 -04:00
Ryan C. Gordon a791689086 metal: Added some support interfaces to Apple's Metal API (thanks, Caleb!).
Caleb Cornett's comments:

"A few weeks ago, Alex added a partial Metal API to SDL2:

https://hg.libsdl.org/SDL/rev/22c8e7cd8d38

I noticed it was missing a few features that would help Metal become a
first-class citizen in SDL, so I went ahead and wrote them! Here are the new
APIs:

1. SDL_WINDOW_METAL flag for SDL_CreateWindow(). This allows the programmer
to specify that they intend to create a window for use with SDL_MetalView.
The flag is used to ensure correct usage of the API and to prevent
accidentally defaulting to OpenGL on iOS.

2. SDL_Metal_GetLayer(). This function takes a SDL_MetalView and returns a
pointer to the view's backing CAMetalLayer. This simplifies things
considerably, since in the current version of the SDL_Metal API the
programmer is required to bridge-cast a SDL_MetalView handle to an NSView or
UIView (depending on the platform) and then extract the layer from there.
SDL_Metal_GetLayer automatically handles all of that, making the operation
simple and cross-platform.

3. SDL_Metal_GetDrawableSize(). This function already exists in the current
SDL_Metal API (and is used behind-the-scenes for SDL_Vulkan_GetDrawableSize
on Apple platforms) but was not publicly exposed. My patch exposes this
function for public use. It works just like you'd expect.

Tested on macOS 10.14 and iOS 12.4."

Fixes Bugzilla #4796.
2020-04-10 00:37:35 -04:00
Sam Lantinga 3180ba81af First pass at Windows sensor implementation 2020-04-08 08:34:27 -07:00
Sam Lantinga b6eb09ff13 Updated documentation so people know to set the SDL_HINT_NO_SIGNAL_HANDLERS hint before SDL_Init() 2020-03-20 15:55:02 -07:00
Sam Lantinga 4c22a21e06 Fixed bug 3446 - The haptic API does not allow to select the direction axes
meyraud705

Added Linux implementation, otherwise you get "Unsupported direction type" error.
Added documentation to explain why one would use SDL_HAPTIC_FIRST_AXIS.
2020-03-17 14:18:05 -07:00
Sam Lantinga 7379991778 Fixed bug 3446 - The haptic API does not allow to select the direction axes
Mathieu Laurendeau

Consider a device supporting effects on multiple axes.
There's currently no way to play effects against a single-axis direction.


A device supporting effects against X and Y may not allow to play effects with a two-axis direction coordinate, even if one of the coordinates is null.

My current (ugly) work around for this is to add a direction type SDL_HAPTIC_X_FORCE to play effects against a X-axis only direction (patch attached).

This issue impacted two GIMX users using the following wheels:
- Leo Bodnar SimSteering force feedback wheel
- Accuforce direct drive wheel

Playing constant/spring/damper effects against a X-axis direction worked well for the first wheel, but not for the second one.

A better strategy seems to play the effects against the first axis reported by the DirectInput enumeration.

This strategy also works with Logitech wheels (at least the DFGT).

It's been more than a year that I have the latest patch (playing effects against the first axis only) in the GIMX software. It's being used by thousands of people, mostly for adapting their FFB wheel to the PS4. I had no report that proves this strategy to be wrong.
2020-03-16 13:28:38 -07:00
Sam Lantinga 4dea340ca7 Fixed bug 4477 - Support more than 4 XInput-capable devices on Windows
Jimb Esser

Add new RawInput controller API, and improved correlation with XInput/WGI

Reorder joystick init so drivers can ask the others if they handle a device reliably
Do not poll disconnected XInput devices (major perf issue)
Fix various cases where incorrect correlation could happen
Simple mechanism for propagating unhandled Guide button presses even before guaranteed correlation
Correlate by axis motion as well as button presses
Fix failing to zero other trigger
Fix SDL_HINT_JOYSTICK_HIDAPI not working if set before calling SDL_Init()
Add missing device to device names
Disable RawInput if we have a mismatch of XInput-capable but not RawInput-capable devices

Updated to SDL 2.0.13 code with the following notes:
New HID driver: xbox360w - no idea what that is, hopefully urelated
SDL_hidapijoystick.c had been refactored to couple data handling logic with device opening logic and device lists caused some problems, yields slightly uglier integration than previously when the 360 HID device driver was just handling the data.
SDL_hidapijoystick.c now often pulls the device off of the joystick_hwdata structure for some rumble logic, but it appears that code path is never reached, so probably not a problem.
Looks like joystick_hwdata was refactored to not include a mutex in other drivers, maintainers may want to do the same refactor here if that's useful for some reason.
Something changed in how devices get names, so getting generic names.
Had to fix a (new?) bug where removing an XInput controller caused existing controllers (that moved to a new XInput index) to get identified as 0x045e/0x02fd ("it's probably Bluetooth" in code), rendering the existing HIDAPI_IsDevicePresent and new RAWINPUT_IsDevicePresent unreliable.
2020-03-16 12:23:38 -07:00
David Ludwig cc37ee8a0c virtual joysticks: add autotools-build support (Bug 5028)
Autotools support for virtual-joysticks turns it OFF by default.  To turn it
on, pass the following into configure: --enable-joystick-virtual
2020-03-16 00:21:22 -04:00
David Ludwig d64761558c virtual joysticks: improved docs for SDL_JoystickSetVirtual* functions 2020-03-15 13:35:03 -04:00
David Ludwig cc90875647 virtual joysticks: removed ball support (Bug 5028) 2020-03-15 13:25:49 -04:00
Sam Lantinga 1ff483d1f3 Added SDL_GetErrorMsg() to get the error message in a thread-safe way 2020-03-13 21:28:09 -07:00
Sam Lantinga 2be75c6a61 Fixed bug 5028 - Virtual Joysticks (new joystick backend)
David Ludwig

I have created a new driver for SDL's Joystick and Game-Controller subsystem: a Virtual driver.  This driver allows one to create a software-based joystick, which to SDL applications will look and react like a real joystick, but whose state can be set programmatically.  A primary use case for this is to help enable developers to add touch-screen joysticks to their apps.

The driver comes with a set of new, public APIs, with functions to attach and detach joysticks, set virtual-joystick state, and to determine if a joystick is a virtual-one.

Use of virtual joysticks goes as such:

1. Attach one or more virtual joysticks by calling SDL_JoystickAttachVirtual.  If successful, this returns the virtual-device's joystick-index.
2. Open the virtual joysticks (using indicies returned by SDL_JoystickAttachVirtual).
3. Call any of the SDL_JoystickSetVirtual* functions when joystick-state changes.  Please note that virtual-joystick state will only get applied on the next call to SDL_JoystickUpdate, or when pumping or polling for SDL events (via SDL_PumpEvents or SDL_PollEvent).


Here is a listing of the new, public APIs, at present and subject to change:

------------------------------------------------------------

/**
 * Attaches a new virtual joystick.
 * Returns the joystick's device index, or -1 if an error occurred.
 */
extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type, int naxes, int nballs, int nbuttons, int nhats);

/**
 * Detaches a virtual joystick
 * Returns 0 on success, or -1 if an error occurred.
 */
extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index);

/**
 * Indicates whether or not a virtual-joystick is at a given device index.
 */
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index);

/**
 * Set values on an opened, virtual-joystick's controls.
 * Returns 0 on success, -1 on error.
 */
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick * joystick, int axis, Sint16 value);
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualBall(SDL_Joystick * joystick, int ball, Sint16 xrel, Sint16 yrel);
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick * joystick, int button, Uint8 value);
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick * joystick, int hat, Uint8 value);

------------------------------------------------------------

Miscellaneous notes on the initial patch, which are also subject to change:

1. no test code is present in SDL, yet.  This should, perhaps, change.  Initial development was done with an ImGui-based app, which potentially is too thick for use in SDL-official.  If tests are to be added, what kind of tests?  Automated?  Graphical?

2. virtual game controllers can be created by calling SDL_JoystickAttachVirtual with a joystick-type of SDL_JOYSTICK_TYPE_GAME_CONTROLLER, with naxes (num axes) set to SDL_CONTROLLER_AXIS_MAX, and with nbuttons (num buttons) set to SDL_CONTROLLER_BUTTON_MAX.  When updating their state, values of type SDL_GameControllerAxis or SDL_GameControllerButton can be casted to an int and used for the control-index (in calls to SDL_JoystickSetVirtual* functions).

3. virtual joysticks' guids are mostly all-zeros with the exception of the last two bytes, the first of which is a 'v', to indicate that the guid is a virtual one, and the second of which is a SDL_JoystickType that has been converted into a Uint8.

4. virtual joysticks are ONLY turned into virtual game-controllers if and when their joystick-type is set to SDL_JOYSTICK_TYPE_GAMECONTROLLER.  This is controlled by having SDL's default list of game-controllers have a single entry for a virtual game controller (of guid, "00000000000000000000000000007601", which is subject to the guid-encoding described above).

5. regarding having to call SDL_JoystickUpdate, either directly or indirectly via SDL_PumpEvents or SDL_PollEvents, before new virtual-joystick state becomes active (as specified via SDL_JoystickSetVirtual* function-calls), this was done to match behavior found in SDL's other joystick drivers, almost all of which will only update SDL-state during SDL_JoystickUpdate.

6. the initial patch is based off of SDL 2.0.12

7. the virtual joystick subsystem is disabled by default.  It should be possible to enable it by building with SDL_JOYSTICK_VIRTUAL=1



Questions, comments, suggestions, or bug reports very welcome!
2020-03-13 19:08:45 -07:00
Sam Lantinga 93ed3c8baf Updated SDL to version 2.0.13 for development builds 2020-03-10 18:25:47 -07:00
Sam Lantinga 983bbf9ef3 Backed out changeset 51622f74dc85 2020-03-10 18:35:31 -07:00
Sam Lantinga 4fb06a2a38 Updated SDL to version 2.0.13 for development builds 2020-03-10 18:25:47 -07:00
Sam Lantinga 611403dd0e Clarified that the clip rectangle is defined relative to the viewport, and added a clip test to testviewport.c 2020-03-08 21:02:40 -07:00
Sam Lantinga aa384ad02b Fixed bug 5001 - Feature request: SDL_isupper & SDL_islower 2020-03-02 15:21:07 -08:00
Sam Lantinga 4572dd2ae6 Fixed bug 4854 - Add a way to extend the values in controller_type.h
Added a hint SDL_HINT_GAMECONTROLLERTYPE to allow overriding the built-in controller type database
2020-03-02 10:37:28 -08:00
Sam Lantinga 74ed215618 Updated version to 2.0.12 for release candidate build 2020-03-01 14:58:16 -08:00
Sam Lantinga d7ece7ee6f Made SDL_GetAndroidSDKVersion() available for applications 2020-02-17 13:54:45 -08:00
Ryan C. Gordon afb70f2681 test: Reimplemented SDLTest_CommonUsage() to restore binary compatibility.
Fixes Bugzilla #4975.
2020-02-12 13:09:38 -05:00
Sam Lantinga 232b7feef6 Make it possible for the application to use different C runtime begin/end thread functions 2020-02-11 08:26:46 -08:00
Sam Lantinga 9feabd351c Make sure SDL_CreateThread has the same signature regardless of how the DLL was created. 2020-02-11 08:01:44 -08:00
Sam Lantinga 4b585e75d9 Fixed bug 4833 - Use EGL for X11?
Martin Fiedler

To be precise, this is about *desktop OpenGL* on X11. For OpenGL ES, EGL is already used (as it's the only way to get an OpenGL ES context), as Sylvain noted above.

To shine some light on why this is needed:
In 99% of all cases, using GLX on X11 is fine, even though it's effectively deprecated in favor of EGL [1]. However, there's at least one use case that *requires* the OpenGL context being created with EGL instead of GLX, and that's DRM_PRIME interoperability: The function glEGLImageTargetTexture2DOES simply doesn't work with GLX. (Currently, Mesa actually crashes when trying that.)
Some example code:
https://gist.github.com/kajott/d1b29c613be30893c855621edd1f212e
Runs on Intel and open-source AMD drivers just fine (others unconfirmed), but with #define USE_EGL 0 (i.e. forcing it to GLX), it crashes. The same happens when using SDL for window and context creation.

The good news is that most of the pieces for EGL support on X11 are already in place: SDL_egl.c is pretty complete (and used for desktop OpenGL on Wayland, for example), and SDL_x11opengl.c has the aforementioned OpenGL-ES-on-EGL support. However, when it comes to desktop OpenGL, it's hardcoded to fall back to GLX.

I'm not advocating to make EGL the default for desktop OpenGL on X11; don't fix what ain't broken. But something like an SDL_HINT_VIDEO_X11_FORCE_EGL would be very appreciated to make use cases like the above work with SDL.


[1] source: Eric Anholt, major Linux graphics stack developer, 7 years ago already - see last paragraph of https://www.phoronix.com/scan.php?page=news_item&px=MTE3MTI
2020-02-03 08:06:52 -08:00
Sam Lantinga 37278066f2 Export SDL functions for iOS application delegates 2020-01-30 14:51:33 -08:00
Sam Lantinga 355f0b54ec Added support for the Steam Controller on mobile devices 2020-01-29 20:09:11 -08:00
Ryan C. Gordon b4c2e29eed video: Added a hint to override the display's usable bounds. 2020-01-27 10:58:30 -05:00
Sam Lantinga a8780c6a28 Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
Sam Lantinga 981e0d367c Fixed bug 4903 - Lack of color multiply with alpha (SDL_BLENDMODE_MOD + SDL_BLENDMODE_BLEND) blending mode for all renderers
Konrad

This kind of blending is rather quite useful and in my opinion should be available for all renderers. I do need it myself, but since I didn't want to use a custom blending mode which is supported only by certain renderers (e.g. not in software which is quite important for me) I did write implementation of SDL_BLENDMODE_MUL for all renderers altogether.

SDL_BLENDMODE_MUL implements following equation:

dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA))
dstA = (srcA * dstA) + (dstA * (1-srcA))

Background:

https://i.imgur.com/UsYhydP.png

Blended texture:

https://i.imgur.com/0juXQcV.png

Result for SDL_BLENDMODE_MOD:

https://i.imgur.com/wgNSgUl.png

Result for SDL_BLENDMODE_MUL:

https://i.imgur.com/Veokzim.png

I think I did cover all possibilities within included patch, but I didn't write any tests for SDL_BLENDMODE_MUL, so it would be lovely if someone could do it.
2020-01-16 08:52:59 -08:00
Sam Lantinga 5e19e66c73 Fixed bug 4914 - Expose SDL_ScaleMode and add SDL_SetTextureScaleMode/SDL_GetTextureScaleMode
Konrad

This was something rather trivial to add, but asked at least several times before (I did google about it as well).

It should be possible to dynamically change scaling mode of the texture. It is actually trivial task, but until now it was only possible with a hint before creating a texture.

I needed it for my game as well, so I took the liberty of writing it myself.

This patch adds following functions:

SDL_SetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode scaleMode);
SDL_GetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode *scaleMode);

That way you can change texture scaling on the fly.
2019-12-22 13:39:44 -08:00
Sam Lantinga 46e1377d49 Automatically assign player indexes to game controllers, and allow changing the player index for game controllers and joysticks.
Added the functions SDL_JoystickFromPlayerIndex(), SDL_JoystickSetPlayerIndex(), SDL_GameControllerFromPlayerIndex(), and SDL_GameControllerSetPlayerIndex()
2019-12-20 20:12:03 -08:00
Sam Lantinga e22e77dadc Added an untested driver for the Nintendo GameCube adapter, based on code contributed by Ethan Lee 2019-12-19 15:01:35 -08:00
Sam Lantinga 54748a39be Fixed bug 4890 - Add hint for SDL that the graphics context is externally managed
Aaron Barany

Add SDL_HINT_VIDEO_EXTERNAL_CONTEXT hint to notify SDL that the graphics context is external. This disables the automatic context save/restore behavior on Android and avoids using OpenGL by default when SDL_WINDOW_VUKLAN isn't set.

When the application wishes to manage the OpenGL contexts on Android, this avoids cases where SDL unbinds the context and creates new contexts, which can interfere with the application's operation.

When using Vulkan and Metal renderer implementations, this avoids SDL forcing OpenGL to be enabled on certain platforms. While using the SDL_WINDOW_VULKAN flag can be used to achieve the same thing, it also causes Vulkan to be loaded. If the application uses Vulkan directly, this is not necessary, and fails window creation when using Metal due to Vulkan not being present. (assuming MoltenVK isn't installed)
2019-12-08 11:33:06 -08:00
Ozkan Sezer 6fc3886441 SDL_gamecontroller.h: remove comma at end of enumerator list 2019-11-23 03:28:02 +03:00
Sam Lantinga b5aff9d7c3 Added SDL_GameControllerTypeForIndex() and SDL_GameControllerGetType() to return the type of controller attached. 2019-11-22 13:12:12 -08:00
Ozkan Sezer f7df146d15 updated os/2 config file 2019-11-21 11:33:50 +03:00
Ozkan Sezer 8cdb4526d9 CMakeLists.txt: add several missing function checks for unix case. 2019-11-21 10:33:56 +03:00
Sam Lantinga 650964461e Improved XInput VID/PID detection and added SDL_wcsstr() and SDL_wcsncmp() 2019-11-20 16:42:50 -08:00
Ozkan Sezer eb8f14bb6a added SDL_strtokr() as a replacement for POSIX strtok_r (bug #4046.) 2019-11-20 20:40:50 +03:00
Cameron Cawley 20ddf45ede Added SDL_PIXELFORMAT_BGR444 2019-11-02 22:58:52 +00:00
Sam Lantinga 9a76bebfbc SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS defaults to true, to match Steam's default behavior 2019-11-13 14:24:48 -08:00
EXL b22fb9e2ba haiku: Implement message box for Haiku
Add implementation for functions:

SDL_ShowSimpleMessageBox()
SDL_ShowMessageBox()

Add simple customization support also.
Fix build for x86_gcc2.

Partially fixes Bugzilla #4442.
2019-11-11 16:44:40 -05:00
Ryan C. Gordon b70222d056 Fixed a comment typo (thanks, Dominus!).
https://twitter.com/iniquitatis/status/1190064278365188102
2019-11-01 04:32:44 -04:00
Ryan C. Gordon b7df26037b cmake: added support for enabling the ARM SIMD/NEON code. 2019-10-24 23:17:19 -04:00
Ben Avison a6bfdd103f ARM: Create configure option --enable-arm-neon to govern assembly optimizations 2019-10-24 21:17:05 -04:00
Ben Avison 6a6a05289e ARM: Create configure option --enable-arm-simd to govern assembly optimizations 2019-10-24 21:12:08 -04:00
Ozkan Sezer 9530ccba0f SDL_endian.h: Use endian.h for OpenBSD.
Patch from OpenBSD CVS, authored by Donovan Watteau.
2019-10-21 22:22:28 +03:00
Ozkan Sezer 7c7801f166 Fix typo with __MIPSEB__ preprocessor check (bug #4836.)
Patch from Simon Howard
2019-10-21 10:20:25 +03:00
Sam Lantinga b3470f04b1 Added the hint SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS to control whether Nintendo Switch controllers use their button labels or button positions for game controller button reporting. 2019-10-17 17:32:47 -07:00
Ryan C. Gordon ed7483f82c x11: On macOS, look for X11 install in /opt/X11 instead of /usr/X11R6.
This is where Apple installs XQuartz now (and apparently, the compatibility
symlink at /usr/X11R6 can be missing).

Fixes Bugzilla #4706.
2019-10-15 22:36:08 -04:00
Ryan C. Gordon eb066a716c include: Removed a FIXME comment.
Using (1 << 14) instead of 0x4000 might be clearer for the maintainer, but
it makes it harder to look up these flags when debugging an app. The value
has to be written once by one person, the has to be read by tons of people
over and over.
2019-10-15 14:17:32 -04:00
Sylvain Becker e5198bd29d Remove 'Enum' suffixes (bug 4813) 2019-10-11 06:18:24 +02:00
Sylvain Becker a0934a23fd Fixed bug 4813 - Give enums their own name
* SDL_PIXELTYPE_
* SDL_BITMAPORDER_
* SDL_PACKEDORDER_
* SDL_ARRAYORDER_
* SDL_PACKEDLAYOUT_
* SDLK_
* SDL_LOG_CATEGORY_
2019-10-10 17:40:00 +02:00
Ozkan Sezer ffc7d09197 endpointvolume.h checks not needed since changeset 13078:8ab094a9df6b . 2019-10-01 14:00:02 +03:00
Sylvain Becker 1ae61f1009 Added a helper function SDL_LockTextureToSurface()
Similar to SDL_LockTexture(), except the locked area is exposed as a SDL surface.
2019-09-30 20:58:44 +02:00
Brandon Schaefer 68985371a0 offscreen: Add new video driver backend Offscreen
The Offscreen video driver is intended to be used for headless rendering
  as well as allows for multiple GPUs to be used for headless rendering

Currently only supports EGL (OpenGL / ES) or Framebuffers
Adds a hint to specifiy which EGL device to use: SDL_HINT_EGL_DEVICE
Adds testoffscreen.c which can be used to test the backend out
Disabled by default for now
2019-09-24 16:36:48 -04:00
David Ludwig b13c951cca CMake: iOS support added
When using a recent version of CMake (3.14+), this should make it possible to:
- build SDL for iOS, both static and dynamic
- build SDL test apps (as iOS .app bundles)
- generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis)

To use, set the following CMake variables when running CMake's configuration stage:
- CMAKE_SYSTEM_NAME=iOS
- CMAKE_OSX_SYSROOT=<SDK>  (examples: iphoneos, iphonesimulator, iphoneos12.4, /full/path/to/iPhoneOS.sdk, etc.)
- CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures> (example: "arm64;armv7s")

Examples:
- for Simulator, using the latest, installed SDK:
    cmake path/to/SDL -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64

- for Device, using the latest, installed SDK, 64-bit only
    cmake path/to/SDL -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64

- for Device, using the latest, installed SDK, mixed 32/64 bit
    cmake path/to/SDL -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"

- for Device, using a specific SDK revision (iOS 12.4, in this example):
    cmake path/to/SDL -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64

- for Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles):
    cmake path/to/SDL -DSDL_TEST=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
2019-08-27 11:07:43 -04:00
Ozkan Sezer a74d33b796 SDL_messagebox.h: remove comma at end of enumerator list 2019-09-22 21:41:20 +03:00
Sam Lantinga 3fe2d8368c Updated SDL development builds to version 2.0.11 2019-09-22 10:37:16 -07:00
Sam Lantinga 3efea5ea28 Don't have Windows headers define min/max, in case they're defined by application code 2019-09-11 15:08:37 -07:00
Sam Lantinga e5580e18ba x11: add a hint to force the VisualID used when creating a window. 2019-09-04 09:27:58 -07:00
Ryan C. Gordon f49c07b5c4 stdinc: On macOS and iOS, use memset_pattern4() for SDL_memset4().
Fixes Bugzilla #4724.
2019-09-04 00:39:47 -04:00
Sam Lantinga cbdee4d656 [ SDL ] Fix compile error building for Windows/ARM64 on Visual Studio 2017 Win10 SDK 10.0.18362.0 which requires ar,74intr.h/arm64_neon.h header instead of armintr.h/arm_neon.h for intrinsics.
@saml
2019-08-08 13:26:05 -07:00
Alex Szpakowski aebaa316c7 Add public APIs for creating a Metal view attached to an SDL window. Add SDL_metal.h. 2019-08-05 12:35:32 -03:00
Sam Lantinga 63197c4338 Fix bug where the wrong button was the default in the old message box because buttons were added backwards, breaking the indexing used by GetButtonIndex.
Add messagebox flags to explicilty request left-to-right button order or right-to-left.  If neither is specified it'll be some platform default.
2019-08-02 17:19:50 -07:00
Alex Szpakowski d5ec735a33 Add a windowID field to SDL_TouchFingerEvent (bug #4331).
This is unimplemented on some platforms and will cause compile errors when building those platform backends for now.
2019-08-01 18:22:12 -03:00
Ethan Lee f7d82e5616 hidapi: Add SDL_hidapi.c, allows support for multiple hidapi backends.
This is currently supported on Linux and macOS. iOS and Android are not
supported at all, Windows support could be added with some changes to the libusb
backend. The Visual Studio and Xcode projects do not use this feature.

Based on Valve Software's hid.cpp, written in collaboration with Andrew Eikum.
2019-07-31 12:20:55 -04:00
Ozkan Sezer 7a47c292c0 Fix bug 4746 - introduce SDL_zeroa macro. 2019-07-31 01:22:02 +03:00
Alex Szpakowski 39e8b007a7 macOS: fix atomics using deprecated functions instead of compiler intrinsics, when SDL is built with the Xcode project. 2019-07-27 14:08:51 -03:00
Ryan C. Gordon 66d4d8e25d cmake: Added HIDAPI support. 2019-07-08 16:46:52 -04:00
Sam Lantinga 959cfc428e Fixed memory barrier macro check so it isn't quite so fragile 2019-06-30 23:58:31 -07:00
Sam Lantinga cc47810d36 Fixed bug 4683 - SDL_atomic infinite recursion on armv6/armv5 w/ thumb
The real problem is that SDL_atomic.c was built in thumb mode instead of ARM mode, which is required to use the mcr instruction on ARM platforms. Added a compiler error to catch this case so we don't generate code that does infinite recursion.

I also added a potentially better way to handle things on Linux ARM platforms, based on comments in the Chromium headers, which we can try out after 2.0.10 ships.
2019-06-30 23:26:16 -07:00
Ozkan Sezer 282b2b9395 define __ARM_NEON for Windows only if _M_ARM or _M_ARM64 is defined. fixes Visual Studio builds. 2019-06-25 11:47:02 +03:00
Sam Lantinga be6cda9f95 Rolling back GameCube HIDAPI support
It causes the HIDAPI devices to always be opened on enumeration, which causes crashes in the Windows drivers when multiple applications are reading and writing at the same time. We can revisit this after 2.0.10 release.
2019-06-19 15:54:21 -07:00
Sam Lantinga eb71cd800d Make sure we haven't changed the size of the SDL_Event structure and broken binary compatibility. 2019-06-18 06:53:32 -07:00
Sam Lantinga 67c67f3a6b Updated version to 2.0.10 2019-06-17 10:13:28 -07:00
Sam Lantinga 69d27a69cd Fixed bug 4570 - Support Vulkan Portability rather than MoltenVK specifically
Dzmitry Malyshau

Current code, search paths, and error messages are written to only consider MoltenVK on macOS as a Vulkan Portability implementation. It's not the only implementation available to the users. gfx-portability [1] has been shown to run a number of titles well, including Dota2, Dolphin Emulator, and vkQuake3, often out-performing MoltenVK in frame rate and stability (see Dolphin benchmark [2]).

There is no reason for SDL to be that specific, it's not using any MVK-specific functions other than the WSI initialization ("VK_MVK_macos_surface"). gfx-portability exposes this extension as well, and a more generic WSI extension is in process. It would be good if SDL was written in a more generic way that expect a Vulkan Portability library as opposed to MoltenVK specifically.

[1] https://github.com/gfx-rs/portability
[2] https://gfx-rs.github.io/2019/03/22/dolphin-macos-performance.html
2019-06-11 18:13:46 -07:00
Sam Lantinga 9891c31ba0 Fixed bug 4641 - clang and clang-cl builds on windows create -Wpragma-pack warnings 2019-06-10 08:46:20 -07:00
Sam Lantinga 762b788f67 Cleanup on bug 3894 - Fuzzing crashes for SDL_LoadWAV
Simon Hug

Attached is a minor cleanup patch. It changes the option name of one hint to something better, puts one or two more checks in, and adds explicit casting where warnings could appear otherwise.

I hope the naming of the hints and their options is acceptable. It would be kind of awkward to change them after they get released with an official SDL version.
2019-06-09 12:46:10 -07:00
Sam Lantinga 990e166a3b Fixed bug 3894 - Fuzzing crashes for SDL_LoadWAV
Simon Hug

I had a look at this and made some additions to SDL_wave.c.

The attached patch adds many checks and error messages. For some reason I also added A-law and ?-law decoders. Forgot exactly why... but hey, they're small.

The WAVE format is seriously underspecified (at least by the documents that are publicly available on the internet) and it's a shame Microsoft never put something better out there. The language used in them is so loose at times, it's not surprising the encoders and decoders behave very differently. The Windows Media Player doesn't even support MS ADPCM correctly.

The patch also adds some hints to make the decoder more strict at the cost of compatibility with weird WAVE files.

I still think it needs a bit of cleaning up (Not happy with the MultiplySize function. Don't like the name and other SDL code may want to use something like this too.) and some duplicated code may be folded together. It does work in this state and I have thrown all kinds of WAVE files at it. The AFL files also pass with it and some even play (obviously just noise). Crafty little fuzzer.

Any critique would be welcome. I have a fork of SDL with a audio-loadwav branch over here if someone wants to use the commenting feature of Bitbucket:

https://bitbucket.org/ChliHug/SDL

I also cobbled some Lua scripts together to create WAVE test files:

https://bitbucket.org/ChliHug/gendat
2019-06-08 19:02:42 -07:00
Sam Lantinga 316ff3847b Fixed bug 4526 - replace SDL_RW* macros with functions for using in bindings
ace

I got this bug in SDL_ttf:
https://bugzilla.libsdl.org/show_bug.cgi?id=4524
Sylvain proposed solution:
SDL_RWseek(RWops, 0, RW_SEEK_SET);

And it works, but i can use it my project, because it written in C# with SDL2-CS wrapper and there not export for macroses:
#define SDL_RWsize(ctx)         (ctx)->size(ctx)
#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
#define SDL_RWtell(ctx)         (ctx)->seek(ctx, 0, RW_SEEK_CUR)
#define SDL_RWread(ctx, ptr, size, n)   (ctx)->read(ctx, ptr, size, n)
#define SDL_RWwrite(ctx, ptr, size, n)  (ctx)->write(ctx, ptr, size, n)
#define SDL_RWclose(ctx)        (ctx)->close(ctx)

Therefore, I suggest replacing this macros with functions so that they can be exported and used in bindings
2019-06-08 17:43:23 -07:00
Sam Lantinga 8728ce4448 Fixed bug 4557 - SDL_SIMDAlloc and *Free should be in the public interface
Martin Gerhardy

These functions are really useful and should get exposed imo.
2019-06-08 14:54:37 -07:00
Ryan C. Gordon b5d3b6fc25 test: unify all the command line usage logging. 2019-05-28 17:39:13 -04:00
Ryan C. Gordon 00e5eeb40e test: added SDLTest_CommonDefaultArgs()
This is for test apps that don't need custom command line arguments; it lets
us reduce the boilerplate code a tiny bit.
2019-05-19 01:45:15 -04:00
Sam Lantinga 53a6196b32 Don't redefine __SSE__ and related macros if they're already defined 2019-04-23 16:57:34 -07:00
Sam Lantinga f79190f407 Use _Exit() when available 2019-04-23 07:59:31 -07:00
Sam Lantinga 9eac91dd29 Set SDL_HINT_MOUSE_TOUCH_EVENTS for iPhone and iPad as well 2019-04-05 08:10:12 -07:00
Sylvain Becker 05333a6e9f Android: add hint SDL_HINT_ANDROID_BLOCK_ON_PAUSE
to set whether the event loop will block itself when the app is paused.
2019-04-05 09:16:30 +02:00
Sylvain Becker b470cd9b09 Android: default SDL_HINT_MOUSE_TOUCH_EVENTS to 1 as previous behaviour 2019-04-05 08:36:31 +02:00
Sylvain Becker bfdd0b228a Android: remove SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH
java layer runs as if separate mouse and touch was 1,
Use SDL_HINT_MOUSE_TOUCH_EVENTS and SDL_HINT_TOUCH_MOUSE_EVENTS
for generating synthetic touch/mouse events
2019-04-04 17:01:02 +02:00
Sylvain Becker e41576188d Add hint SDL_HINT_MOUSE_TOUCH_EVENTS for mouse events to generate touch events
controlling whether mouse events should generate synthetic touch events
By default SDL will *not* generate touch events for mouse events
2019-04-04 16:51:50 +02:00
Sam Lantinga a0ac5ffc9f Fixed building with C++ 2019-03-19 10:59:41 -07:00
Sam Lantinga 03fc5eebcb Fixed building with C++ 2019-03-19 10:56:46 -07:00
Sam Lantinga 8177388e5e Fixed declaration of SDL_main_func for C++ 2019-03-19 08:29:34 -07:00
Sam Lantinga de82759c84 Added support for building SDL as a dynamic library on iOS 2019-03-19 07:53:33 -07:00
Ethan Lee c528615626 hidapi: Add support for Wii U/Switch USB GameCube controller adapter.
Note that a single USB device is responsible for all 4 joysticks, so a large
rewrite of the DeviceDriver functions was necessary to allow a single device to
produce multiple joysticks.
2019-03-12 20:27:54 -04:00
Ryan C. Gordon 911bf6241b events: Make debug logging of the event queue a hint instead of an #ifdef.
This makes it easy to toggle it on when debugging a new platform (or just
getting more visibility into an app) without having to rebuild SDL.
2019-03-15 14:08:30 -04:00
Sylvain Becker 9a98dcc516 Rename surface aligned memory flag to SDL_SIMD_ALIGNED 2019-02-04 08:34:24 +01:00
Sylvain Becker e5d194e902 Add SDL_MEMALIGNED flag for SDL_Surface using aligned memory.
If an SDL_Surface has an aligned memory pointers, it should be freed
using SDL_SIMDFree() (will be used by SDL_ttf).
2019-01-31 11:45:31 +01:00
Sam Lantinga 7dc92a7669 Initial Android OpenSL ES implementation, contributed by ANTA 2019-01-12 12:18:44 -08:00
Sam Lantinga 5e13087b0f Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Sylvain Becker 71b6645177 Rename _SDL_sensor_h in public header, not to trigger Wreserved-id-macro 2018-12-10 13:32:24 +01:00
Sam Lantinga 70ce0f2e06 Added the hint SDL_HINT_GAMECONTROLLERCONFIG_FILE to specify a file to load at initialization containing SDL game controller mappings 2018-12-07 12:02:08 -08:00
Sylvain Becker 6259a72636 Warnings: fix a documentation warning and missing prototypes 2018-12-05 16:13:12 +01:00
Sylvain Becker 69c256c102 Fix comment and end of lines 2018-12-04 18:15:45 +01:00
Sylvain Becker f64c943370 Update comment URL of USB document (HID Usage Tables 1.12) 2018-12-04 17:13:13 +01:00
Sylvain Becker 09b462044f Windows: NEON detection and intrinsic includes on Visual Studio
Visual Studio doesn't define __ARM_ARCH nor _ARM_NEON, but _M_ARM and _M_ARM64,
so SDL_HasNEON() was bypassed.

PF_ARM_NEON_INSTRUCTIONS_AVAILABLE doesn't see to be defined (but still works
 when defined as 19).
2018-12-04 16:50:31 +01:00
Sylvain Becker aea7e56a24 android: use __ARM_NEON instead of __ARM_NEON__ to include <arm_neon.h>
Only __ARM_NEON is defined with Android NDK and arm64-v8a
Tested on ndk-r18, ndk-r13 and also Xcode.
(Visual Studio needs a different fix).

Fixes Bugzilla #4409.
2018-12-04 12:34:45 +01:00
Ryan C. Gordon 1e4acca851 Added some detail to a Doxygen comment (thanks, Sylvain!). 2018-12-01 12:17:34 -05:00
Ozkan Sezer 3f0d520a49 SDL_touch.h (SDL_TouchDeviceType): remove comma at end of enumerator list. 2018-11-26 19:55:01 +03:00
Sam Lantinga 7b306bf34d Added atomics support for armv8-a (Raspberry Pi 3) 2018-11-23 21:29:42 -08:00
Sam Lantinga ac15de18bd Fixed bug 4392 - SDL_cpuinfo.h breaks compilation with C bool type
Luke Dashjr

Bug 3993 was "fixed" by #undef'ing bool. But this breaks C99's stdbool.h bool too.

For example, mpv's build fails with:

../audio/out/ao_sdl.c:35:5: error: unknown type name ?bool?

It seems ill-advised to be #undef'ing *anything* here - what if the code including SDL_cpuinfo.h actually wants to use altivec?
2018-11-19 21:28:52 -08:00
Sam Lantinga b73703b9c6 Fixed bug 4391 - hid_enumerate() sometimes causes game to freeze for a few seconds
Daniel Gibson

Even though my game (dhewm3) doesn't use SDL_INIT_JOYSTICK, SDL_PumpEvent() calls SDL_JoystickUpdate() which ends up calling hid_enumerate() every three seconds, and sometimes on my Win7 box hid_enumerate() takes about 5 seconds, which causes the whole game to freeze for that time.
2018-11-19 21:17:00 -08:00
Sam Lantinga 1a4c0d4e17 Fixed bug 4377 - SDL_PIXELFORMAT enum is anonymous, which prevents its use in a templated function
zen3d

While trying to build Pixie lisp (https://github.com/pixie-lang/pixie), which uses SDL for multimedia output, the mandelbrot example won't build. The problem is that internally pixie uses a templated function to dump a value, and gcc chokes because SDL_PIXELFORMAT_RGA8888 is an anonymous enum.

I solved the problem locally by changing from:
   enum {
      SDL_PIXELFORMAT_UNKNOWN,
      ... etc. ...
      SDL_PIXELFORMAT_YUYV = ... etc ...
   };
to:
   typedef enum {
      SDL_PIXELFORMAT_UNKNOWN,
      ... etc. ...
      SDL_PIXELFORMAT_YUYV = ... etc ...
   } SDL_PIXELFORMAT_ENUM;
The net result of this change is that the enum containing SDL_PIXELFORMAT_* is no longer an anonymous enum and can now be used by a templated function.

This local change fixes Pixie lisp for me.

I did notice that you use the idiom
   typedef enum {
      ... etc ...
   } SDL_FOO;
elsewhere in your code, so that change to SDL_PIXELFORMAT doesn't look like it would have a negative impact.
2018-11-12 19:23:49 -08:00
Alex Szpakowski 5029d50ea8 Add SDL_TouchDeviceType enum and SDL_GetTouchDeviceType(SDL_TouchID id).
Touch device types include SDL_TOUCH_DEVICE_DIRECT (a touch screen with window-relative coordinates for touches), SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE (a trackpad-style device with absolute device coordinates), and SDL_TOUCH_DEVICE_INDIRECT_RELATIVE (a trackpad-style device with screen cursor-relative coordinates).

Phone screens are an example of a direct device type. Mac trackpads are the indirect-absolute touch device type. The Apple TV remote is an indirect-relative touch device type.
2018-11-10 16:15:48 -04:00
Ozkan Sezer ed694ec61f close_code.h: #error if included without matching begin_code.h 2018-11-06 23:45:50 +03:00
Ozkan Sezer a60751b7a7 fix bug #4362 - SDL_syswm.h with SDL_PROTOTYPES_ONLY broken in C++ mode 2018-11-06 20:50:24 +03:00
Ryan C. Gordon bc57ac27f9 mir: Removed mir client support.
Fixes Bugzilla #4288.
2018-11-02 21:34:17 -04:00
Ryan C. Gordon 62494a2e27 Merge SDL-ryan-batching-renderer branch to default. 2018-10-31 15:03:41 -04:00
Ryan C. Gordon 8340b0f0e2 render: Add floating point versions of various draw APIs. 2018-10-23 01:34:03 -04:00
Sam Lantinga b08bdc4401 Don't build SDL_JOYSTICK_HIDAPI by default on iOS
If you enable this, you'll need to link with CoreBluetooth.framework and add something like this to your Info.plist:
<key>NSBluetoothPeripheralUsageDescription</key>
<string>MyApp would like to remain connected to nearby bluetooth Game Controllers and Game Pads even when you're not using the app.</string>
2018-10-26 09:27:31 -07:00
Sam Lantinga 14329256cb Generalized the XInput user index into a player index 2018-10-25 16:53:14 -07:00
Sam Lantinga 9987ca69f3 Added SDL_JoystickGetXInputUserIndex() 2018-10-25 12:54:42 -07:00
Ryan C. Gordon 1ecf4dfc5f render: Added SDL_RenderFlush(). 2018-10-04 16:34:44 -04:00
Ryan C. Gordon 5fb67f9f55 render: Move to a batching system for rendering (work in progress). 2018-09-20 15:46:02 -04:00
Ryan C. Gordon 0cf1ae9d0b Fixed a comment typo. 2018-09-05 21:24:13 -04:00
Sam Lantinga 207428b444 Don't rumble Bluetooth PS4 controllers by default, as that switches the controller into extended input report mode, which breaks games that use DirectInput. 2018-08-29 20:23:39 -07:00
Jeremy Ong a794126d56 vulkan: SDL_Vulkan_GetInstanceExtensions should accept a NULL window.
Fixes Bugzilla #4235.
2018-08-24 09:49:48 -04:00
Sam Lantinga 8adadf8f0e Added documentation for additional Android sensors 2018-08-23 10:51:54 -07:00
Ozkan Sezer 7be4fca62c SDL_power.c: Adjust SDL_POWER_DISABLED ifdefs to avoid zero-size array
Otherwise if SDL_POWER_DISABLED is disabled (eg with --disable-power):

... with clang -pedantic:
src/power/SDL_power.c:48:50: warning: use of GNU empty initializer extension [-Wgnu-empty-initializer]
static SDL_GetPowerInfo_Impl implementations[] = {
                                                 ^
src/power/SDL_power.c:48:50: warning: zero size arrays are an extension [-Wzero-length-array]
2 warnings generated.

... with gcc -pedantic:
src/power/SDL_power.c:48:50: warning: ISO C forbids empty initializer braces [-Wpedantic]
src/power/SDL_power.c:48:50: warning: ISO C forbids empty initializer braces [-Wpedantic]
 static SDL_GetPowerInfo_Impl implementations[] = {
                                                  ^
src/power/SDL_power.c:48:30: error: zero or negative size array ?implementations?
 static SDL_GetPowerInfo_Impl implementations[] = {
                              ^~~~~~~~~~~~~~~

... with Watcom:
./src/power/SDL_power.c(85): Error! E1112: Initializer list cannot be empty
2018-10-15 11:01:00 +03:00
Ozkan Sezer ee97d4f4c1 add a minimal config and makefile to test watcom/os2 builds. 2018-10-14 23:56:56 +03:00
Ozkan Sezer 0e5a3f6ecf SDL_thread.h: undefine SDL_CreateThreadWithStackSize before redefining. 2018-10-12 01:03:40 +03:00
Ryan C. Gordon acb05f50d8 thread: make SDL_CreateThreadWithStackSize() a public API. 2018-10-11 16:40:01 -04:00
Sam Lantinga b60e5b82fb Update documentation to note that this hint works on Android too (thanks Trent!) 2018-10-03 15:48:26 -07:00
Sam Lantinga b251876126 commit c6b28f46b8116552ec2b38d1d3c8535df28ba7a1
Author: Anthony Pesch <inolen@gmail.com>
Date:   Fri May 4 20:21:21 2018 -0400

    Added SDL_AUDIO_ALLOW_SAMPLES_CHANGE flag enabling users of SDL_OpenAudioDevice to get
    the sample size of the actual hardware buffer vs having a stream created to handle the
    delta
2018-10-01 09:47:10 -07:00
Sam Lantinga f225af0c1e Added SDL_GetDisplayOrientation() to get the display orientation, and added a new event SDL_DISPLAYEVENT to notify the application when the orientation changes.
Documented the values returned by the accelerometer and gyroscope sensors
2018-08-22 21:48:28 -07:00
Sam Lantinga 7f4860e2be Doh.. __IPHONEOS__ is defined on tvOS 2018-08-21 20:38:22 -07:00
Sam Lantinga 74e99f7416 Don't use CoreMotion on tvOS 2018-08-21 20:34:09 -07:00
Sam Lantinga 6f758ad25f Moved SDL_IsTablet() to a cross-platform API function 2018-08-21 20:03:54 -07:00
Sam Lantinga c6647bf9c9 Added the iOS sensor implementation 2018-08-21 17:24:12 -07:00
Sam Lantinga c5bcefa7e8 Fixed duplicate definition of SDL_JoystickID 2018-08-21 13:44:11 -07:00
Sam Lantinga 3e5dbc694a Added a dummy sensor driver 2018-08-21 13:29:21 -07:00
Sam Lantinga 7c3040e08a First pass on the new SDL sensor API 2018-08-21 12:11:34 -07:00
Sam Lantinga 109544ca04 Add SDL_IsTablet() to Android and iOS SDL. 2018-08-21 11:23:47 -07:00
Sam Lantinga 7d3a7ef827 Use a single hint for both Xbox 360 and Xbox One controllers, since they are often the same driver. 2018-08-15 23:35:54 -07:00
Sam Lantinga 5930b50855 Re-enabled the HIDAPI joystick driver on Windows and Mac OS X 2018-08-09 22:53:43 -07:00
Sam Lantinga b37518b3d8 SDL: disable HIDAPI in SDL on Windows/Mac. 2018-08-09 16:03:55 -07:00
Sam Lantinga d2042e1ed4 Added HIDAPI joystick drivers for more consistent support for Xbox, PS4 and Nintendo Switch Pro controller support across platforms.
Added SDL_GameControllerRumble() and SDL_JoystickRumble() for simple force feedback outside of the SDL haptics API
2018-08-09 16:00:17 -07:00
Ethan Lee b4fe7412f9 SDL_exp 2018-08-04 11:52:46 -04:00
Sam Lantinga ff8c9538bc Allow trapping the back button so right mouse click can work on some Android systems (thanks Rachel!)
Also, added a function SDL_AndroidBackButton() so applications can respond to the back button directly
2018-07-12 13:28:13 -07:00
Ethan Lee 0a7faa4ae5 Fix Linux haptic scaling, add 2.1 FIXME 2018-05-04 21:58:39 -04:00
Ozkan Sezer b11c75e9f4 configury, cmake: add check for endpointvolume.h :
add HAVE_ENDPOINTVOLUME_H, HAVE_MMDEVICEAPI_H and HAVE_AUDIOCLIENT_H
in SDL_config.h.in, SDL_config.h.cmake, SDL_config_windows.h, and in
SDL_config_winrt.h.
2018-09-28 13:41:04 +03:00
Sam Lantinga 7df0f4fdac Fixed bug 4277 - warnings patch
Sylvain

Patch a few warnings when using:
-Wmissing-prototypes -Wdocumentation -Wdocumentation-unknown-command

They are automatically enabled with -Wall
2018-09-27 14:56:29 -07:00
Sam Lantinga bc6c199790 Updated version to 2.0.9 2018-09-26 10:08:14 -07:00
Sam Lantinga ef34704875 Fixed bug 4264 - SDL_CreateTextureFromSurface generates error message but returns ok
Anthony @ POW Games

SDL_CreateTextureFromSurface makes an internal call to SDL_GetColorKey which can return an error and spams the error log with "Surface doesn't have a colorkey" even though the original function didn't return an error.
2018-09-24 16:41:55 -07:00
Sam Lantinga 6b3e893105 Added hints SDL_HINT_MOUSE_DOUBLE_CLICK_TIME and SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS to allow tuning double-click sensitivity.
Also increased the default double-click radius to 32 pixels to be more forgiving for touch interfaces
2018-09-14 19:26:26 -07:00
Ozkan Sezer afc1738ecb SDL_sensor.h, SDL_video.h: remove comma at end of enumerator lists.
Avoids gcc -pedantic warnings, closes bug #4253.
2018-09-07 10:47:50 +03:00
Sam Lantinga a515853569 Added support for external mouse in Samsung DeX mode
relative mode doesn't work, but absolute coordinates are functional
2018-06-18 13:14:02 -07:00
Sam Lantinga 113801b790 Added SDL_IsChromebook() to determine if we're running on a Chromebook. 2018-06-05 12:46:13 -07:00
Ryan C. Gordon b7e88aaae0 audio: Added ARM NEON versions of audio converters.
These are _much_ faster than the scalar equivalents on the Raspberry Pi that
I tested on. Often 3x to 4x as fast!
2018-05-16 02:03:06 -04:00
Ryan C. Gordon 4df859c586 cpuinfo: Added SDL_HasAVX512F().
This checks for the "foundation" AVX-512 instructions (that all AVX-512
compatible CPUs support).
2018-05-21 11:35:42 -04:00
Ryan C. Gordon 8543ad7df1 cpuinfo: Added some internal SIMD-aligned allocation functions.
Fixes Bugzilla #4150 (sort of).
2018-05-21 11:34:57 -04:00
Ozkan Sezer c11ae93aed SDL_stdinc.h: move the alloca() includes before begin_code.h 2018-05-10 08:28:00 +03:00
Sam Lantinga c04dca0dad Fixed bug 4159 - Windows headers are included after packing alignment change
lectem

The SDL_syswm.h header includes the windows.h header after including begin_code.h which changes the structure packing alignment.

It seems this is not safe as suggested by the following warning :
warning C4121: 'JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE_V2': alignment of a member was sensitive to packing
2018-05-07 19:26:02 -07:00
Sam Lantinga f521b22eb5 Added SDL_THREAD_PRIORITY_TIME_CRITICAL 2018-04-23 22:07:56 -07:00
Sam Lantinga 432312561f Added SDL_LinuxSetThreadPriority() to directly set the priority of a Linux thread (tid)
This function tries using RealtimeKit connecting over DBUS as needed.
2018-04-23 19:18:52 -07:00
Sam Lantinga 6d39e67bad Fixed bug 4103 - SDL_cpuinfo.h provokes warnings with -Wundef on non-x86 hosts
Felix Geyer

Forwarding from https://bugs.debian.org/892087 quoting verbatim:

The SDL2 header SDL_cpuinfo.h generates gcc warnings if the program using
it compiles with the -Wundef warning. (In particular, this means that QEMU
builds using it fail on at least sparc hosts, since QEMU dev builds
use both -Wundef and -Werror.).

/usr/include/SDL2/SDL_cpuinfo.h:63:5: warning: "HAVE_IMMINTRIN_H" is not defined, evaluates to 0 [-Wundef]
 #if HAVE_IMMINTRIN_H && !defined(SDL_DISABLE_IMMINTRIN_H)
2018-03-10 21:20:25 -08:00
Sam Lantinga a8ac588549 Added SDL_GameControllerMappingForDeviceIndex() to get the mapping for a controller before it's opened 2018-03-07 13:30:40 -08:00
Mark Callow be6ca785e3 Support official Vulkan SDK for macOS.
This tries to load vulkan.framework or libvulkan.1.dylib before MoltenVK.framework
or libMoltenVK.dylib. In the previous version, layers would not work for applications
run-time loading the default library.
2018-02-25 23:02:09 -08:00
Sam Lantinga 5adc1b7d3e Updated documentation with API changes in SDL 2.0.8 2018-02-24 08:18:09 -08:00
Mark Callow 69958441be Fix high-dpi support on macOS and simplify it and iOS variant.
The detault drawableSize for a CAMetalLayer is its bounds x its scale.
So it is sufficient to set the *layer's* scale to the desired value.
2018-02-21 09:58:21 -08:00
Sam Lantinga 8ddebfa06e Fixed bug 4085 - X11: Allow configuring _NET_WM_BYPASS_COMPOSITOR through SDL hints
Callum McGing

This patch allows the user to disable the behaviour that blocks the compositor through a new hint: SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR. This allows tools or other windowed applications to behave properly under KWin.
2018-02-16 10:23:10 -08:00
sezero 4c2a444e3a add SDL_log10 and SDL_log10f to include and dynapi 2018-02-08 17:07:47 +03:00
Ethan Lee 11c348b4d7 SDL_log10 2018-01-17 11:53:09 -05:00
Sam Lantinga f59b9c8b13 Replaced SDL_HINT_APPLE_TV_REMOTE_SWIPES_AS_ARROW_KEYS with SDL_HINT_TV_REMOTE_AS_JOYSTICK which controls whether remotes on iOS and Android are interpreted as joysticks (the default) or as return/escape/arrow keys. 2018-02-06 15:03:38 -08:00
Sam Lantinga 6ed184ec69 Added SDL_IsAndroidTV() 2018-02-06 15:03:35 -08:00
Sam Lantinga 85c34e9a39 Added SDL_HINT_IOS_HIDE_HOME_INDICATOR to determine how the home indicator on the iPhone X is handled.
This variable can be set to the following values:
   "0"       - The indicator bar is not hidden (default for windowed applications)
   "1"       - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications)
   "2"       - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications)
2018-02-01 15:21:01 -08:00
Sam Lantinga 9338a619f8 Added a hint SDL_HINT_APPLE_TV_REMOTE_SWIPES_AS_ARROW_KEYS to prevent turning Apple TV remote swipes into arrow key events 2018-01-17 17:24:15 -08:00
Sam Lantinga e3cc5b2c6b Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Alex Szpakowski 48fea0cee4 macOS: Fix MoltenVK Metal view resizing, and allow the metal view to be used without vulkan. 2017-12-31 15:21:25 -04:00
Sam Lantinga b92e2f027a Fixed bug 4004 - iOS: don't hide keyboard on RETURN
Dominik Reichardt

As discussed in 2012 the iOS onscreen keyboard hides when you hit RETURN (see https://discourse.libsdl.org/t/on-screen-keyboard-change/19216).
IMO this is a bad idea to not be able to influence this behavior and just recently this was fixed for Android by adding the hint SDL_HINT_ANDROID_RETURN_HIDES_IME in changeset 11768	6ce3bb5e38a5.
2017-12-19 10:57:21 -08:00
Sam Lantinga 0597bf6e99 Fixed bug 3993 - altivec.h include in SDL_cpuinfo.h breaks compilation with -std=c++11
bastien.bouclet

According to this GCC bug report, altivec.h requires building with the gnu extensions: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78263.

As an application developer, I don't want SDL to force me to enable the gnu extensions.
2017-12-12 16:25:43 -08:00
Sam Lantinga 2afc0b7fa5 Add the ability to set SDL to handle Return as 'hide IME' on Android softkeyboard. (thanks Rachel!) 2017-12-12 12:52:23 -08:00
Sam Lantinga e8bbbb37f1 Added support for Android video textures 2017-12-12 12:52:17 -08:00
Sam Lantinga f1ec8a5f4c Check for immintrin.h before using it in SDL_cpuinfo.h 2017-12-11 12:00:12 -08:00
Sam Lantinga baae74c857 Added SDL_WinRTGetDeviceFamily() to find out what type of device your application is running on (thanks Daniel Knobe!) 2017-12-10 09:10:02 -08:00
Ryan C. Gordon dbce1341d5 audio: fixed typo in Doxygen comment. 2017-12-09 03:24:01 -05:00
Ryan C. Gordon 7cb8b50ad8 hints: Add "metal" to the list of SDL_RENDER_DRIVER hints. 2017-12-08 17:43:57 -05:00
Sam Lantinga cf3d450313 Added SDL_RenderGetMetalLayer() and SDL_RenderGetMetalCommandEncoder() 2017-12-08 14:30:10 -08:00
Sam Lantinga ba9c336e04 Fixed building for simulators or older iOS SDKs 2017-12-07 17:47:01 -08:00
Sam Lantinga 6deb1e7595 Fixed compiling Metal renderer on iOS 2017-12-07 17:12:03 -08:00
Ryan C. Gordon 2a2c8d42ca Initial shot at a renderer target for Apple's Metal API.
This isn't complete, but is enough to run testsprite2. It's currently
Mac-only; with a little work to figure out how to properly glue in a Metal
layer to a UIView, this will likely work on iOS, too.

This is only wired up to the configure script right now, and disabled by
default. CMake and Xcode still need their bits filled in as appropriate.
2016-04-21 03:16:44 -04:00
Ryan C. Gordon 351d6d4784 audio: Port WASAPI to WinRT, remove XAudio2 backend.
XAudio2 doesn't have capture support, so WASAPI was to replace it; the holdout
was WinRT, which still needed it as its primary audio target until the WASAPI
code code be made to work.

The support matrix now looks like:

WinXP: directsound by default, winmm as a fallback for buggy drivers.
Vista+: WASAPI (directsound and winmm as fallbacks for debugging).
WinRT: WASAPI
2017-12-06 12:24:32 -05:00
Ryan C. Gordon 083fe066d5 winrt: Patched to compile on Ryan's workstation. :)
I'm not sure why I needed this, but it appears to fix the build on VS2015 here.
2017-12-06 13:48:51 -05:00
Sam Lantinga 57ebc72714 Fixed bug 3975 - Add GLES2 support for macOS via ANGLE library
Andrey

Seems latest google angle library successfully built & tested under macOS'es.

https://github.com/google/angle

We need to use GLES2 to implement true cross-platform code.
2017-12-04 20:35:01 -08:00
Sam Lantinga 14452e9550 Fixed typos (thanks Martin!) 2017-12-04 20:21:52 -08:00
Sam Lantinga 88e3562ba0 Use the included Khronos headers on Android so we can create Core OpenGL contexts when building with older SDK 2017-11-27 15:07:07 -08:00
Sam Lantinga dba9979f44 Added support for aarch64 memory barrier instruction 2017-11-19 23:36:54 -08:00
Sam Lantinga a6a4e27ae8 Updated SDL's YUV support, many thanks to Adrien Descamps
New functions get and set the YUV colorspace conversion mode:
	SDL_SetYUVConversionMode()
	SDL_GetYUVConversionMode()
	SDL_GetYUVConversionModeForResolution()

SDL_ConvertPixels() converts between all supported RGB and YUV formats, with SSE acceleration for converting from planar YUV formats (YV12, NV12, etc) to common RGB/RGBA formats.

Added a new test program, testyuv, to verify correctness and speed of YUV conversion functionality.
2017-11-12 22:51:12 -08:00
Sam Lantinga 846d008036 Only include Intel intrinsics header on x86 and x64 2017-11-11 16:20:00 -08:00
Sam Lantinga 4026db8c7e Replaced the intrinsics header with the single header that includes all intrinsics so we can use AVX, etc. 2017-11-10 14:22:21 -08:00
Brandon Schaefer 9f4e4be8e0 Fixed bug 3943 - General SDL_HINT_VIDEO_DOUBLE_BUFFER hint support 2017-11-07 09:10:32 -08:00
Sam Lantinga 2c5724ef5d Updated version to 2.0.8 since SDL_image depends on it 2017-11-04 21:58:48 -07:00
Sam Lantinga afbba1822c Fixed compiling on Windows with HAVE_LIBC enabled 2017-11-04 18:01:03 -07:00
Sam Lantinga bcdf8b916b Added SDL_fmod() and SDL_fmodf() 2017-11-04 17:35:03 -07:00
Sam Lantinga 34502143d9 Added float versions of SDL's math functions 2017-11-04 15:34:14 -07:00
Sam Lantinga bba90a6562 Fixed using libunwind on iOS, where it's only available on the simulator (thanks Vit!) 2017-11-04 09:44:29 -07:00
Sam Lantinga 7abef33c5b Android configure-based build fixes (thanks Vit!) 2017-11-04 09:00:40 -07:00
Sam Lantinga 54a0245b70 Fixed bug 3926 - SDL_main export
e_pluschauskas

I noticed that after updating SDL to 2.0.6 my application now exports SDL_main.

At GitHub SDL mirror (branch 2.0.5) SDL_main prototyped as
extern C_LINKAGE int SDL_main(int argc, char *argv[]);
but at branch 2.0.6 prototype is
extern C_LINKAGE DECLSPEC int SDL_main(int argc, char *argv[]);
2017-11-01 17:41:25 -07:00
Brandon Schaefer 2ac567b715 Fixed bug 3902 - Add a specific KMSDRM hint for low latency video 2017-10-26 16:37:20 -07:00
Sam Lantinga fe2b5fec61 Document the SDL audio channel mapping 2017-10-20 14:48:10 -07:00
Sam Lantinga 7a6cf53aea Added SDL_AudioStreamFlush() to the list of new audio stream functions 2017-10-20 10:45:38 -07:00
Ryan C. Gordon 729329068b audio: Added SDL_AudioStreamFlush(). 2017-10-19 18:05:42 -04:00
Sam Lantinga 80f8464d97 Added audio stream conversion functions:
SDL_NewAudioStream
    SDL_AudioStreamPut
    SDL_AudioStreamGet
    SDL_AudioStreamAvailable
    SDL_AudioStreamClear
    SDL_FreeAudioStream
2017-10-18 15:54:05 -07:00
Sam Lantinga a225ffc1d7 Added min/max macros for the sized SDL datatypes 2017-10-16 14:39:56 -07:00
Sam Lantinga fc60db86b3 Fixed compiler warning 2017-10-12 17:17:09 -07:00
Sam Lantinga 4b28429882 Android doesn't have libunwind.h in API 16 2017-10-12 14:21:21 -07:00
Sam Lantinga 9c580e14c9 Added functions to query and set the SDL memory allocation functions:
SDL_GetMemoryFunctions()
    SDL_SetMemoryFunctions()
    SDL_GetNumAllocations()
2017-10-12 13:44:28 -07:00
Sam Lantinga 0ce23a5498 Updated version to 2.0.7 2017-10-12 08:08:04 -07:00
Sam Lantinga d90fce3c9e Exposed the joystick locking functions for multi-threaded access to the joystick API 2017-10-10 11:10:15 -07:00
Brandon Schaefer e564da78b7 revert files I didnt mean to commit! 2017-09-29 10:15:44 -07:00
Brandon Schaefer e27f12e0da wayland: Fix bug 3814 -Wmissing-field-initializers 2017-09-29 10:07:37 -07:00
Sam Lantinga c44e741bd9 Fixed bug 3842 - fix SDL_thread.h for emx
Ozkan Sezer

EMX declares _beginthread() / _endthread() in stdlib.h, not process.h.
The attached patch updates the OS/2 case of SDL_thread.h for it.  (It
also tidies the unreadable whitespace in win32 case.)
2017-09-23 12:38:47 -07:00
Alex Szpakowski 80f9e2f199 iOS: Fix compiling using the iOS 7 SDK, partially broken since MoltenVK support was added.
Note that apps submitted to the iOS App Store *must* use a modern iOS SDK (currently iOS 10 is probably the minimum), however the SDK used to build is separate from the minimum iOS version an app supports at runtime.
2017-09-21 20:11:44 -03:00
Sam Lantinga c08a7a74a5 Added a hint SDL_HINT_AUDIO_CATEGORY to control the audio category,
determining whether the phone mute switch affects the audio
2017-09-15 17:27:32 -07:00
Sam Lantinga 16b8c4ea43 Fixed bug 3811 - change HAVE_COPYSIGN to HAVE__COPYSIGN in SDL_config_windows.h
Ozkan Sezer

The patch below changes HAVE_COPYSIGN macro in SDL_config_windows.h to
HAVE__COPYSIGN, so that _copysign() can be used in SDL_stdlib.h which
is available in many more windows-targeting toolchains such as MinGW,
MSVC >= 6, etc, and not just  MSVC >= 2013. SDL_stdlib.c already has a
specific check for HAVE__COPYSIGN, so I believe this is reasonable.
2017-09-10 10:30:25 -07:00
Sam Lantinga be1caece4a Correction: copysign has been supported by windows several toolchains
for a very long time, including MSVC6, MinGW, LCC-Win32, (no released
watcom versions though, but that's of no concern.)

Patch from Ozkan Sezer
2017-09-10 09:19:10 -07:00
Sam Lantinga 569c222ca8 Updated documentation so it's clear you should use SDL_SetWindowDisplayMode() to change the size of fullscreen windows. 2017-09-09 11:04:35 -07:00
Sam Lantinga f465f24d73 Fixed bug 3760 - RWops doesn't check for integer overflow when stdio_fseek only supports 32 bits
Simon Hug

When RWops seeks with fseek or fseeko it uses the types long or off_t which can be 32 bits on some platforms. stdio_seek does not check if the 64-bit integer for the offset fits into a 32-bit integer. Offsets equal or larger than 2 GiB will have implementation-defined behavior and failure states would be very confusing to debug.

The attached patch adds range checking by using the macros from limits.h for long type and some bit shifting for off_t because POSIX couldn't be bothered to specify min and max macros.

It also defines HAVE_FSEEKI64 in SDL_config_windows.h so that the Windows function gets picked up automatically with the default config.

And there's an additional error message for when ftell fails.
2017-09-09 08:36:37 -07:00
Sam Lantinga f33377802a Fixed bug 3807 - Remove restriction from DECLSPEC macro for OS/2
Ozkan Sezer

The following patch removes the unnecessary / wrong
Watcom restriction from the DECLSPEC macro for OS/2.
2017-09-09 07:42:29 -07:00
Sam Lantinga cedbb3118c Fixed building with the first version of Visual Studio 2017, which doesn't have __has_include() (Thanks Simon!) 2017-09-08 15:08:50 -07:00
Sam Lantinga 4657d9f33c We don't need to pass the renderer into SDLTest_CleanupTextDrawing() 2017-09-08 04:53:31 -07:00
Sam Lantinga b0b3da7702 Added a function to clean up test text drawing 2017-09-08 04:14:05 -07:00
Ryan C. Gordon fb28393200 vulkan: use "unsigned int" instead of "unsigned" 2017-09-06 19:35:36 -04:00
Sam Lantinga 4ca5d8622a Fixed bug 3780 - GCC 7 implicit fallthrough warnings
Martin Gerhardy 2017-08-28 06:58:01 UTC

SDL_blit.h, SDL_fillrect.c and SDL_stdinc.h produces a lot of the (new) gcc-7 implicit fallthrough warnings.
2017-09-06 04:32:30 -07:00
Sam Lantinga 28bf56c12c Fixed bug 3801 - HAVE_LIBSAMPLERATE_H depending on HAVE_LIBC in current SDL_config.h.in
Ozkan Sezer

HAVE_LIBSAMPLERATE_H is depending on HAVE_LIBC in current config.h.in:
it shouldn't be.  HAVE_LIBUDEV_H, HAVE_DBUS_DBUS_H, HAVE_IBUS_IBUS_H,
HAVE_FCITX_FRONTEND_H, and HAVE_ALTIVEC_H have the same situation too.
I suggest something like the following, which moves them out of the
HAVE_LIBC confinement and also moves the windows dx header stuff along
side them. (Not ideal, but a bit cleaner I think.)
2017-09-06 10:31:05 -07:00
Sam Lantinga d51dc7378b Fixed bug 3797 - configure check for float.h
Ozkan Sezer

Cmake checks for float.h, but configure does not:  the attached patch
adds float.h to checked headers in configury, and it adds the missing
HAVE_FLOAT_H macro to SDL_config.h.cmake and SDL_config.h.in.

In SDL_config_macosx.h and SDL_config_windows.h, defined HAVE_FLOAT_H
as 1, where I know that it's true.
2017-09-06 01:14:23 -07:00
Ryan C. Gordon a12989f94c vulkan: Changed SDL_WINDOW_VULKAN value to match Tizen's fork. 2017-09-03 13:20:33 -04:00
Sam Lantinga ff76f8e5b4 Fixed bug 3791 - SDL_bits.h: __builtin_clz is supported in gcc >= 3.4
Ozkan Sezer

__builtin_clz is supported in gcc >= 3.4. The following patchlet adjusts
SDL_bits.h for it.
2017-08-31 15:17:59 -07:00
Sam Lantinga 629f8abab4 Updated documentation, you don't need to initialize the audio subsystem to do in-place format conversion. (Thanks Simon Hug!) 2017-08-29 09:02:04 -07:00
Sam Lantinga abf8fc4c01 Fixed check for Mac OS X 10.11+ SDK (thanks Edward Rudd!) 2017-08-29 08:27:23 -07:00
Sam Lantinga 2d655cd814 MAC_OS_X_VERSION_MAX_REQUIRED isn't actually set in recent Xcode versions 2017-08-29 02:32:53 -07:00
Sam Lantinga 1067b528d3 Fixed building with an older Mac OS X SDK 2017-08-28 20:52:05 -07:00
Sam Lantinga e8b114ecfc Vulkan support on Mac OS X introduces a link time dependency (CAMetalLayer) on 10.11 and newer 2017-08-28 19:32:08 -07:00
Sam Lantinga dbb0a2aa74 Removed the need for libSDL2main.a on Android, and separated JNI initialization out for other integrations 2017-08-28 14:34:15 -07:00
Sam Lantinga d28cb702e4 Fixed bug 3781 - unbalanced #pragma pack(pop) in close_code.h
Ozkan Sezer

Revision 288 (http://hg.libsdl.org/SDL/rev/2f5a6062db86) excluded the
Watcom compiler from forcing 4 byte structure packing in begin_code.h.
However, it missed updating close_code.h, which now has an unbalanced
#pragma pack(pop) if the compiler is Watcom.  The issue seems to have
crawled into SDL2, too.
2017-08-28 09:41:00 -07:00
Sam Lantinga ce2b16445e Be clear that disabling Vulkan surface support disables the entire SDL Vulkan integration 2017-08-28 00:11:38 -07:00
Sam Lantinga 37ce9f2773 Fixed typedef redefinition errors when including both SDL_vulkan.h and vulkan.h
You should always include vulkan/vulkan.h first, then include SDL_vulkan.h
2017-08-27 23:13:15 -07:00
Sam Lantinga 24a0d3bc6d Don't define Vulkan types if vulkan.h has already been included 2017-08-27 22:27:45 -07:00
Ryan C. Gordon 25e3a1ec90 vulkan: Initial Vulkan support!
This work was done by Jacob Lifshay and Mark Callow; I'm just merging it
into revision control.
2017-08-27 22:15:57 -04:00
Sam Lantinga 003d491f86 Fixed bug 3724 - Allow Angle Static Link
Carlos

We would like to add a switch (define) that allows us to compile Angle statically with SDL. That is, getting rid of the OpenGL DLL. Usually you need OpenGL to be loaded dynamically as DLL because implementation is provided by the system but no need with Angle.

Only 2 files need modification and it shouldn't affect current behaivor:
include/SDL_egl.h and src/video/SDL_egl.c, as in here

https://github.com/native-toolkit/sdl/pull/10/files

The flag name could be SDL_VIDEO_STATIC_ANGLE (instead of NATIVE_TOOLKIT_STATIC_ANGLE) as discussed here https://github.com/native-toolkit/sdl/pull/10

We have tested this with both Windows and UWP, using NME engine (https://github.com/haxenme/nme).

Releated issue: https://bugzilla.libsdl.org/show_bug.cgi?id=1820
2017-08-27 19:05:57 -07:00
Sam Lantinga bf1268287d SDL_thread.h: fix os/2 defines (rev 11340:2688d85b817c was a missing patch) 2017-08-27 18:48:51 -07:00
Sam Lantinga 5ca0152218 Fixed bug 3774 - Cmake build fails for Android
sfalexrog

Android haptic code was not added to CMakeLists.txt, leading to build failures when targeting Android platform.

Attached patch adds Android haptic driver to source sets and adds configuration parameter to SDL_config.h.cmake.
2017-08-26 21:17:12 -07:00
Ryan C. Gordon d8fc70ea1e opengl: add support for GL_KHR_no_error.
This is completely untested!

Fixes Bugzilla #3721.
2017-08-24 21:30:53 -04:00
Sam Lantinga 9b3ec6a570 SDL_thread.h: add missing os/2 defines.
(essentially replicates the windows case || SDL1.2 case.)
2017-08-21 13:01:22 -07:00
Ryan C. Gordon 01e0d8fc85 opengl: Add support for [GLX|WGL]_ARB_create_context_robustness.
This patch was originally written by Marc Di Luzio for glX and enhanced by
Maximilian Malek for WGL, etc. Thanks to both of you!

Fixes Bugzilla #3643.
Fixes Bugzilla #3735.
2017-08-19 15:02:03 -04:00
Sam Lantinga 18a6538507 add missing os/2 apientry defs to SDL_opengl.h 2017-08-19 11:15:58 -07:00
Sam Lantinga 30d554e3d6 Fixed building SDL applications with Visual Studio and the clang toolset
Also fixed building 64-bit SDL with clang. 32-bit doesn't build because of the inline assembly for C runtime support.
2017-08-19 03:07:44 -07:00
Sam Lantinga 12d33b33ca Fixed building with Visual Studio 2017 and the Windows XP toolset if _USING_V110_SDK71_ accidentally gets undefined 2017-08-19 02:23:50 -07:00