Commit Graph

5909 Commits

Author SHA1 Message Date
Sam Lantinga
a6a2cdbd7c Added the name of the Qanba Dragon Arcade Joystick in PC mode 2022-06-15 17:28:18 -07:00
Francisco Javier Trujillo Mata
6b03c1adf6 Add filesystem driver 2022-06-15 15:15:26 -07:00
Francisco Javier Trujillo Mata
52f00833b0 Add Thread drivers 2022-06-15 15:15:26 -07:00
Francisco Javier Trujillo Mata
217d3a6dab Add systimer support 2022-06-15 15:15:26 -07:00
Francisco Javier Trujillo Mata
7343ece806 Define available PS2 RAM 2022-06-15 15:15:26 -07:00
Francisco Javier Trujillo Mata
e4409f6733 Include SDL_Log driver 2022-06-15 15:15:26 -07:00
Francisco Javier Trujillo Mata
f0a05ed476 Add some PS2 flags 2022-06-15 15:15:26 -07:00
Francisco Javier Trujillo Mata
273d9e4640 Fix atomic support for PS2 2022-06-15 15:15:26 -07:00
Anonymous Maarten
ae7446a959 stlib: Extract SDL_memcpy and SDL_memset to its own file respectively
This is done such that we can disable LTO for these 2 functions when
building with MSVC.

This is due to a limitation of Link Time Code Generation (LTCG).
Code generation might generate a new reference to memset after linking
has started. The LTCG must make assumptions about where memset is
defined which is normally the C runtime.
2022-06-15 14:17:35 -07:00
Sam Lantinga
a5d338bd2d Added support for the Qanba Dragon Arcade Joystick (PS3) on macOS 2022-06-15 14:11:00 -07:00
Sam Lantinga
7d7c48302b Use python3 for sort_controllers.py 2022-06-15 14:10:22 -07:00
Sam Lantinga
72fea0ed6f Added support for the Qanba Dragon Arcade Joystick 2022-06-15 13:58:28 -07:00
takase1121
f8ae3ef1eb wayland: use libdecor resize edge enums for libdecor 2022-06-15 10:21:18 -04:00
Ozkan Sezer
960b86dcb5 update SDL_render_d3d12.c after DPI scaling/highdpi support patch.
See https://github.com/libsdl-org/SDL/pull/5778#issuecomment-1153006938
2022-06-14 21:03:31 -07:00
Ryan C. Gordon
ded6c22efb
render: Corrected wrong SDL_memcpy() sizes for viewport, cliprect.
Fixes #5786.
2022-06-14 14:10:14 -04:00
Frank Praznik
e427e80bfe wayland: Use the output descriptions from xdg-output when available
Some compositors will provide 'nicer' / 'human readable' output descriptions via the xdg-output protocol. Use these description strings, when available, instead of the model name provided by wl-output.  On compositors such as GNOME where this is provided, the display names provided to applications by SDL will now match those in the desktop display settings panel.  On compositors where this data isn't provided, the old behavior of using the model string provided by wl-output will remain unchanged.

Additionally, per the protocol spec, output data provided by xdg-output should supersede wl-output data, so this is the recommended behavior in general.
2022-06-14 11:02:20 -04:00
Ozkan Sezer
714502d373 minor windows warning fixes. 2022-06-13 22:15:56 +03:00
Simon McVittie
507ce36d80 video: Note unused SDL_surface creation parameters for removal in SDL 3
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-06-13 11:53:53 -07:00
Simon McVittie
535fdc3adc video: Detect and reject nonsense SDL_surface dimensions
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-06-13 11:53:53 -07:00
Simon McVittie
8c9f7104e3 video: Harden calculation of SDL_surface pitch and size against overflow
If the width is sufficiently ludicrous, then the calculated pitch or
the image size could conceivably be a signed integer overflow, which
is undefined behaviour. Calculate in the unsigned size_t domain, with
overflow checks.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-06-13 11:53:53 -07:00
Simon McVittie
63b3b9a558 Fix some typos in diagnostic messages
Detected by Debian's packaging QA tool, Lintian.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-06-13 08:33:27 -07:00
Ryan C. Gordon
9a0367675f
windows: Get better name for the physical display, for Vista and later.
Fixes #5321.
2022-06-12 15:28:49 -04:00
Cameron Cawley
fd8cafc72e Rename variables in SDL_egl.c to be more intuitive 2022-06-11 14:20:18 -07:00
Eric Wasylishen
e09551bc80 Fix WinRT build 2022-06-11 14:19:01 -07:00
Eric Wasylishen
ab81a559f4 Windows DPI scaling/highdpi support
Adds hint "SDL_WINDOWS_DPI_SCALING" which can be set to "1" to
change the SDL coordinate system units to be DPI-scaled points, rather
than pixels everywhere.

This means windows will be appropriately sized, even when created on
high-DPI displays with scaling.

e.g. requesting a 640x480 window from SDL, on a display with 125%
scaling in Windows display settings, will create a window with an
800x600 client area (in pixels).

Setting this to "1" implicitly requests process DPI awareness
(setting SDL_WINDOWS_DPI_AWARENESS is unnecessary),
and forces SDL_WINDOW_ALLOW_HIGHDPI on all windows.
2022-06-11 14:19:01 -07:00
Eric Wasylishen
448e05e3c8 add DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED define 2022-06-11 14:19:01 -07:00
Eric Wasylishen
1b797957c1 SDL_windowsvideo.c: add HIGHDPI_DEBUG ifdef, print DPI awareness at startup if defined
document some additional quirks
2022-06-11 14:19:01 -07:00
Eric Wasylishen
1488c40812 WM_DPICHANGED: remove some dead code, add comment 2022-06-11 14:19:01 -07:00
Eric Wasylishen
60ef11b3cb Fix Watcom compile errors 2022-06-11 14:19:01 -07:00
Eric Wasylishen
d3b970d4d5 HighDPI: remove SWP_NOSIZE in WIN_SetWindowPosition
If the move results in a DPI change, we need to allow the window to resize (e.g. AdjustWindowRectExForDpi frame sizes are different).

- WM_DPICHANGED: Don't assume WM_GETDPISCALEDSIZE is always called for PMv2 awareness - it's only called during interactive dragging.

- WIN_AdjustWindowRectWithStyle: always calculate final window size including frame based on the destination rect,
not based on the current window DPI.

- Update wmmsg.h to include WM_GETDPISCALEDSIZE (for WMMSG_DEBUG)

- WIN_AdjustWindowRectWithStyle: add optional logging

- WM_GETMINMAXINFO: add optional HIGHDPI_DEBUG logging

- WM_DPICHANGED: fix potentially clobbering data->expected_resize

Together these changes fix the following scenario:
- launch testwm2 with the SDL_WINDOWS_DPI_AWARENESS=permonitorv2 environment variable
- Windows 10 21H2 (OS Build 19044.1706)
- Left (primary) monitor: 3840x2160, 125% scaling
- Right (secondary) monitor: 2560x1440, 100% scaling

- Alt+Enter, Alt+Enter (to enter + leave desktop fullscreen), Alt+Right (to move window to right monitor). Ensure the window client area stays 640x480. Drag the window back to the 125% monitor, ensure client area stays 640x480.
2022-06-11 14:19:01 -07:00
Eric Wasylishen
51ebefeeee Support PMv2 DPI awareness, add SDL_HINT_WINDOWS_DPI_AWARENESS
The hint allows setting a specific DPI awareness ("unaware", "system", "permonitor", "permonitorv2").

This is the first part of High-DPI support on Windows ( https://github.com/libsdl-org/SDL/issues/2119 ).
It doesn't implement a virtualized SDL coordinate system, which will be
addressed in a later commit. (This hint could be useful for SDL apps
that want 1 SDL unit = 1 pixel, though.)

Detecting and behaving correctly under per-monitor V2
(calling AdjustWindowRectExForDpi where needed) should fix the
following issues:

https://github.com/libsdl-org/SDL/issues/3286
https://github.com/libsdl-org/SDL/issues/4712
2022-06-11 14:19:01 -07:00
Cameron Gutman
81d3adddbf events: Fix spurious early returns from SDL_WaitEvent()/SDL_WaitEventTimeout()
Fixes #5780
2022-06-11 14:18:45 -07:00
Nhalrath
b3260e7eb3 Remove macro definition for SDL_ERRBUFIZE
I was looking at how errors are handled by SDL and came across this #define SDL_ERRBUFIZE which looks like a typo for SDL_ERRBUFSIZE, but either way, it looks like this isn't being used anywhere anymore because it was getting reported whenever I compile SDL with -Wunused-macros, and the last time it was mentioned in the code was from commit 09ca66b.
2022-06-11 08:42:59 -07:00
Frank Praznik
4a3277b0f9 wayland: Always commit window constraints before entering fullscreen
XDG-toplevel min/max size values are double-buffered data and must be committed before entering the fullscreen state, or a max window size value smaller than the display dimensions may cause the compositor to incorrectly configure the fullscreen window size.  This fixes windowed->fullscreen transitions on GNOME, where, previously, certain combinations of window flags and min/max size values could cause entering fullscreen mode to fail with odd window sizes and/or offsets due to the new max size values not being committed before entering fullscreen, causing the compositor to clamp to the old values.

In the case of libdecor, it has its own layer of buffering on top of the xdg-toplevel surface for the min/max window dimensions, so both a frame commit and surface commit are required to set the state properly.
2022-06-10 14:24:12 -07:00
Frank Praznik
78698a0ba2 wayland: Use a separate frame callback for setting the surface damage region
Previously, the surface damage region was being set in the same callback used for preventing render hangs in the GL backend when the surface was not visible.  This was not ideal, as the callback was never fired in the case of using a different render backend or having a swap interval of 0.  Use a separate frame callback for setting the surface damage region to ensure that it fires reliably, regardless of the backend being used or swap interval.
2022-06-10 14:24:12 -07:00
Frank Praznik
146ea9b0e1 wayland: Only set the surface opaque region if EGL transparency is disabled
Check if the "SDL_VIDEO_EGL_ALLOW_TRANSPARENCY" hint is enabled and don't mark surfaces as opqaue if it is.
2022-06-10 14:24:12 -07:00
Frank Praznik
a20516d4f3 wayland: Swap emulated mode dimensions in more cases
Some compositors (GNOME for example) don't set the transform flag when dealing with portrait mode displays, so the video modes won't have the width/height swapped in all cases where they should be.  Check for both the 90/270 degree transform flag and if the display is taller than it is wide when determining whether to swap the width and height of the emulated video modes, and adjust the comparison logic when size testing against the native mode to account for this.
2022-06-10 14:24:12 -07:00
Frank Praznik
e1c8350439 wayland: Add a hint to disable video mode emulation under Wayland
Add the hint "SDL_VIDEO_WAYLAND_MODE_EMULATION", which can be used to disable mode emulation under Wayland. When disabled, only the desktop and/or native display resolution is exposed.
2022-06-10 14:24:12 -07:00
Frank Praznik
e9d3dcea73 wayland: Unify integer and fractional output scaling
Previously, scale values used by the displays and surfaces were always integers, with fractional scale values only being calculated when the backbuffer and viewport sizes were being determined. Now, if xdg-output is available, the fractional scale of output displays is calculated when the displays are enumerated and the true scale values of the output devices are used whenever possible.

This unifies the integer and fractional scaling systems, allows for the use of more accurate scale values that minimize overdraw when windows straddle multiple outputs, and lays the groundwork for the pending Wayland scaling protocols that will report the preferred scale values per-surface instead of per-output.
2022-06-10 14:24:12 -07:00
Frank Praznik
4fde7dd830 wayland: Refactor the Wayland mode emulation and viewport logic
Compartmentalize the fullscreen mode emulation code blocks, unify the windowed/fullscreen viewport logic, consolidate all window geometry code into a central function to eliminate blocks of duplicate code and rename related variables and functions to more explicitly reflect their purpose.
2022-06-10 14:24:12 -07:00
Sam Lantinga
ce5763230b The backlight event is "change", not "add" or "remove" 2022-06-10 12:42:45 -07:00
Sam Lantinga
68544be44b Added support for the Nintendo Online controllers 2022-06-10 11:31:59 -07:00
Ryan C. Gordon
b75cd2b36d
x11: Force window back to expected size after SDL_SetWindowBordered.
This helps if the window manager decided to let it fill the space that
an existing border was using before its removal.

Fixes #5718.
2022-06-10 14:13:07 -04:00
Ozkan Sezer
51db775442 updated windows watcom exports file after last commit. 2022-06-10 06:23:20 +03:00
Sam Lantinga
9202df0472 Implemented SDL_GameControllerGetFirmwareVersion() for HIDAPI PS5 controllers 2022-06-09 18:11:34 -07:00
Guldoman
e5a3acd6bd ime: fcitx: Retrieve cursor position and selection
Also, if `SDL_HINT_IME_SUPPORT_EXTENDED_TEXT` is enabled, make use of
`SDL_TEXTEDITING_EXT` by sending the full preedit string.
2022-06-09 15:18:50 -07:00
Guldoman
dd7bed9ebc ime: ibus: Retrieve cursor position and selection
Also, if `SDL_HINT_IME_SUPPORT_EXTENDED_TEXT` is enabled, make use of
`SDL_TEXTEDITING_EXT` by sending the full preedit string.
2022-06-09 15:18:50 -07:00
Guldoman
d11702ce29 ime: wayland: Make use of SDL_TEXTEDITING_EXT
Because we were sending multiple chunks of preedit strings,
`SDL_SendEditingText` was using the old `SDL_TEXTEDITING` event only.

Now if `SDL_HINT_IME_SUPPORT_EXTENDED_TEXT` is enabled, we send the full
string and correctly set the cursor position and selection size.
2022-06-09 15:18:50 -07:00
Guldoman
74bcc5a0a3 stdlib: Add SDL_utf8strnlen 2022-06-09 15:18:50 -07:00
Sam Lantinga
c7f4103807 Special case for k_eControllerType_XInputSwitchController in the raw input path 2022-06-09 13:47:29 -07:00
Sam Lantinga
e6cb082232 Fixed the default mapping on Windows for the HORI Fighting Commander 2022-06-09 13:20:38 -07:00
Cameron Cawley
0a93ac1294 Work around the lack of clock() on PS Vita 2022-06-09 11:07:06 -07:00
chalonverse
6f69bbc541 D3D11: Fix SDL_TEXTUREACCESS_TARGET not working if SDL_HAVE_YUV was 0
Added a couple of missing SDL_zeros in CreateTexture
2022-06-08 12:51:09 -07:00
chalonverse
8303c5d0a3 Added missing SDL_zero for renderTargetViewDesc 2022-06-08 12:51:09 -07:00
Sam Lantinga
d58d637ac6 Added support for the Qanba Obsidian Arcade Joystick on Linux 2022-06-08 11:07:36 -07:00
Charlie Birks
0fcfaf9e94 emscripten: use MAIN_THREAD_EM_ASM for the fb/cursor proxying
This is how everything else was handled and fixes undefined symbol
errors in non-threads builds.
2022-06-08 08:09:46 -07:00
chalonverse
7a335df9cf Updated CMakeLists.txt and configure.asc/script so that it checks for the required Windows SDK version before it enables the d3d12 renderer. Also fixed reported warnings in some builds. 2022-06-07 17:07:33 -07:00
Sylvain
2cc2260435
Fixed bug #5768 - SDL_RenderGeometry's software backend failed to render when texture coordinates are reversed
handle flip vertical/horizontal when reconstructing rects from triangles
2022-06-07 16:30:01 +02:00
chalonverse
4082821822
DirectX 12 Renderer (#5761)
* DirectX 12 Renderer (27 squashed commits)

* Add missing SDL_hidapi.h of merge of SDL.vcxproj.filters

* Fixed OpenWatcom build failure

* Dynapi fix

Co-authored-by: Ryan C. Gordon <icculus@icculus.org>
2022-06-06 17:42:30 -07:00
Ozkan Sezer
63e12cf601 SDL_windows_main.c: replace CopyMemory() with SDL_memcpy() 2022-06-06 22:55:56 +03:00
Ryan C. Gordon
ec0204d243
x11: Don't use GetXftDPI() when XRandR can tell us the DPI per-output.
Fixes #5764.
2022-06-06 14:39:58 -04:00
Ozkan Sezer
61115aebd3 update dynapi after the loongarch support patch 2022-06-06 19:29:56 +03:00
yuanhecai
50d8642fa3 Add optimiztion function with LSX in LoongArch
1. yuv420_rgb24_lsx
1. yuv420_rgba_lsx
2. yuv420_bgra_lsx
3. yuv420_argb_lsx
4. yuv420_abgr_lsx
2022-06-06 08:49:09 -07:00
yuanhecai
17f63e53f8 Add loongarch support
LSX and LASX are enabled by default if compiler supports them.
2022-06-06 08:49:09 -07:00
Ryan C. Gordon
9703f23663
SDL_SetHintWithPriority: actually, this test is good.
Otherwise, we end up calling the callback if both the old and new value
are NULL.

This reverts commit 5f25a6ea78 (and also
trims some whitespace).
2022-06-06 10:55:29 -04:00
Ryan C. Gordon
5f25a6ea78
Revert "SDL_SetHintWithPriority: better test if hint value has changed."
Actually, the original test was fine, disregard.

This reverts commit c391bdc160.
2022-06-06 09:36:20 -04:00
Ryan C. Gordon
c391bdc160
SDL_SetHintWithPriority: better test if hint value has changed. 2022-06-06 09:31:35 -04:00
Ryan C. Gordon
55a07d91fa
SDL_SetHintWithPriority: Allow setting NULL hints.
Fixes #5120.
2022-06-06 09:30:43 -04:00
Ryan C. Gordon
a236bf4f25
x11: Hook up display hotplug notifications.
Obviously this needs XRandR support.

Fixes #4977.
2022-06-06 02:13:37 -04:00
Ryan C. Gordon
6b4bd5a759
test_harness: Report if zero tests to run.
Fixes static analysis complain about a potential malloc(0) call.
2022-06-05 09:34:54 -04:00
Christoph Reichenbach
3a20274ddf Refactoring: move GUID operations out of Joystick
- SDL_JoystickGUID -> SDL_GUID (though we retain a type alias)
- Operations for GUID <-> String ops are now in
  src/SDL_guid.c and include/SDL_guid.h
- The corresponding Joystick operations delegate to SDL_guid.c
- Added test/testguid.c
2022-06-04 17:22:13 -07:00
Sam Lantinga
423141bfca Added a function to get the controller firmware version 2022-06-03 18:50:00 -07:00
Sam Lantinga
17410887d0 Separated controller type data into a C file 2022-06-03 15:03:08 -07:00
Sam Lantinga
ae2cc29f8b Make sure initial state is set correctly for the D3D renderer
Fixes https://github.com/libsdl-org/SDL/issues/5749
2022-06-03 09:44:34 -07:00
David Gow
847539afeb wayland: Only call libdecor_dispatch() if we've loaded libdecor
As of #5703, we call libdecor_dispatch() in Wayland_WaitEventTimeout(),
but this will crash if we don't load libdecor, as
SDL_VideoData::shell.libdecor will be NULL.

Since we don't load libdecor if we don't intend to use it (i.e., if
should_use_libdecor returns false), this results in a crash under KDE in
almost all circumstances.
2022-06-01 08:32:13 -07:00
Sam Lantinga
7fa46ec40b The Google Pixel fingerprint sensor also shows up on Linux when running on the phone 2022-05-31 11:11:19 -07:00
Ethan Lee
964e979d06 hidapi: Allow disabling libusb support at runtime 2022-05-30 13:45:24 -07:00
Sam Lantinga
c87b0142fe Fixed building with C89 compiler 2022-05-30 12:02:25 -07:00
Guldoman
f78f775238 ime: windows: allocate space for null terminator 2022-05-28 08:57:29 -07:00
Sam Lantinga
fd2a2eea10 Fixed declaration-after-statement warning 2022-05-28 07:49:18 -07:00
Sam Lantinga
d2c4d74dd0 Fixed build with MinGW-64 windows.devices.power.h
The MinGW-64 header defines the parameters as ABI::Windows::Foundation::IReference<INT32 > **, but the Windows header defines the parameters as __FIReference_1_int**
2022-05-27 15:49:35 -07:00
Sam Lantinga
bd22ca762e Revert "Workaround for compiling with MinGW-w64"
This reverts commit efdf43aa9b.

The broken mingw headers aren't in an official release yet, so reporting this upstream.
2022-05-27 15:40:50 -07:00
Sam Lantinga
efdf43aa9b Workaround for compiling with MinGW-w64
Fixes bug https://github.com/libsdl-org/SDL/issues/5589
2022-05-27 15:34:45 -07:00
Sam Lantinga
bef9f2b2c4 Don't trigger device notifications when Steam Deck backlight changes 2022-05-26 20:45:48 -07:00
Cameron Cawley
347659e8cf riscos: Ensure that last_mouse_buttons is initialised correctly 2022-05-25 14:26:36 -07:00
Cameron Cawley
cb43eb43f8 riscos: Ensure the mouse focus is set when creating the window 2022-05-25 14:26:36 -07:00
Cameron Cawley
6eda520f64 riscos: Add a basic implementation of SDL_ShowCursor() 2022-05-25 14:26:36 -07:00
Sam Lantinga
22d6e09a8d Don't try to call hid_ble_scan() if HIDAPI is disabled
Fixes https://github.com/libsdl-org/SDL/issues/5699
2022-05-25 11:05:39 -07:00
Sam Lantinga
b28d304b23 Only include controller_type.h in SDL_joystick.c
It has a huge array of controllers and we only want it instantiated once
2022-05-24 17:24:54 -07:00
Ozkan Sezer
9220f92bae hidapi/libusb/hid.c (read_thread): mark as SDLCALL 2022-05-25 01:01:02 +03:00
Simon McVittie
412ceb84d4 video: Only check major version in SDL_GetWindowWMInfo
Since #5602, SDL is intended to have the same ABI across the whole
major-version 2 cycle, so we should not check that the minor version
matches the one that was used to compile an application.

There are two checks that could make sense here.

The first check is that the major version matches the expected major
version. This is usually unnecessary and is not usually done (if we're
calling into the wrong library we'll likely crash anyway), but since we
have the information, we might as well continue to use it.

The second check is whether the version provided by the caller is
equal to or greater than a threshold version at which additional fields
were added to the struct. If it is, we should populate those fields;
if it is not, then we cannot. This is only useful on platforms where
additional fields have genuinely been added during the lifetime of
SDL 2, like Windows and DirectFB (but not X11).

This commit changes the first check to be consistent about only looking
at the minor version, while leaving the second check using SDL_VERSIONNUM
(which will be removed or widened in SDL 3, but it's fine for now).

Resolves: https://github.com/libsdl-org/SDL/issues/5711
Fixes: cd7c2f1 "Switch versioning scheme to be the same as GLib and Flatpak"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-24 08:56:23 -07:00
Mathieu Eyraud
fe46569cce Fix potential memory leak in SDL_AddHintCallback 2022-05-21 09:47:34 -07:00
Ivan Le Lann
e4b5afa576 fix unused variable depending on YUV format 2022-05-21 09:46:46 -07:00
Christian Rauch
e59cba95a0 add libdecor_dispatch 2022-05-21 09:40:26 -07:00
Ryan C. Gordon
dc62fec5e9
audio: Fix locking in backends that manage their own callback threads.
Otherwise you might get a race where an app pauses the device, but
the audio callback still manages to run after the pause is in place.
2022-05-20 21:08:29 -04:00
Sam Lantinga
b1cf322971 Fixed HIDAPI PS4 controller being picked up when running under Steam
Input with PS4 configuration enabled
2022-05-19 16:50:59 -07:00
Ryan C. Gordon
9edd411a83
x11: send move/resize events when waiting on fullscreen change.
Otherwise we ignore the Configure/etc events when they come in because
the window is already in an identical state as far as SDL is concerned.

Fixes #5593.

May also fix:
Issue #5572.
Issue #5595.
2022-05-19 17:19:52 -04:00
Cameron Cawley
b798e49c92 Fix build warning with MSVC 2022-05-19 23:55:24 +03:00
Cameron Cawley
f0566702c5 Fix enabling SDL_DYNAMIC_API in OpenWatcom builds 2022-05-19 20:11:10 +03:00
Cameron Cawley
3d52d04977 Remove the '_' prefix from symbol names in Windows OpenWatcom builds 2022-05-19 20:11:10 +03:00
Cameron Cawley
9dfa000bc0 Initial support for building for Windows with OpenWatcom 2022-05-19 20:11:10 +03:00
Sam Lantinga
5669743a43 Make sure SDL_CaptureMouse() is only called on the main thread
Windows handles mouse capture on a per-thread basis, and capture must be done on the thread used to create a window.

Fixes https://github.com/libsdl-org/SDL/issues/5577
2022-05-19 09:52:47 -07:00
Ozkan Sezer
15781a6986 dynapi: fix SDL_DYNAPI_PROC for SDL_iPhoneSetAnimationCallback() 2022-05-19 18:55:02 +03:00
Cameron Cawley
f5cf0e37f7 Remove unused and duplicate defines from SDL_dynapi_overrides.h 2022-05-19 17:23:24 +03:00
Ozkan Sezer
03ebc4397f dynapi: add missing SDLCALL for SDL_TLSSet's dtor param. 2022-05-19 14:01:10 +03:00
Pierre Wendling
501a499180 Add clang-format on/off comments where necessary.
Comments were added in places where INDENT-ON/OFF comments are. Places
like stdlib's asm don't need it as clang-format doesn't try to indent it.
2022-05-19 01:31:29 -07:00
Sam Lantinga
0e6d4baa6b Fixed compile warning on gcc 11 2022-05-19 01:23:24 -07:00
Sam Lantinga
c7dff3a22e Attempt to get the X1 and X2 button state on X11 by using the current event state instead of direct X11 query. 2022-05-19 00:35:22 -07:00
Sam Lantinga
57130b75a9 Revert "x11: get x1/x2 button state in GetGlobalMouseState"
This reverts commit 3fcc2cb500.

Button4 and Button5 are for the scrollwheel, not the extended buttons.
I don't know of a way to query the state of the extended buttons using X11.
2022-05-19 00:31:20 -07:00
Sam Lantinga
47f1cb550d Fixed picking up the correct mapping for virtual controllers on Android
Fixes https://github.com/libsdl-org/SDL/issues/5662
2022-05-18 23:48:15 -07:00
Sam Lantinga
f7b774a7e0 Fixed build error on Linux if HAVE_INOTIFY isn't defined
Fixes https://github.com/libsdl-org/SDL/issues/5682
2022-05-18 17:59:17 -07:00
Sam Lantinga
f9a9d3c8d4 Also restore previous capture window if CaptureMouse() fails 2022-05-18 17:23:49 -07:00
Sam Lantinga
7044452dd6 Handle recursion in SDL_UpdateMouseCapture()
Fixes https://github.com/libsdl-org/SDL/pull/5608
2022-05-18 17:15:45 -07:00
Ozkan Sezer
dbd54dd708 adjust dynapi after commit 0cca71a changes for SDL_qsort and SDL_bsearch 2022-05-19 03:00:04 +03:00
Sam Lantinga
e19a9a7931 Fixed a message box getting the mouse capture state out of sync 2022-05-18 15:34:07 -07:00
Cameron Cawley
622311c016 Add extra XInput structures and defines for older SDKs 2022-05-18 15:04:42 -07:00
Cameron Cawley
c8eea02071 Fix C89 build errors in Windows builds 2022-05-18 15:03:15 -07:00
Cameron Cawley
0cca71a846 Use SDLCALL for callbacks in public APIs 2022-05-18 15:01:27 -07:00
Cameron Cawley
ffab9f46b5 Avoid clashing with system headers when redefining standard library functions 2022-05-18 16:44:17 -04:00
Sam Lantinga
06aca7edaa Fixed warping back into the window when gaining focus with warp relative mode enabled 2022-05-18 10:10:51 -07:00
Sam Lantinga
b44241ab2f Don't send mouse events when warping in relative mode
This fixes games which set relative mode and then did mouse warping at the same time

Reference https://github.com/libsdl-org/SDL/issues/5609
2022-05-18 08:56:09 -07:00
Ivan Epifanov
8c5bda6acd Vita: remove Vita-specific RWOps code 2022-05-18 08:29:25 -07:00
Sam Lantinga
aa6ea607d9 Fixed whitespace
Whitespace inconsistencies reported in https://github.com/libsdl-org/SDL/pull/5673
2022-05-18 06:58:14 -07:00
Ryan C. Gordon
56665e1d9d cocoa: Try to use better system cursors.
These try to pull from the .pdf files that are installed with
macOS, which fit our needs better, and fall back to the most
reasonable defaults available from NSCursor if we can't load
them.

Since these are installed under /System, they should be sandbox
accessible, and if this totally fails, it should still go on,
albeit with a less good cursor.

Reference Issue #2123.
2022-05-17 12:51:08 -04:00
Alex Szpakowski
e9c7b5191c macOS: Fix reference counts of internal window data.
Fixes crashes when destroying or recreating a window (#5664).
2022-05-16 18:17:27 -07:00
Ozkan Sezer
a48004952d disable dynapi for os/2, at least for now. (see bugs #5667 and #5669.) 2022-05-17 01:33:20 +03:00
Ozkan Sezer
ec1a0f62dd SDL_malloc.c: workaround calling convention issues for real_xxx procs. 2022-05-17 01:33:02 +03:00
Sam Lantinga
1f2a241688 Add new virtual joysticks to the end of the list
This guarantees that the device index that's returned is stable, as long as no joystick hotplug events occur.
2022-05-16 09:02:35 -07:00
Sam Lantinga
3c3ccb1d48 Fixed crash if a virtual joystick was disconnected 2022-05-16 08:56:17 -07:00
Ryan C. Gordon
2317a96c8e
x11: Use XC_top_left_corner/XC_top_right_corner instead of XC_fleur.
On Gnome (and hopefully others!), this produces something that actually
matches SDL_SYSTEM_CURSOR_SIZENWSE/SDL_SYSTEM_CURSOR_SIZENESW. On
other desktop enviroments, it probably fits the spirit better than
XC_fleur in any case.

Reference Issue #2123.
2022-05-16 10:53:01 -04:00
Sam Lantinga
48b6cd8bc2 Fixed whitespace 2022-05-16 07:23:30 -07:00
Sam Lantinga
f0bc5c9cbf Added effects support for virtual controllers 2022-05-16 07:21:28 -07:00
Sam Lantinga
b3a18706ee Removed unused variables 2022-05-16 06:37:38 -07:00
Sam Lantinga
7e005bd843 Fixed mapping the paddle buttons with the virtual controller 2022-05-16 06:22:18 -07:00
Sam Lantinga
bfac54b59c Added the ability to specify which buttons and axes are present for virtual controllers 2022-05-15 20:34:44 -07:00
Sam Lantinga
94eeb587c1 First pass at extending virtual controller functionality
Added the ability to specify a name and the product VID/PID for a virtual controller

Also added a test case to testgamecontroller, if you pass --virtual as a parameter
2022-05-15 20:01:12 -07:00
Sam Lantinga
7ad15c5b8f Added game controller support for virtual joysticks
Fixes https://github.com/libsdl-org/SDL/issues/5662
2022-05-15 09:35:52 -07:00
Sam Lantinga
996b3dc37a Fixed warning building with Visual Studio 2022-05-15 09:33:28 -07:00
Ethan Lee
e4bb3c8649 wayland: Fix build for configs without libdecor 2022-05-11 18:13:44 -04:00
Ethan Lee
6222bd3143
wayland: Don't create a new libdecor context if one already exists 2022-05-11 16:26:43 -04:00
Ethan Lee
6f88cbe4c9 wayland: Support xdg_decoration requesting client-side decorations.
Don't be fooled by the diff size - this ended up being a big refactor of the
shell surface management, masked only by some helper macros I wrote for the
popup support.

This change makes it so when xdg_decoration is supported, but CSD is requested,
the system bails on xdg support entirely and resets all the windows to use
libdecor instead. This transition isn't pretty, but once it's done it will be
smooth if decorations are an OS toggle since libdecor will take things from
there.

In hindsight, we really should have designed libdecor to be passed a toplevel,
having it manage that for us keeps causing major refactors for _every_ change.
2022-05-11 13:13:59 -07:00
Eddy Jansson
d7866ffac8 assert: Check for integer overflow.
Move rendering of the assert message into a separate
function so we can remove the ugly loop construction.

Changes the logic such that allocation failure no longer
immediately returns SDL_ASSERTION_ABORT, instead we
fall back to the truncated message.

If an error is indicated from SDL_snprintf, then we do
abort with SDL_ASSERTION_ABORT.
2022-05-11 12:55:49 -07:00
Michael Fitzmayer
9b75fa0165
N-Gage port: add changes from code reviews, overall cleanup (#5618)
* Add changes from code review by @ccawley2011, #5597, overall cleanup

* Update N-Gage README, minor cleanup and rephrasing

* Call SDL_SetMainReady() before calling SDL_main, return SDL_main instead of main
2022-05-11 09:31:34 -07:00
Sam Lantinga
6da99d4a6c Don't use SDL_SIMDFree() if the pixels haven't been allocated with SDL_SIMDAlloc() 2022-05-11 08:40:17 -07:00
Cameron Cawley
2f924020e8 Add SDL_SCANCODE_CALL and SDL_SCANCODE_ENDCALL 2022-05-10 16:12:10 -07:00
Cameron Cawley
2bc373622b Add SDL_SCANCODE_SOFTLEFT and SDL_SCANCODE_SOFTRIGHT 2022-05-10 16:12:10 -07:00
Alex Szpakowski
f871c178b9 macOS: remove dead code for supporting 10.6 at runtime. 2022-05-10 14:04:14 -07:00
Eddy Jansson
f7280dcebb log: Check for integer overflow. 2022-05-10 06:47:11 -07:00
Alex Szpakowski
ec8fa57750 macOS: always use Objective-C ARC (automatic ref counting).
Change Cocoa SDL_VideoData and SDL_WindowData implementations from C structs to Objective-C objects, since bridging between C and ObjC is easier that way.
2022-05-09 21:53:40 -07:00
Simon McVittie
2a7948016a cpuinfo: Check for overflow in SIMD allocation
If the size to be allocated is very large and untrusted, then adding
the padding etc. might be enough to cause unsigned overflow, after
which a very small amount of memory will be allocated.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-09 21:31:39 -07:00
Simon McVittie
cf1daafa3f cpuinfo: Set padding to 0 if none is needed
It'll be simpler to use overflow detection after this refactor.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-09 21:31:39 -07:00
Frank Richter
0e63b514d5 Don't define memcpy(), memset() when using static VC runtime.
The linker will complain about duplicated symbols otherwise
(see #3662, #5156).
2022-05-07 08:10:52 -07:00
Sam Lantinga
8cd908e0b9 Fixed building with Visual Studio 2013
Added SDL_vacopy.h since it needs to be included after Windows headers
2022-05-06 10:51:55 -07:00
Sam Lantinga
a3c1ca1fa1 Added support for the Backbone One guide button
The guide button is activated on a long press (> 400ms)
2022-05-06 09:07:36 -07:00
Simon McVittie
fff97c95eb build: Mechanically generate ABI versions from version number
If we're strict about applying something resembling semantic versioning
to the "marketing" version number, then we can mechanically generate
the ABI version from it.

This limits the range of valid micro versions (patchlevels) to 0-99.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 09:55:35 -07:00
Simon McVittie
cd7c2f1de7 Switch versioning scheme to be the same as GLib and Flatpak
For stable releases, this gives us the ability to make bugfix-only point
releases such as 2.24.1 if we want to, and distinguish between them
programmatically. For example, this ability could have been useful after
2.0.16 to fix Xwayland regressions, and after 2.0.18 to fix event loop
regressions.

For development releases, this gives us the ability to make multiple
prereleases during the same feature cycle, and distinguish between them
programmatically. For example, this would have been useful during 2.0.22
development, which went through three prereleases before reaching the
final release.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 09:55:35 -07:00
Simon McVittie
63814ec767 Add static assertions that the version number is consistent
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 09:55:35 -07:00
Simon McVittie
d4b82bfa4c Add static assertions for version numbers' limits
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 09:55:35 -07:00
Cameron Cawley
b398a847be Add SDL_FLOATWORDORDER for older ARM toolchains 2022-05-04 09:52:11 -07:00
Alexander Kanavin
adac3bd1e2 video: restore ability to disable fb accel via hint
Somewhere in code refactoring between .20 and .22 this check
was lost, and so the hint had no effect anymore.
2022-05-04 08:35:13 -07:00
Ozkan Sezer
3f813cf1ef SDL_rawinputjoystick.c: fixed -Werror=declaration-after-statement 2022-05-04 10:05:56 +03:00
atfrase
db9e14e504 disabled linux joystick debugging outputs and reverted unnecessary comment edit 2022-05-03 10:44:09 -07:00
atfrase
3b53555bcf copied default Steam Controller mapping for wired and wireless-dongle USB pids 2022-05-03 10:44:09 -07:00
atfrase
13b1bf4f21 added default gamepad mapping for Steam Controller with new GUID (possibly caused by the firmware update to enable BLE?) 2022-05-03 10:44:09 -07:00
atfrase
f7a19f9ea8 relaxed the digital hat deadzone slightly, and fixed typo in DEBUG_GAMEPAD_MAPPING define 2022-05-03 10:44:09 -07:00
atfrase
3696e23d09 added hints SDL_HINT_LINUX_DIGITAL_HATS and SDL_HINT_LINUX_HAT_DEADZONES to control the new Linux hat handling; added define DEBUG_GAMEPAD_MAPPINGS to log messages when generating default gamepad mapings for Linux joysticks 2022-05-03 10:44:09 -07:00
atfrase
0b8e796e2c added hueristic to differentiate digital vs analog 'hat' input axes and expose the latter as regular axes; added automatic deadzones to hat outputs, in case analog axes are still mapped to digital hats; updated automatic gamepad control mapping to more completely follow the spec 2022-05-03 10:44:09 -07:00
Michael Fitzmayer
fbd230bb6c
Add support for the Nokia N-Gage (#5597)
* Add initial support for the Nokia N-Gage

* N-Gage: disable clipping for the time being, issue needs to be resolved later

* Move va_copy definition to SDL_internal.h

* Move stdlib.h include to SDL_config_ngage.h, much cleaner this way

* Remove redundant include, add HAVE_STDLIB_H

* Revert "N-Gage: disable clipping for the time being, issue needs to be resolved later"

This reverts commit 4f5f0fc36cc7f34fad05e45671dfa7b8dc32fd51.

* N-Gage: fix clipping issue by providing proper math functions
2022-05-03 08:51:49 -07:00
emily
3fcc2cb500 x11: get x1/x2 button state in GetGlobalMouseState 2022-05-03 07:12:04 -07:00
Susko3
6150245d65 Add new verbosity level for logging of SDL_SysWMEvents
Now logged only if SDL_HINT_EVENT_LOGGING is set to "3" or above.
2022-05-02 15:33:13 -07:00
Daniel Brookman
d1a3981bf8 Fix crash when reading background events for MFi controllers on macOS
Enabling GCController.shouldMonitorBackgroundEvents to read background events
for MFi controllers before receiving the first GCControllerDidConnectNotification
is apparently a no-go on macOS (12.3.1 for me), and would crash on attempt.
Apple's documentation is... not great, and doesn't point this out.

This waits for IOS_AddMFIJoystickDevice() to get called down the chain from GCControllerDidConnectNotification, and enables GCController.shouldMonitorBackgroundEvents
if it hadn't been already.

On iOS and tvOS, GCController.shouldMonitorBackgroundEvents is ignored, so
there's no need to check their versions.
2022-05-02 15:31:28 -07:00
Jan200101
bb0b6dd42e Fixed using WGI without XInput 2022-05-02 11:33:55 -07:00
Sam Lantinga
5394238cdc Don't include the internal header for a file intended for use by applications 2022-04-30 11:40:26 -07:00
Eddy Jansson
9e5cbf034a Disallow non-positive allocation.
Ensure that we're not trying to call SDL_small_alloc()
with a count of zero.

Transforming the code like this fixes a
-Wmaybe-uninitialized warning from GCC 12.0.1
2022-04-29 18:34:13 -07:00
Eddy Jansson
6c2928b4be Switch uses of MIN() to SDL_min()
We're excluding files in src/hidapi to minimize the
diff against the upstream project.
2022-04-29 10:39:51 -07:00
Eddy Jansson
ca26df3404 assert: Allow messages of any length.
Messages are no longer truncated to SDL_MAX_LOG_MESSAGE.
2022-04-29 10:39:02 -07:00
Eddy Jansson
888899244c log: Allow log messages of any length.
Log messages are no longer truncated to SDL_MAX_LOG_MESSAGE.
2022-04-29 10:39:02 -07:00
Eddy Jansson
645db217a0 log: Use malloc for long messages.
For short messages, use a stack buffer that is
significantly smaller than SDL_MAX_LOG_MESSAGE.

The rationale for this is that we don't want to risk
blowing the stack, while at the same time we would
like to not put pressure on the memory allocator unless
absolutely necessary.
2022-04-29 10:39:02 -07:00
Eddy Jansson
73448fe245 assert: Remove use of alloca()
For short messages, use a stack buffer that is
significantly smaller than SDL_MAX_LOG_MESSAGE.

For larger messages, fall back to allocation.
2022-04-29 10:39:02 -07:00
Eddy Jansson
97774cdf72 Move in va_copy() define block from stdlib. 2022-04-29 10:39:02 -07:00
Sam Lantinga
7e636b03cc Removed log message length limitation for Apple platforms
This works in conjunction with https://github.com/libsdl-org/SDL/pull/5584
2022-04-29 10:16:14 -07:00
Carl Friess
2ccb0dfd16 Check for macOS 10.16 to support apps built with older macOS SDKs 2022-04-29 00:24:23 -07:00
Sam Lantinga
a0cdc1fc30 Added declaration of SDL_LogInit() and SDL_LogQuit()
Fixes compile warning on Android
2022-04-28 15:01:34 -07:00
Ryan C. Gordon
29694869b1
audio: Revert one of the resampler optimizations.
This is the one that splits the "left wing" into two for loops to
bubble out the conditional that decides if it should read from the
left padding or the input buffer.

I still believe the optimization is good, but the basic logic of it
was incorrect, and needs to be reexamined and fixed before going
back into revision control.
2022-04-28 15:58:39 -04:00
Ryan C. Gordon
0f45a4e303
log: Don't try to SDL_free the static array. :)
I shouldn't be allowed near computers, I swear.
2022-04-27 12:22:37 -04:00
Ryan C. Gordon
31e83cd14c
log: Fixed build (sorry!) 2022-04-27 12:13:44 -04:00
Ryan C. Gordon
fde9a7086e
log: Make the message buffer static.
Now we don't have to worry about allocation failure, or performance
issues or changes to the allocation layout when trying to track down
subtle bugs.
2022-04-27 12:05:07 -04:00
Ryan C. Gordon
c4141bc11c
log: Wrap the call to the logging implementation in a mutex.
Fixes #2463.
2022-04-27 09:41:05 -04:00
Ryan C. Gordon
2a42952281
log: Don't stack-allocate the message buffer.
It's 4 kilobytes, so I could see this failing if you have a thread with
a tiny stack that unexpectedly logs something.
2022-04-27 09:41:04 -04:00
Ozkan Sezer
12f15aaa74 fix build 2022-04-27 10:03:32 +03:00
Ryan C. Gordon
05bd225a80
x11: If XRandR isn't available, add a generic display.
We can get _some_ of the info we need out of standard Xlib and report a
single display (which might actually be multiple physical displays mushed
into a single desktop). This is better than nothing, but you should really
just build with XRandR support and get a better X server.  :)
2022-04-26 23:17:14 -04:00
Ryan C. Gordon
ccc70e644b
x11: Fixed some compiler warnings. 2022-04-26 23:17:13 -04:00
Ryan C. Gordon
7d7ec9c951
x11: Remove XVidMode and Xinerama support.
Fixes #1782.
2022-04-26 23:17:13 -04:00
Sam Lantinga
e551384a99 Added functions to get the platform dependent name for a joystick or game controller 2022-04-26 14:54:14 -07:00
Mirko Galimberti
b293888c7d Fixes an issue introduced via #5573 when building for i686 2022-04-26 20:55:40 +03:00
Ryan C. Gordon
5066910bf5 audio: Make pregenerated resampler kaiser filter more precise. 2022-04-26 13:32:42 -04:00
Ryan C. Gordon
111c3add73 audio: Resampler optimizations.
- Calculate `j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING` once per loop
  iteration since we use it multiple times.
- Do the left-wing loop in two sections: while `srcframe < 0` and then
  the remaining calculations when `srcframe >= 0`. This bubbles a conditional
  out of every iteration of a tight loop, giving us a boost. We could
  _probably_ do this to the right-wing loop too, but it's less straightforward
  there.
- The real win: Use floats instead of doubles. This almost doubles the speed
  of the entire function on Intel CPUs, and for embedded things without
  hardware-level support for doubles, the speedup is enormous. This in
  theory might reduce audio quality, though, and I had to put a check in
  place to avoid a division-by-zero that we avoided at higher precision, but
  this is likely to be worth keeping for at least the Sony PSP and other
  smaller platforms, if not everyone.
2022-04-26 13:32:42 -04:00
Ryan C. Gordon
de019568dc audio: Prebake the resampler's kaiser table instead of doing it at runtime. 2022-04-26 13:32:42 -04:00
Ryan C. Gordon
f6eb4b0759
pulseaudio: Feed audio data in response to write callbacks.
Instead of waiting until the entire buffer from the SDL callback is ready
to be accepted by PulseAudio, we use pa_stream_set_write_callback and
feed some portion of the buffer as callbacks come in asking for more.

This lets us remove the halving of the buffer size during device open,
and also (hopefully) solves several strange hangs that happen in unusual
circumstances.

Fixes #4387
Fixes #2262
2022-04-26 13:22:32 -04:00
Sam Lantinga
01ef98a5d0 Don't force keyboard auto-repeat on, if the user has disabled it for some reason
Fixes https://github.com/libsdl-org/SDL/issues/2400
2022-04-26 10:19:52 -07:00
FriendlyAI
795744fc75 Turn off relative mouse before window checks as well 2022-04-26 10:07:26 -07:00
FriendlyAI
e2d268a399 SDL_cocoamouse.m: SetRelativeMouseMode even if out of focus
Should fix #3087
2022-04-26 10:07:26 -07:00
Jibb Smart
d7c07d6b09
Read motion sensor scale from Switch controllers (#5555)
* Read IMU scale data from Switch controllers. Up until now, SDL has used hard-coded scaling which isn't correct with some supported controllers.

* Moved declarations to beginning of code blocks to better fit with SDL style requirements
2022-04-26 09:57:17 -07:00
Mirko Galimberti
76afb8583b Introduces Cocoa_GetWindowDisplayIndex. This enable a proper management for dpi when switching between retina and non-retina displays. 2022-04-26 09:51:31 -07:00
Dimitriy Ryazantcev
c39df2fb0c joystick: get HID top-level collection preparsed data directly from RawInput API. 2022-04-26 09:48:35 -07:00
Ozkan Sezer
e9ff4fdd49 add SDL_bsearch 2022-04-26 04:03:25 +03:00
Mathieu Eyraud
0b2a55ea7d Fix typo 2022-04-25 15:46:17 -07:00
meyraud705
3dcfe86082 Add joystick battery event 2022-04-25 15:46:17 -07:00
meyraud705
0964c84d77 Always use SDL_PrivateJoystickBatteryLevel to update battery level
But do not use it for initialisation.
2022-04-25 15:46:17 -07:00
Sam Lantinga
fa29e2d7f7 Updated to version 2.0.23 for development 2022-04-25 13:45:51 -07:00
Ryan C. Gordon
53dea98309
x11: revert checks for _NET_WM_STATE_FULLSCREEN changes.
This reverts commit 85977354fb.
This reverts commit 0249df9d96.

Fixes #5572.
Reopens #5390.
2022-04-25 14:00:04 -04:00
Sam Lantinga
981e1e3c44 Fixed logical size synchronization issue on macOS
https://discourse.libsdl.org/t/sdl-2-0-22-prerelease/35306/6
2022-04-23 10:35:05 -07:00
Ozkan Sezer
7a5743031d hidapi, libusb: import mainstream commit 536bad201e 2022-04-23 20:01:40 +03:00
Sam Lantinga
fa073ed01a Revert "Fix relative mouse input for Unvanquished (unvanquished.net)"
This reverts commit 3318590796.

Fixes https://github.com/libsdl-org/SDL/issues/5569
2022-04-22 22:31:04 -07:00
Sam Lantinga
8986efd643 Added support for the Backbone One controller on iOS 2022-04-22 14:21:46 -07:00
Sam Lantinga
2ca0837888 SDL: sometimes the PS5 controller doesn't report having to power even when connected over USB. Possibly related to being completely charged? Either way we already know that it's USB or BT so let's use the driver's knowledge instead. 2022-04-22 14:21:41 -07:00
Sam Lantinga
04bf7c9434 Fixed build 2022-04-22 09:36:39 -07:00
Sam Lantinga
d9b5805ba5 Return a correlation error when trigger rumble is attempted without correlation 2022-04-22 09:13:40 -07:00
Sam Lantinga
ba62ead5ec Handle potential out of memory condition when working with hints 2022-04-21 08:47:41 -07:00
Cameron Gutman
145824f6ab WGI: Only call RoUninitialize() if RoInitialize() succeeded 2022-04-21 08:47:22 -07:00
Cameron Gutman
00b2e10a7a WGI: Keep a reference to the MTA to avoid crashing on COM teardown
Fixes #5552
Fixes #5270
2022-04-21 08:47:22 -07:00
Cameron Gutman
8982d9f403 windows: Fix RoInitialize() failure after a CoInitializeEx() call using apartment threading
This mirrors the same codepath in WIN_CoInitialize() which handles STA and MTA.
2022-04-21 08:47:22 -07:00
Cameron Gutman
923cb4463e windows: Fix calling convention for RoInitialize/RoUninitialize
Fixes #5563
2022-04-20 21:02:40 -05:00
Ryan C. Gordon
d4a01bfef0
os2: SDL_DestroyMutex should ignore NULL mutexes.
Every other backend does this, so this should match, now.
It's possible this was harmless, but we can avoid the system call
and the (likely?) debug message when it fails, though!
2022-04-20 14:08:09 -04:00
Eddy Jansson
a40405d724 hidapi: Wrap CopyHIDDeviceInfo in define checks.
The purpose of this is to silence a 'defined but not used'
warning.
2022-04-20 09:33:40 -07:00
Frank Praznik
aeadbdd788 Remove an unused function prototype 2022-04-20 09:39:34 -04:00
Frank Praznik
c8c59a2139 Fix a -Wshadow warning 2022-04-20 09:39:34 -04:00
Jaylon Gowie
d9009388c8 SceKernelMemBlockType to unsigned int 2022-04-19 14:17:27 -07:00
Jaylon Gowie
3753a7b1c3 Fix recent changes in VitaSDK 2022-04-19 14:17:27 -07:00
Sam Lantinga
02225aa738 Fixed build 2022-04-18 22:57:03 -07:00
Ryan C. Gordon
49a2e4b0ea
x11: Revert "Fix keymap updating for X11 backend"
This reverts commit de6d290266.

This patch had multiple issues, discussed in #5520.
2022-04-19 00:37:39 -04:00
Sam Lantinga
b9fe6ba0e7 Fixed compile warnings 2022-04-18 13:09:08 -07:00
Sam Lantinga
57927a2458 Don't call scandir() inside of scandir()
This works around a crash in address sanitizer
2022-04-18 12:57:28 -07:00
Sylvain
1ede941f5c SDL_render.c: internally change viewport/cliprect type from SDL_FRect to SDL_DRect (double precision). (see bug #5547) 2022-04-18 12:26:32 -07:00
Sam Lantinga
9919d1a7a5 Remove HWND_TOPMOST for fullscreen windows
Fixes https://github.com/libsdl-org/SDL/issues/5509
2022-04-18 11:51:54 -07:00
pionere
009a0ff95f use explicit GetModuleFileNameW 2022-04-18 14:12:22 -04:00
pionere
de711e1685 simplify SDL_GetBasePath on windows
- use GetModuleFileName directly (as recommended)
2022-04-18 14:12:22 -04:00
Jan Beich
7c140429a8 Enable evdev-based gamecontrollerdb on FreeBSD 2022-04-18 09:57:49 -07:00
Sam Lantinga
e7b01ee745 Added controller mapping for the Thrustmaster Dual Analog 3.2 on Linux 2022-04-18 09:55:52 -07:00
Frank Praznik
2b52946143 video: Don't minimize fullscreen windows on focus loss by default when mode switching is disabled
When mode switching is disabled in a video backend, fullscreen windows are basically just fullscreen desktop windows with different internal scaling.  As no mode switching occurs, there's no need to minimize them on focus loss by default.  This can still be overridden by explicitly setting the internal hint for minimizing on focus loss.

This has the side effect of fixing a bug on GNOME, where, when a fullscreen Wayland window has it's focus lost and restored via alt+tab followed by switching back to windowed mode, the top portion of the window won't end up being obstructed by GNOME's top bar.
2022-04-18 09:39:25 -07:00
Ethan Lee
c37090f9a4 wayland: Add support for TOOLTIP/POPUP_MENU 2022-04-18 12:31:02 -04:00
Sam Lantinga
9e264b921b Certain audio drivers, like the RME "Pro" Audio driver, have resampling quality issues when using WASAPI.
We'll use SDL's resampling algorithm so we have consistent quality between platforms and drivers.

Fixes https://github.com/libsdl-org/SDL/issues/5538
2022-04-18 09:20:47 -07:00
Sam Lantinga
254fcc90eb Revert "video: Prefer Wayland over X11"
This reverts commit 8ceba27d62.

SDL Wayland support is stable, but there are a number of issues with third-party software (NVIDIA drivers, libwayland event overflow, libdecor not handling plugin load failures, Steam overlay not working with Wayland, etc.) that make it better to default to X11 at this time.

Games which would like to prefer wayland when available can use the following code before SDL_Init():
	SDL_SetHint(SDL_HINT_VIDEODRIVER, "wayland,x11");

Fixes https://github.com/libsdl-org/SDL/issues/5527
2022-04-18 09:03:14 -07:00
Ryan C. Gordon
c1336b21ed hints: Make SDL_VIDEODRIVER and SDL_AUDIODRIVER formal hints.
They were just environment variables before.

Fixes #5528.
2022-04-17 11:31:55 -07:00
Ryan C. Gordon
67e0f546c5
x11: Update the display when the WM changes a window's fullscreen state.
Fixes #5390.
2022-04-15 18:25:53 -04:00
Frank Praznik
edb473cf46 video: Wayland: Always round scaled pointer coordinates down
Rounding up can cause the pointer coordinates to exceed the window boundaries at the right and bottom edges.
2022-04-15 16:24:20 -04:00
Frank Praznik
13393a1c4b video: Wayland: Clamp fullscreen window dimensions to desktop
A scaled fullscreen window may exceed the bounds of the desktop.  Clamp the window size to the desktop dimensions in fullscreen mode.
2022-04-15 16:24:20 -04:00
pionere
0adb67017b avoid NullPointer in SDL_GetRenderTarget 2022-04-15 15:47:35 -04:00
pionere
01b14e14e6 avoid NullPointer in SDL_GL_MakeCurrent 2022-04-15 08:30:33 -04:00
David Gow
9c2f46b0d5 Wayland: Add SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR
This hint allows libdecor to be used even when xdg-decoration is
available. It's mostly useful for debugging libdecor, but could in
theory be used by applications which want to (for example) bundle their
own libdecor plugins.
2022-04-12 11:52:41 -04:00