Commit Graph

249 Commits

Author SHA1 Message Date
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
Ozkan Sezer
d0c5097cdc minor autotools build system updates. 2021-01-24 00:51:25 -05:00
Sylvain Becker
4fbb9f31ab Fix declarations after statement 2021-01-24 00:51:24 -05:00
Sylvain Becker
0e7d435f13 Add basic testgles2_sdf program to demonstrate sign distance field with opengles2 2021-01-24 00:51:24 -05:00
Sam Lantinga
c94283d404 testgamecontroller: log which controller the event came from 2021-01-13 11:01:54 -08:00
Sam Lantinga
9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Ozkan Sezer
88eaf356a7 minor update to test/acinclude.m4 (pkg.m4) 2020-12-30 15:53:20 +03:00
Ozkan Sezer
5ed3d21f6e testsem.c: fix -Wmissing-braces warnings. 2020-12-24 00:55:30 +03:00
Joel Linn
2b040cebbe Atomic test: Fix use after free
SDL_SemPost() was called by the FIFO threads after the semaphore was
freed because the main thread actually synchronized on the
`writerRunning`/`readersRunning` count and not the semaphores itself.
2020-12-23 13:36:23 -08:00
Joel Linn
6267b95177 Semaphore test: Add overhead tests. 2020-12-23 13:36:02 -08:00
Joel Linn
95a6d4e848 Semaphore test: Put test into separate function. 2020-12-23 13:35:35 -08:00
Ozkan Sezer
090fffac6a test/Makefile.os2: add warning switches to CFLAGS. 2020-12-24 00:29:40 +03:00
Ozkan Sezer
239c8f1f4c testvulkan.c: fix -Wmissing-braces warnings. also fix whitespace. 2020-12-24 00:28:50 +03:00
Ozkan Sezer
20ca1192d2 testgesture.c: comment out unused drawLine() 2020-12-24 00:26:32 +03:00
Ozkan Sezer
b064028c2d testatomic.c: fix warnings due to SDL_AtomicDecRef() use 2020-12-24 00:25:40 +03:00
Sam Lantinga
390b2cf0d3 Enable PS5 enhanced functionality for testgamecontroller 2020-12-22 20:53:27 -08:00
Sam Lantinga
058a0ab47f Set the pad lights on the PS5 controller corresponding to the player index
Also allow setting the player index from testgamecontroller using the number keys
2020-12-22 14:38:32 -08:00
Ozkan Sezer
b4b674dabb CMakeLists.txt: sync DYLIB_CURRENT_VERSION to Xcode project 2020-12-22 22:10:50 +03:00
Sam Lantinga
350f1b0d16 Updated SDL to version 2.0.15 for development 2020-12-22 10:36:15 -08:00
Ozkan Sezer
9f655fe522 regenerated configure 2020-12-22 17:03:20 +03:00
Ozkan Sezer
86191351c0 acinclude & sdl2.m4 updates:
- acinclude/alsa.m4, esd.m4: Ran through autoupdate to replace several
  AC_TRY_[COMPILE|LINK|RUN] with corresponding AC_???_IFELSE , so that
  autoconf-2.70 doesn't warn.
- sdl2.m4: Ditto.
- test/acinclude.m4 (sdl2): Ditto.
2020-12-22 17:00:28 +03:00
Ozkan Sezer
f117db5186 sdl2.m4 updates:
- remove HP/UX 9 (%@#!) support
- change fopen() mode from "a" to "w" in test code.
- bump its serial num to 2.
- test/acinclude.m4: same sdl2.m4 updates.
2020-12-22 17:00:11 +03:00
Ozkan Sezer
537f824f38 test/Makefile.os2: wlib must run case-sensitively. 2020-12-21 20:40:10 +03:00
Sam Lantinga
67e9132dd5 Fixed circular dependency problem when building in the test directory 2020-12-20 12:22:28 -08:00
Ozkan Sezer
5c654d0df4 tests: regenerate configure using autoconf patched for AC_PATH_X11
Specifically this patch which does not invoke _AC_PATH_X_XMKMF and
_AC_PATH_X_DIRECT internal autoconf routines when cross-compiling:
http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=33c3a47c04ab70a4dd54963fe433a171bc03747f

Without this, CFLAGS would brokenly have system include paths like
-I/usr/include/X11 when cross-compiling e.g. for windows.  (And it
also resulted in annoying imake crashes for my setup...)
2020-12-18 17:00:00 +03:00
Ozkan Sezer
716ac535d8 test/acinclude.m4: rename SDL_CONFIG to SDL2_CONFIG, regenerate configure 2020-12-15 01:20:00 +03:00
Ozkan Sezer
44d4a61d92 minor cleanups to configure.ac to reduce autoconf-2.70 warnings a bit.
configure output is practically unchanged. there are still lots of
AC_TRY_COMPILE/AC_TRY_LINK replacements needed to really eliminate
the warnings, but that's for another time.
2020-12-14 08:11:40 +03:00
Ozkan Sezer
f1cab8aea6 fix bug #5253: handle NULL title or message fields in SDL_MessageBoxData
- SDL_video.c (SDL_ShowMessageBox): replace messageboxdata, set title
  or message field to "" if either of them is NULL.
- SDL_video.c (SDL_ShowSimpleMessageBox):  set title or message to ""
  if either of them is NULL for EMSCRIPTEN builds.
- SDL_bmessagebox.cc: add empty string check along with NULL check for
  title and message fields.
- SDL_windowsmessagebox.c (AddDialogString): remove NULL string check
- SDL_windowsmessagebox.c (AddDialogControl):  add empty string check
  along with the NULL check.
- SDL_x11messagebox.c: revert commit 677c4cd68069
- SDL_os2messagebox.c: revert commit 2c2a489d76e7
- test/testmessage.c: Add NULL title and NULL message tests.
2020-12-10 11:20:56 +03:00
Sam Lantinga
3c68051eaf Allow background input when testing game controllers 2020-12-04 15:47:28 -08:00
Sam Lantinga
04f0fd13b5 Remember to close the game controller when we're done with it 2020-11-27 18:57:42 -08:00
Sam Lantinga
012471e959 Open and test all connected controllers 2020-11-27 18:57:38 -08:00
Sam Lantinga
24cc0012f0 Some controllers don't always reset their triggers to zero when they are released (e.g. Xbox One S in Bluetooth mode), so only trigger rumble if the trigger is pulled halfway or more. 2020-11-25 16:05:15 -08:00
Sam Lantinga
e16afa792f Automatically switch to testing a new controller when it's plugged in 2020-11-24 16:38:49 -08:00
Sam Lantinga
34bea84a54 Fixed bug 5335 - Patch: enable joystick/haptic/evdev support by default on FreeBSD
Alex S

Ah, that's not quite enough. You need to:
  1. rename src/joystick/bsd/SDL_sysjoystick.c to something;
  2. regenerate configure.
2020-11-23 23:03:55 -08:00
Sam Lantinga
04b45b5581 Allow testing a specific controller 2020-11-23 14:28:30 -08:00
Sam Lantinga
ff4bc1389c Fixed mapping controllers after adding the touchpad button 2020-11-23 14:28:16 -08:00
Sam Lantinga
75721b191c Allow testing effects on PS4 controllers
Note, this will switch the controller into advanced report mode which breaks DirectInput on Windows
2020-11-21 18:01:23 -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
fe4da4206a Improve LED color calculation, don't set LED unless left thumbstick is moved 2020-11-16 10:39:44 -08:00
Sam Lantinga
9f51fad361 Added support for the touchpad on PS4 and PS5 controllers 2020-11-13 18:01:29 -08:00
Sam Lantinga
e749c1266f Fixed overflow in trigger rumble calculation 2020-11-12 07:53:01 -08:00
Simon McVittie
65847539dd test: Add a unit test for input device classification heuristics
This uses pre-recorded evdev capabilities, so that we can check for
regressions without the devices having to be physically present.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-11-11 19:15:43 -08:00
Sam Lantinga
1e2caac58b Added SDL_JoystickRumbleTriggers() and SDL_GameControllerRumbleTriggers() 2020-11-11 18:57:37 -08:00
Ryan C. Gordon
c3a32605f8 testvulkan: Patched to compile with SDL's internal Vulkan headers. 2020-11-09 04:55:15 -05:00
Sam Lantinga
009b62f1c2 Be explicit about mapping the new game controller paddle buttons 2020-11-07 02:22:15 -08:00
Sam Lantinga
5a92edee03 Don't try to map the accelerometer as a game controller 2020-11-06 15:54:18 -08:00
Sam Lantinga
59a644fb01 iOS should use the same size window for the controller tests as other platforms
Otherwise the position of the button and axis elements won't be correct
2020-11-06 14:44:26 -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
e555d45331 Added SDL_JoystickHasLED
Currently, this is only supported by the PS4 HIDAPI driver.
2020-11-05 11:07:54 -08:00