Commit Graph

6650 Commits

Author SHA1 Message Date
Sam Lantinga
f430ef5ddc Don't change the window position when creating it on iOS, it is already placed on the correct display 2022-11-10 17:27:48 -08:00
Sam Lantinga
7c05ea0a0e Added mappings for the GameSir T3 and T4 Pro controllers 2022-11-10 13:35:59 -08:00
Sam Lantinga
404cb27677 Added macOS mappings for the Nintendo Switch Pro Controller over Bluetooth 2022-11-10 13:28:03 -08:00
pionere
29cafa9c94 add SDL_ContextNotSupported and validate flags in SDL_RecreateWindow similar to SDL_CreateWindow 2022-11-10 06:56:24 -08:00
Ryan C. Gordon
1008cc8e5f
video: Add some braces to match SDL coding style. 2022-11-09 12:55:27 -05:00
pionere
ac3349faaf solve FIXMEs in SDL_video.c 2022-11-09 12:54:07 -05:00
pionere
e5c599f8c6 fix SOLARIS_ATOMICS
- use 'sizeless' int types (int uses 32-bit even if _LP64 is set)
2022-11-09 12:45:14 -05:00
pionere
b095df7f5c simplify MSC_ATOMICS
- use _Interlocked(Compare)ExchangePointer in case of _M_IX86 as well
- improve assertions:
  1. add assertions to SDL_AtomicAdd/SDL_AtomicSet and SDL_AtomicCAS
  2. use sizeof(a->value) instead of sizeof(int)
2022-11-08 10:32:31 -08:00
meyraud705
3dc88da022 Fix Dualshock 4 rumble stopping too early
Dualshock 4 controller only rumbles for 5 seconds maximum. Resend
rumble command every 2 seconds to make long rumble work.
2022-11-08 10:30:11 -08:00
Sam Lantinga
6432f45a1c Don't treat the Nintendo IMU as a separate game controller on Linux 2022-11-08 10:27:21 -08:00
Sam Lantinga
2e3b4f3fd7 Don't send rumble to the Amazon Luna controller on macOS
Sending rumble to the Amazon Luna controller on macOS gets there, but IOHIDDeviceSetReport() blocks for a long time and eventually fails.

This appears to be a bug in the macOS Bluetooth stack, ref rdar://99265496
2022-11-08 07:50:51 -08:00
Sam Lantinga
02bc359b64 Shorten "Bensussen Deutsch & Associates,Inc.(BDA)" to "BDA" for controller names 2022-11-07 19:31:18 -08:00
Ryan C. Gordon
b0dc6709b9 coreaudio: Don't use deprecated kAudioObjectPropertyElementMaster symbol.
Fixes #6449.
2022-11-07 14:26:48 -05:00
pionere
e873d60981 fix handling of SDL_EventQ.active
- SDL_EventQ.active is a bool variable -> do not use SDL_AtomicGet/Set, it does not help in any way
- protect SDL_EventQ.active with SDL_EventQ.lock
- set SDL_EventQ.active to FALSE by default
2022-11-07 09:12:37 -08:00
pionere
eb670742f5 better SDL_AtomicGet(Ptr) implementation 2022-11-07 09:09:37 -08:00
Hubert Maier
5dc93451d2
JANITORIAL : Correct some more spelling mistakes (#6489) 2022-11-06 11:49:37 -08:00
Sam Lantinga
c2675d74c5 Revert "cocoa: Discard the IME Candidate Window immediately when Escape is pressed"
This reverts commit 0d76e2a8a1, as it introduced other issues:
https://github.com/libsdl-org/SDL/pull/6486#issuecomment-1304684865
2022-11-06 10:52:20 -08:00
Sam Lantinga
f2ce7c5fb2 Added the G29 as a PlayStation controller 2022-11-06 08:23:08 -08:00
Sam Lantinga
9d1dbd2ad8 Added note about trigger rumble availability across third-party Xbox One controllers 2022-11-06 01:16:52 -08:00
Sam Lantinga
e7a56323ab Make sure we wait after sending the rumble packet when initializing the PowerA Xbox One Mini Wired Controller 2022-11-06 01:43:05 -07:00
Sam Lantinga
6875e62af3 Make sure we don't send Xbox controllers rumble so quickly that it overwhelms the firmware
Fixes https://github.com/libsdl-org/SDL/issues/6435
2022-11-06 01:15:20 -07:00
Sam Lantinga
38af459dd9 Fixed potential clobbering of packets of different types using SDL_HIDAPI_SendRumble() 2022-11-06 01:15:19 -07:00
Sam Lantinga
e45cb5b1e2 Fixed initializing the PowerA Xbox One Mini Wired Controller 2022-11-06 01:15:18 -07:00
Edward Li
0d76e2a8a1 cocoa: Discard the IME Candidate Window immediately when Escape is pressed 2022-11-05 17:03:10 -07:00
Sam Lantinga
15a9890919 Added SDL_HINT_HIDAPI_IGNORE_DEVICES to specify devices that should be ignored in SDL_hid_enumerate() 2022-11-05 16:44:52 -07:00
Sam Lantinga
297ecb706d Added SDL_strcasestr() for a case insensitive version of SDL_strstr() 2022-11-05 15:58:30 -07:00
Sam Lantinga
a4626dea8d Fixed initializing the PDP Xbox One and Victrix Gambit controllers 2022-11-05 14:24:41 -07:00
Sam Lantinga
7e11b09b3b The PowerA Xbox One Mini Wired Controller works with the HIDAPI driver now 2022-11-05 13:50:37 -07:00
Sam Lantinga
a2d66b6a91 SDL_GameControllerMapping() should return the string for the actual mapping that was used when opening a gamecontroller, rather than do a GUID match again
Also don't match against the zero guid if that happens to be in the mapping list for some reason
2022-11-05 13:12:10 -07:00
Stefan Sperling
f3bf543e2a recognize game controllers connected via raphnet technologies WUSBMote v2.2
This is a USB adapter for controllers shipped with Nintendo's NES-mini and
SNES-mini consoles.
Tested with both NES and SNES controllers, buttons map as expected on both.
2022-11-05 10:35:07 -07:00
Sam Lantinga
24cdebe464 Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED to control the brightness of the Xbox button LED on the Xbox One controller 2022-11-05 10:34:08 -07:00
Ryan C. Gordon
78f97108f9
audio: Avoid accumulation errors in resampler.
Fixes #6391.
2022-11-05 10:39:35 -04:00
David Edmundson
689218ebf5 Fix wayland reconnection paths
Most of this code is disabled out for now.

- For mouse cursors we have a wl_surface for both system and custom
cursors which needs recreating.
 - The other patch is about nullification after deletions
2022-11-04 11:13:30 -04:00
Sam Lantinga
33a68f575f Added Linux mappings for the Logitech G29 in PS3 and PS4 modes 2022-11-03 16:02:58 -07:00
Sam Lantinga
c70e675900 Wait a bit for devices to initialize before trying to enumerate and open them.
This works around udev event nodes arriving before hidraw nodes and the controller being opened twice - once using the Linux driver and once by the HIDAPI driver.

This also fixes a kernel panic on Steam Link hardware due to trying to open the hidraw device node too early.

A delay of 10 ms seems to be a good value, tested on Steam Link hardware.
2022-11-03 12:37:54 -07:00
Guldoman
084fa4c3fa cocoa: Reset IME when sending composed text
This will send an empty `TEXTEDITING` event that is used to signal the 
end of the composition.
2022-11-03 10:41:53 -07:00
Guldoman
70a41f9bc2 wayland: Read window data only if window is valid 2022-11-01 05:14:05 -07:00
Sam Lantinga
b75d318776 Sometimes the HID open doesn't succeed immediately after being notified about the device
Tested on Steam Link hardware with the Nintendo Switch Pro controller, which will occasionally take 2 attempts to open.
2022-10-31 13:33:53 -07:00
Jasper Hugunin
27ee8c8e14 Fix mismatch between Init and Quit
Init says that audio implies events (line 195), Quit was missing the implication.
2022-10-31 11:22:40 -07:00
Frank Praznik
33a430056f wayland: Don't modify the mouse capture flag in relative mode
If relative mouse mode is explicitly enabled, don't modify the capture flag on button events or the window might report having lost mouse focus if a button is pressed while moving the cursor.
2022-10-31 10:13:58 -07:00
Hubert Maier
678ef7977f SDL_KMSDRMOPENGLES.H: Correct spelling mistakes
begining -> beginning
beggining -> beginning
2022-10-30 11:24:42 -04:00
Hubert Maier
8b9c82e140 SDL_RENDER_PSP.C: Correct spelling mistakes
wether -> whether
2022-10-30 11:24:42 -04:00
Hubert Maier
3369b0163f SDL_PS2_MAIN.C: Correct spelling mistake
untill -> until
2022-10-30 11:24:42 -04:00
Hubert Maier
d7a46a16e9 SDL_SYSLOADSO.c: Correct spelling mistake
publically -> publicly
2022-10-30 11:24:42 -04:00
Hubert Maier
6a881302ad SDL_IBUS.H: Correct spelling mistake
recieve -> receive
2022-10-30 11:24:42 -04:00
Hubert Maier
61f3662c95 SDL_QSA_AUDIO.C: Correct spelling mistake
occured -> occurred
2022-10-30 11:24:42 -04:00
Ethan Lee
571ff1a3a9 wayland: Prepare cursor implementation for reconnect support
Co-authored-by: David Edmundson <kde@davidedmundson.co.uk>
2022-10-30 00:19:09 -04:00
Ethan Lee
9c8b1fd8b6 wayland: Cleanup work to aid reconnect support
Co-authored-by: David Edmundson <kde@davidedmundson.co.uk>
2022-10-29 22:41:42 -04:00
Sam Lantinga
f6b1e028ab Allow vendor matching for hid_enumerate() on all backends 2022-10-29 10:43:11 -07:00
Sam Lantinga
4556074e18 Re-set the maximize state if we were maximized while fullscreen 2022-10-29 09:35:07 -07:00
Sam Lantinga
ab06a307dc Don't report windows being maximized when fullscreen on X11
This is a functional state for some window managers (tested using stock Ubuntu 22.04.1), and removing that state, e.g. using SDL_RestoreWindow(), results in a window centered and floating, and not visually covering the rest of the desktop.
2022-10-29 09:21:17 -07:00
Ryan C. Gordon
b9e1d1b4de events: Rename SDL_SendKeyboardKeyComplete to SDL_SendKeyboardKeyAndKeycode.+ 2022-10-28 16:19:00 -04:00
Ryan C. Gordon
9221548114 emscripten: Make an attempt at correct keyboard scancode/keycodes.
This uses a newer browser API to get physical scancodes, but still
uses the (deprecated) event field that we were already using for
scancodes, but for keycodes instead now, which appears to be more
accurate.

Since keyboard layout isn't (generally) available to web apps, this
adds an internal interface to send key events with both scancode
and keycode to SDL's internals, instead of sending just scancodes and
expecting SDL to use its own keymap to generate keycodes.

Future work in this area would be to use the keyboard layout APIs
on browsers that support them, which would allow us to use SDL's
usual keymap code and not rely on a deprecated browser API, but
until we get there, this patch gives significantly more correct
results than we would have before.

Fixes #2098.
2022-10-28 16:19:00 -04:00
Francisco Javier Trujillo Mata
a8f019b1f0 Using ST and removing warnings 2022-10-28 11:42:44 -07:00
Francisco Javier Trujillo Mata
f2ebedae92 adding texture function 2022-10-28 11:42:44 -07:00
Francisco Javier Trujillo Mata
5de01eb0aa Make render to use new functions 2022-10-28 11:42:44 -07:00
Sam Lantinga
f500c14766 Fixed DirectFB build 2022-10-28 08:39:02 -07:00
Ryan C. Gordon
9e8d2f3948
video: Don't use texture framebuffer on Windows Subsystem for Linux.
Reference Issue #6333.
2022-10-27 13:54:53 -04:00
Frank Praznik
4223e6ac7a wayland: Early-out sooner when requesting fullscreen on a popup
Exit the fullscreen sequence sooner if it is requested that a popup window be fullscreen.

The surface commit formerly in this path is irrelevant and can be removed as previous changes made it so that SetFullscreen() is no longer called from anywhere except Wayland_SetWindowFullscreen().
2022-10-26 22:19:59 -04:00
Ryan C. Gordon
41d38c0f64 shape: More robust handling of failure cases in CreateShaper. 2022-10-26 13:57:49 -04:00
Ryan C. Gordon
c8d20f96ba shape: Free platform-specific shaped window data.
Fixes #2128.
2022-10-26 13:57:49 -04:00
Frank Praznik
30c2dac787 wayland: Remove duplicate #include statement 2022-10-25 17:03:25 -07:00
Sam Lantinga
25d0473aad Removed Razer Onza Tournament Edition mapping
The controller can use either hat or buttons for the D-Pad, depending on what Linux driver is in use. The automatic mapping in LINUX_JoystickGetGamepadMapping() will do the right thing based on the exposed capability bits.

I'm sure this is the case for other controllers as well, so we might be removing more mappings over time.
2022-10-25 16:14:26 -07:00
Sam Lantinga
e837debc25 Bindings should have a trailing comma, so the CRC can be appended 2022-10-25 16:13:50 -07:00
Sam Lantinga
b6cf889af4 Use ScreenCount() instead of SDL_GetNumVideoDisplays()
The limitation appears to be specific to multi-screen setups
2022-10-25 15:10:50 -07:00
Sam Lantinga
c74ea994a5 Added support for the Razer Raiju Tournament Edition controller in Bluetooth mode 2022-10-25 13:11:41 -07:00
Sam Lantinga
72f6e216dc Disabled debug logging 2022-10-25 12:25:57 -07:00
Sam Lantinga
e3f5744db4 Don't use XIWarpPointer() on multi-display configurations 2022-10-25 12:14:00 -07:00
Alynne
5fbf8f6cf0 Adds DualSense Edge 2022-10-25 10:32:44 -07:00
Sam Lantinga
da478d1f66 Fixed build 2022-10-25 10:30:56 -07:00
Sam Lantinga
a6018ae57f Added support for the NVIDIA SHIELD controller v1.03 to the HIDAPI driver 2022-10-25 10:23:51 -07:00
Ozkan Sezer
20beed3029 SDL_EGL_GetProcAddress: remove unnecessary underscore-prepended search.
Closes https://github.com/libsdl-org/SDL/issues/6236.
2022-10-25 14:56:32 +03:00
Steven Noonan
053b5f85f1 SDL_windowsevents: minimize white screen flash on window creation
Clear the window to black on the initial window draw, to avoid a really
obnoxious white flash. This doesn't always eliminate it, but it
definitely minimizes it.
2022-10-24 10:39:37 -07:00
Steven Noonan
d2300516c3 cocoa: set sRGB colorspace on nswindow
This makes the colorspace match across different graphics APIs. By
default, OpenGL was getting a much more saturated colorspace (maybe
Display P3?) and it was looking very different from the rendering done
by Metal or MoltenVK.
2022-10-24 10:38:59 -07:00
Steven Noonan
019e9d4c92 SDL_cocoavideo.m: add missing SDL_cocoaopengles.h include 2022-10-24 10:38:36 -07:00
Sam Lantinga
dd72f3f03d Added comment for #endif 2022-10-24 10:37:43 -07:00
Steven Noonan
3d35c08585 fix a few 'unused but set variable' and 'unused function' warnings 2022-10-24 10:36:56 -07:00
Sam Lantinga
f4d1f5ed54 SDL-HIDPS4: fix PS4 Slim controller over BT - it sends the same input report as the it does over USB, but with a larger packet size
CR: saml
2022-10-23 16:35:36 -07:00
Thomas Cashman
8db3a33872 #6433 Fix WINRT_IsScreenKeyboardShown on Xbox 2022-10-23 11:42:11 -07:00
Sam Lantinga
413500ab69 Replaced mouseWheelGesture with GCMouse support on iOS (thanks @russelltg!)
Fixes https://github.com/libsdl-org/SDL/issues/6411
2022-10-22 09:37:34 -07:00
Deve
2ebaafa6c9 Use translationInView for mouse wheel event 2022-10-22 09:31:39 -07:00
Anonymous Maarten
c3b13346e0 On x86, pass -nodefaultlib to linker when wanting to avoid the C library 2022-10-22 09:28:00 -07:00
Sam Lantinga
5b8f830e34 Virtual joysticks don't need initial axis jitter protection
Fixes https://github.com/libsdl-org/SDL/issues/6426
2022-10-22 09:25:09 -07:00
Ozkan Sezer
0e1d19cf68 fix build errors resulting from -Wmisleading-indentation 2022-10-22 18:56:40 +03:00
Sam Lantinga
a905a7869f Clear the previous bitmap when calculating a new window shape
Fixes https://github.com/libsdl-org/SDL/issues/6428
2022-10-22 08:50:18 -07:00
Ozkan Sezer
65a38a4015 hidapi, libusb: remove os/2 symbol load hack after os/2 loadso updates 2022-10-22 08:40:16 -07:00
Ozkan Sezer
3f1b5efcca os2 loadso improvements:
- SDL_LoadObject: upon failure, strip the .dll extension and retry,
  but only if module name has no path.
- SDL_LoadFunction: upon failure, retry with an underscore prepended,
  e.g. for gcc-built dlls.
2022-10-22 08:40:16 -07:00
Ozkan Sezer
3d415bc5d6 loadso, dlsym, SDL_LoadFunction: cleanup the underscored name path.
- strlcpy was passed a wrong buffer length parameter. has worked so
  far by luck.
- use memcpy instead of strlcpy for simplicity.
- 'append' has been a typo: should be 'prepend'.
2022-10-22 07:25:46 -04:00
Ozkan Sezer
4264c0b674 os2: fix error message for SDL_LoadObject() 2022-10-21 11:21:40 +03:00
Ryan C. Gordon
e7ab581d79
coreaudio: Dispose of AudioQueue before waiting on the thread.
Otherwise the thread might block for a long time (more than 10 seconds!).
It's not clear to me why this happens, or why its safe to do this with a
resource that's still in use, but we have, until recently, always
disposed of the AudioQueue first, so changing back is probably okay.

Also changed the disposal to allow in-flight buffers to reach hardware;
otherwise you lose the last little bit of audio that's already been queued
but not played, which you can hear clearly in the loopwave test program.

Fixes #6377.
2022-10-19 09:14:16 -04:00
Sam Lantinga
aefc6b5bb5 Renamed variables, index is the singular of indices 2022-10-18 08:40:03 -07:00
GNQG
965ba1e097 fix SDL_SendEditingText when long composition text is enabled and strlen(text) == SDL_TEXTEDITINGEVENT_TEXT_SIZE 2022-10-18 08:26:27 -07:00
Sylvain
dfbb93dd0c
SDL_Renderer / GLES2: add specific list of indice to render rect (see #6401) 2022-10-18 11:31:30 +02:00
Sylvain
e8a4c23ce5
Revert commit 790fa3156c.
SDL_BLENDMODE_INVALID case is probably used for custom blendmode
2022-10-18 10:45:01 +02:00
Sylvain
790fa3156c
Fix warning: enumeration value 'SDL_BLENDMODE_INVALID' not explicitly handled in switch 2022-10-18 10:41:10 +02:00
Sylvain
3d99d31026
Fixed bug #6401 - back-end can choose the order the triangles when rendering rects, attempt to fix small glitch rendering. 2022-10-18 10:34:56 +02:00
Sylvain
285cbf6fdd
Revert commit 485bb3565b.
"Fixed bug #6401 - change the order of triangles when using RenderCopy, RenderCopyEx and RenderFillRect"
because the glitch reappears on other backend
2022-10-18 10:04:06 +02:00
Sam Lantinga
0bc852ce53 Revert "Disable the RAWINPUT joystick driver by default"
Disabling RAWINPUT on Windows 10 causes these issues:
* All Xbox controllers are named "XInput Controller".
* Trigger rumble no longer works.
* "XInput Controllers" are now also listed as separate haptic devices
2022-10-17 17:43:06 -07:00
Deve
7e1088167a Fixed command modifier on macOS 2022-10-17 16:49:21 -07:00
Deve
cdf312c83d Fixed mouse warp after resizing window on macOS. 2022-10-17 16:27:40 -07:00
David Jacewicz
7c7cd2a605 Fix issue #6037 (incorrect modifier flags on Wayland) 2022-10-17 13:27:39 -07:00
Wouter Wijsman
3903f4c88a PSP: Use vramalloc instead of conflicting valloc function
The libpspvram library was offering a function with conflicted with valloc. This has been renamed now, so SDL2 had to be updated for it.
2022-10-17 21:59:38 +02:00
Sam Lantinga
333935ff3f Make sure we completely unlock joysticks when opening HIDAPI devices
Also lock the joysticks when adding and removing Android joysticks
2022-10-17 11:10:53 -07:00
Sam Lantinga
47ba997f06 Disable the RAWINPUT joystick driver by default
It's only needed to support more than 4 Xbox controllers, and adds significant complexity to the joystick processing, and we regularly get bugs from people who aren't using an SDL window who need to turn on SDL_HINT_JOYSTICK_THREAD.
2022-10-17 07:39:52 -07:00
Sam Lantinga
5025f24033 Don't use RAWINPUT joystick driver on Windows XP
Fixes https://github.com/libsdl-org/SDL/issues/6400
2022-10-17 07:35:00 -07:00
Brad Smith
f4e3af15a1 Simplify OSS test by removing OpenBSD specific location of the soundcard.h header
OpenBSD has long since stopped using OSS. Remove checking for OpenBSD specific header.
2022-10-17 07:18:47 -07:00
Sylvain
485bb3565b
Fixed bug #6401 - change the order of triangles when using RenderCopy, RenderCopyEx and RenderFillRect 2022-10-17 13:30:30 +02:00
Sam Lantinga
70dfd6dd1a Added mapping for Xbox Series X controller
Fixes https://github.com/libsdl-org/SDL/issues/6296
2022-10-16 09:06:02 -07:00
Frank Praznik
ed412c1385 wayland: Cleanup event source comments, headers, and error reporting
Replace instances of fprintf(stderr, ...) with SDL_SetError(), replace C++ comments with C style, use a uniform format for multi-line comments, and remove unused headers as poll and select aren't used in this file (the SDL function which calls them is used instead).
2022-10-16 08:40:50 -07:00
Daniel Bomar
22461383c6 SDL_audiocvt: Respct the SDL_HINT_AUDIO_RESAMPLING_MODE hint
This implements using libsamplerate for the SDL_AudioCVT API.
This library was already being used for audio streams when this hint is
set.
2022-10-15 14:31:00 -07:00
Sam Lantinga
e8fdb861ef Removed redundant masking when loading the IMU calibration 2022-10-15 10:02:39 -07:00
happyharryh
a6573f94ab Fix bugs in IMU calibration loading for Nintendo Controllers 2022-10-15 10:01:22 -07:00
Frank Praznik
6204768653 wayland: Don't block on libdecor_dispatch()
libdecor_dispatch() needs to be called, as libdecor plugins might do some required internal processing within, however care must be taken to avoid double-blocking in the case of a timeout, which can occur if libdecor_dispatch() and the SDL event processing both work on the main Wayland queue. Additionally, assumptions that libdecor will always dispatch the main queue or not process zero-length queues (can occur if a wait is interrupted by the application queueing an event) should not be made, as this behavior is outside the control of SDL and can change.

SDL handles polling for Wayland events and then calls libdecor to do its internal processing and dispatch. If libdecor operates on the main queue, it will dispatch the queued events and the additional wl_display_dispatch_pending() call will be a NOP. If a libdecor plugin uses its own, separate queue, then the wl_display_dispatch_pending() call will ensure that the main queue is always dispatched.
2022-10-15 09:33:37 -07:00
Frank Praznik
e89389ba0e wayland: Use MAP_PRIVATE when mapping the keyboard keymap file descriptor
Per the Wayland spec, this must be mapped with MAP_PRIVATE in version 7 of the protocol and higher.
2022-10-15 09:30:06 -07:00
Sam Lantinga
5129a07707 Steam Controller support defaults off, as documented in SDL_hints.h 2022-10-14 14:35:52 -07:00
Sam Lantinga
6af17369ca Added mapping for Qanba Drone on Linux without HIDAPI 2022-10-14 10:36:24 -07:00
Sam Lantinga
93b7196763 Only update the battery level if we're on Bluetooth
Fixes battery level dropping to empty with the Qanba Drone Arcade Stick.

It looks like we might also be able to skip the check for all third party controllers, but I think this is the right thing to do for Sony controllers as well.
2022-10-14 10:32:03 -07:00
Sam Lantinga
120a957d07 Added support for the Qanba Drone Arcade Stick 2022-10-14 09:57:02 -07:00
Sam Lantinga
6bb0c2a5c2 Added documentation for some scancodes 2022-10-14 06:33:38 -07:00
Sam Lantinga
91ff88451b Disable "The key you just pressed is not recognized by SDL." message by default 2022-10-13 23:56:17 -07:00
Sam Lantinga
139192140c Fixed reported cases of "Keyboard layout unknown" messages
In all cases they were using SDL_SCANCODE_TABLE_XFREE86_2 with some keycodes remapped or fewer than expected keycodes. This adds a sanity check that catches all of them and gives them the right scancode table.
2022-10-13 23:23:55 -07:00
Sam Lantinga
2c1923859a Don't remove entries from an existing scancode keymap
If we can't find the X11 keysym, it's likely that either the keysym is NoSymbol, in which case we won't hit it anyway, or it's been mapped to a character, in which case the existing mapping is correct for the scancode and the character will be reflected in the keycode mapping.
2022-10-13 22:50:57 -07:00
Sam Lantinga
99f2a50394 X11 scancode mapping cleanup
* Consolidated scancode mapping tables into a single location for all backends
* Verified that the xfree86_scancode_table2 is largely identical to the Linux scancode table
* Updated the Linux scancode table with the latest kernel keycodes (still unmapped)
* Route X11 keysym -> scancode mapping through the linux scancode table (which a few hand-written exceptions), which will allow mappings to automatically get picked up as they are added in the Linux scancode table
* Disabled verbose reporting of missing keysym mappings, we have enough data for now
2022-10-13 22:41:47 -07:00
Cameron Gutman
f5afb7d11a directfb: Fix return type of DirectFB_RenderPresent() 2022-10-13 18:44:15 -05:00
Sam Lantinga
fc73386f45 Fixed the mapping from raw joystick values to the expected [SDL_JOYSTICK_AXIS_MIN, SDL_JOYSTICK_AXIS_MAX] range. (thanks Tas!)
The original code mapped incorrectly from [min, max] to [-32768, 32512], the upper bound being SDL_JOYSTICK_AXIS_MAX - 255 instead of SDL_JOYSTICK_AXIS_MAX.
2022-10-12 21:44:50 -07:00
Pierre Wendling
5b9608e08c Remove D3D9 workarounds for Watcom.
The linked PRs have been merged since May.
2022-10-12 17:55:37 +03:00
Ryan C. Gordon
2d7816e358
dynapi: Disable support for API call logging by default.
We can manually enable it if necessary, but it bloats the library to
leave it on just in case.

Fixes #6381.
2022-10-12 09:59:31 -04:00
Sylvain
f69e004d01
Android default to dynamic API disabled (see #6381) 2022-10-12 13:58:41 +02:00
Sylvain
f6ff87788a
Android default to dynamic API disabled (see #6381) 2022-10-12 13:55:14 +02:00
Desour
6836273d14 Use XIWarpPointer if compiled with xinput2
Co-authored-by: Andrei E <andreien@proton.me>
2022-10-11 16:43:24 -07:00
Ethan Lee
be2cb00066 wayland: Check for the input handle before checking the keyboard handle 2022-10-11 11:16:52 -04:00
Sam Lantinga
df1bd07dee d3d12: actually execute the pending commands before processing resize
This makes sure all the resources are in the expected state

Fix the D3D12 case in https://github.com/libsdl-org/SDL/issues/6376
2022-10-11 07:25:27 -07:00
Frank Praznik
0b88e609bc wayland: Raise wl_seat maximum version to 8
Version 8 is required for supporting axis_value120 high-resolution scroll events.
2022-10-11 09:15:21 -04:00
zhailiangliang
41c718edca Fix memory leak in PSP_CreateTexture 2022-10-10 22:36:55 -07:00
happyharryh
6f224e4d9f Made timestamp_us of sensor events increase monotonically for Nintendo controllers 2022-10-10 22:33:19 -07:00
Pierre Wendling
8117bfe5d1 PS2: Ignore warnings from toolchain headers.
The `gsInline.h` header creates `Wdeclaration-after-statement` warnings.
2022-10-10 22:31:16 -07:00
Pierre Wendling
5ddac7e026 PSP: Fix type mismatch warnings. 2022-10-10 22:31:16 -07:00
Pierre Wendling
c1317175b4 PSP: Fix Wformat warnings. 2022-10-10 22:31:16 -07:00
Pierre Wendling
669532d529 PSP: Remove dead code.
Fixes unused variable warning.
2022-10-10 22:31:16 -07:00
Ryan C. Gordon
17322e2be6
dynapi: Optionally log every call into the SDL API.
This will only log things going through dynapi, which means it won't
do anything if dynapi is disabled for a given build, but also things
that call the `*_REAL` version of an API won't log either (which is
to say, if an internal piece of SDL calls a public API, it won't log
it, but if an application calls that same entry point, it will).

Since this just inserts a different function pointer, unless you
explicitly request this at runtime, it won't add any overhead, and,
of course, the entire thing can be turned off with a single #define
so it doesn't even add extra unused code to the shared library if
the kill switch is flipped.
2022-10-10 13:17:07 -04:00
Sam Lantinga
4507083503 Fixed build 2022-10-10 09:39:55 -07:00
Sam Lantinga
680d0f043a Added support for undefined or centered position for shaped windows
Fixes https://github.com/libsdl-org/SDL/issues/6359
2022-10-10 09:27:26 -07:00
Pierre Wendling
43a2b0b1e5 N3DS: Use macro to correct axis.
Using `(value * SDL max) / 3DS max` allows for marginally better
accuracy compared to `value * (SDL max / 3DS max)`.
2022-10-10 08:50:59 -07:00
Pierre Wendling
49c25b1daf N3DS: Fix PrivateSensorUpdate call.
A new timestamp parameter was added in 2c51874.
2022-10-10 08:50:59 -07:00
Pierre Wendling
cb1972b3ba N3DS: ZL and ZR should be considered as triggers.
Previously they were considered as clicking stick.
2022-10-10 08:50:59 -07:00
Pierre Wendling
86a8714fea N3DS: Refactor joystick module to avoid globals. 2022-10-10 08:50:59 -07:00
Pierre Wendling
392f3882d0 N3DS: Use SDL_Sensor instead of Joystick sensors. 2022-10-10 08:50:59 -07:00
Pierre Wendling
efc93e6851 N3DS: Don't set num_display by hand.
Doing so creates 2 empty displays at the beginning of the list.
2022-10-10 08:50:59 -07:00
Pierre Wendling
83ec6062af N3DS: Move gfxInit and hidInit from main to video. 2022-10-10 08:50:59 -07:00
Pierre Wendling
266014faa7 N3DS: Use SDL_Touch instead of the Joystick touch. 2022-10-10 08:50:59 -07:00
Pierre Wendling
f9785702a6 N3DS: Deduce screen from window's display.
This removes the need for a dedicated window creation flag.
2022-10-10 08:50:59 -07:00
Pierre Wendling
46a13ad97a N3DS: NEON is likely not supported. 2022-10-10 08:50:59 -07:00
Pierre Wendling
af2bc2ed0e N3DS: Use osSetSpeedupEnable instead of PTMSYSM. 2022-10-10 08:50:59 -07:00
Pierre Wendling
03bbbcd85e N3DS: Use CreateJoystickGUIDForName. 2022-10-10 08:50:59 -07:00
Pierre Wendling
2b2693ae90 N3DS: Use asprintf instead of snprintf. 2022-10-10 08:50:59 -07:00
Pierre Wendling
655275378d N3DS port (squashed)
A dedicated renderer using Citro3D would likely allow for better
much better graphical performances.
2022-10-10 08:50:59 -07:00
Sam Lantinga
61b5360e17 Only check to see if the ICC profile changes when the display changes or we gain focus
Fixes https://github.com/libsdl-org/SDL/issues/6366
2022-10-10 08:29:05 -07:00
Sam Lantinga
f99fc3268e d3d12: fixed window resize handling
Fixes https://github.com/libsdl-org/SDL/issues/6355
2022-10-09 11:42:39 -07:00
Sam Lantinga
490c20f93f d3d12: reset the vertex buffer size when it is released 2022-10-09 09:57:55 -07:00
Sam Lantinga
efdb390caa Disable the HIDAPI Wii driver by default as it doesn't work with the dolphinbar 2022-10-09 09:11:33 -07:00
Frank Praznik
6391ad970c wayland: Factor out common libdecor frame commit code
The pattern of:
 libdecor_state_new()
 libdecor_frame_commit()
 libdecor_state_free()

 was used in several places. Factor it out into a common function.
2022-10-09 08:50:54 -07:00
Frank Praznik
b0a9396b00 wayland: Remove XDG surface geometry calls
These were needed to fix some buggy behavior regarding committing old buffer sizes when entering fullscreen that has since been corrected. Remove them.
2022-10-09 08:50:54 -07:00
Guldoman
b91ddbc3e2 wayland: null-terminate drop data 2022-10-09 08:48:34 -07:00
Anonymous Maarten
eb8eb621b1 SDL_x11modes: fix -Wunused-variable 2022-10-08 23:41:07 +02:00
Anonymous Maarten
01498d3acf SDL_render_psp.c: fix -Wshadow
Emitted by PSP's gcc
2022-10-08 23:41:07 +02:00
Anonymous Maarten
4298e79887 SDL_offscreenframebuffer.c: fix format '%d' expecting int instead of Uint32
Emitted by Nintendo 3DS's gcc (fix is same as used by ngage)
2022-10-08 23:41:07 +02:00
Anonymous Maarten
b51a88a95c SDL_malloc.c: fix variable 'used' set but not used
Emitted by clang-cl
2022-10-08 23:41:07 +02:00
Anonymous Maarten
5c150ddc2f SDL_mslibc.c: fix unknown pragma ignored [-Wunknown-pragmas]
Emitted by clang-cl
2022-10-08 23:41:07 +02:00
Anonymous Maarten
85fd40fafd Fix -Wunused-const-variable warning when using clang-cl 2022-10-08 23:41:07 +02:00
Anonymous Maarten
2105c7f6ed SDL_thread.c: fix unused function SDL_FreeErrBuf when building without thread support (emscripten) 2022-10-08 23:41:07 +02:00
Sam Lantinga
b18c361b0f Updated variable name for mouse coordinates in mouse wheel events 2022-10-08 13:18:00 -07:00
Sam Lantinga
4f318c904a Add cursor position to mouse wheel event (thanks @meyraud705!)
Fixes https://github.com/libsdl-org/SDL/pull/6351
2022-10-08 12:01:42 -07:00
Sam Lantinga
17b43b0fdd Don't try to create a semaphore for the mutex implementation if threads are disabled
Fixes https://github.com/libsdl-org/SDL/issues/6344
2022-10-08 09:32:09 -07:00
Sam Lantinga
33050fea39 Only open HID devices that might have a HIDAPI driver available
This prevents an OS prompt for every connected device when running on Android
2022-10-07 11:29:49 -07:00
Nicolas Cian
484d5fd6cf audio open: ensure 2 devices don't get the same id 2022-10-07 06:45:01 -07:00
Sam Lantinga
fc720321b3 Fix rare deadlock when opening a HID controller on Android
Fixes https://github.com/libsdl-org/SDL/issues/6347
2022-10-06 18:23:07 -07:00
Sam Lantinga
689409fd97 Fixed the start button on the Nimbus+ controller on tvOS
Also updated mappings for Nintendo Switch controllers on tvOS, to reflect the lack of guide/menu button availability
2022-10-06 17:34:24 -07:00
Frank Praznik
914a65e098 wayland: Don't unset min/max values when entering fullscreen via a compositor event
If the compositor is entering fullscreen and hasn't removed any constraints itself, it's already too late at this point.  Remove the unnecessary call.

Restoring the limits when exiting fullscreen is still required, though, as they may have been removed when entering fullscreen via an SDL request.
2022-10-06 14:00:36 -04:00
Frank Praznik
69cf5fb0e1 wayland: Remove surface type helpers
These were remnants of a time before the surface type was explicitly stored, so they can be removed per the TODO note.
2022-10-06 14:00:36 -04:00
Frank Praznik
c2b0c41c0a wayland: Set/unset the opaque regions on surfaces when transparency is toggled
Caches the SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY hint at init time and registers a callback, which is fired when the hint is changed during runtime and toggles the opaque region for existing surfaces.
2022-10-06 14:00:36 -04:00
Frank Praznik
ea5958009c wayland: Set the damage buffer size when supported
The preferred method for setting the damage region on compositor protocol versions 4 and above is to use wl_surface.damage_buffer. Use this when available and only fall back to wl_surface.damage on older versions.

Bumps the highest supported version of wl_compositor to version 4.
2022-10-06 14:00:36 -04:00
Frank Praznik
a8cb7bbe2f wayland: Add dedupe logic to window geometry configuration
Adds deduplication logic to ConfigureWindowGeometry() to avoid setting redundant backbuffer, viewport and surface opaque region dimensions. State is now only set when the window and/or backbuffer dimensions change.

This repurposes the viewport rect to always hold the actual size of the window, which can differ from the SDL size if things are being scaled. The SDL_Rect was removed in favor of two ints, as the x/y members of the struct were never used, so they just wasted space.

Since the internal variables always have the true window size, the width/height getter functions are no longer required and can be removed.
2022-10-06 14:00:36 -04:00
slime
d2160c29d1 iOS: implement SDL_GetWindowSizeInPixels. 2022-10-05 18:39:18 -07:00
Sam Lantinga
ddc3de602e Added mapping for PS5 controller over Bluetooth on Android 12
Tested on Pixel 3a
2022-10-05 16:24:05 -07:00
Sam Lantinga
81afb3e303 Need to swap endianness when extracting the CRC from game controller mappings 2022-10-05 16:18:42 -07:00
Andrey Filipenkov
92c71ae385 [iOS] respect initial status bar configuration when displaying the launch storyboard 2022-10-05 13:30:19 -07:00
Andrey Filipenkov
5b13136471 [UIKit] handle app lifecycle events in a custom object instead of AppDelegate
removes the need to call SDL counterparts manually when custom AppDelegate is used
2022-10-05 13:28:55 -07:00
daniel
e41942e814 fix compilation error SDL_coreaudio mixing declarations and code 2022-10-04 21:04:45 -07:00
Sylvain
fdef96e233
Android: remove "nativeSetComposingText" since it's not used anymore
(and it may fail registering at init if code is cleaned with proguard)
2022-10-04 12:08:09 +02:00
Sylvain
eac3d6d3c0
SDL_video.c: fix variable 'i' may be uninitialized when used here "_this->name = bootstrap[i]->name;" 2022-10-04 10:46:42 +02:00
David Gow
ad29875ee6 Wayland: Emulate mouse warp using relative mouse mode
Several games (including Source and GoldSrc games, and Bioshock
Infinite) attempt to "fake" relative mouse mode by repeatedly warping
the cursor to the centre of the screen. Since mouse warping is not
supported under Wayland, the viewport ends up "stuck" in a rectangular
area.

Detect this case (mouse warp while the cursor is not visible), and
enable relative mouse mode, which tracks the cursor position
independently, and so can Warp successfully.

This is behind the SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP hint, which
is enabled by default, unless the application enables relative mouse
mode itself using SDL_SetRelativeMouseMode(SDL_TRUE).

Note that there is a behavoural difference, in that relative mouse mode
typically doesn't take mouse accelleration into account, but the
repeated-warping technique does, so mouse movement can seem very slow
with this (unless the game has its own mouse accelleration option, such
as in Portal 2).
2022-10-03 19:11:18 -07:00
Sam Lantinga
9e3c4b9f32 Use the correct platform defines 2022-10-03 17:50:01 -07:00
Sam Lantinga
5291e5cb76 Added version checking to SDLActivity.java
Make sure the SDL java and C code match when updating SDL in a game.
Right now we're assuming that we only have to make sure release versions match. We can extend the version string with an interface version if we need more fine grained sanity checking.

Fixes https://github.com/libsdl-org/SDL/issues/1540
2022-10-03 17:36:17 -07:00
Sam Lantinga
3607f8316f Find out if a controller is wireless using WGI (thanks @DJm00n!)
Confirmed using an Xbox Series X controller over USB and Bluetooth

Fixes https://github.com/libsdl-org/SDL/issues/6322
2022-10-03 11:02:23 -07:00
Ryan C. Gordon
321ca1091d
opengles2: Texture names are GLuint, not GLenum. 2022-10-03 12:00:38 -04:00
Ryan C. Gordon
01c5554f0e
opengles2: SDL_GL_BindTexture() should bind all YUV textures.
This matches what the non-GLES OpenGL renderer does.

Fixes #6070.
2022-10-03 11:57:10 -04:00
slime
f8f562dace iOS: remove dead pre-iOS 8 codepaths.
SDL hasn't supported those older iOS versions for a little while now.
2022-10-02 19:57:46 -07:00
slime
bbeacd72c4 Fix some credit comments. 2022-10-02 19:32:36 -07:00
Sam Lantinga
cf331ef3f9 Fixed build 2022-10-02 17:25:43 -07:00
Sam Lantinga
64ea6cefaf SDL_ResetHint() no longer clears the callbacks associated with a hint
Also added SDL_ResetHints() to reset all callbacks, and clarified that SDL_ClearHints() is just used for cleanup at shutdown.

Fixes https://github.com/libsdl-org/SDL/issues/6313
2022-10-02 17:17:31 -07:00