Commit graph

7117 commits

Author SHA1 Message Date
Colin Kinloch a683ce4153 linux: Add portal drag and drop 2023-09-20 11:01:49 -04:00
Sam Lantinga 37dee79b74 Fixed sensor timestamp units for third-party PS5 controllers
(cherry picked from commit a72dfa6a5fe8d8901175db852de8686b83487522)
2023-09-18 13:00:33 -07:00
Sam Lantinga 62e7049a4f Fixed error: array subscript 2 is above array bounds of ‘const Uint8[2]’
Smart compilers don't like dereferencing off the end of arrays

(cherry picked from commit f6756047a4190d9c82222e4ec378bdb14a72f8d7)
2023-09-18 12:20:22 -07:00
Sam Lantinga fff3c2573a Fixed sensor timestamp calculation for third-party PS5 controllers
(cherry picked from commit 7059a55ccca04b75145c3d23a317fbe1eb77039e)
2023-09-18 11:58:39 -07:00
Guldoman 70a2ac2f1c x11: Always update clipboard owner
This allows utilities like clipboard managers to keep track of the
changes.

(cherry picked from commit 65aaf3a9ab9ec2be2973084060c2df5321b5acaa)
2023-09-15 05:23:02 -07:00
Max Bachmann a8b9414697 detect fanatec steering wheels
(cherry picked from commit fd1c54a004250d844d82bb20ddfe75029585f53a)
2023-09-12 15:36:20 -07:00
Simon McVittie 8ad043fc38 render: Enable clipping for zero-sized rectangles
Battle for Wesnoth apparently relies on being able to disable rendering
of UI elements by setting the clip rectangle to be empty.

Resolves: https://github.com/libsdl-org/SDL/issues/6896
Fixes: 00f05dcf "render: only enable clipping when the rectangle is valid"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-09-09 11:14:04 -07:00
Frank Praznik 88299502b4 wayland: Ensure that the toplevel window is recreated when switching decoration modes
If a compositor tries to change the decoration mode when initially creating a window, the hidden flag might not yet be unset if the decoration mode is changed during the initial roundtrip in Wayland_ShowWindow(). As hiding the window destroys the decoration manager object, the hidden flag check is unnecessary, as the decoration configuration listener will never be entered when the window is hidden.

(cherry picked from commit 37e1fc3b5894f379f4f8253b867a76a135213a7d)
2023-09-06 14:56:16 -04:00
Makarenko Oleg 1d495351a0 Detect Simagic wheel bases as wheels (#8198)
Simagic DirectDrive wheel bases have the same vendor + product id's

(cherry picked from commit a2c1984d371e86e97bd6ffb176e835925e6afb3a)
2023-09-04 12:12:21 -07:00
Oleg 365a36386a Detect Logitech G923 Playstation as wheel
G923 have two different versions - Xbox version is already present in the wheel list, but not the PS version.

(cherry picked from commit 266b91d2fd2b3362d1828f8a6b58589bdaa4f75d)
2023-09-04 11:05:52 -07:00
Oleg 242b25aba4 Detect Logitech PRO Racing Wheel for Xbox (PC mode) as wheel
Logitech PRO Racing Wheel have two different versions - for Playstation and Xbox. Vendor + Product ID for Playstation version already present in SDL sources, but not an Xbox version

(cherry picked from commit cde67ea49ad812088bd5c8cfd67ef090ac1c1d86)
2023-09-04 11:01:52 -07:00
Jeremy Demeule aa7ba62978 metal: Add hint to select low power device instead of the default one (#8182)
On some system like MacBook Pro Intel with AMD card, asking for the default device will always return the AMD GPU.
This is not an issue for 99% of the case when the renderer context is here to provide the maximum performance level like for game.
However, for video application using GPU for 1 quad and 1 texture, using the discrete GPU for that lead to an important power consumption (4 to 8W), heat increase, and fan noise.
With this patch, I successfully amend ffplay to only use the integrated GPU (i.e. the Intel one), instead of the discrete GPU (i.e. the AMD one).
2023-08-31 01:55:18 -07:00
Anonymous Maarten 0b995f21e7 wayland: add SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL 2023-08-30 23:03:47 +02:00
Anonymous Maarten bb1fe302cf wayland: don't define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_* macro's
They mess with #ifdef conditional in headers.
2023-08-30 22:46:17 +02:00
Ozkan Sezer f032e8c191 updated dynapi after SDL_GDKGetDefaultUser addition 2023-08-25 19:03:40 +03:00
Ethan Lee 24fcb61470 – gdk: Add SDL_GDKGetDefaultUser, SDL_GetPrefPath implementation 2023-08-25 10:41:14 -04:00
Sam Lantinga 6ff48dddcb Fixed the report format for the Razer Wolverine V2 Pro
(cherry picked from commit 69aec8c915b5cddae2bb6171d7d5404f4d779db3)
2023-08-24 11:38:18 -07:00
Ryan C. Gordon 9237f8edc1
video: Fixed small memory leak when disconnecting a display. 2023-08-23 16:27:10 -04:00
Ryan C. Gordon 1f4e86d61c
video: Minor cleanup in SDL_VideoQuit.
(This code changed in SDL3, no need to cherry-pick it to there.)
2023-08-23 16:27:09 -04:00
Ryan C. Gordon 04ff593bf5
emscriptenaudio: Fire the capture silence_callback at an interval.
Previously it was using setTimeout, not setInterval, so it would only fire
once, which was obviously a mistake.

(cherry picked from commit fb79211732d0cdf17a250a43c619b6938842cfaf)
2023-08-23 16:25:30 -04:00
Ryan C. Gordon ddbbef88e3
emscriptenaudio: Don't bother undefining things about to be unreachable.
Since the top-level table is getting undefined, all the things in it will
be unreachable and eligible for garbage collection without explicitly
nulling them out.

(cherry picked from commit 5191b20541fce0e3b3071124ced69c31fcaeb783)
2023-08-23 16:24:09 -04:00
Ryan C. Gordon ae7f54f514
emscriptenaudio: Deal with blocked audio devices better.
Now, if the AudioContext starts in a "suspended" state, because the browser
blocked it from playing by default, we we run the audio "thread" in a timer
and throw away the generated audio. Once the AudioContext is allowed to
resume, we clear this timer.

The end result is that the app will continue to drain its audio queue
instead of consuming more memory over time (and, if it relies on an audio
callback to make progress, continue to run!), with the effect that the
page is merely silent but otherwise functioning as intended.

Once the user interacts with the page and the browser permits the the
AudioContext to run for real, audio should still be in sync, instead of
just starting to play audio that might now be at least several seconds behind.

(cherry picked from commit fd75a4ca05bdbd7b0fecf781e59c77a07d264b16)
2023-08-23 16:21:49 -04:00
Sam Lantinga 0b9d8e679a Quiet spurious warning
Fixes https://github.com/libsdl-org/SDL/issues/8112
2023-08-13 13:54:18 -07:00
Anonymous Maarten 10135b2d7b Fix overflow when doing SDL_sscanf("%hd", ...)
An overflow occured in the stdlib_sscanf test, when using msys2 clang32 toolchain.

(cherry picked from commit 342ec5113171214154cb197bb3e0e3a0056ea2ad)
2023-08-10 15:06:57 -07:00
Mathieu Eyraud f348370e1b Fix out of bound read of 'has_hat' array
(cherry picked from commit 94b3f78c440bfd52182848adf39db71325861e9c)
2023-08-10 08:26:45 -07:00
Sam Lantinga 951657c99b Fixed crash when running with the dummy video driver 2023-08-10 08:25:29 -07:00
Sam Lantinga 7df721d4e9 Allow running tests with the dummy video driver 2023-08-10 08:25:29 -07:00
Anonymous Maarten 0465224616 Sync -Wsign-compare warning fix from sdl2-compat 2023-08-09 02:53:48 +02:00
Sam Lantinga 4bceea70c5 Added the Victrix Pro FS for PS4/PS5 to the controller list
(cherry picked from commit fa189d302e93ceca7db194709563b901ae1bbfd4)
2023-08-07 14:10:56 -07:00
Frank Praznik f522c5380c wayland: Don't initialize OpenGL when the window flags didn't specify it
Applications that don't specify a rendering flag are likely handling Vulkan/GL themselves, so SDL loading OpenGL by default in this case is unnecessary overhead, and if a render backend requires it, the window will be recreated with the appropriate flags when the renderer is initialized.

(cherry picked from commit 9ab20251277d001ee34caeb59a7eaa54b40af622)
2023-08-04 08:53:16 -07:00
Sam Lantinga 2304b4e86a Added a gamepad mapping for the G-Shark GS-GP702
Fixes https://github.com/libsdl-org/SDL/issues/8068

(cherry picked from commit 06bea1eb5544e778c1258d3d7f47f6d06110c379)
2023-08-02 14:38:29 -07:00
Sam Lantinga 0f753d9794 The Flydigi Vader and Apex series controllers all have the same VID, PID, and name
(cherry picked from commit 58e3084477afe344bae42ab352d56eba25b4a36b)
2023-08-02 14:38:23 -07:00
Sam Lantinga 805fc29ae8 Removed Flydigi Vader 2 mappings
Many of the Flydigi controllers use the same VID/PID and have different mappings, so let's revisit this once we have more data.

(cherry picked from commit 5388edd5494030b8c43b2f79e3f5c9b71f57a703)
2023-08-02 14:38:01 -07:00
Ozkan Sezer 57f3c41b97 adjusted coding style in SDL_os2_joystick.c to match rest of SDL better 2023-08-02 20:40:10 +03:00
Ozkan Sezer b58557a3a6 minor os/2 stuff merged from the bitwiseworks' fork
(cosmetics only.)
2023-08-02 17:10:28 +03:00
Ozkan Sezer 6a787b8004 SDL_video.c: move ngage video before offscreen.
Reference issue: https://github.com/libsdl-org/SDL/pull/8069.
(cherry picked from commit e2e87a536c1d05c41243747ad8e755398803b185)
2023-08-02 17:00:40 +03:00
Ozkan Sezer 0deed07b3e SDL_video.c: move os2 video before offscreen.
as offscreen is enabled in CMakeLists.txt, we get a blanks window
otherwise.

From a patch by Silvan Scherrer, at Bitwiseworks' fork.
(cherry picked from commit 66d5ad19f0260f42426a66fe664b6e98291faa37)
2023-08-02 17:00:40 +03:00
Sam Lantinga ebf2c49b50 Fixed build 2023-08-02 01:37:05 -07:00
Sam Lantinga 38c63afd64 Fixed duplicate key press/release events on iOS
When a hardware keyboard is attached, it can take over 100 ms for the keyboard event to generate text input. In that case we want to record that we recently received a keyboard event so we don't synthesize duplicate virtual key press/release events for the input text.

(cherry picked from commit 648de4f9b8ebcf9e794aba2ec2955d129167c48b)
2023-08-02 01:27:54 -07:00
Sam Lantinga 030bb7282a Synchronize on-screen keyboard state with text input active state
When a hardware keyboard is attached to an iPad, you can easily trigger a set of on-screen keyboard transitions that will take place over time, and we need to track whether we're currently showing or hiding the keyboard and make sure we don't clobber the existing state during those transitions.

Testing:
* Connected a hardware keyboard to an iPad
* Launched checkkeys
* Noted the keyboard bar was active at the bottom of the screen and text input was active
* Tapped with both fingers to quickly toggle text input off and back on
* Noted the keyboard bar slid down and then back up, and text input was active
* Tapped on the keyboard bar to bring up the full on-screen keyboard and then closed it so the keyboard bar was still active, and text input was still active
* Tapped on the screen to turn text input off, noted the keyboard bar slid down
* Tapped with both fingers to quickly toggle text input on and back off
* Noted that the keyboard bar slid up and then back down, and text input was inactive
* Tapped on the screen to turn text input on, tapped on the keyboard bar to bring up the full on-screen keyboard, and text input was active
* Pressed a key on the physical keyboard, the on-screen keyboard closed, the key press and release was delivered (with no text input) and then the keyboard bar slid up, and text input was active again

Fixes https://github.com/libsdl-org/SDL/issues/7979

(cherry picked from commit c3288d113e434b20d2f0dda73210d3a52504d199)
2023-08-02 01:17:15 -07:00
Sam Lantinga 335e9c769a Only pass keypresses up the responder chain when text input is active
This is another attempt to make sure we don't cause beeps from unhandled key presses while still allowing full text input functionalty.

If this isn't selective enough, we might need to go up the responder chain to see what's going to handle the event before passing it along.

Fixes https://github.com/libsdl-org/SDL/pull/6962

(cherry picked from commit a8abe612ed5597cbaabb903c0121b5b48baee91d)
2023-08-02 01:14:07 -07:00
Sam Lantinga 5e9320f6b5 Revert "Stop beep when running iOS apps on ARM-based Macs"
This reverts commit bbf38bbbc334bc0ee90d3eec228a968d8fc1689e, which prevented text input from working when a hardware keyboard was connected, since key strokes don't get to the text input field.

Fixes https://github.com/libsdl-org/SDL/issues/7958

(cherry picked from commit f5ea6ae18d860796184b9b31a2005957cb7e30a2)
2023-08-02 01:12:21 -07:00
Sam Lantinga e2afc1f37a Fixed build 2023-08-01 18:58:21 -07:00
Sam Lantinga 2468fccf7f Fixed crash if a display is enumerated twice
This can happen if a monitor is in the process of becoming primary because another monitor was disconnected.

(cherry picked from commit 07578fde3dad2dadd605f5b18399c8d021f6ae5d)
2023-08-01 18:30:24 -07:00
Ryan C. Gordon dc5dda0f31 cocoa: Ignore first mouse motion event after enabling relative mode.
Fixes #7918.
2023-08-01 18:34:03 -04:00
Ryan C. Gordon 3030fd815c
x11: Blocking for window maximization should wait 100 ms, not 1000.
Reference Issue #7070.
2023-08-01 13:55:04 -04:00
Ryan C. Gordon 5c3df60ec9
Revert "x11: check if window size/position has changed during SDL_ShowWindow."
This reverts commit aa536217b3.
2023-08-01 12:10:52 -04:00
Sam Lantinga 8825fbf713 Fall back to Xlib if XRandR isn't available
This fixes video initialization on headless systems with VNC

Fixes https://github.com/libsdl-org/SDL/issues/8054

(cherry picked from commit 71099149b8fc062ea0ece232ccdd9f0ee9b3588b)
2023-07-31 14:41:34 -07:00
Mathieu Eyraud 82cd3bfe1c Add missing break
(cherry picked from commit 0500fca00c141cc4ab9be15ce5ddb7bc8c5c17b2)
2023-07-29 17:33:10 +03:00
Ozkan Sezer 7cc3248044 minor os/2 stuff merged from the bitwiseworks' fork 2023-07-28 23:55:50 +03:00
Sam Lantinga 507be6c3f8 Sorted controller list
(cherry picked from commit 3174d0b97025376e4a7b6e881501a43472238e0e)
2023-07-27 12:49:24 -07:00
Max Maisel f4561db69a Add Steam Deck controller mapping to database.
This adds support for the back paddles, and the "..." key
which are not automatically detected.
* "Back" is mapped to the top left "two windows" key.
* "Start" is mapped to the top right "hambuger menu" key.
* "Guide" is mapped to the "Steam" key.
* The "..." key is just a generic button.

When looking at the screen, paddles are number
* P1: Top right
* P2: Top left
* P3: Bottom right
* P4: Botom Left

The new controller mapping was created with the SDL3 gamepadmap tool.

(cherry picked from commit 27b8abb0562f46e64337d5d799b877c357001254)
2023-07-27 12:49:24 -07:00
Sam Lantinga 37d1ab83c5 Make sure the mouse and keyboard focus is cleared when a window is hidden
(cherry picked from commit a16b241b8937db7701fce6c1f410e3af84f8c4e6)
2023-07-25 11:50:54 -07:00
Ozkan Sezer 890bee64a4 os2 audio refactoring and capture support
- Fixed audio device detection and usage.
- Implemented audio capture support
- Refactored buffer handling to separate pointers to fill and drain buffers.

Based on patches by josch1710 and Lars Erdmann:
https://github.com/bitwiseworks/SDL2-os2/pull/7
2023-07-25 11:40:02 +03:00
Weng Xuetian 64294e4560 Remove the unimplemented CloseIC in fcitx module
This call is actually a left-over when porting from fcitx4 service to the new org.freedesktop.portal.Fcitx supported by both fcitx4/fcitx5. CloseIC is actually never a part of the new interface on org.freedesktop.portal.Fcitx. It cause any issue user visible effect.
2023-07-20 13:37:13 -07:00
Sam Lantinga c4c034ca4b Don't fail to create a window if it's too large, just clamp it to the max instead
Some window is better than no window...

(cherry picked from commit 4a18893c73a4a6b963384e186c1b70c6f6cb08a4)
2023-07-17 17:48:56 -07:00
Sam Lantinga f7dc8c0eaa Fixed LED pending check failing when the controller timestamp is very large
In this case we know the controller has been on for a while and the Bluetooth connection LED cycle is complete.

Also fixed the timestamp being zero the first time it is checked

(cherry picked from commit bd4f155bbbdc4be34505535e4bd936ae12671925)
2023-07-17 17:40:17 -07:00
Sam Lantinga bb036ef544 Don't send k_EPS5FeatureReportIdCapabilities to Sony PS5 controllers
This report is for third party controllers only.

(cherry picked from commit 16dd5f0da4ee950e9f998a757dcb4789463e67e2)
2023-07-17 17:39:33 -07:00
Sam Lantinga 910dad505a Don't tickle Bluetooth PS5 controllers in simple mode with an effects packet
That will put the PS5 controller into enhanced mode, which breaks DirectInput games

(cherry picked from commit 2fef0be2f646ae048e239aa6694e632081c85238)
2023-07-17 17:36:41 -07:00
Ozkan Sezer 4b2b475ac2 remove unused vulkan/*.hpp files.
(cherry picked from commit 611b3dd1fd7aec30ba9c830c7c5f8a0cdbaf9ff5)
2023-07-17 00:11:51 +03:00
Sam Lantinga 6089b35706 Fixed getting the CRC of virtual joysticks without a VID/PID
(cherry picked from commit b40fb5c51e2a5350ba00fbf4db86b4ae1066db92)
2023-07-16 04:36:06 -07:00
Frank Praznik a999100858 wayland/video: Validate the returned window display pointer before dereferencing it
If, in the case where all displays has been disconnected, and some window state change occurs before an active display is re-added and finalized, the pointer returned by SDL_GetDisplayForWindow() will be null necessitating that the returned pointer be checked for validity before dereferencing it.
2023-07-14 10:43:54 -04:00
Ryan C. Gordon b9d16dac4e
pulseaudio: Some fixes that seem to avoid an assertion in libpulse.
- Make sure the hotplug thread has hit its main loop before letting
  DetectDevices continue.
- Don't unref the context subscription operation until it completes
  (or we are shutting down).

I'm not sure which change fixed the problem, but at least one of them
appears to have done so.

Reference Issue #7971.
2023-07-12 23:29:39 -04:00
Ozkan Sezer 776a5e0d25 pulseaudio: eliminate <pulse/simple.h> include. 2023-07-13 01:51:10 +03:00
Ryan C. Gordon 832b524180
pulseaudio: don't wait on pa_context_subscribe in hotplug thread.
This risks blocking the thread if disaster ensues, and we can wait in the
thread's main loop for subscription as well anywhere else.

Reference Issue #7971.

(cherry picked from commit 956b18f50cc3794f253b025cca6e5e00c445fd67)
2023-07-12 16:05:09 -04:00
Ozkan Sezer 29d461b628 need pulseaudio >=0.9.15. call pa_threaded_mainloop_set_name only if available. 2023-07-12 21:39:41 +03:00
Sam Lantinga e8b6edd5a0 RAWINPUT_RegisterNotifications() should return int, for consistency
(cherry picked from commit 1903d7b1bf6c73ef23e4d6934c9fec5246dd0b2e)
2023-07-11 10:52:57 -07:00
Sam Lantinga 34c5bde355 Improved RAWINPUT <-> XInput/WGI device correlation
If there is only one controller slot available, assume that's the one matching new RAWINPUt devices. This will be right most of the time, and uncorrelation will fix any bad guesses.

(cherry picked from commit 41882a1acb6054dc7a56fd5ff7f0a279ba1144c0)
2023-07-11 10:46:37 -07:00
Sam Lantinga 9117b2e300 Fixed crash if RAWINPUT is not initialized
We shouldn't be doing any of this work in that case

(cherry picked from commit dfc5e6964eca0a0813768518d08cf1c80136e896)
2023-07-11 10:46:37 -07:00
Sam Lantinga 6bf5f5a221 Don't send k_ePS4FeatureReportIdCapabilities to Sony PS4 controllers
This report is for third party controllers only, and might be causing issues with fake PS4 controllers.

Reference https://github.com/libsdl-org/SDL/issues/7960

(cherry picked from commit 092a4b780ca464de71b89ffa5dc655ce256ce350)
2023-07-10 09:48:43 -07:00
Sam Lantinga 92fd2938e7 Minor cleanup 2023-07-10 09:42:12 -07:00
Andre Barata 9cd7cbe134 Added support for absolute mice with evdev 2023-07-10 09:37:45 -07:00
Christopher Wellons 8231278817
Unaligned stacks on i686-w64-mingw32, may lead to crashes (#7607)
Co-authored-by: Ozkan Sezer <sezeroz@gmail.com>
2023-07-10 03:05:32 +03:00
Ozkan Sezer 0ad822eb70 SDL_RWFromMem, SDL_RWFromConstMem: reject negative size parameters. 2023-07-10 00:14:35 +03:00
Sam Lantinga 156c7badf5 Re-added mappings for older Xbox One controllers on Linux
The xpad kernel driver doesn't know about these controllers and ends up using BTN_C and BTN_Z and the automatic mapping doesn't work correctly.

It turns out VID 0x045e and PID 0x02e0 is used by the 8BitDo SN30 Pro when connecting via Bluetooth in XInput mode.

Fixes https://github.com/libsdl-org/SDL/issues/7925

(cherry picked from commit 80e1c75e1c6d330318478c1549a97aedb09e58bc)
2023-07-09 09:50:46 -07:00
Sam Lantinga 4b1dd54a56 Fixed mapping BTN_TR2 to right trigger
(cherry picked from commit ea60da5b94ed8ec69aad69ca46e81567ab99ed2a)
2023-07-08 18:18:48 -07:00
Alex Maese acdde129bb X11: Use XFixes to detect clipboard updates
Currently, SDL_CLIPBOARDUPDATE events are only sent when an SDL window
has its selection cleared.  This change sends the event anytime the
XFixesSelectionNotify event is raised, and when the selection is either
the clipboard or the primary selection.
2023-07-08 13:17:40 -07:00
Sam Lantinga f8a0135edf Added WGI gamepad added/removed listeners for RAWINPUT
This fixes WGI correlation on startup when the WGI gamepad list isn't populated yet

(cherry picked from commit f047e178b610c6888212c3096c10eb3f64f31a15)
2023-07-08 10:40:12 -07:00
Sam Lantinga 1f7bc08884 Don't tickle Bluetooth PS4 controllers in simple mode with an effects packet
That will put the PS4 controller into enhanced mode, which breaks DirectInput games

(cherry picked from commit efed24850af2994802c28f7a257ea17c9ec97d0a)
2023-07-08 10:30:31 -07:00
Sam Lantinga de849d5e6f Lazily initialize the WGI gamepad support
Initializing "Windows.Gaming.Input.Gamepad" will put Bluetooth PS4 controllers into enhanced report mode, which breaks any game using DirectInput. Let's wait to do this until absolutely necessary.

(cherry picked from commit 785f57eb9102206e74ac7f9b363a37cbf037cf9d)
2023-07-08 10:30:14 -07:00
Sam Lantinga a6228e7aaf Added the hint SDL_HINT_JOYSTICK_WGI to control whether to use Windows.Gaming.Input for controllers 2023-07-08 09:34:58 -07:00
Sam Lantinga e16a83d393 Prefer using XInput for rumble over WGI, as it allows rumble in the background 2023-07-07 09:47:49 -07:00
Sam Lantinga a0a3957eb6 Continue running XInput detection while RAWINPUT is active
This allows us to re-enable XInput correlation for RAWINPUT devices without reintroducing the controller shutdown bug for controllers using the wireless adapter in https://github.com/libsdl-org/SDL/issues/3468.

Fixes https://github.com/libsdl-org/SDL/issues/7940
2023-07-07 09:47:48 -07:00
Takase b90343e512 video(wayland): use both --icon and --icon-name for Zenity (#7897)
video(wayland): use both --icon and --icon-name for Zenity

Many distros ship an older version of Zenity that supports GTK3, while some distros ship newer version of Zenity which uses libadwaita.

This command tries to use --icon and fall back to --icon-name when it fails.
2023-07-06 17:56:51 -07:00
Sam Clegg 042243471f emscripten: Add JS library dependencies using EM_JS_DEPS macro
See https://github.com/emscripten-core/emscripten/pull/19780
2023-07-06 18:15:49 -04:00
Sam Lantinga 3054c0dc50 Fixed %p formatting when there is following text
(cherry picked from commit f4bd17deeeca6957d92979cf07fa436c249a9eda)
2023-07-06 08:37:27 -07:00
Sam Lantinga 52d63ba26c Do a full UCS4 zero termination on iconv converted strings
We don't necessarily know the size of the output characters, so do a full 32-bit zero termination on the output string.

This fixes garbage at the end of Windows clipboard text

(cherry picked from commit ecbbac7c7292300cf998a2ff04db3c721203b0b7)
2023-07-05 22:25:49 -07:00
Sam Lantinga bad5431a14 Fixed wayland clipboard not always updating in response to Ctrl-C
(cherry picked from commit cc254d885d66d4c3499f63864b8d403e1e97f325)
2023-07-05 22:18:16 -07:00
Sam Lantinga 1ab452fc57 Fixed printf formatting for "%p" and added a unit test to check it
(cherry picked from commit c63aa9545eb800390176fd2fd86036da81f91100)
2023-07-05 22:17:15 -07:00
Sam Lantinga 2a946832ba Added GetClientScreenRect() and fixed build for C89 compilers
(cherry picked from commit 61ff86617ac9aa86e843aacd29b060b628bf9456)
2023-07-05 11:06:28 -07:00
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
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
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
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
Simon McVittie 26a38a0b20 linux: Reduce magic numbers when mapping gamepad axes
The bitfield `mapped` has two different sets of meanings, depending
whether we're setting up the triggers or the d-pad. Represent them
as symbolic constants rather than opaque integers.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit c4d49fadd4500cb522b2a98e5a42d024c566d8bf)
2023-06-13 05:45:43 -07:00
Sam Lantinga b3e1fd97b8 Fixed enumerating Steam Controllers on iOS
(cherry picked from commit dec0dbff13d4091035209016eb2d0dd82c9aba58)
2023-06-13 05:44:34 -07:00
Sam Lantinga c77aaa5d99 Fixed n3ds build
(cherry picked from commit d95dbe78bb7a5087ecfb8d301417b1108d868738)
2023-06-12 15:41:09 -07:00
Sam Lantinga e4e0a12901 Reduce the chance of destroying the joystick mutex while it's in use
Fixes https://github.com/libsdl-org/SDL/issues/7811

(cherry picked from commit 6390165fd4c193631d6780758a4aeec0d02b90eb)
2023-06-12 15:31:16 -07:00
Ryan C. Gordon 2afb49ba9a cocoa: Warp mouse to center of window before enabling relative mouse.
This prevents the case where the mouse might be at the edge of the
window when enabling relative mode, which confuses macOS, at it
might believe the user is attempting to resize the window.

Fixes #6994.
2023-06-11 12:47:26 -04:00
Ozkan Sezer 154ad6faa9 SDL_dynapi.c: minor cosmetics. 2023-06-10 20:50:10 +03:00
Sam Lantinga 2aa8525ecb Fixed build 2023-06-10 09:29:09 -07:00
Sam Lantinga 36033e3832 Make it clear that you can't mix 2D rendering and the window surface API
Also added functions to query and destroy the window surface so you can switch between modes if you want.

See https://github.com/pygame-community/pygame-ce/issues/2190 for more details.
2023-06-10 08:54:36 -07:00
Sam Lantinga 320f3fffbe Fixed querying device info on the MOBAPAD M073
The query packet needs to contain valid rumble data in order to be accepted by the controller.

Fixes https://github.com/libsdl-org/SDL/issues/7788

(cherry picked from commit 5490873daa12a57ff4b36090f25f04530323c6e4)
2023-06-09 18:43:14 -07:00
Sam Lantinga 30b4d90f1c Only update the serial number if it hasn't already been set
This fixes the serial number for Nintendo Switch Pro, which is queried from the hardware in device initialization, and was later clobbered by the USB string which isn't correct.

(cherry picked from commit 2042e9c4e3cba6ffa9c34abac14828e31365f98b)
2023-06-09 17:36:06 -07:00
Sam Lantinga 1cdd6dc829 Fixed reading input from the Razer Atrox Arcade Stick using Windows Gaming Input
(cherry picked from commit 172cfca51332a845abf9c141ae56aa121fe4ada5)
2023-06-09 14:36:12 -07:00
Ozkan Sezer f5b3247aae further mouse relative motion fix for os/2 (thanks Andrey Vasilkin) 2023-06-08 03:40:32 +03:00
Ryan C. Gordon aa536217b3
x11: check if window size/position has changed during SDL_ShowWindow.
Fixes #4216.

(cherry picked from commit 49b5cfa6c5cb9bb8cecce508e12fa7f8e0cc302f)
2023-06-07 15:46:59 -04:00
Ozkan Sezer b1324fbc9f fixed os/2 mouse relative motion not working (thanks Andrey Vasilkin,)
for issue reported at https://github.com/bitwiseworks/SDL2-os2/issues/5
2023-06-05 11:50:50 +03:00
Sam Lantinga 4700fbcbdf Don't bother re-encoding Latin1 characters in the ASCII range
(cherry picked from commit 6150b5b3cbde0e592c4ffe822f66aa5f9c90c3d9)
2023-06-04 05:40:07 -07:00