Commit Graph

4383 Commits

Author SHA1 Message Date
Ethan Lee ad310d3900 wayland: libdecor support for SetWindowModalFor 2021-07-28 09:45:10 -07:00
Ethan Lee 93976ade3b wayland: libdecor support for GetWindowWMInfo 2021-07-28 09:45:10 -07:00
David Gow 1fb4429bc0 wayland: Avoid a pointer→TouchID cast warning
As of [1], SDL now compiles with a warning in SDL_waylandevents.c on
32-bit systems under gcc 10.3.0:

/tmp/SDL/src/video/wayland/SDL_waylandevents.c: In function 'seat_handle_capabilities':
/tmp/SDL/src/video/wayland/SDL_waylandevents.c:958:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  958 |         SDL_AddTouch((SDL_TouchID)seat, SDL_TOUCH_DEVICE_DIRECT, "wayland_touch");
      |                      ^
/tmp/SDL/src/video/wayland/SDL_waylandevents.c:964:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  964 |         SDL_DelTouch((SDL_TouchID)seat);
      |                      ^

This is due to SDL_TouchID always being 32-bit, but seat being a pointer
which is (obviously) only 32-bit on 32-bit systems. The conversion is
therefore harmless, so silence it with an extra cast via intptr_t.

This is what the cocoa backend does (and is similar to what the Win32
backend does, except with size_t).

Fixes: 03c19efbd1 ("Added support for multiple seats with touch input on Wayland")

[1]: 03c19efbd1
2021-07-28 09:05:23 -07:00
David Gow 18303c92bc Wayland: Fix building with --disable-wayland-shared with libdecor.
When wayland is not dynamically loaded (--enable-wayland-shared=no)
libdecor.h is not included unless SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
is set, so it fails to build.  We can't simply move the libdecor.h
include above the #ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC block, as
libdecor.h itself #includes wayland headers we need to replace with
#defines. Instead, duplicate the #include.

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

Note that this doesn't fix any of the underlying issues of libdecor
being treated as part of wayland, it just fixes the build. A better
solution would probably be to decouple the wayland dynamic loading
from the libdecor dynamic loading completely, though that is a lot
more work...
2021-07-28 17:01:02 +03:00
David Gow 21cba92423 wayland: Don't create zxdg toplevel decoration twice
Each window can have at most one zxdg toplevel decoration, but as of
[1], we accidentally create two. (If libdecor is not in use). This
causes wayland windows with server-side decorations (e.g. on KDE/KWin)
to crash with the message:

zxdg_decoration_manager_v1@7: error 1: decoration has been already constructed

This extra zxdg_decoration_manager_v1.get_toplevel_decoration() call was
introduced while deprecating wl-shell and xdg-shell-stable[1] support,
and possibly was a bad interaction with [2], which moved the decoration
creation around.

Fixes: 6aae5b44f8 ("Remove wl-shell and xdg-shell-unstable-v6 support (#4323)")

[1]: https://github.com/libsdl-org/SDL/pull/4323
[2]: https://github.com/libsdl-org/SDL/pull/4374
2021-07-28 04:12:39 -07:00
Ethan Lee 7b239edb83 wayland: Assign frame_callback on window creation.
Fixes a crash when creating and destroying a window without calling SwapWindow.
2021-07-28 00:48:05 -07:00
Sam Lantinga 41e1a2360f Correct the maximized size and position for borderless resizable windows
This fixes bug https://github.com/libsdl-org/SDL/issues/4043
2021-07-27 16:51:08 -07:00
Ethan Lee 03185e748b wayland: Tag/Check wl_output objects as well, fixes crashes when libdecor is in use 2021-07-27 16:05:53 -07:00
Ryan C. Gordon 871c11191b wayland: handle pending resizes immediately, not on SwapWindow.
This was originally a workaround for an old Mesa bug, since fixed, apparently,
and causes other problems.

Fixes #4326.
2021-07-27 18:24:09 -04:00
Sam Lantinga 51c61d7cdf Run the entire Cocoa messagebox function on the main thread.
This fixes bug https://github.com/libsdl-org/SDL/issues/4420
2021-07-27 14:57:18 -07:00
Sam Lantinga dfd3f30e88 Make Cocoa_HandleTitleButtonEvent() static since it's not used anywhere else 2021-07-27 14:27:37 -07:00
Ethan Lee a3eb297ec2 wayland: Rework enter/leave and update_scale_factor to avoid bogus wl_output data.
Also remove get_window_scale_factor() which was just pointless indirection.
2021-07-27 14:21:32 -07:00
Simon Zeni 6aae5b44f8
Remove wl-shell and xdg-shell-unstable-v6 support (#4323)
* wayland-protocol: update wayland.xml to 1.19.0

* wayland: remove shell_surface field from SDL_SysWMinfo

* wayland: remove wl_shell support

* waypand-protocols: update xdg-shell.xml to 1.20

* wayland: remove xdg-shell-unstable-v6 support

* wayland: deprecate wl shell surface syswm info, add xdg surface
2021-07-27 14:12:26 -07:00
Sam Lantinga 88e4755c26 Make sure we don't try to turn on relative mouse mode while clicking on the window title bar.
This fixes bug https://github.com/libsdl-org/SDL/issues/4469
2021-07-27 12:43:45 -07:00
Splamy c72aef2664 Fixed microphone randomly stop working
WASAPI_WaitDevice is used for audio playback and capture, but needs to
behave slighty different.
For playback `GetCurrentPadding` returns the padding which is already
queued, so WaitDevice should return when buffer length falls below the
buffer threshold (`maxpadding`).
For capture `GetCurrentPadding` returns the available data which can be
read, so WaitDevice can return as soon as any data is available.

In the old implementation WaitDevice could suddenly hang. This is
because on many capture devices the buffer (`padding`) wasn't filled
fast enough to surpass `maxpadding`. But if at one point (due to unlucky
timing) more than maxpadding frames were available, WaitDevice would not
return anymore.

Issue #3234 is probably related to this.
2021-07-27 14:19:11 -04:00
Ryan C. Gordon 4ef8674df1
Revert "wasapi: Open capture devices the way we used to."
This reverts commit 0d0fee7569.
2021-07-27 14:18:44 -04:00
Ryan C. Gordon 0d0fee7569
wasapi: Open capture devices the way we used to.
This should work around the regression in #3234, since it basically reverts
the problem change, but only for capture devices.

Fixes #3234.
2021-07-27 14:13:31 -04:00
Ryan C. Gordon f4eb7f329e
spinlock: Favor gcc-style atomics over MSVC interfaces.
This resolves a problem when using Clang on Windows.

Fixes #4346.
2021-07-27 13:45:33 -04:00
Ryan C. Gordon 736a424ff4
pulseaudio: Optionally add "monitor" sources to device list.
There's a new hint to enable this.

Fixes #2917.
2021-07-27 13:12:57 -04:00
Ryan C. Gordon 8d790b10f8
audiocvt: stereo-to-mono SSE3 now uses unaligned accesses.
On modern CPUs, there's no penalty for using the unaligned instruction on
aligned memory, but now it can vectorize unaligned data too, which even if
it's not optimal, is still going to be faster than the scalar fallback.

Fixes #4532.
2021-07-27 12:23:46 -04:00
Sam Lantinga 2a53f8315a Fixed controllers showing up under both MFI and HIDAPI drivers
The Game Controller Kit doesn't show the controllers at startup, so the HIDAPI driver sees them first and therefore gets preference when a controller is supported by both drivers.

This fixes bug https://github.com/libsdl-org/SDL/issues/4209
2021-07-26 23:29:20 -07:00
Sam Lantinga 46869db01c Fixed controller rumble on macOS
Needed to add a strong reference to the haptics engine
2021-07-26 23:27:13 -07:00
Sam Lantinga a850fec733 Added missing mapping for the Xbox Elite Controller on Linux
This fixes https://github.com/ValveSoftware/steam-for-linux/issues/7826
2021-07-26 15:05:02 -07:00
Ozkan Sezer d80ef3e5f5 SDL_VideoInit: silence 'may be used uninitialized' warning
src/video/SDL_video.c:475: warning: 'i' may be used uninitialized in this function
2021-07-26 22:51:24 +03:00
Luis Cáceres 45de0a1d13 Support comma-separated lists in SDL_AUDIODRIVER 2021-07-26 15:14:54 -04:00
Luis Cáceres 5ec69285fa Support comma-separated lists in SDL_VIDEODRIVER 2021-07-26 15:14:54 -04:00
Sam Lantinga ba8bc143c1 Sort joystick entries in /dev/input
This fixes https://github.com/libsdl-org/SDL/issues/4430
2021-07-26 12:09:33 -07:00
Sam Lantinga 8d527def81 Revert "hidapi_switch: Implement HD rumble effect (#4538)"
This reverts commit 19082b115b, which broke rumble on the Nintendo Switch Pro controller
2021-07-26 10:18:18 -07:00
Narr the Reg 19082b115b
hidapi_switch: Implement HD rumble effect (#4538) 2021-07-26 10:00:53 -07:00
Christian Rauch ac904b8e95 wayland: ignore resize in fullscreen or maximised mode 2021-07-25 14:54:12 -07:00
Christian Rauch ee062c644a wayland: implement toggling decorations 2021-07-25 14:54:12 -07:00
Christian Rauch 2b3cf36fd9 wayland: forward window events 2021-07-25 14:54:12 -07:00
Christian Rauch 48066984b7 wayland: enable/disable ACTION_RESIZE for fullscreen 2021-07-25 14:54:12 -07:00
Christian Rauch 9e6fcbe72c wayland: client-side decoration 2021-07-25 14:54:12 -07:00
Christian Rauch e5f9fae034 wayland: don't flush after setting fullscreen 2021-07-25 14:54:12 -07:00
Mathieu Eyraud 8e604a5f12 Fix error handling in X11_SetWindowTitle
X11_XChangeProperty return 1 on success.
2021-07-25 14:51:33 -07:00
Jaylon Gowie bc3b98f3ed Replace with SDL_SendKeyboardKeyAutoRelease 2021-07-25 07:41:30 -07:00
Jaylon Gowie 5cd37c0a7b Add Enter Key support to PSVita IME keyboard 2021-07-25 07:41:30 -07:00
Sam Lantinga 10ec4c8671 Added support for the PowerA Nintendo Switch Spectra Controller 2021-07-24 22:11:22 -07:00
Sam Lantinga 3c9559f765 Don't try to rumble third-party Nintendo Switch Pro controllers
Sending rumble to the PowerA Spectra Nintendo Switch controller hangs input reports for a couple of seconds.
2021-07-24 19:43:56 -07:00
Sam Lantinga cc19b13bc3 Fixed missing return statement 2021-07-24 19:21:29 -07:00
Sam Lantinga d4ac6b5ed9 Detect buffer overflow when getting DirectInput device state
This fixes bug https://github.com/libsdl-org/SDL/issues/4528
2021-07-24 15:58:33 -07:00
Sam Lantinga 3b85e3fdfc Fixed internal Windows key state when using Windows+Space or Windows+G shortcuts
This fixes bugs:
https://github.com/libsdl-org/SDL/issues/4369
https://github.com/libsdl-org/SDL/issues/4500
2021-07-24 15:47:11 -07:00
Sam Lantinga 03c19efbd1 Added support for multiple seats with touch input on Wayland
This fixes bug https://github.com/libsdl-org/SDL/issues/4517
2021-07-24 15:25:50 -07:00
Sam Lantinga ff1b5e1bf7 Implemented the window flash operations for X11 2021-07-24 15:11:36 -07:00
Ryan C. Gordon 5ae0dd4b52
joystick: Split out Linux opening code for reuse by querying code.
This prevents an assertion whem LINUX_JoystickGetGamepadMapping tried to
open the stick temporarily and messed with global state by doing so. Now
the global state is only set in LINUX_JoystickOpen, but the common code
is shared by both interfaces.

Fixes #4198.
2021-07-24 17:48:26 -04:00
Sam Lantinga f1633127d1 Added a window flash operation to be explicit about window flash behavior 2021-07-24 13:42:19 -07:00
Joel Linn b2c8d3e9e4 audiocvt: 5.1 to Stereo conversion utilizing AVX 2021-07-24 15:39:17 -04:00
Joel Linn 638befc1a9 audiocvt: 5.1 to Stereo conversion utilizing SSE 2021-07-24 15:39:17 -04:00
Joel Linn db56526f14 audiocvt: Replace divisions
Division is expensive and the compiler can not replace it themselves.
Though we now we will be ok in terms of floating point edge behaviour.
2021-07-24 15:39:17 -04:00