Commit Graph

10759 Commits

Author SHA1 Message Date
Sam Lantinga 7a074f582e Steam Controller handling improvements
* Only handle the controller interfaces on a Steam Controller and wireless dongle
* Wait until we get the connected status when initializing a wireless dongle
2024-11-18 21:36:23 -08:00
Sam Lantinga 0c53d9a1ee Implemented SendEffect for Steam Controllers 2024-11-18 18:26:07 -08:00
Sam Lantinga d8f8cf3e99 Added SDL_HINT_JOYSTICK_HIDAPI_STEAM_HOME_LED 2024-11-18 14:50:37 -08:00
Sam Lantinga 184da780f5 Fixed a crash when unplugging a Steam Controller dongle 2024-11-18 12:13:42 -08:00
Frank Praznik 70fe38bcb2
wayland: Rename some display related variables to better reflect their purpose
Use the 'logical' prefix for the logical width and height, and clarify that the physical dimensions reflect the width/height in millimeters.
2024-11-18 11:39:27 -05:00
Sam Lantinga e027b85cc4 Validate that pixel formats have the correct attributes
Also added a test to save and load as BMP format to make sure pixel transformations are working correctly.

Fixes https://github.com/libsdl-org/SDL/issues/11483
2024-11-17 11:58:57 -08:00
Ozkan Sezer 0f9e551d71 joystick/gdk/SDL_gameinputjoystick.c: fix build errors due to -Wformat 2024-11-17 00:45:02 +03:00
Sam Lantinga af6ce629c4 Make sure pairing remains enabled for the entire time dongle pairing is active 2024-11-16 13:42:12 -08:00
Sam Lantinga 2b10a040ff Fixed rare case of wireless Steam Controller not being detected at startup 2024-11-16 13:10:02 -08:00
expikr e9f7a1b359 fix relative system scale function on Windows
source: https://web.archive.org/web/20161202223814/https://ihme.org/~orbik/random_stuff/donewmouseaccel.png
Co-Authored-By: Sam Lantinga <slouken@libsdl.org>
2024-11-15 16:00:19 -08:00
expikr 25390d6c21 fix relative warp emulation broken by #11460 2024-11-15 15:58:09 -08:00
Cameron Gutman e0166256ff joystick: Fix connection type for Steam Controller and Xbox 360 dongles 2024-11-15 17:54:14 -06:00
Sam Lantinga 8657fa8b3b Improved reliability of the Steam Controller driver 2024-11-15 15:55:13 -08:00
expikr f8468d580d add brace for contitional
Co-authored-by: Sam Lantinga <slouken@libsdl.org>
2024-11-15 10:20:17 -08:00
expikr eaef956a9a fix errenous delta when warping
The following changes do not alter any logic:
- rename x/ydelta fields to x/y_accu to better reflect what it actually is about
- coalesce the logic for modifying internal state to one spot, branch based on whether the input was a move or a warp

The following changes alter the logic:
- put the x/y_accu addition under the relative branch only, warps should not add to the accumulation buffer by any definition
- (MAIN FIX) when the destination window desires relative mode, warp events should be dropped if SDL_MOUSE_RELATIVE_WARP_MOTION is false, or have x/yrel set to zero if true
2024-11-15 10:20:17 -08:00
Sam Lantinga b54f6044a5 Removed Linux Steam Controller support
The HIDAPI driver has all the functionality we need on Linux
2024-11-15 08:53:40 -08:00
Sam Lantinga b43b333d25 Moved the GPU renderer to the bottom of the list
We've gotten the feedback we wanted from having it first, so we'll move the other renderers back up for the widest compatibility across devices and platforms.

Fixes https://github.com/libsdl-org/SDL/issues/11468
2024-11-15 08:32:49 -08:00
Sam Lantinga b71151a697 Added support for pairing controllers to the Steam Controller dongle 2024-11-14 20:04:31 -08:00
Sam Lantinga f0b61c69e7 Fixed duplicate controllers showing up on the Steam Controller wireless dongle 2024-11-14 14:19:16 -08:00
Sam Lantinga fe3566ca46 Ignore Steam Controllers in the Linux driver if HIDAPI is handling them 2024-11-14 11:20:52 -08:00
Sam Lantinga 7959b08a4d Fixed spacing 2024-11-14 09:25:57 -08:00
Sam Lantinga 0f9505256d Steam Controller support defaults off on mobile platforms
These platforms require prompting for Bluetooth permissions, so don't enable this by default.
2024-11-14 09:05:16 -08:00
Sam Lantinga 140aba9e5d Enable Steam Controller support by default
It now handles both wired and wireless controllers and Steam will set SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES for Steam Controllers if it's handling them.
2024-11-14 08:18:03 -08:00
Cameron Gutman 68c2cf84f6 hidapi: Add support for the Steam Controller wireless dongle 2024-11-14 06:57:22 -08:00
Cameron Gutman 1a311bc638 hidapi: Add support for Steam controllers connected via USB 2024-11-14 06:57:22 -08:00
Cameron Gutman e67ae274a5 hidapi: Fix bus type in HIDAPI_IGNORE_DEVICE() on Linux
This bug prevented the Steam Controller's keyboard and mouse
interfaces from being properly ignored by the HIDAPI joystick
driver on Linux.
2024-11-13 22:06:37 -06:00
Ryan C. Gordon 7007b4762b
events: Fix a compiler warning.
Fixes #11410.
2024-11-13 20:03:21 -05:00
Sam Lantinga 9a4ae4b9ed Fixed crash if SDL_GetVideoDisplayForWindow() returns NULL 2024-11-13 10:45:01 -08:00
cosmonaut 5a74aadac9 GPU: Null check shader inputs in CreateGPUGraphicsPipeline 2024-11-12 14:31:13 -08:00
Ryan C. Gordon 32cc92dceb
pipewire: i/o callbacks should avoid higher-level iteration during device open.
Sometimes these callbacks will fire while we're still waiting on state to
settle down in PIPEWIRE_OpenDevice, which means we're holding the device lock,
but then the i/o callback will fire from a background thread and also try to
grab the device lock, but can't, because PIPEWIRE_OpenDevice is holding it and
waiting for this i/o callback to finish...hence, a deadlock.

So now, if the device is still opening, output callbacks will write silence
and input callbacks will just flush the buffer, without calling the main
iterate function, and thus avoid obtaining the lock.
2024-11-12 15:18:41 -05:00
Evan Hemsley 119b4fa5f5
GPU: Remove D3D11 backend and allow D3D12 to ingest DXBC (#11456) 2024-11-12 10:55:21 -08:00
Andrei Alexeyev 332fd824f0
GPU Vulkan: release submitted command buffer after defrag (#11430) 2024-11-08 09:40:26 -08:00
Sam Lantinga 54ff1f35bd Fixed audio dropouts when plenty of audio is queued on Android 2024-11-07 19:29:51 -08:00
Sam Lantinga 37b49c98dc Fixed setting up surround sound on NVIDIA Shield TV 2024-11-07 19:05:29 -08:00
Semphris 3e2ef64c98 Add SDL_SaveFile and SDL_SaveFile_IO functions 2024-11-07 17:55:02 -08:00
Sam Lantinga 97dac37373 Added SDL_HINT_ANDROID_LOW_LATENCY_AUDIO 2024-11-07 16:34:34 -08:00
Sam Lantinga 6836ef8fd2 Added logging for low latency audio state 2024-11-07 16:31:35 -08:00
Sam Lantinga 908bd84c5e Fixed reopening a controller on Android 2024-11-07 15:36:32 -08:00
Sam Lantinga 908b42f2b9 Fixed 8BitDo M30 mapping to match fighting game conventions and the layout in XInput mode 2024-11-05 11:43:28 -08:00
Sam Lantinga 028194286c Added mappings for the various firmware versions of the 8BitDo SN30 Pro controller
Fixes https://github.com/libsdl-org/SDL/issues/9460
2024-11-05 11:43:28 -08:00
Sam Lantinga ed943318e2 Support multiple joystick buttons bound to the same gamepad button 2024-11-05 11:43:28 -08:00
Sam Lantinga 27b828754a Use HIDAPI to provide better names for DirectInput controllers
Fixes https://github.com/libsdl-org/SDL/issues/10207
2024-11-05 11:43:28 -08:00
Sam Lantinga 5a7b75607a Added the OpenVR license to openvr_capi.h
License taken from https://github.com/ValveSoftware/openvr/blob/master/LICENSE
2024-11-04 13:32:59 -08:00
Sam Lantinga c1246e31a4 Added support for the PowerA OPS v1 and v3 Pro wireless controllers 2024-11-04 12:05:57 -08:00
Sam Lantinga d3b882b4f9 Added support for the PowerA Fusion Pro 4 and Fusion Pro Wireless controllers 2024-11-04 10:48:50 -08:00
Petar Popovic 96729e745a SDL_GetClosestFullscreenDisplayMode(): Rename parameter `mode` to `closest`
Also: Check, if the parameter is NULL inside the function.
2024-11-03 21:03:44 -08:00
Sam Lantinga 683991ab71 Get the full display bounds if the window doesn't fit in the usable bounds. 2024-11-03 20:58:18 -08:00
Sam Lantinga 6823e3f005 Fixed gaps in scaled 9-grid texture rendering 2024-11-03 20:47:45 -08:00
Frank Praznik 458f616c53
wayland: Send a display removed event when a display is disconnected
An event would be dispatched if a display was dynamically added after initialization, but not if one was removed.
2024-11-03 12:43:47 -05:00
Petar Popovic 73e0e8cf5b SDL_GetDisplayForPoint(), SDL_GetDisplayForRect(): Check argument for NULL. 2024-11-03 07:55:07 -08:00
Sam Lantinga 8026866994 wayland: fixed memory leak at shutdown 2024-11-02 22:56:03 -07:00
Sam Lantinga 7031b240df Added SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER 2024-11-02 22:22:29 -07:00
Sam Lantinga 87dade4421 Set SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER for the GPU renderer
Fixes https://github.com/libsdl-org/SDL/issues/11393
2024-11-01 18:38:42 -07:00
Sam Lantinga 927d297161 Updated to version 3.1.7 for development 2024-11-01 15:49:31 -07:00
Sam Lantinga 78cc5c1734 Updated to version 3.1.6 for the preview release 2024-11-01 14:27:01 -07:00
Sam Lantinga c5f12b135d Fixed the D-pad on wireless Xbox 360 controllers 2024-11-01 09:02:55 -07:00
Sam Lantinga 8b48b70c6e Fixed return value setting state on combined Joy-Con controllers 2024-10-31 20:37:23 -07:00
expikr e2857fc5a2 Update SDL_mouse.c 2024-10-30 12:01:51 -07:00
Maia 5699ba799e Add return to CHECK_VULKAN_ERROR_AND_RETURN macro 2024-10-30 11:52:42 -07:00
Sam Lantinga 09495059df Fixed the PS5 controller face buttons on Amazon Fire TV, Android 11 2024-10-30 05:23:00 -07:00
Sam Lantinga c099d0525e sort_controllers.py: fixed parsing SDL_PRIVATE_GAMEPAD_DEFINITIONS 2024-10-30 05:21:59 -07:00
M. P. Halpin 24bdbb8bf4 Supress Metal warning when compiling against macOS 10.11-10.13 2024-10-29 20:03:18 -07:00
Sam Lantinga 51628034d9 Don't offset the view if there's no text input rect
Otherwise this will shift the entire view upwards, which probably isn't what you want.
2024-10-29 16:42:16 -07:00
Sam Lantinga c8a04eec06 Autorelease keys should go down when pressed. 2024-10-29 16:24:40 -07:00
Evan Hemsley b4dff42dcd
GPU: Add SDL_CancelGPUCommandBuffer (#11316)
---------

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
2024-10-29 14:43:22 -07:00
cosmonaut 014b473bcc GPU D3D12: Fix depth texture sampling 2024-10-29 12:05:35 -07:00
cosmonaut ff14a1781f GPU D3D12: Fix indirect buffers not being refcounted 2024-10-29 10:34:54 -07:00
d-musique 35e53f76a9
metal: check success of device creation (#11367)
When macOS runs under a virtual environment, it is possible that
MTLCreateSystemDefaultDevice() does not succeed.
Not checking this failure results in a crash down the road.
This change allows to skip GPU renderer and use an adequate fallback.

Co-authored-by: D.musique <d-musique@users.noreply.github.com>
2024-10-29 12:35:13 -04:00
Caleb Cornett 54836050c9 metal: Add availability checks 2024-10-29 08:13:51 -07:00
Frank Praznik 8f9a562969
wayland: Remove vestigial struct member 2024-10-29 10:51:18 -04:00
Frank Praznik 36c209080c wayland: Refactor some shell surface related names 2024-10-28 14:30:08 -04:00
Frank Praznik 2b7dc55364 wayland: Check the WM capabilities before sending a minimize event
Wayland gives no feedback to windows regarding whether a minimize request was successful, so we would universally send the minimize event and assume that the request succeeded.

Check the window manager capabilities, if available, for whether window minimization is supported, and don't send the minimized event in the case that it is unsupported.
2024-10-28 14:30:08 -04:00
Frank Praznik 1abbd13414 wayland: Throttle interactive user resize events
Excessive resize events generated during interactive window resizing can cause applications to lag, severely in some cases. Throttle interactive resize events to once per frame callback interval.
2024-10-28 14:30:08 -04:00
Petar Popovic cb0c7c9680 SDL_CreateDirectory(): directory tree creation for absolute paths for non-Windows platforms 2024-10-28 01:56:48 -04:00
Petar Popovic a10578acbd SDL_SYS_RenamePath(): Fix error message. 2024-10-27 16:54:13 -07:00
Petar Popovic 8468c372b2 SDL_EnumerateDirectory(): (posix) Fix return value when directory is invalid 2024-10-25 22:52:56 -07:00
Dan Ginsburg 4f160d69a6 Closes #10318 - implement Android prerotation in the Vulkan renderer 2024-10-25 14:21:29 -07:00
Ozkan Sezer 93471cf78d video/openvr: minor clean-up:
- make all of function pointers static
- make EGLint context_attribs[] static
- comment out unused function pointer ov_wglGetCurrentContext
- remove unused SDL_DisplayMode openvr_dm_default
- move SDL_VideoDisplay openvr_vd_default to OPENVR_VideoInit()
  context and eliminate its C99 initializers
- replace atoi() calls with SDL_atoi()
- replace atof() calls with SDL_atof()
2024-10-25 23:20:24 +03:00
Ryan C. Gordon 344546b4ea cocoa: Make sure GL context destruction happens on the main thread.
Fixes #10900.
2024-10-24 16:27:58 -04:00
Ryan C. Gordon 8d3bec99a7
audio: Make SDL_GetAudioStreamProperties() thread safe. 2024-10-24 14:37:23 -04:00
Frank Praznik 731853077a
Send drop complete events when the drop leaves the window on Cocoa, Wayland, and X11
This is already done on win32, however, other platforms were left in a state of limbo if a drop operation began, then never completed due to the drop leaving the window.
2024-10-24 13:36:24 -04:00
Ryan C. Gordon 4ea26a7771
emscripten: scale mousewheel X coordinates correctly, not just Y coordinates.
Fixes #10454.
2024-10-23 23:35:02 -04:00
Ryan C. Gordon 7108291d0b video: Change SDL_GLattr to SDL_GLAttr. 2024-10-23 18:50:52 -04:00
Frank Praznik 924f719b97
wayland: Get the window content scale from the backend
The window content scale may change independently of the display it is on if scaling or accessibility features are involved, so query it directly from the backend instead of inferring it.
2024-10-23 15:49:26 -04:00
kyle-sylvestre 22bc430bbb Set error using function hresult 2024-10-23 10:53:46 -07:00
Sam Lantinga 6eca02a0e7 evdev: correctly handle composite devices
These can be both mouse and keyboard and should be initialized and exposed to the application as both.
2024-10-23 10:52:50 -07:00
Sam Lantinga ba1412cb9f evdev: fixed devices not being removed on disconnect 2024-10-23 10:52:00 -07:00
Evan Hemsley 423337796c
GPU Vulkan: Use dedicated allocation for download buffers (#11298) 2024-10-23 09:37:06 -07:00
Ivan Epifanov 1f8b9a320c VITA: fix SDL_ShowMessageBox by using different memory type 2024-10-22 12:19:33 -07:00
Anonymous Maarten 0bec18245d android: fix android.content.Context:getCacheDir JNI prototype 2024-10-22 18:03:34 +02:00
Ryan C. Gordon e61f0678ee
x11: Remove the "safety net" error handler.
This is an X11 error catcher that lived for the entire life of the program,
which causes problems in itself, but it also tries to make calls into Xlib,
which would cause further panics.

It's goal was to reset video modes if the app was going down, but it often
failed to do so, and caused potentially avoidable crashes instead.

Fixes #7975.
2024-10-22 10:41:30 -04:00
Sam Lantinga c56af0d975 Removed unused code 2024-10-21 17:26:14 -07:00
Sam Lantinga 35be8bb7f9 Fixed warning C4456: declaration of 'e' hides previous local declaration
This also fixes incorrect interpretation of OPENVR_SetupJoystckBasedOnLoadedActionManifest() return value.
2024-10-21 15:53:47 -07:00
Emmanuele Bassi 8119568805 x11: Remove text-scaling-factor setting checks
The text-scaling-factor setting is not useful, now that we watch the
Xft/DPI and Gdk/WindowScalingFactor XSETTINGS keys; on the contrary, it
is problematic in mixed environments with both the KDE and GNOME
portals, as they end up stepping on each other's toes, and we end up
with the wrong scaling factor value.

Fixes: https://github.com/libsdl-org/SDL/issues/11142
2024-10-21 15:26:22 -07:00
Sam Lantinga 1c51b8dc33 Only set the OpenGL flag if the OpenVR driver is active 2024-10-21 15:22:56 -07:00
Sam Lantinga 82b3325978 Fixed memory leaks if Windows initialization fails 2024-10-21 15:22:56 -07:00
Sam Lantinga d199586683 Fixed memory leaks if OpenVR initialization fails 2024-10-21 15:22:56 -07:00
Sam Lantinga 0aea14cf45 Added logging for additional events 2024-10-21 14:23:29 -07:00
Sam Lantinga 3d47877bb4 Added SDL_EVENT_RENDER_DEVICE_LOST
This is sent when the device is lost and can't be recovered.

Also fixed the vulkan renderer so it returns errors appropriately and will log and break if debug mode is enabled.
2024-10-21 13:28:40 -07:00
Sam Lantinga 26567df878 Don't treat mouse buttons as focus clicks if the window has mouse capture
This fixes the following sequence:
* Press mouse button down
* Alt-tab away from the window
* Alt-tab back to the window
* Release mouse button

Fixes https://github.com/libsdl-org/SDL/issues/7747
2024-10-21 09:46:07 -07:00