Commit graph

10531 commits

Author SHA1 Message Date
Sam Lantinga
29023f51e8 Worked around bug with Sony PS Now PS3 controller where DirectInput polling will continue to return success after the controller is unplugged.
The code is now reliant on SDL_PrivateJoystickAdded() and SDL_PrivateJoystickRemoved() being called correctly when devices are added or removed on Windows
2018-08-09 16:03:50 -07:00
Sam Lantinga
90f9ce1e41 Fixed Windows build 2018-08-09 16:03:29 -07:00
Sam Lantinga
db39b4811f 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
Ryan C. Gordon
13edfebf3b libm: Don't let Visual Studio generate an implicit memset() call. 2018-08-08 15:39:20 -04:00
Ryan C. Gordon
fd89008004 backout INFINITY change...of course Visual Studio doesn't have it. 2018-08-08 12:36:54 -04:00
Ryan C. Gordon
87c0669163 e_exp: One more compiler warning. 2018-08-08 12:19:01 -04:00
Ryan C. Gordon
a6ccb4f336 libm: Fixed all static analysis warnings. 2018-08-08 12:13:56 -04:00
Ryan C. Gordon
0e7971862f e_exp: Fixed compiler warning on Visual Studio. 2018-08-08 10:26:22 -04:00
Ryan C. Gordon
28f6d22f39 haiku: Rename internal functions from BE_* to HAIKU_*
Fixes Bugzilla #2349.
2018-08-07 18:07:11 -04:00
Ryan C. Gordon
f04deb0b0e configure: Make wayland sources depend on generated headers.
Otherwise occasionally the sources will try to compile before the headers it
needs are generated.

Fixes Bugzilla #3977.
2018-08-07 17:28:07 -04:00
Ryan C. Gordon
ab610a7584 evdev: On sudden termination, make sure keyboard isn't lost (thanks, Tadek!)
"In release 2.0.6, when Linux evdev keyboard support has been moved to a
separate source file, a feature was added to disable normal keyboard event
processing to prevent "spilling" keystrokes to background virtual console.

This feature has one unpleasant side effect: if application fails to call
`SDL_Exit` before termination or crashes with fatal signal, console is left
in unusable state with keyboard not working and no possibility to switch
virtual console. If user has a chance, he can login remotely and restore
keyboard with `kbd_mode`, otherwise the only option is to reboot the machine.

This patch fixes that problem by intercepting fatal signals (with `sigaction`)
and process termination (with `atexit`), to restore keyboard state, if it
wasn't properly restored with `SDL_Exit`.

The function registered with `atexit` also restores original signal handlers,
to prevent leaving invalid handlers after SDL library is unloaded, if it was
loaded dynamically with `dlopen`.

No signal handlers or `atexit` function are installed if SDL boolean hint
`SDL_HINT_NO_SIGNAL_HANDLERS` is `SDL_TRUE`.

Additionally, if environment variable `SDL_INPUT_LINUX_KEEP_KBD` exists,
keyboard initialization function completely skips disabling keyboard. This
can be useful for debugging."

Fixes Bugzilla #4193.
2018-08-07 16:56:46 -04:00
Ryan C. Gordon
c041a8ab67 alsa: optionally run entire pipeline non-blocking. 2018-08-07 16:49:18 -04:00
Ryan C. Gordon
8b5143fc7d audio: Deal with device shutdown more carefully.
This would cause problems in various ways, but specifically triggers an
assert when you close a WASAPI capture device in an app running over RDP.

Related to (but not the actual bug) in Bugzilla #3924.
2018-08-07 13:04:15 -04:00
Mai Lavelle
b193f2c097 haptic: Fix initial detection of haptic devices on Linux system
SDL_UDEV_Scan must be called during SDL_SYS_HapticInit to ensure devices
outside of the 0-31 range are added to the list of haptic devices.

Fixes Bugzilla #3923.

--HG--
extra : histedit_source : 3244924c52322015bb86e5aa1168270ac457f7f7
2018-08-07 12:06:31 -04:00
Sam Lantinga
ab526d283f Backed out changeset 448e9f627e71
It turns out the mapping is correct, just the name was confusing
2018-08-06 13:00:11 -07:00
Sam Lantinga
0d0879fbfc Removed mapping for VID/PID 0x0079/0x0006, which is a generic PCB used in many different devices
Different device with same vid/pic that is kind of a Saitek shape:
https://www.trust.com/en/product/17416-gxt-24-runa-compact-gamepad

n64 with same ID
https://bbs.archlinux.org/viewtopic.php?id=163488

PS shaped with numbers for buttons
https://pineight.com/mw/index.php?title=USB_game_controller#DragonRise_Inc._Generic_USB_Joystick

fightstick with same vid/pid
https://retropie.org.uk/forum/topic/7594/bartop-2-player-zero-delay-encoders-not-working
2018-08-06 11:58:08 -07:00
Ozkan Sezer
bda34ed63c SDL_expf: return SDL_exp() instead of SDL_uclibc_exp() for consistency. 2018-08-05 10:01:01 +03:00
Ethan Lee
54ce812205 SDL_exp 2018-08-04 11:52:46 -04:00
Ryan C. Gordon
b41191fbf2 cmake: use WINDOWS instead of WIN32.
--HG--
extra : histedit_source : be7d5850d1e2d3ca834da337a4ac88dca63c0547
2018-08-02 16:21:43 -04:00
Ryan C. Gordon
45974c3953 Some drag'and'drop improvements.
First: disable d'n'd events by default; most apps don't need these at all, and
if an app doesn't explicitly handle these, each drop on the window will cause
a memory leak if the events are enabled. This follows the guidelines we have
for SDL_TEXTINPUT events already.

Second: when events are enabled or disabled, signal the video layer, as it
might be able to inform the OS, causing UI changes or optimizations (for
example, dropping a file icon on a Cocoa app that isn't accepting drops will
cause macOS to show a rejection animation instead of the drop operation just
vanishing into the ether, X11 might show a different cursor when dragging
onto an accepting window, etc).

Third: fill in the drop event details in the test library and enable the
events in testwm.c for making sure this all works as expected.

--HG--
extra : rebase_source : a8d5c21e97b34dbd6ce88237863c084d8825350a
extra : amend_source : 81c4acd9f5ca8dc5a4642b250ca6b42fd79cac87
2018-08-02 16:03:47 -04:00
Ryan C. Gordon
cb84e488f5 Backed out changeset dfebed374d73.
This change isn't correct. See comments in Bugzilla #4183.

--HG--
extra : rebase_source : a083f2f9dbda7cebffc8629e29c7205133d35c21
2018-07-22 19:42:08 -04:00
Ryan C. Gordon
d1d7e776ed libm: Fixed signature mismatches for __ieee754_rem_pio2 and __kernel_rem_pio2.
Fixes Bugzilla #4201.

--HG--
extra : rebase_source : 66bdbdda3e4821bd87fcecf9d4f10f0a522f5a2e
2018-07-22 19:40:42 -04:00
Ryan C. Gordon
50654a3801 windows: Fixed some Visual Studio warnings about shadowed variables.
Fixes Bugzilla #4118.

--HG--
extra : rebase_source : c724a73700dbbd51aae4ba885e3465cf3e5daf30
2018-07-22 19:28:27 -04:00
Vitaly Novichkov
2b79c7662d Remove "lib" prefix from DLL file on MinGW builds
closes bug #4209.
2018-06-29 18:29:17 +03:00
Marc Di Luzio
750ab3ed08 Ensure we still clear the X locale modifiers even if not compiled with ibus or fcitx support 2018-07-12 16:52:45 +01:00
Ryan C. Gordon
31b032bcc3 dbus: Deal with undefined behavior with va_args.
Parse out a copy of the varargs ourselves to get to the reply portion, since
the original passed to D-Bus might modify or not modify the caller's copy,
depending on system ABI.
2018-07-13 17:53:24 -04:00
Sam Lantinga
abfd37842e Clean up captured pointer code to avoid logcat clutter on pre-8.0 systems (thanks Rachel!) 2018-07-13 12:55:50 -07:00
Sam Lantinga
a9bf4b69ea More controller drivers support CARTESIAN coordinates.
This fixes rumble on the Saitek Cyborg V.3 Rumble Pad
2018-07-12 13:28:15 -07:00
Sam Lantinga
bbc117137c 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
Ozkan Sezer
b8c51e817d ltmain.sh: make OSX autofoo builds' compatibility version match Xcode builds.
closes bug #4208.
2018-07-05 23:01:10 +03:00
Wohlstand
0b7134ff2c Fixed bug 4210 - SSE2-based converter makes junk result of S32 -> Float
At the HG state e604fe493d45, 64-bit assemblies are using SSE2-based resampler, produces junk sound when converting the S32 -> Float32 -> S16 chain. The `NEED_SCALAR_CONVERTER_FALLBACKS` thing works perfectly.

If I will find a reason that caused this mistake, I'll send a patch by myself.
2018-07-02 03:53:57 +03:00
Ozkan Sezer
89a9a997ec made the wasapi configury option consistent with others. 2018-07-01 19:50:00 +03:00
Ozkan Sezer
45850bad77 make WASAPI configurable in autofoo and cmake (default is on.)
closes bug #3798.
2018-07-01 17:01:04 +03:00
Ozkan Sezer
d88abddcbc SDL_windowstaskdialog.h (struct _TASKDIALOGCONFIG): make unions anonymous
otherwise build fails. (at least with my VS2005. and the code accesses the
arms of the unions anonymously anyway.)
2018-06-30 20:55:51 +03:00
Ozkan Sezer
e5213cf7df correct the comment correction.. 2018-06-30 20:10:40 +03:00
Ozkan Sezer
fca418b01b comment correction 2018-06-30 20:04:01 +03:00
Ozkan Sezer
09860178dc ran 'chmod -x' on two files 2018-06-30 20:03:23 +03:00
Ryan C. Gordon
7fbc806f83 Attempt to fix "cast from pointer to integer of different size" warnings. 2018-06-29 16:56:11 -04:00
Ryan C. Gordon
c2b083ec57 Corrected a comment. 2018-06-29 16:55:55 -04:00
Ryan C. Gordon
11298991b4 Patched to compile on Visual Studio (typo). 2018-06-25 23:00:38 -04:00
Ryan C. Gordon
d2fcd08e53 atomic: Fight with all the assemblers that don't like REP NOP. :/ 2018-06-25 16:34:16 -04:00
Ryan C. Gordon
db4f3793c0 atomic: Spin locks now try to use the x86 PAUSE instruction for short waits.
Fixes Bugzilla #4151.
2018-06-25 15:58:35 -04:00
Ryan C. Gordon
a9d21ce606 yuv: Patched to make static analysis happy (warned about unused variable). 2018-06-25 13:14:52 -04:00
Ryan C. Gordon
82f977c0b5 Deal with possible malloc(0) calls, as pointed out by static analysis. 2018-06-25 12:55:23 -04:00
Ryan C. Gordon
ecd3391777 wayland: Keep protocol XML files in-tree.
Now you don't need the latest Wayland installed to build with
newer protocols supported, as they'll build correctly; even if
your system can't use them, we can make intelligent decisions
at runtime about what's available on the current machine anyhow.

This also simplifies some logic and possible failure cases in
the configure and CMake scripts.

Fixes Bugzilla #4207.

--HG--
extra : amend_source : 1b786977f162f8a9e984f543a044e1a0da80f2bd
2018-06-25 09:37:25 -07:00
Ryan C. Gordon
c84533767a gles2: Whoops, overzealous copy/paste on my part. :) 2018-06-25 01:57:28 -04:00
Ryan C. Gordon
f881ef4e85 wayland: Implemented xdg-wm-base support.
This is just in parity with the existing zxdg-shell-unstable-v6 code. Making
the Wayland target robust (and uh, with title bars) is going to take a lot
of work on top of this.

--HG--
extra : amend_source : eb632de165fc406527a6627635382c22151223b5
2018-06-24 22:42:36 -07:00
Ryan C. Gordon
9ddbda088a android: Android.mk should only preserve debug symbols in debug builds.
Fixes Bugzilla #4111.
2018-06-24 15:21:01 -04:00
Anthony Pesch
cfcef86f4d alsa: avoid hardware parameters with an excessive number of periods.
The previous code attempted to use set_buffer_size / set_period_size
discretely, favoring the parameters which generated a buffer size that was
exactly 2x the requested buffer size. This solution ultimately prioritizes
only the buffer size, which comes at a large performance cost on some machines
where this results in an excessive number of periods. In my case, for a 4096
sample buffer, this configured the device to use 37 periods with a period size
of 221 samples and a buffer size of 8192 samples. With 37 periods, the SDL
Audio thread was consuming 25% of the CPU.

This code has been refactored to use set_period_size and set_buffer_size
together. set_period_size is called first to attempt to set the period to
exactly match the requested buffer size, and set_buffer_size is called second
to further refine the parameters to attempt to use only 2 periods. The
fundamental change here is that the period size / count won't go to extreme
values if the buffer size can't be exactly matched, the buffer size should
instead just increase to the next closest multiple of the target period size
that is supported. After changing this, for a 4096 sample buffer, the device
is configured to use 3 periods with a period size of 4096 samples and a buffer
size of 12288 samples. With only 3 periods, the SDL Audio thread doesn't even
show up when profiling.

Fixes Bugzilla #4156.
2018-05-04 21:21:32 -04:00
Ryan C. Gordon
353e706a9e cmake: Look in popular places for X11 headers, export this info properly.
Fixes CMake not being able to find X11 on FreeBSD (which generally has the
headers in /usr/local/include/X11).

List of other popular places borrowed from CMake's FindX11 module.

This worked on the configure script because of magic in the AC_PATH_X macro.

Fixes Bugzilla #4815.
2018-06-24 15:12:18 -04:00