Commit graph

11628 commits

Author SHA1 Message Date
Sam Lantinga 488a91eb40 Fixed crash if mutex functions are used before any mutex has been created
(cherry picked from commit cc49f1e279b7ef0edf30d8eeaee9e05fd079bf82)
2023-07-05 10:17:19 -07:00
expikr f75c0e3204 center cursor to client area (excludes titlebar thickness)
(cherry picked from commit a7326b9396662c1e248dd530f6985f24e0ea337e)
2023-07-05 10:12:53 -07:00
Sam Lantinga 4d4c81d438 Revert "Update SDL_windowswindow.c"
This reverts commit d0fdf6207bf231eccc7f50ec8b98f6301bb6ce46.

(cherry picked from commit f49f1434b9d4c13c821ae6f789defb07e140f1fe)
2023-07-05 09:22:56 -07:00
expikr 1e6c128c4c Update SDL_windowswindow.c
(cherry picked from commit d0fdf6207bf231eccc7f50ec8b98f6301bb6ce46)
2023-07-04 21:59:58 -07:00
Anonymous Maarten 1c6a649362 cmake: check whether SONAME actualy exists
//Have include libunwind.h
2023-07-05 00:25:24 +02:00
Anonymous Maarten 0262f757e1 cmake: check whether libunwind can be compiled and linked against 2023-07-05 00:25:24 +02:00
Anonymous Maarten 8908d16285 cmake: explicitly disable WINDOWS_EXPORT_ALL_SYMBOLS for SDL2
This fixes the following errors when a dll attempts to link to a shared SDL2::SDL2:

m.c.obj : error LNK2019: unresolved external symbol __imp___acrt_iob_func referenced in function printf
m.c.obj : error LNK2019: unresolved external symbol __imp___stdio_common_vfprintf referenced in function _vfprintf_l
MSVCRTD.lib(init.obj) : error LNK2019: unresolved external symbol _CrtDbgReport referenced in function _CRT_RTC_INIT
MSVCRTD.lib(init.obj) : error LNK2019: unresolved external symbol _CrtDbgReportW referenced in function _CRT_RTC_INITW
MSVCRTD.lib(error.obj) : error LNK2019: unresolved external symbol strcpy_s referenced in function "void __cdecl _RTC_StackFailure(void *,char const *)" (?_RTC_StackFailure@@YAXPEAXPEBD@Z)
MSVCRTD.lib(error.obj) : error LNK2019: unresolved external symbol strcat_s referenced in function "void __cdecl _RTC_StackFailure(void *,char const *)" (?_RTC_StackFailure@@YAXPEAXPEBD@Z)
MSVCRTD.lib(error.obj) : error LNK2019: unresolved external symbol __stdio_common_vsprintf_s referenced in function _vsprintf_s_l
MSVCRTD.lib(error.obj) : error LNK2001: unresolved external symbol __C_specific_handler_noexcept
MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol _wmakepath_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath@@YAHPEB_WPEA_W_K@Z)
MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol _wsplitpath_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath@@YAHPEB_WPEA_W_K@Z)
MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol wcscpy_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath@@YAHPEB_WPEA_W_K@Z)
MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol __vcrt_GetModuleFileNameW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll@@YAPEAUHINSTANCE__@@XZ)
MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol __vcrt_GetModuleHandleW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll@@YAPEAUHINSTANCE__@@XZ)
MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol __vcrt_LoadLibraryExW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll@@YAPEAUHINSTANCE__@@XZ)
2023-07-05 00:15:46 +02:00
Sam Lantinga 61808b03b5 Fixed resource leak and crash at exit in the D3D11 renderer
Also, for some reason ID3D11DeviceContext_OMGetRenderTargets() was failing in the second read pixels call in the "testautomation --filter render_testViewport" test.

We already know the target view, so just use that.

(cherry picked from commit 619f65af0c390dd10bc0e6bf9dc1227e7ecee54d)
2023-07-03 17:42:16 -07:00
Sam Lantinga d65185a6a7 Made error handling more consistent in D3D12_RenderReadPixels()
(cherry picked from commit 90262f274ab73a2a0db227f8a1a3ea823ba0faec)
2023-07-03 17:42:07 -07:00
Sam Lantinga bf277eb808 The clip rect is defined in terms of the current viewport
Don't use the viewport offset when setting the clip rect in the D3D12 renderer.

This fixes "testautomation --filter render_testViewport" on Windows

(cherry picked from commit 304d425f99b3b62e5f77ef869731bb702810a572)
2023-07-03 17:15:30 -07:00
Ozkan Sezer 825b0324cf fixed windows build after commit 7e8be3f 2023-07-04 02:24:28 +03:00
Sam Lantinga 7e8be3f280 Retry to open the clipboard in case another application has it open
This fixes 'testautomation --filter clipboard_testClipboardTextFunctions' on Windows

(cherry picked from commit c24496727cdd40d5c0ffdf7b6a61085ec3a2766d)
2023-07-03 16:11:07 -07:00
Sam Lantinga a6ba8a1585 Removed spurious casts
(cherry picked from commit f73419e122ab0c2c7920b9de0921f5d6a464115d)
2023-07-03 16:11:02 -07:00
Ryan C. Gordon e65ca61957
khronos: Fixed a typo in a Vulkan header, to match upstream.
Fixes #7916.

(cherry picked from commit c0bd18f023329aeddeddaf8efdf879dbaf2f517a)
2023-07-03 11:04:41 -04:00
scribam e42a3a3233 cmake: use SDL_CPU_ARM32 instead of CMAKE_GENERATOR_PLATFORM STREQUAL "ARM" 2023-07-01 23:26:19 +02:00
Ryan C. Gordon 769bf2ebcc
rwops: Use SetFilePointerEx on Windows for appending writes.
Fixes #7900.
2023-07-01 00:30:23 -04:00
Sam Lantinga fc0854651b Added Linux mapping for the Logitech Chillstream
Fixes https://github.com/libsdl-org/SDL/issues/7829

(cherry picked from commit 675fc8c38f3f5685d177f0ecf7f43d57a109992e)
2023-06-29 16:15:00 -07:00
Anonymous Maarten e6f635ca17 wayland: don't use libdecor_frame_get_* functions when header doesn't have it
and we're statically linking to the library.
This fixes building SDL with -DSDL_WAYLAND_SHARED=OFF

(cherry picked from commit 5b5b67df203e9f8391e7e53aa5de54abf14c482e)
2023-06-29 16:04:47 -04:00
Sam Lantinga 099e53f3a5 Fixed build 2023-06-29 11:25:54 -07:00
Sam Lantinga 0f940cb6ce Added support for the Nintendo Online Famicom controllers
(cherry picked from commit baa9c57581490bd9cdefabb213e7cb6d0c30b296)
2023-06-29 11:18:09 -07:00
Ryan C. Gordon 1453cfa4e9
pulseaudio: Move to a threaded mainloop.
This used to create a context and mainloop for each device and the hotplug
thread, but this isn't correct use of PulseAudio's API. Now we have a
single context and a pa_threaded_mainloop, and all threads cooperate around
it.

This was originally from SDL3, in 35292d7dba88faa667f86e77c63651d19ef49178.

Reference Issue #7883.
Reference Issue #7427.
2023-06-28 20:32:14 -04:00
Sam Lantinga 0ba93e4aac Don't crash if SDL_MapRGB() and SDL_MapRGBA() are passed a NULL format
(cherry picked from commit fadc4916a9bcc410c2148a91bf0adf742410a4ba)
2023-06-27 16:08:53 -07:00
Sam Lantinga 170428b107 Fixed Nintendo Switch Pro controllers that don't have readable user calibration
(cherry picked from commit 9ee1200e6f8fecd394d9355781af40ac90851546)
2023-06-27 07:50:00 -07:00
Narr the Reg 950ff0056a hidapi: switch: Handle MCU input reports
(cherry picked from commit 425062c123f88b6890277905714e02c9375f5b5e)
2023-06-26 10:07:15 -07:00
Sam Lantinga 38619bb28d SDL_FindFreePlayerIndex() will always return the next available player index
Fixes https://github.com/libsdl-org/SDL/issues/7868

(cherry picked from commit 87e916dd214866af9cfd67eb4618918bc8b0f1b4)
2023-06-24 15:40:09 -07:00
Sam Lantinga c6660afe44 Corrected the Victrix FS Pro as a PS4 controller instead of a PS3 controller
(cherry picked from commit 44bae1e8a9329481c72b22de5a595b953eee8417)
2023-06-23 15:44:15 -07:00
Sam Lantinga 8acf729650 Removed 100 ms hitch when querying third party Nintendo Switch controllers that don't respond to request for info 2023-06-21 14:11:41 -07:00
Sam Lantinga dfbdaca2b8 Use default sensor calibration if we can't read it from the Nintendo Switch controller
Fixes https://github.com/libsdl-org/SDL/issues/7830

(cherry picked from commit 3694dabe7c16bb8e76f6f4820a1987ce16c4a3c9)
2023-06-21 10:40:02 -07:00
Sam Lantinga 657c346556 Apply DPI scale to mouse coordinates in SDL_WarpMouseInWindow()
Fixes https://github.com/libsdl-org/SDL/issues/7855
2023-06-21 08:44:19 -07:00
Sam Lantinga ceece918e4 Updated to version 2.29.0 for development 2023-06-20 11:50:19 -07:00
Sam Lantinga ffa78e6bea Updated to version 2.28.0 for release 2023-06-20 11:00:20 -07:00
Simon McVittie 4ce5c3a694 ibus: Handle error when getting the D-Bus machine ID
It is possible for retrieving the machine ID to fail, either because
dbus was installed incorrectly (machine ID absent or corrupt), or in
32-bit builds, because stat() on the machine ID fails with EOVERFLOW
if it has an out-of-range timestamp or inode number.

dbus has historically treated this as a faulty installation, raising
a warning which by default causes the process to crash. Unfortunately,
dbus_get_local_machine_id() never had a way to report errors, so it has
no alternative for that (bad) error handling.

In dbus >= 1.12.0, we can use dbus_try_get_local_machine_id() to get
the same information, but with the ability to cope gracefully with
errors. ibus won't work in this situation, but that's better than
crashing.

(cherry picked from commit 91198baed40d5709020c3001e9234f4580df696a)

Mitigates: https://github.com/ValveSoftware/steam-for-linux/issues/9605
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-20 09:45:25 -07:00
Sam Lantinga a3d4fd71c3 Added support for blitting SDL_PIXELFORMAT_INDEX1LSB
Fixes https://github.com/libsdl-org/SDL/issues/7844
2023-06-19 08:36:30 -07:00
Sam Lantinga d97423ebab Fixed DualSense controllers not being picked up by the HIDAPI driver
The hidraw device may take additional time to get the correct permissions for us to open it. In my tests on Steam Deck hardware, this ranges between 5-8ms.

(cherry picked from commit c6ee9780df4286f66c38f3fa9732daa9afe0a8a3)
2023-06-18 12:22:06 -07:00
Sam Lantinga 333a03f1ec We don't know in advance whether a device is connected over Bluetooth in SDL2 2023-06-17 13:15:07 -07:00
Sam Lantinga 5b8fc907df Added support for the GameSir G4 Pro
We can't read device info or IMU calibration from this controller, and it has no gyro or accelerometer, but is otherwise perfectly functional.

(cherry picked from commit f168f9c81326ad374aade49d1dc46f245b20d07a)
2023-06-17 13:07:03 -07:00
Eric Wasylishen 76392f4fe1 Handle DPI scaling in SDL_GetWindowSurface
Fixes DPI awareness of testdrawchessboard (previously, the surface was
being created in points instead of pixels, resulting in the demo app
only drawing in a corner of the screen on High-DPI displays)

*_CreateWindowFramebuffer()/*_UpdateWindowFramebuffer(): are updated
to use SDL_GetWindowSizeInPixels instead of SDL_GetWindowSize() or
window->w/window->h.

Most of the _CreateWindowFramebuffer backends are untested except
for Windows.

Fixes #7047

(cherry picked from commit 67c91353e01f6f2c0cc80c17eeddbad6def7cb01)
2023-06-14 17:23:54 -07:00
Sam Lantinga 3a5abee512 Removed unused function
(cherry picked from commit 73927b09480fd5d664f7077a70a8b6df318cdd2d)
2023-06-14 15:16:44 -07:00
Sam Lantinga e7ee375f22 Fixed third-party Nintendo Switch Pro controllers shutting down when we try to set the home LED.
This fixes the PDP Afterglow Wireless Deluxe Controller.

(cherry picked from commit 0c16f4faf00eb573d051cac7d60ed8dd22e5596a)
2023-06-14 15:15:27 -07:00
Sam Lantinga 4aec54988c Allow switching licensed Nintendo Switch Pro controllers into gyro input mode
(cherry picked from commit 8c95bd814bf1cf0ea1f12aa724938176a7dfd780)
2023-06-14 15:13:11 -07:00
Sam Lantinga 271e03f0d7 Added support for the PowerA Fusion Pro Wireless Controller in Bluetooth mode
This controller shows up with a VID/PID of 0, but has full functionality over Bluetooth

(cherry picked from commit cdfc0c5a3314e4e0cd5152feddd8950c7eb797f1)
2023-06-14 15:12:56 -07:00
Sam Lantinga d4f9be4416 Updated to version 2.27.1 for release candidate 2023-06-13 19:44:26 -07:00
Sam Lantinga 1f5b21ead5 Removed more Linux Xbox mappings in favor of the automatic mapping
This fixes the Xbox Series X share button on Linux 5.x kernels.

(cherry picked from commit 0f4b15e16b7f07a46db6dc8e651f8c1849d658c5)
2023-06-13 17:06:24 -07:00
Sam Lantinga 35c7884929 Use the automatic mapping instead of a hardcoded one for Xbox controllers on Linux
This is much more robust and able to dynamically create a mapping for Xbox One S, Xbox Series X, and Xbox Elite 2 controllers.

(cherry picked from commit 9567989eb3ce9c858f0fe76806c5ccad69da89ba)
2023-06-13 17:06:21 -07:00
Sam Lantinga 3f6c4ec6d0 Cleanup for previous change, fixing typos, etc.
(cherry picked from commit 883b0f4071687f2e5c8329963f97504e9679394b)
2023-06-13 17:04:54 -07:00
Sam Lantinga fc72f12e7f Added automatic mapping support for Xbox controllers on the 6.x Linux kernels
This automatically adds support for the share button and paddles when present.

(cherry picked from commit db1d4d3d76f5e21b2547463710b513fe0ebd7fad)
2023-06-13 17:04:17 -07:00
Ozkan Sezer 681f67d353 fixed build after commit d2372c8538. 2023-06-14 00:25:50 +03:00
Sam Lantinga d2372c8538 Added automatic mapping for Xbox Elite paddles using the xpadneo driver
We can't actually tell yet whether a controller has paddles, so this code isn't effective, but I'll file an upstream issue and see if we can get that resolved.

(cherry picked from commit b0677f476fa43f4a113b04a959228fd38f95d740)
2023-06-13 10:12:07 -07:00
Sam Lantinga 7db23f4ef1 Fixed joystick vendor detection in Linux automatic gamepad mapping
(cherry picked from commit 071d1e29dd4f80605932f320aa2e05fda383944c)
2023-06-13 10:11:55 -07:00
Simon McVittie 36ff6327b0 linux: Improve gamepad mapping heuristic to accept Android conventions
This heuristic for gamepads without a more specific mapping already
tried two incompatible conventions for handling triggers: the Linux
Gamepad Specification uses hat switch 2 for the triggers (for whatever
reason), but the de facto standard set by the drivers for older Xbox
and Playstation controllers represents each trigger as the Z-axis of
the nearest analog stick.

Android documentation encourages Bluetooth gamepad manufacturers to use
a third incompatible convention where the left and right triggers are
represented as the brake and gas pedals of a driving simulator
controller. The Android convention also changes the representation of
the right stick: instead of using X and Y rotation as a second pair
of axes, Android uses Z position as a second horizontal axis, and
Z rotation as a second vertical axis.

Try to cope gracefully with all of these. This will hopefully resolve
the issue described in #5406 (when using unpatched kernels).

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit cf1dc66e2cfc7a65374c5fea681dd31c50363a2c)
2023-06-13 05:46:01 -07:00