Commit graph

11642 commits

Author SHA1 Message Date
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
Ozkan Sezer 3e341021c3 fixed typo in prev. patch. 2023-07-28 07:35:14 +03:00
Ozkan Sezer 1ecf77d630 test/testnativecocoa.m: fixed deprecation warnings. 2023-07-28 07:21:14 +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
Anonymous Maarten 2b0ca87119 SDL_atomic.h: __ARM_ARCH is not always defined for an arm platform
e.g. riscos toolchain
(cherry picked from commit 8105f1d5b5b83328f4d0017a562674efca821077)
2023-07-26 20:39:20 +03: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 e7761aec37 update docs/README-os2 after the last os/2 audio patch. 2023-07-25 20:51:32 +03: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
Sam Lantinga ba0c270c7a Removed invalid assert in testatomic
(cherry picked from commit 8adab0b88ab1c0aa69242fffc48afdba085b1dc4)
2023-07-22 18:40:31 -07:00
Anonymous Maarten 322dbdde4e ci: bump mymindstorm/setup-emsdk to latest tag 2023-07-22 17:36:27 +02: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 a4ad293d4a Relicensed testutils to match other test code
Permission granted in 76a7b629bf (commitcomment-121408342)

(cherry picked from commit 6c2472d459602eb3c3ee109d6e8f255336109673)
2023-07-16 04:37:15 -07: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
Anonymous Maarten 57e9a9eee6 ci: move 'set -eu' to after source_cmd 2023-07-14 15:02:10 +02: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
Ozkan Sezer 376c6a9dd1 apply commit 3aba9d4473 to autotools, too. 2023-07-13 01:51:02 +03:00
Ryan C. Gordon 3aba9d4473
pulseaudio: We should be using libpulse, not libpulse-simple.
This probably worked by a quirk of the dynamic loader...?

(cherry picked from commit 6aef14fb2d40bc39580d198423930741104c8d94)
2023-07-12 16:43:05 -04: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
Joshua Barnett 547c8c288b Add kernel32 to SDL_EXTRA_LIBS required for cross-compilation to Win32 native
Linking error experienced while compiling with the following toolchain
due to lack of kernel32.lib

d35e5f8dde/cmake/platforms/WinMsvc.cmake (L317-L321)
2023-07-09 14:02:32 +02:00
Sam Lantinga 4b1dd54a56 Fixed mapping BTN_TR2 to right trigger
(cherry picked from commit ea60da5b94ed8ec69aad69ca46e81567ab99ed2a)
2023-07-08 18:18:48 -07:00