Commit Graph

2805 Commits (8b0660b25acd1ce0a5f763fffb3d9e6f0cd8de8f)

Author SHA1 Message Date
Sam Lantinga 8b50dcb21b Use the controller product string instead of hard-coding controller names 2019-12-11 17:46:54 -08:00
Sam Lantinga 89401b21e9 Added support for the Razer Raion Fightpad for PS4 2019-12-10 13:09:52 -08:00
Sam Lantinga a21f6b7a91 Add the manufacturer to the joystick name on Mac OS X, for consistency with other drivers 2019-12-10 11:46:22 -08:00
Sam Lantinga 2a161e7add Remove any duplicate manufacturer in the joystick name 2019-12-10 11:30:56 -08:00
Sam Lantinga 3469481ef6 Don't include the manufacturer if it's already included in the product string 2019-12-10 10:00:49 -08:00
Sam Lantinga bb37a1ebf5 Fixed the name of the Razer RAION Fightpad 2019-12-10 09:38:10 -08:00
Sam Lantinga 82d2c357c3 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 3d34750ced 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 3626506369 Added some missing Xbox controller names 2019-12-09 13:54:03 -08:00
Sam Lantinga 140918bb6f 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 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
Sam Lantinga 135a90539b Fixed the Apple TV remote menu button on tvOS 13.2 (thanks Romain Tisserand) 2019-12-06 13:48:13 -08:00
Sam Lantinga 7a51ad6a50 Fixed the game controller menu button on tvOS 13.2 (thanks Romain Tisserand) 2019-12-06 13:48:10 -08:00
Ryan C. Gordon 597f11e563 cocoa: Patched to compile on older compilers. 2019-12-05 17:27:06 -05:00
Sam Lantinga 8342fa7c7e Fixed controller mapping issues caused by PS3 gyro jitter 2019-12-05 13:48:08 -08:00
Sam Lantinga 6d00166813 Get full axis range for PS3 controller triggers on Linux 2019-12-05 13:18:53 -08:00
Ryan C. Gordon ca2c8609e1 cocoa: SDL_GetDisplayDPI() should account for Retina displays.
Fixes Bugzilla #4856.
2019-12-04 12:20:24 -05:00
Sam Lantinga b7576025e3 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 e5af951eae 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 55eb76218d 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 7a3ae59037 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 3da6a0b20e 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 7b08eb481d direct3d11: Fixed incorrect texture coordinates (thanks, Martin!).
Fixes Bugzilla #4860.
2019-12-03 03:07:34 -05:00
Gerasim Troeglazov c8a2ef863e 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
Sam Lantinga b98808f639 Updated DPAD binding for 8Bitdo Zero controller 2019-11-28 14:23:24 -08:00
Sam Lantinga 2fd3f756d2 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 8aaf945b2f 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 a3a8fcef77 Added support for the 8Bitdo SN30 Pro, wired connection 2019-11-28 10:04:05 -08:00
Sam Lantinga 4a77613881 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 b8d65da459 Check for duplicates in the supported controller list 2019-11-27 15:27:21 -08:00
Sam Lantinga 0b863f8a5c 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 84f8e53c85 Fixed detection of the Mad Catz FightPad Pro 2019-11-27 15:27:16 -08:00
Sam Lantinga 98cc9cf208 Added support for the Google Stadia Controller 2019-11-27 12:38:53 -08:00
Sam Lantinga 43cb7b3c51 Added support for the Hori Fighting Commander 2019-11-27 12:38:51 -08:00
Sam Lantinga a76e547477 Added support for the PowerA XB1 Fusion Fight Pad 2019-11-27 12:38:48 -08:00
Sam Lantinga a5e6b87ce6 Added support for a variant of the PowerA FUSION Pro Controller 2019-11-26 08:35:41 -08:00
Sam Lantinga 532164366e 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 f3d95396d6 Added some missing controller names 2019-11-25 15:02:54 -08:00
Sam Lantinga 8243a3e801 Added support for the Hyperkin X91 2019-11-25 15:02:50 -08:00
Sam Lantinga 494af7a6e7 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 2713a1aae0 Moved the SteelSeries controllers into the "known controller" section 2019-11-25 13:27:26 -08:00
Sam Lantinga 26d53fbb83 Updated identification for the SteelSeries Stratus Duo 2019-11-25 11:12:09 -08:00
Sam Lantinga 308e7f2fec Linux hidapi code dynamically loads udev 2019-11-23 12:11:20 -08:00
Sam Lantinga 359ae75bb2 Fixed DragonRise Generic USB PCB showing up as a PS3 controller 2019-11-23 12:11:16 -08:00
Sam Lantinga 8e153922e4 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
Sam Lantinga 6dce9733d9 Use SDL_zeroa() appropriately 2019-11-22 16:23:37 -08:00
Sam Lantinga 733f25252a Fixed build 2019-11-22 14:09:24 -08:00
Sam Lantinga 13006ba9e1 Added support for the PDP Versus Fighting Pad 2019-11-22 13:44:40 -08: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
Sam Lantinga c0650aca21 Added support for the PDP Battlefield One controller 2019-11-21 14:04:48 -08:00
Sam Lantinga a132b183cd Fixed the guide button on the NVIDIA Controller v01.04 2019-11-21 13:09:00 -08:00
Sam Lantinga cc4f890521 Added support for the NVIDIA Controller v01.04 on Linux and Mac OS X 2019-11-21 12:11:47 -08:00
Sam Lantinga 2a7b635b9b Added support for the NVIDIA Controller v01.04 on Android 2019-11-21 11:52:50 -08:00
Sam Lantinga 51487a71b9 Added support for the MOGA XP5-A Plus 2019-11-21 10:14:57 -08:00
Ozkan Sezer 405a3c821b ran gendynapi.pl after newly added SDL_string.c functions. 2019-11-21 11:50:50 +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
Sam Lantinga ce8411c587 Fixed Xbox One Elite Series 2 showing up as 2 devices in Bluetooth mode on Windows 2019-11-20 08:43:24 -08:00
Ozkan Sezer 200d37dabb SDL.c (SDL_ExitProcess): unconstify its param to match its declaration. 2019-11-20 02:47:40 +03:00
Sam Lantinga 972a70d844 Added support for the Xbox One Elite Series 2 controller on Mac OSX 2019-11-19 15:15:00 -08:00
Sam Lantinga 68d8fc5c7b Added support for the Xbox One Elite Series 2 controller in wired mode 2019-11-18 15:46:13 -08:00
Sam Lantinga 2bfcf5cd96 Added Linux controller mapping for the Xbox One Elite Series 2 controller in Bluetooth mode 2019-11-18 14:08:05 -08:00
Sam Lantinga 1e24a1514d Added names for some missing Xbox controllers 2019-11-18 11:51:39 -08:00
Sam Lantinga 144956442d Added identifiers for the Xbox One Elite Series 2 controller 2019-11-18 11:44:51 -08:00
Sam Lantinga df728f8591 Fixed unused function warning on Android 2019-11-18 10:48:14 -08:00
Sam Lantinga dd7fe0af08 Fixed bug 4814 - Missing scancodes on Linux
Michael Roe

The mappings for keyboard scancodes on Linux do not include keypad left and right parentheses (used on some Microsoft keyboard), keypad plus/minus, LANG1 and LANG2 (used on Korean keyboards), XK86MenuKB, and F20 (remapped to Audio Mic Mute in the usual X11 config).
2019-11-16 22:45:49 -08:00
Sam Lantinga b1539c4c49 Fixed bug 4819 - Attempting to create an OpenGL ES context with unachievable MSAA parameters under X11 dooms the program
Solra Bizna

I have written a program that, in the event that the user requests more MSAA samples than their hardware supports, attempts to gracefully fall back to the best MSAA available. This code works with my conventional OpenGL renderer, but if I change nothing about the code except to make it request an OpenGL ES profile instead, Xlib kills the program with an error that looks like:

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  4 (X_DestroyWindow)
  Resource id in failed request:  0x5c00008
  Serial number of failed request:  188
  Current serial number in output stream:  193

To trigger the bug, attempt to create a window with the SDL_WINDOW_OPENGL flag, with SDL_GL_CONTEXT_PROFILE_MASK set to SDL_GL_CONTEXT_PROFILE_ES, and with SDL_GL_MULTISAMPLESAMPLES set to any unsupported value. SDL_CreateWindow properly returns NULL, but at this point the program is already doomed. Xlib will shortly terminate the program with an error. Calling SDL_CreateWindow again will immediately trigger this termination.

I have attached a skeletal program that reproduces this bug for me. Replacing SDL_GL_CONTEXT_PROFILE_ES with SDL_GL_CONTEXT_PROFILE_COMPATIBILITY avoids the bug (but, obviously, doesn't create an OpenGL ES context).

As I suspected, the problem was with XDestroyWindow being called twice on the same window. The X11_CreateWindow function in src/video/x11/SDL_x11window.c calls SetupWindowData. If initialization fails after that point, XDestroyWindow gets called on the window by a subsequent call to X11_DestroyWindow. But, later in the same function, iff a GLES context is requested and initializing it fails, X11_XDestroyWindow (which wraps XDestroyWindow) is manually called. Shortly after, the intended call to X11_DestroyWindow occurs, which attempts to destroy the same window again. Boom.

(The above confusing summary involves three separate, similarly-named functions: XDestroyWindow, X11_DestroyWindow, X11_XDestroyWindow)

I have attached a simple patch that removes the redundant X11_XDestroyWindow calls. I've tested that XDestroyWindow still gets called for the windows in question, and that it only gets called once.
2019-11-16 22:35:48 -08:00
Cameron Cawley 85aabec27e atomic: Support compiling on ARMv3 2019-10-11 22:08:53 +01:00
Cameron Cawley 20ddf45ede Added SDL_PIXELFORMAT_BGR444 2019-11-02 22:58:52 +00:00
Sam Lantinga a9ac9e3865 Don't try to use this driver with the Xbox One S in Bluetooth mode on Linux 2019-11-16 19:58:29 -08:00
Sam Lantinga 9ca5373024 Added support for the Xbox One S controller in Bluetooth mode on Linux 2019-11-16 19:55:53 -08:00
Sylvain Becker 9d4c3f12cd Fix missing prototype warning 2019-11-16 22:59:56 +01:00
Sylvain Becker 2dab79bcc2 Fix crash when detecting SIMD 2019-11-16 22:55:36 +01:00
Sam Lantinga cf33f1f0ef Added a utility function to simplify the hint handling logic 2019-11-13 21:53:01 -08:00
Sam Lantinga a63e93a193 Supported Android and Apple hardware has ARM SIMD capability 2019-11-13 15:46:58 -08: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 b44fe0f838 haiku: Rename BE_* entities to HAIKU_*
In favor Bugzilla #2349.
Update copyright years to 2019.

Partially fixes Bugzilla #4442.
2019-11-12 17:24:37 -05:00
Peter Kosyh 33ae5e5e99 haiku: mouse_relative fix
Partially fixes Bugzilla #4442.
2019-11-11 22:23:33 -05:00
Peter Kosyh 79510b7569 haiku: mouse->ShowMouse method added
Partially fixes Bugzilla #4442.
2019-11-11 22:22:40 -05:00
Gerasim Troeglazov 95a402d745 haiku: Add support for relative mouse mode.
Partially fixes Bugzilla #4442.
2019-11-11 22:21:17 -05:00
Gerasim Troeglazov bd648bd5a3 haiku: Add simple relative mode for mouse.
Partially fixes Bugzilla #4442.
2019-11-11 22:18:21 -05:00
Adrien Destugues 3b516e633b haiku: Fix crash when opening window.
- _num_clips was not set in constructor, so a NULL _clips could be
  mistakenly dereferenced.
- As _clips is accessible outside the class, it is not a good idea to
  free/reallocate it. Try to limit this by reallocating only when it needs to
  grow.

Partially fixes Bugzilla #4442.
2019-11-11 22:14:00 -05:00
Jerome Duval 50806eeea2 haiku: use addr_t instead of size_t for OpenGL dynamic loading.
Partially fixes Bugzilla #4442.
2019-11-11 22:04:10 -05:00
Peter Kosyh 55b5d8dce6 haiku: Invert mouse wheel values to match what SDL expects.
Partially fixes Bugzilla #4442.
2019-11-11 21:59:39 -05: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
Ozkan Sezer a365c7f6fb ran gendynapi.pl after SDL_HasARMSIMD() addition 2019-11-04 11:15:24 +03:00
Sylvain Becker 303646a697 Android: some readability: redundant casts, deads stores, redundant control flow 2019-10-31 15:53:10 +01:00
Ozkan Sezer fea3c8bdef SDL_qsort.c: sync comments with version 1.15 from mainstream 2019-10-31 17:10:02 +03:00
Sylvain Becker 88ba6798e9 Wayland: touch events, use of memory after it is freed 2019-10-30 21:12:36 +01:00
Sylvain Becker 86ae245bc0 Use correct enum: typo in org_kde_kwin_server_decoration_mode
instead of org_kde_kwin_server_decoration_manager_mode
2019-10-30 17:59:20 +01:00
Sylvain Becker 81cdd50002 Remove redundant 'SDL_GetErrBuf' declaration 2019-10-30 17:35:40 +01:00
Sylvain Becker 9e509e4a4f SDL_render_gles2: remove ineffective widening cast
warning: either cast from 'int' to 'size_t' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast]
2019-10-30 16:45:53 +01:00
Sylvain Becker ce308a7841 revert this const parameter for X11 function 2019-10-30 16:33:32 +01:00
Sylvain Becker dab55a8d23 Readability: remove redundant cast 2019-10-30 16:20:58 +01:00
Sylvain Becker f16e51068b Fix const warning in RLE getpix functions 2019-10-30 16:17:59 +01:00
Sylvain Becker 25d53a4475 SDL_syspower.c: remove redundant expression 2019-10-30 16:12:39 +01:00
Sylvain Becker d4a67e2541 Readability: change some pointer parameter to be pointer to const 2019-10-30 16:06:51 +01:00
Sylvain Becker 3d100df36f Readability: remove const-qualifation from function declaration
const-qualification of parameters only has an effect in function definitions
2019-10-30 15:43:49 +01:00
Sylvain Becker 60d3965ece Readability: remove redundant return, continue, enum declaration 2019-10-30 15:36:17 +01:00
Sylvain Becker b458d7a28f Readability: remove redundant cast to the same type 2019-10-30 15:13:55 +01:00