Commit Graph

13348 Commits (8321813452a2967449d31b6339dca8d0511c833d)

Author SHA1 Message Date
Sam Lantinga 281018f169 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:39:20 -07:00
Sam Lantinga 5490873daa 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
2023-06-09 18:41:21 -07:00
Sam Lantinga 2042e9c4e3 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.
2023-06-09 17:34:12 -07:00
Sam Lantinga c8051b11e8 Fixed reading input from the Razer Atrox Arcade Stick using Windows Gaming Input 2023-06-09 14:35:43 -07:00
Sylvain aaccf3cd52 X11: common function to wait for the WM before sending SDL Window events 2023-06-09 19:48:59 +02:00
Sylvain 8096f7269b Android: add robustness. check that the native code is run for the first time. 2023-06-09 10:13:58 +02:00
Sylvain ae9d8acc3b Android: when an EventFilter is binded to SDL_EVENT_DID_ENTER_FOREGROUND event and triggered, GL context is expected to be already restored. 2023-06-09 10:00:01 +02:00
Sam Lantinga 4c0758a234 Fixed crash if display couldn't be found in SDL_UpdateFullscreenMode() 2023-06-08 12:39:32 -07:00
Simon McVittie d9c17e7055 testevdev: Add details of some more 8BitDo devices
Thanks to Jeremy Whiting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie a2ed083285 testevdev: Describe several equivalent devices
https://github.com/ValveSoftware/steam-devices/pull/34 lists several
more devices that are functionally equivalent to this one from the
point of view of their evdev metadata. Thanks to apgrc.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie f4a53e78c8 testevdev: Add test data for a DualSense (PS5) gamepad
Also make details of PS4 gamepads (which are very similar from an evdev
point of view) more specific.

Thanks to Sam Lantinga and Jeremy Whiting for recording these.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie 2fb1df1551 testevdev: Add test data for Nintendo Switch Joy-Cons via Bluetooth
Thanks to Jeremy Whiting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie 8a82e06075 testevdev: Add test data for Microsoft Xbox Series S|X Controller
Like the Stadia controller, this is unusual because it represents the
Share button as the Record key from a multimedia keyboard (as of Linux
6.2.11 with the xpad driver). Thanks to Jeremy Whiting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie ff01b43459 testevdev: Add Google Stadia controller
This is a bit unusual because it has a small number of what would
ordinarily be keyboard keys. Thanks to Jeremy Whiting for recording
this.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie 9ad0b8b47f testevdev: Add test data for another Switch Pro Controller
A newer evemu-describe transcript has this same controller with its
buttons mapped differently, presumably a result of driver changes in
the Linux kernel. Either way, we should recognise it as a gamepad.
Thanks to Jeremy Whiting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie 7b526d0cad testevdev: Finish incomplete data for Switch Pro Controller via USB
This didn't include any buttons, which I assume was because I
transcribed them incorrectly rather than reflecting reality. Confirmed
against another Switch Pro Controller on a more recent kernel (thanks
to Jeremy Whiting).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie 4c33ef94c6 testevdev: Note a functionally-equivalent device
We don't need to re-test the heuristic with the same input data, but
knowing that another device has equivalent evdev metadata is useful
information to record. Thanks to Jeremy Whiting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie 4c035dc1e3 testevdev: Add another laptop touchpad
This was reported by Rémi Bernon as an example of older SDL's non-udev
code path going wrong for touchpads when the invoking user happens to
be in the input group, which I believe was fixed by fdd945f2.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Sam Lantinga 32d015a6a0 Fixed PS3 controller initialization over Bluetooth
Now that we have hidapi that knows whether the controller is connected via Bluetooth or USB, this is much easier to fix.
2023-06-08 10:46:56 -07:00
Frank Praznik e15da1985a video: Apply cleared flag states when restoring hidden windows
Hiding a window and then clearing the minimized, maximized, fullscreen, or grabbed flags wouldn't result in the new state being applied to the window when shown, as the pending flags would always be zero, resulting in the flag application function never being entered. Calling SDL_RestoreWindow() didn't result in the minimized or maximized state being cleared on the hidden window either.

Save the current window flags to the pending flags when hiding a window, and universally apply the pending flags when the window is shown again to ensure that all state that was set or cleared when the window was hidden is applied. Any pending flags that match the existing window flags will be automatically deduplicated by the corresponding functions.
2023-06-08 12:34:56 -04:00
Ryan C. Gordon 49b5cfa6c5
x11: check if window size/position has changed during SDL_ShowWindow.
Fixes #4216.
2023-06-07 15:42:22 -04:00
Sam Lantinga dc06116c71 Steam sets the device version of the Steam Virtual Gamepad to 0, for the best compatibility with old games 2023-06-06 12:33:48 -07:00
Sam Lantinga d032492aab Fixed detecting Bluetooth Steam Controllers on Windows 2023-06-05 21:28:12 -07:00
Sam Lantinga 17c397f7ec Save the error code before doing any other operation
SDL_ClearError() resets the Win32 error code to 0
2023-06-05 21:18:49 -07:00
Sam Lantinga 6e7769cde1 Fixed detecting Bluetooth Steam Controllers 2023-06-05 19:52:00 -07:00
Sam Lantinga 6150b5b3cb Don't bother re-encoding Latin1 characters in the ASCII range 2023-06-04 05:37:06 -07:00
Sam Lantinga 491ae20d96 Only convert the result of XLookupString() if it's not already UTF-8
Fixes https://github.com/libsdl-org/SDL/issues/7766
2023-06-04 02:50:03 -07:00
Sam Lantinga c369b90019 Fixed SDL_iconv_string() truncation when handling SDL_ICONV_E2BIG 2023-06-04 01:01:06 -07:00
Sam Lantinga d40695115f Cleaned up Alt-Enter/Ctrl-Enter fullscreen toggle logic
Alt-Enter will go from the current state to fullscreen desktop, or if already there, will leave fullscreen mode.
Ctrl-Enter will go from the current state to exclusive fullscreen mode, or if already there, will leave fullscreen mode.
2023-06-03 23:24:21 -07:00
Rusty Moyher 052a9d3284 macOS: Removed the fullscreen blanking window
- Removed the blanking window used in SDL_WINDOW_FULLSCREEN. This allows CMD + Tab to work.
- Changed the fullscreen NSWindow level so this works properly.

Fixes issue #7776
2023-06-03 23:05:09 -07:00
Sam Lantinga fa41ece65f Allow other applications to open controllers on macOS 2023-06-03 11:53:36 -07:00
Sam Lantinga 6815e75caf Steam uses a different VID/PID for the Steam Virtual Gamepad on Windows 2023-06-03 11:39:03 -07:00
Sam Lantinga 5f00147e61 Revert "Fixed detection of the Steam Virtual Gamepad on macOS"
This reverts commit 5fcd70578b.

Steam has been updated to send a version of 1 to avoid conflicts with controllers that report a version of 0.
2023-06-03 11:35:27 -07:00
Ozkan Sezer 0c862d9a55 added compiler support comment about #pragma push_macro/pop_macro. 2023-06-03 17:23:40 +03:00
Sam Lantinga 5fcd70578b Fixed detection of the Steam Virtual Gamepad on macOS 2023-06-02 18:37:45 -07:00
Sam Lantinga 9837653b9d Allow the application to send commands to Nintendo Switch controllers 2023-06-02 15:52:56 -07:00
Sam Lantinga 7c55845c80 Fixed build if SDL_JOYSTICK_RAWINPUT_MATCHING isn't enabled 2023-06-02 11:20:31 -07:00
Sam Lantinga 767507fcf6 Don't use raw input while Remote Desktop is active
Raw input will not send game controller events while Remote Desktop is active, so dynamically switch between XInput and raw input when Remote Desktop state changes.

Fixes https://github.com/libsdl-org/SDL/issues/7759
2023-06-02 11:16:07 -07:00
Sam Lantinga a5a1844681 Fixed build error 2023-06-02 10:20:29 -07:00
Sam Lantinga e8b5b4881c Fixed WGI immediately being correlated with raw input devices with no input
The at rest match state is 0x0000008800000000, not 0
2023-06-02 09:38:18 -07:00
Sam Lantinga 2e27812d39 Fixed event sequence when Remote Desktop connects and disconnects
1. Send display disconnected events for all displays no longer connected
2. Send display connected events for all displays that have been connected
3. Send window display events for any windows that have changed displays
2023-06-02 08:51:47 -07:00
Alibek Omarov 6aaf032320 wayland: reset orientation bitmask before reading values from hint on QtWayland
Signed-off-by: Alibek Omarov <a1ba.omarov@gmail.com>
(cherry picked from commit 68e3e99087544c64abb534613643080312aced96)
2023-06-02 08:06:30 -07:00
Alibek Omarov 56520372ca hints: clarify support for comma-separated values for QtWayland orientation that's available since 2.0.22
Signed-off-by: Alibek Omarov <a1ba.omarov@gmail.com>
(cherry picked from commit c39524042520d6962434228ab8af9ba7e0542308)
2023-06-02 07:42:06 -07:00
Ozkan Sezer 8c476ca1b0 hidapi/libusb: need libusb >= 1.0.16 because of libusb_get_port_numbers 2023-06-02 07:26:38 -07:00
Ozkan Sezer e27c10a5b1 hidapi/libusb: don't try to dlsym libusb_wrap_sys_device
not used in SDL.
2023-06-02 07:26:38 -07:00
Ozkan Sezer 3ecdbf27cc hidapi: silence redefinition warnings 2023-06-02 07:25:02 -07:00
Sam Lantinga f082c68b2f Updated with upstream suggestions in https://github.com/libusb/hidapi/pull/582 2023-06-01 10:48:15 -07:00
Sam Lantinga 0ad089de21 Backed out local changes to build with libusb on Windows 2023-06-01 08:30:10 -07:00
Sam Lantinga b36679b90e Updated with upstream suggestions in https://github.com/libusb/hidapi/pull/582 2023-06-01 08:27:56 -07:00
Sam Lantinga 20182eed7c Updated with upstream suggestions in https://github.com/libusb/hidapi/pull/572 2023-06-01 07:47:28 -07:00