Commit Graph

6986 Commits

Author SHA1 Message Date
Ryan C. Gordon b93a8a86ab
emscripten: Restore compatibility with existing emsdk releases.
(cherry picked from commit 5008521538)
2023-09-20 14:37:56 -04:00
Jaswant Panchumarti 536f625bde
Use EM_ASM_PTR when the return value is a pointer
- closes https://github.com/libsdl-org/SDL/issues/8241

(cherry picked from commit 953b55dd6d)
2023-09-20 14:37:24 -04:00
Sam Lantinga cc4973ea45 Fixed sensor timestamp units for third-party PS5 controllers
(cherry picked from commit a72dfa6a5f)
(cherry picked from commit 37dee79b74)
2023-09-18 13:00:50 -07:00
Sam Lantinga 8114bd9108 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 f6756047a4)
(cherry picked from commit 62e7049a4f)
2023-09-18 12:20:36 -07:00
Sam Lantinga 495fca1517 Fixed sensor timestamp calculation for third-party PS5 controllers
(cherry picked from commit 7059a55ccc)
(cherry picked from commit fff3c2573a)
2023-09-18 11:59:00 -07:00
Sam Clegg 7d80e20883 emscripten: Add JS library dependencies using EM_JS_DEPS macro
See https://github.com/emscripten-core/emscripten/pull/19780

(cherry picked from commit 042243471f)
2023-09-15 15:29:47 -07:00
Guldoman f3847c157a x11: Always update clipboard owner
This allows utilities like clipboard managers to keep track of the
changes.

(cherry picked from commit 65aaf3a9ab)
(cherry picked from commit 70a2ac2f1c)
2023-09-15 05:23:21 -07:00
Max Bachmann b576e29d9b detect fanatec steering wheels
(cherry picked from commit fd1c54a004)
(cherry picked from commit a8b9414697)
2023-09-12 15:36:41 -07:00
Simon McVittie d710e0be27 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>
(cherry picked from commit 8ad043fc38)
2023-09-09 11:14:25 -07:00
Makarenko Oleg e9ab663c43 Detect Simagic wheel bases as wheels (#8198)
Simagic DirectDrive wheel bases have the same vendor + product id's

(cherry picked from commit a2c1984d37)
(cherry picked from commit 1d495351a0)
2023-09-04 12:12:37 -07:00
Oleg c8d1de1a9b 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 266b91d2fd)
(cherry picked from commit 365a36386a)
2023-09-04 11:06:06 -07:00
Oleg bf8c9cd6bf 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 cde67ea49a)
(cherry picked from commit 242b25aba4)
2023-09-04 11:02:09 -07:00
Sam Lantinga 8a5ba43d00 Updated to version 2.28.3 for release 2023-09-01 11:22:07 -07:00
Jeremy Demeule c25a49c406 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).

(cherry picked from commit aa7ba62978)
2023-08-31 01:55:40 -07:00
Anonymous Maarten d46fdfa3ee wayland: add SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL 2023-08-30 23:03:29 +02:00
Anonymous Maarten 787d339282 wayland: don't define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_* macro's
They mess with #ifdef conditional in headers.
2023-08-30 22:46:53 +02:00
Sam Lantinga 874f6feab4 Fixed the report format for the Razer Wolverine V2 Pro
(cherry picked from commit 69aec8c915)
(cherry picked from commit 6ff48dddcb)
2023-08-24 11:39:15 -07:00
Sam Lantinga ae72cd57b5 Quiet spurious warning
Fixes https://github.com/libsdl-org/SDL/issues/8112

(cherry picked from commit 0b9d8e679a)
2023-08-13 13:54:45 -07:00
Anonymous Maarten 5bfdb6e02f Fix overflow when doing SDL_sscanf("%hd", ...)
An overflow occured in the stdlib_sscanf test, when using msys2 clang32 toolchain.

(cherry picked from commit 342ec51131)
(cherry picked from commit 10135b2d7b)
2023-08-10 15:07:11 -07:00
Mathieu Eyraud 739d3ec189 Fix out of bound read of 'has_hat' array
(cherry picked from commit 94b3f78c44)
(cherry picked from commit f348370e1b)
2023-08-10 08:27:11 -07:00
Sam Lantinga 2ccb311cb7 Added a gamepad mapping for the G-Shark GS-GP702
Fixes https://github.com/libsdl-org/SDL/issues/8068

(cherry picked from commit 06bea1eb55)
(cherry picked from commit 2304b4e86a)
2023-08-02 14:39:09 -07:00
Sam Lantinga e0a345702d The Flydigi Vader and Apex series controllers all have the same VID, PID, and name
(cherry picked from commit 58e3084477)
(cherry picked from commit 0f753d9794)
2023-08-02 14:39:09 -07:00
Sam Lantinga 9fba36511f 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 5388edd549)
(cherry picked from commit 805fc29ae8)
2023-08-02 14:39:09 -07:00
Ozkan Sezer 45fb778fe5 adjusted coding style in SDL_os2_joystick.c to match rest of SDL better
(cherry picked from commit 57f3c41b97)
2023-08-02 20:40:24 +03:00
Sam Lantinga 031912c4b6 Updated to version 2.28.2 for release 2023-08-02 08:31:42 -07:00
Ozkan Sezer 348cc05b4f minor os/2 stuff merged from the bitwiseworks' fork
(cosmetics only.)
(cherry picked from commit b58557a3a6)
2023-08-02 17:10:50 +03:00
Ozkan Sezer e2e87a536c SDL_video.c: move ngage video before offscreen.
Reference issue: https://github.com/libsdl-org/SDL/pull/8069.
2023-08-02 17:00:10 +03:00
Ozkan Sezer 66d5ad19f0 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.
2023-08-02 09:26:41 -04:00
Sam Lantinga 94e945ccff Fixed build
(cherry picked from commit ebf2c49b50)
2023-08-02 01:37:24 -07:00
Sam Lantinga 3f93f56b6e 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 648de4f9b8)
(cherry picked from commit 38c63afd64)
2023-08-02 01:29:30 -07:00
Sam Lantinga ed5ef8fed4 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 c3288d113e)
(cherry picked from commit 030bb7282a)
2023-08-02 01:29:30 -07:00
Sam Lantinga 39781eef09 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 a8abe612ed)
(cherry picked from commit 335e9c769a)
2023-08-02 01:29:30 -07:00
Sam Lantinga 3436124804 Revert "Stop beep when running iOS apps on ARM-based Macs"
This reverts commit bbf38bbbc3, 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 f5ea6ae18d)
(cherry picked from commit 5e9320f6b5)
2023-08-02 01:29:30 -07:00
Sam Lantinga 9267a9032e Fixed build
(cherry picked from commit e2afc1f37a)
2023-08-01 18:58:40 -07:00
Sam Lantinga 02be870c54 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 07578fde3d)
(cherry picked from commit 2468fccf7f)
2023-08-01 18:30:46 -07:00
Ryan C. Gordon 84ad531689 cocoa: Ignore first mouse motion event after enabling relative mode.
Fixes #7918.

(cherry picked from commit dc5dda0f31)
2023-08-01 18:40:24 -04:00
Ryan C. Gordon e73a81b28a
x11: Blocking for window maximization should wait 100 ms, not 1000.
Reference Issue #7070.

(cherry picked from commit 3030fd815c)
2023-08-01 13:55:58 -04:00
Ryan C. Gordon 133ad1915c
Revert "x11: check if window size/position has changed during SDL_ShowWindow."
This reverts commit aa536217b3.

(cherry picked from commit 5c3df60ec9)
2023-08-01 13:51:37 -04:00
Sam Lantinga 5733f42c7c 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 71099149b8)
(cherry picked from commit 8825fbf713)
2023-07-31 14:41:51 -07:00
Mathieu Eyraud dda971833e Add missing break
(cherry picked from commit 0500fca00c)
2023-07-29 17:33:20 +03:00
Ozkan Sezer 38a5aed974 minor os/2 stuff merged from the bitwiseworks' fork 2023-07-28 23:56:20 +03:00
Sam Lantinga 301f227879 Sorted controller list
(cherry picked from commit 3174d0b970)
(cherry picked from commit 507be6c3f8)
2023-07-27 12:50:32 -07:00
Max Maisel 2ca4c0233a 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 27b8abb056)
(cherry picked from commit f4561db69a)
2023-07-27 12:50:32 -07:00
Ozkan Sezer e3f90c6068 remove unused vulkan/*.hpp files.
(cherry picked from commit 611b3dd1fd)
2023-07-26 18:10:00 +03:00
Ozkan Sezer b4d8765426 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
(cherry picked from commit 890bee64a4)
2023-07-25 14:03:00 +03:00
Weng Xuetian 2eb73e2419 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:31 -07:00
Sam Lantinga fb57ba763d 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 bd4f155bbb)
(cherry picked from commit f7dc8c0eaa)
2023-07-17 17:46:30 -07:00
Sam Lantinga 63a98d0da2 Don't send k_EPS5FeatureReportIdCapabilities to Sony PS5 controllers
This report is for third party controllers only.

(cherry picked from commit 16dd5f0da4)
(cherry picked from commit bb036ef544)
2023-07-17 17:46:29 -07:00
Sam Lantinga 78f11e05ff 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 2fef0be2f6)
(cherry picked from commit 910dad505a)
2023-07-17 17:46:29 -07:00
Sam Lantinga ff4fd93f4c Fixed getting the CRC of virtual joysticks without a VID/PID
(cherry picked from commit b40fb5c51e)
(cherry picked from commit 6089b35706)
2023-07-16 04:38:48 -07:00