Commit graph

11672 commits

Author SHA1 Message Date
Sam Lantinga
f40a11945f Remove any duplicate manufacturer in the joystick name 2019-12-10 11:30:56 -08:00
Sam Lantinga
7a51772418 Don't include the manufacturer if it's already included in the product string 2019-12-10 10:00:49 -08:00
Sam Lantinga
77784463c1 Fixed the name of the Razer RAION Fightpad 2019-12-10 09:38:10 -08:00
Sam Lantinga
60d180e428 Fixed rumble after Xbox controller initialization
When we initialize the controller it has an internal rumble sequence number, and if our rumble sequence number doesn't match that, rumble won't happen. To fix that we cycle through the range of sequence numbers, and at some point we'll match up with the controller's sequence number and it'll roll forward until it matches our next rumble sequence number.
2019-12-09 16:52:11 -08:00
Sam Lantinga
662e995ae9 The PowerA Mini controller blocks while writing feature reports, so don't try to use the HIDAPI driver for it on Linux 2019-12-09 13:54:05 -08:00
Sam Lantinga
80bc288d57 Added some missing Xbox controller names 2019-12-09 13:54:03 -08:00
Sam Lantinga
91b24c357b Fixed bug 4883 - Add approximation for display DPI on iOS
Aaron Barany

There appears to be no way to directly access the display DPI on iOS, so as an approximation the DPI for the iPhone 1 is used as a base value and is multiplied by the screen's scale. This should at least give a ballpark number for the various screen scales. (based on https://stackoverflow.com/questions/25756087/detecting-iphone-6-6-screen-sizes-in-point-values it appears that both 2x and 3x are used)

I have updated the patch to use a table of current devices and use a computation as a fallback. I have also updated the fallback computation to be more accurate.
2019-12-08 11:36:40 -08:00
Sam Lantinga
9c591a8538 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
Sam Lantinga
0bac215ef1 Fixed the Apple TV remote menu button on tvOS 13.2 (thanks Romain Tisserand) 2019-12-06 13:48:13 -08:00
Sam Lantinga
1261b79fa7 Fixed the game controller menu button on tvOS 13.2 (thanks Romain Tisserand) 2019-12-06 13:48:10 -08:00
Ryan C. Gordon
d4ae38e3de cocoa: Patched to compile on older compilers.
--HG--
extra : rebase_source : 5208ac48839c78cc7c88614cf5eceab92a0d79fc
2019-12-05 17:27:06 -05:00
Sam Lantinga
fa5fc94422 Fixed controller mapping issues caused by PS3 gyro jitter 2019-12-05 13:48:08 -08:00
Sam Lantinga
54dbdfc8eb Ignore axis jitter when mapping controllers 2019-12-05 13:18:56 -08:00
Sam Lantinga
e3ef217e93 Get full axis range for PS3 controller triggers on Linux 2019-12-05 13:18:53 -08:00
Ryan C. Gordon
bf9b22caa9 cocoa: SDL_GetDisplayDPI() should account for Retina displays.
Fixes Bugzilla #4856.
2019-12-04 12:20:24 -05:00
Sam Lantinga
eef3b51057 Fixed bug 4882 - Fix build for iOS when disabling OpenGL
Aaron Barany

Since OpenGL is deprecated on iOS, it is advantageous to be able to remove all OpenGL related code when building SDL for iOS. This patch adds the necessary #if checks to compile in this case.
2019-12-03 22:07:58 -08:00
Alex Smith
d3aa0260ee Fix sending SDL_WINDOWEVENT_RESTORED after unminimizing windows on X11
SDL_SendWindowEvent will only send a RESTORED event if the window has
the minimized or maximized flag set. However, for a SHOWN event, it
will clear the minimized flag. Since the SHOWN event was being sent
first for a MapNotify event, the RESTORED event would never be sent.
Swapping the SendWindowEvent calls around fixes this.

https://bugzilla.libsdl.org/show_bug.cgi?id=4821
2019-12-02 15:41:25 +00:00
Cameron Gutman
59728f9802 Use stat() to minimize input device opens when not using udev
Calling open() on input devices can generate device I/O which blocks
the main thread and causes dropped frames. Using stat() we can avoid
opening anything unless /dev/input has changed since we last polled.

We could have used something fancy like inotify, but it didn't seem
worth the added complexity for this uncommon non-udev case.
2019-11-20 20:27:45 -08:00
Sam Lantinga
8fd426855c Fixed bug 4877 - Add support for loading menus from a nib/xib instead of building a hardcoded minimum set
Eric Shepherd

Currently, SDL on Cocoa macOS creates a rudimentary menu bar programmatically if none is already present when the app is registered during setup.

SDL could be much more easily and flexibly used on macOS if upon finding that no menus are currently in place, it first looked for the application's main menu nib or xib file and, if found, loaded that instead of programmatically building the menus.

This would then let developers simply drop in a nib file with a menu bar defined in it and it would be installed and used automatically.

Attached is a patch that does just this. It changes the SDL_cocoaevents.m file to:

* In Cocoa_RegisterApp(), before calling CreateApplicationMenus(), it calls a new function, LoadMainMenuNibIfAvailable(), which attempts to load and install the main menu nib file, using the nib name fetched from the Info.plist file. If that succeeds, LoadMainMenuNibIfAvailable() returns true; otherwise false.
* If LMMNIA() returns false, CreateApplicationMenus() is called to programmatically build the menus as before.
* Otherwise, we're done, and using the menus from the nib/xib file!

I made these changes to support a project I'm working on, and felt they were useful enough to be worth offering them for uplift. They should have zero impact on existing projects' behavior, but make Cocoa SDL development miles easier.
2019-12-03 07:12:55 -08:00
Ryan C. Gordon
152078a690 pulseaudio: don't let FlushCapture get stuck in an infinite loop on shutdown.
Fixes Bugzilla #4645.
2019-12-03 03:53:06 -05:00
Ryan C. Gordon
8a8f825f18 direct3d11: Fixed incorrect texture coordinates (thanks, Martin!).
Fixes Bugzilla #4860.
2019-12-03 03:07:34 -05:00
Gerasim Troeglazov
216706a976 haiku: Disable pointer history
(note from PulkoMandy on Bugzilla #4442 about why this is a desirable patch:
"The event mask: note that the window and GL view run in their own thread
which I don't expect to be too much CPU bound, and will quickly pop these
messages and forward them to the main thread in our SDL code. Therefore the
B_NO_POINTER_HISTORY should be no problem, and is the default on Haiku
anyway (it was not in BeOS, but we changed that and added a
B_FULL_POINTER_HISTORY flag to request the old behavior explicitly). So, this
seems fine.")

Partially fixes Bugzilla #4442.
2019-12-03 02:49:01 -05:00
Ryan C. Gordon
f1d916b454 cmake: ${SDL_CMAKE_DEBUG_POSTFIX} needs to be wrapped in quotes.
Otherwise, if it's an empty string, it causes problems.

Fixes Bugzilla #4117.
2019-12-03 02:42:53 -05:00
Sam Lantinga
a975a672c8 Updated DPAD binding for 8Bitdo Zero controller 2019-11-28 14:23:24 -08:00
Sam Lantinga
a8b35bc28c Fixed trying to use the HIDAPI driver for the original Xbox One S Bluetooth controller 2019-11-28 11:44:17 -08:00
Sam Lantinga
dee346af66 Fixed mapping controllers that have axes that start at -32768 and then snap to 0 at the first input report 2019-11-28 11:44:15 -08:00
Sam Lantinga
668f2bd321 Added support for the 8Bitdo SN30 Pro, wired connection 2019-11-28 10:04:05 -08:00
Sam Lantinga
e28b12ca6a Added the full Xbox One Elite Series 2 controller initialization sequence, to start input reports after switching out of Bluetooth mode. 2019-11-27 18:26:57 -08:00
Sam Lantinga
5d869a7e59 Backed out changeset 6f0ec1079286, which fixed bug 4775
This change broke individual key events, so I'm reverting the change until we can investigate a better fix.
2019-11-27 17:17:03 -08:00
Sam Lantinga
a0a3169d7f Check for duplicates in the supported controller list 2019-11-27 15:27:21 -08:00
Sam Lantinga
03f52303a9 Sorted controller entries by type and VID/PID to more easily find entries in the list 2019-11-27 15:27:19 -08:00
Sam Lantinga
5472c08f0e Fixed detection of the Mad Catz FightPad Pro 2019-11-27 15:27:16 -08:00
Sam Lantinga
78ab9d822d Added support for the Google Stadia Controller 2019-11-27 12:38:53 -08:00
Sam Lantinga
751809cca4 Added support for the Hori Fighting Commander 2019-11-27 12:38:51 -08:00
Sam Lantinga
85e1d73e12 Added support for the PowerA XB1 Fusion Fight Pad 2019-11-27 12:38:48 -08:00
Ozkan Sezer
4205214211 CMakeLists.txt: sync DYLIB_CURRENT_VERSION to Xcode project 2019-11-26 20:41:00 +03:00
Sam Lantinga
3a04fa45ce Added support for a variant of the PowerA FUSION Pro Controller 2019-11-26 08:35:41 -08:00
Sam Lantinga
bc1cfae60e Use the same logic to get the config descriptor in hid_open() as in hid_enumerate() 2019-11-25 16:29:12 -08:00
Sam Lantinga
8c5dc58b2f Added some missing controller names 2019-11-25 15:02:54 -08:00
Sam Lantinga
346666653f Added support for the Hyperkin X91 2019-11-25 15:02:50 -08:00
Sam Lantinga
7eecaefd82 Use SDL_hidapi.c instead of the platform specific hid.c implementations when libusb isn't available 2019-11-25 15:02:48 -08:00
Sam Lantinga
1d549300f2 Backed out change to dynamically load udev - it's already happening in SDL_hidapi.c 2019-11-25 15:02:45 -08:00
Sam Lantinga
6b61f030d5 Moved the SteelSeries controllers into the "known controller" section 2019-11-25 13:27:26 -08:00
Sam Lantinga
a7a866b321 Updated identification for the SteelSeries Stratus Duo 2019-11-25 11:12:09 -08:00
Sam Lantinga
87e9b82737 Linux hidapi code dynamically loads udev 2019-11-23 12:11:20 -08:00
Sam Lantinga
6cb3b5112c Fixed DragonRise Generic USB PCB showing up as a PS3 controller 2019-11-23 12:11:16 -08:00
Sam Lantinga
11431c5c53 Added the Linux hidraw sources when libusb isn't available 2019-11-23 11:35:20 -08:00
Sam Lantinga
2fba75a8fe This packet didn't end up being needed to initialize input for the Xbox One Elite Series 2 controller 2019-11-22 17:46:30 -08:00
Ozkan Sezer
9bb60d130b SDL_gamecontroller.h: remove comma at end of enumerator list 2019-11-23 03:28:02 +03:00
Sam Lantinga
07880dca0e Use SDL_zeroa() appropriately 2019-11-22 16:23:37 -08:00