Commit graph

11627 commits

Author SHA1 Message Date
Ozkan Sezer
2467ed197c minor warning fixes. 2019-08-04 14:56:02 +03:00
Alex Szpakowski
99c222cc77 Implement touch window IDs on x11/xinput2. 2019-08-04 00:34:23 -03:00
Ozkan Sezer
08a0f96749 fix permissions 2019-08-03 12:50:28 +03:00
Ozkan Sezer
0f3d9a7186 remove test/aclocal.m4 2019-08-03 12:49:50 +03:00
Sam Lantinga
1d2350c07f Fixed building on Mac OS X without libusb 2019-08-02 18:14:31 -07:00
Sam Lantinga
7de41a80e1 Fix nullptr crash on android
nullcheck the device coming back from InputDevice.getDevice(deviceId) in new code added to sdlactivity.onkey.


java.lang.NullPointerException:
  at org.libsdl.app.SDLSurface.onKey (SDLActivity.java:1793)
  at android.view.View.dispatchKeyEvent (View.java:13321)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1912)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1912)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1912)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1912)
  at com.android.internal.policy.DecorView.superDispatchKeyEvent (DecorView.java:685)
  at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent (PhoneWindow.java:1869)
  at android.app.Activity.dispatchKeyEvent (Activity.java:3447)
  at org.libsdl.app.SDLActivity.dispatchKeyEvent (SDLActivity.java:496)

@dang @saml @dave
2019-08-02 17:20:00 -07:00
Sam Lantinga
ac6485552e 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
Sam Lantinga
f146a96b35 Added support for a few controllers on Android 2019-08-02 17:12:49 -07:00
Alex Szpakowski
d34695ffd4 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
Ozkan Sezer
c8e23236cd configury: allow libusb-less hidapi for macosx. 2019-08-01 17:41:40 +03:00
Ozkan Sezer
9c13eeabbb use WIN_IsWindowsVistaOrGreater() from core/windows for isVistaOrNewer 2019-07-31 23:37:02 +03:00
Ethan Lee
55c49e7d33 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
Sam Lantinga
571fc2a8b1 Make sure HIDAPI is initialized whenever we call HIDAPI_IsDevicePresent() 2019-07-31 10:20:37 -07:00
Andrew Eikum
e0039a7c75 joystick: Ensure HIDAPI is initialized before calling it 2019-07-31 11:14:48 -05:00
Andrew Eikum
5e44950dfe cmake: Fix locating libusb header at configure-time
Removing the CheckUSBHID call is necessary to avoid caching the failed header
check result before we find libusb via pkg-config.
2019-07-31 11:34:00 -05:00
Ozkan Sezer
ac7da51929 minor whitespace tidy-up. 2019-07-31 19:40:50 +03:00
Sam Lantinga
198b2d497f Fixed bug 4692 - Command line parsing
Galadrim

As I have seen, SDL implements its own command line parser for Windows in SDL_windows_main.c. Unfortunately, it doesn't seem to allow command line arguments with trailing backslashes if quoting is required.

Usually, when you write an application that gets command line arguments passed as argc and argv, the parsing is done by parse_cmdline. The Windows API also provides the function CommandLineToArgvW, so an application can parse itself if only the command line string is provided. Both functions behave almost identically according to their documentation. If the argument "\\" (including the quotes) is passed, they both turn it into a single backslash.

The SDL command line parser on the other hand doesn't recognize the second quote character as the closing character in this example and therefore includes it in the parsed argument. The parser does not count the number of backslashes preceding a quote. It always treats a quote as escaped if a backslash is in front of it. Therefore, it should be impossible to quote and escape an argument correctly, if it has a trailing backslash and contains characters that require quoting.

Of course, each application is allowed to implement its own parsing rules, so SDL is free to do so. But the problem I see is that there are arguments, that are impossible to be passed to the parser correctly, as I described above. Is there a reason, why SDL does not simply use CommandLineToArgvW instead of implementing its own parser?

Here are some links that show that correct argument parsing, as it is usually done in Windows, is quite complicated:

https://docs.microsoft.com/en-us/windows/desktop/api/shellapi/nf-shellapi-commandlinetoargvw

http://www.windowsinspired.com/how-a-windows-programs-splits-its-command-line-into-individual-arguments/
2019-07-31 09:11:20 -07:00
Ozkan Sezer
32894f4f11 use SDL_zeroa at more places where the argument is an array. 2019-07-31 05:11:40 +03:00
Ozkan Sezer
ab8f831379 Fix bug 4746 - introduce SDL_zeroa macro. 2019-07-31 01:22:02 +03:00
Ozkan Sezer
ac4cb57923 minor build fix. 2019-07-31 01:19:26 +03:00
Ozkan Sezer
82cdc07031 MS_ADPCM_Decode: fix assigning an array to a pointer (lose '&'). 2019-07-31 00:10:00 +03:00
Ozkan Sezer
97014820d1 better readability.. 2019-07-31 00:07:15 +03:00
Ozkan Sezer
61368f443c SDL_iconv_string: add (char*) casts before SDL_malloc() calls. 2019-07-31 00:06:50 +03:00
Ozkan Sezer
0806aa2d53 minor build fixes. 2019-07-31 00:05:28 +03:00
Sam Lantinga
85138c1ec6 Fixed bug 4538 - validate image size when loading BMP files 2019-07-30 11:00:00 -07:00
Andrew Eikum
5542297551 hidapi: Update repository URLs
Upstream hidapi has been re-homed. Update the repo URLs to help guide folks
where to contribute fixes.
2019-07-25 08:05:13 -05:00
Sam Lantinga
f20de21177 Fixed bug 4742 - SDL 2.0.10 DMG has duplicated files (instead of symlinks) 2019-07-30 10:15:49 -07:00
Sam Lantinga
88ea879a38 Fixed bug 4745 - 2.0.10 fails to build against macOS 10.11 SDK
Joshua Root

NSEventSubtypeMouseEvent was added in 10.12, so it needs to be defined on 10.11 as well
2019-07-30 10:04:46 -07:00
Sylvain Becker
2e6310cc74 Fixed bug 4739 - Android: loading native libs, generated by bundletool (Thanks akk0rd87) 2019-07-27 20:21:42 +02:00
Alex Szpakowski
9f568ea83a 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
Sam Lantinga
b43ec841b4 Don't call hid_enumerate() if the HIDAPI drivers are all disabled 2019-07-25 15:21:44 -07:00
Sam Lantinga
902abb593a Added tag release-2.0.10 for changeset bc90ce38f1e2 2019-07-25 11:04:36 -07:00
Andrew Eikum
b71dec57ab hidapi: Zero out new hid_device_info structs 2019-07-23 14:41:00 -05:00
Ethan Lee
7a84f02172 Copypaste SDL_NSLog to UIKit backend, document it as such 2019-07-17 23:20:57 -04:00
Sam Lantinga
c4c43627bb Fixed bug 4726 - Fix for tvOS GetPrefPath
Caleb Cornett

Unlike iOS and macOS, tvOS does not have any persistent local storage. In fact, the ApplicationSupport directory pointed to by the existing Cocoa GetPrefPath() throws an error whenever any attempt is made to access it. To get any local storage on an Apple TV, our only option is to use a temporary cache directory.

This patch changes the tvOS PrefPath to this cache directory and also logs a critical warning that this if developers want their save data to persist across game sessions, they must use some form of iCloud storage.
2019-07-18 19:33:17 -07:00
Sam Lantinga
c0871789d5 Fixed build error 2019-07-17 16:47:19 -07:00
Sam Lantinga
6e1595997a Merged latest changes from Steam into controller_type.h 2019-07-17 16:47:17 -07:00
Sam Lantinga
6a313250ad Add linked list of opened HID devices to prevent accessing already freed devices in device removal callback that is sometimes called even after being unregistered 2019-07-17 16:47:13 -07:00
Sam Lantinga
d5f6eda1b2 Added support for the Victrix Pro Fight Stick for PS4 2019-07-17 13:01:44 -07:00
Cameron Gutman
bdb24dc076 Allow hotplugging joysticks without udev 2019-06-24 21:08:26 -07:00
Sam Lantinga
c5309610f9 Fixed bug 4704 - SDL_HINT_ANDROID_SEPERATE_MOUSE_AND_TOUCH on Windows?
superfury

I notice that, somehow, when locking the mouse into place(using SDL_SetRelativeMouseMode), somehow at least the movement information gets through to both mouse movement and touch movement events?

My app handles both, so when moving a touched finger accross the app(using RDP from an Android device) I see the mouse moving inside the app when it shouldn't(meaning that the touch movement is ignored properly by the app(press-location dependant) but the mouse movement is still performed due to the mouse movement events)?
2019-07-15 09:36:53 -07:00
Sam Lantinga
6e31658d7c Fixed bug 4723 - Generic Xbox pad controller bindings seem odd/broken
alexrice999

I have a knock off wired xbox 360 controller called afterglow for xbox 360 controller. Despite there being a few afterglow controllers in the controller mapping the guid of my controller seems to map to Generic Xbox pad. This binding is as follows:
```
 "030000006f0e00001304000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:a0,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:a3,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
```
When running openmw I have a strange issue that the joysticks work for up and down movements but not for side to side. I managed to track this down to the side to side events being classified as joystick events instead of gamepad events.
I believe this is due to both "leftstick" and "leftx" being bound to "a0" which seems odd to me. If I change openmw's mappings to remove these the controller works as expected. I was hoping someone who knows a lot more than me (as I have only been exploring this today trying to fix my controller) would know what is happening
2019-07-14 16:59:39 -07:00
Jimb Esser
f300711f50 Blacklist Corsair device causing hang 2019-07-14 16:48:31 -07:00
Alex Szpakowski
60cae8d8af macOS: Fix SDL_GL_CreateContext/MakeCurrent on non-main threads causing a Main Thread Checker warning when built with Xcode 11 / the macOS 10.15 SDK.
Fixes bug #4714.
2019-07-13 17:04:02 -03:00
Ryan C. Gordon
5ad9adcc0e ios: Fixed MFi guide button not being detected (thanks, Caleb!).
Fixes Bugzilla #4721.
2019-07-12 21:28:43 -04:00
Ryan C. Gordon
85acfec543 cmake: Add setupapi library to Windows build dependencies (hidapi needs it).
Fixes Bugzilla #4719.
2019-07-12 13:40:58 -04:00
Ryan C. Gordon
1ceddc5a20 cocoa: Set keyboard mod state correctly when turning off capslock.
Fixes Bugzilla #4716.

--HG--
extra : rebase_source : 5b360391f52cf3a4655f9bd3a7f4a2ad0c487851
2019-07-11 01:07:14 -04:00
Sylvain Becker
aec1d08f5a x11: prevent a synthetic mouse event when using a touchscreen
With multitouch, register to receive XI_Motion (which desctivates MotionNotify),
so that we can distinguish real mouse motions from synthetic one.

(bug 4690)
2019-07-10 10:06:28 +02:00
Ryan C. Gordon
2196977939 x11: set some modality things on message boxes with parent windows.
--HG--
extra : amend_source : 48628fd472f064256c194505f50c2e4bb040f03a
2019-07-09 17:28:02 -04:00
Sylvain Becker
ecbbaa8996 SDL_Mouse/Touch: discard synthetic events when hints are not set.
Those are generated/flagged by platform layer.
2019-07-09 11:46:42 +02:00