Commit Graph

9536 Commits (8c9f7104e32ef8c425623d12ef6825e26b99aec2)

Author SHA1 Message Date
Brick 72f41d1fb1 Added missing parenthesis around SDL_clamp 2021-08-14 17:24:33 -07:00
Jānis Rūcis 454943cf3e emscripten: Don't flag window fullscreen on external requests
Also, the condition was always true.
2021-08-14 17:04:46 +01:00
Joseph Kogut 55af8dcad9 emscripten: use emscripten_set_window_title api 2021-08-14 17:04:46 +01:00
Joseph Kogut d8baad7e48 emscripten: use emscripten_get_screen_size api 2021-08-14 17:04:46 +01:00
Charlie Birks abc04270b7 emscripten: Fix framebuffer array creation optimisation 2021-08-14 17:04:46 +01:00
Charlie Birks b4f11a3669 emscripten: Drop commented out code from the dummy driver 2021-08-14 17:04:46 +01:00
Charlie Birks 0a87075662 Update SDL_config_emscripten.h for upstream 2021-08-14 17:04:46 +01:00
Sam Clegg d448896234 Add SDL_config_emscripten.h
Currently we maintain a config file in the emscripten
repo, but this seems like what other embedded/cross
platforms do.
2021-08-14 17:04:46 +01:00
David Gow fbc364908a Use the new SDL_clamp() macro where sensible
There were a few places throughout the SDL code where values were
clamped using SDL_min() and SDL_max(). Now that we have an SDL_clamp()
macro, use this instead.
2021-08-14 09:01:14 -07:00
David Gow 35c1bbfa49 SDL_stdinc.h: Add an SDL_clamp() function
Add a function to clamp a value to a range.

SDL_clamp(x, a, b) is equivalent to SDL_min(a, SDL_max(x, b)): it
ensures that x is not smaller than a, nor larger than b.

While, as best I can tell, this isn't actually standardised anywhere,
it's a very useful function/macro to have.
2021-08-14 09:01:14 -07:00
Charlie Birks 07a2d71e90 emscripten: Feed silence to device when paused 2021-08-14 12:24:35 +01:00
Sam Lantinga dcc5eef0e2 Clarify that one of the PIDs of the Xbox Elite Series 2 controller is used in Bluetooth mode 2021-08-14 00:31:46 -07:00
Sam Lantinga 91a55a02de Relative mouse motion is delivered to the window with keyboard focus
This was the original intent (note SDL_UpdateWindowGrab() in SDL_OnWindowFocusGained() and SDL_OnWindowFocusLost()) and fixes a bug where relative motion unexpectedly stops if the task bar is covering the bottom of the game window and the mouse happens to move over it while relative mode is enabled.

Another alternative would be to confine the mouse when relative mode is enabled, but that generates mouse motion which would need to be ignored, and it's possible for the user moving the mouse to combine with the mouse moving into the confined area so you can't easily tell whether to ignore the mouse motion. See https://github.com/libsdl-org/SDL/issues/4165 for a case where this is problematic.
2021-08-14 00:00:57 -07:00
Sam Lantinga 694771513c Get the window size for the window receiving the mouse motion
This is the mouse focus except in the case where relative motion is enabled and the mouse is over a window floating on top of the application window (e.g. the taskbar)
2021-08-14 00:00:57 -07:00
Sam Lantinga 6a1e1ed9ae Relative mouse mode grab is based on the window with the input focus
This fixes restoring the cursor clip rectangle after the mouse has moved off of the window.

Also try to better synchronize cursor visibility with mouse position changes when changing relative mode. This doesn't work perfectly, but it seems to improve things on Windows.
2021-08-14 00:00:57 -07:00
Sam Lantinga e42e9a12de Fixed build 2021-08-13 20:48:56 -07:00
Sam Lantinga 441fbcaa3d Added HIDAPI support for the Xbox Adaptive Controller 2021-08-13 20:48:54 -07:00
Sam Lantinga b5e5c1ef48 Added Ctrl-T to toggle topmost mode in test programs 2021-08-13 17:53:39 -07:00
Sam Lantinga 4d9efcb55c Fixed flag test for boolean correctness 2021-08-13 11:52:25 -07:00
Sam Lantinga b28ed02803 Don't warp the mouse for relative mode when the window doesn't have focus 2021-08-13 11:39:41 -07:00
Sam Lantinga 629e9f820a Fixed return value of SDL_GetGrabbedWindow() when we have an internal grab because of mouse relative mode 2021-08-13 11:06:43 -07:00
Sam Lantinga 6aa1498b98 This assert wasn't correct, we set the internal grab for mouse relative mode as well. 2021-08-13 11:03:19 -07:00
David Gow 105f120615 checkkeys: Create a renderer for window display on Wayland
On Wayland -- or at least on some Wayland implementations -- windows
aren't shown until something has been rendered into them. For the
'checkkeys' test program, this means that keyboard input isn't
registered, making the program rather useless.

By creating a renderer and presenting once, the window is properly
displayed, and the test behaves as it does under X11 (including
XWayland).

The exact same thing was done with testmessge in 1cd97e2695 (PR #4252)
2021-08-13 08:29:17 -07:00
Sam Lantinga 907943a236 Added support for the Xbox One S Controller with 5.x series firmware 2021-08-12 17:51:08 -07:00
Joshua Root 1e92135297 Improve portability of SDL_Convert51ToStereo_AVX
Don't rely on checking __clang_major__ since it is not comparable
between different vendors. Don't use "#pragma clang attribute" since it
is only available in relatively recent versions, there's no obvious way
to check if it's supported, and just using __attribute__ directly (for
gcc as well) results in simpler code anyway.
2021-08-12 16:04:35 -07:00
Joshua Root 9bf6557585 Correctly check for bswap builtins before using
The __clang_major__ and __clang_minor__ macros provide a marketing
version, which is not necessarily comparable for clang distributions
from different vendors[1]. In practice, the versioning scheme for
Apple's clang is indeed completely different to that of the llvm.org
releases. It is thus preferable to check for features directly rather
than comparing versions.

In this specific case, __builtin_bswap16 was being used with older
Apple clang versions that don't support it.

[1] https://clang.llvm.org/docs/LanguageExtensions.html#builtin-macros
2021-08-12 16:03:44 -07:00
Ozkan Sezer 7aec0b90ee SDL_hidapi_xboxone.c: fix bogus 'uninitialized' warning from clang.
The last 'size == 50' check is always true anyway.
2021-08-13 01:56:56 +03:00
Sam Lantinga cec5a129f5 Fixed libudev hotplug notifications in the HIDAPI driver 2021-08-12 15:49:33 -07:00
Sam Lantinga 6eb4ebb502 Simplified the HIDAPI Xbox One controller initialization 2021-08-12 15:49:33 -07:00
Simon McVittie 25cd749adb x11: Don't change mode if we are already in the correct mode
If we are already in the desired mode, changing it is a no-op at best,
and harmful at worst: on Xwayland, it sometimes happens that we disable
the crtc and cannot re-enable it.

Resolves: https://github.com/libsdl-org/SDL/issues/4630
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-12 12:23:40 -07:00
Sam Lantinga 584b89abe6 Added support for the color LED on the Xbox Elite Series 2 controller 2021-08-12 08:17:10 -07:00
Sam Lantinga 64882b2466 Added support for the Xbox One Elite 2 Controller with 5.x series firmware 2021-08-12 08:17:08 -07:00
Ozkan Sezer ed6eb07e79 SDL_wasapi.c: fixed build against older SDKs. 2021-08-12 01:40:50 +03:00
Andrei Alexeyev 68ca35c318 wayland: fix memleak in output listener 2021-08-11 14:11:52 -07:00
Andrei Alexeyev e9179314c4 joystick/linux: fix memleaks; streamline joylist item removal 2021-08-11 14:11:52 -07:00
Ozkan Sezer 44a76710d1 Don't disable clang avx instrinsics on win32 if __AVX__ is defined.
C.f.: https://github.com/libsdl-org/SDL/issues/4533
2021-08-11 08:47:52 -07:00
Ethan Lee ae7ee2a59c wayland: Ignore stateless/sizeless configs when starting in fullscreen mode 2021-08-11 11:02:33 -04:00
Sam Lantinga ac32c522ad Try using the built-in WASAPI audio rate conversion
Fixes https://github.com/libsdl-org/SDL/issues/4608
2021-08-10 18:11:09 -07:00
Sam Lantinga cb1e20b058 Added KMOD_SCROLL to track the scroll lock state
Fixes https://github.com/libsdl-org/SDL/issues/4566
2021-08-10 17:50:17 -07:00
Sam Lantinga 609cea1eb8 Enable SSE3 intrinsics when building with Visual Studio
Fixes https://github.com/libsdl-org/SDL/issues/4530
2021-08-10 17:14:06 -07:00
Sam Lantinga d5ad6f6e6a Clarified that you should never have side-effects in the parameters to SDL_min/SDL_max 2021-08-10 16:51:52 -07:00
Ozkan Sezer bb91d7a5ea regenerated configure script 2021-08-11 01:56:40 +03:00
SDL Wiki Bot 056a42f199 Sync wiki -> header 2021-08-10 22:20:06 +00:00
Sam Lantinga f5794f9eeb Added SDL_SetTextureUserData() and SDL_GetTextureUserData() to associate a user-specified pointer with an SDL texture 2021-08-10 15:17:59 -07:00
Sam Lantinga a0af7ce731 OSS is no longer the preferred audio backend on modern UNIX systems
Fixes https://github.com/libsdl-org/SDL/issues/4207
2021-08-10 15:05:49 -07:00
Sam Lantinga 3f6ebffff4 Updated to version 2.0.17 for development 2021-08-10 15:02:36 -07:00
Sam Lantinga 6810399352 Enable AAUDIO driver for Android
I thought this was already enabled for 2.0.16, but apparently not.

Fixes https://github.com/libsdl-org/SDL/issues/3710
2021-08-10 14:50:43 -07:00
Sam Lantinga 016b02f24c Fixed build, C89 doesn't allow non-constant static initializers 2021-08-10 12:17:37 -07:00
Ozkan Sezer 77c8d11137 configuration updates for dlopen:
- cmake, configure (CheckDLOPEN): --enable-sdl-dlopen is now history..
  detach the dl api discovery from SDL_LOADSO_DLOPEN functionality.
  define HAVE_DLOPEN. also define DYNAPI_NEEDS_DLOPEN (CheckDLOPEN is
  called only for relevant platforms.)
- update SDL_config.in and SDL_config.cmake accordingly.
- SDL_dynapi.h: set SDL_DYNAMIC_API to 0 if DYNAPI_NEEDS_DLOPEN is
  defined, but HAVE_DLOPEN is not.
- pthread/SDL_systhread.c: conditionalize dl api use to HAVE_DLOPEN
- SDL_x11opengl.c, SDL_DirectFB_opengl.c, SDL_naclopengles.c: rely
  on HAVE_DLOPEN, not SDL_LOADSO_DLOPEN.
- SDL_config_android.h, SDL_config_iphoneos.h, SDL_config_macosx.h,
  SDL_config_pandora.h, and SDL_config_wiz.h: define HAVE_DLOPEN.

Closes: https://github.com/libsdl-org/SDL/pull/4351
2021-08-10 12:07:32 -07:00
hgs3 cb0fd05eeb Adding a clarifying comment in case a programmer unfamiliar with UTF-16 and UTF-32's relationship chances upon the code. 2021-08-10 12:07:11 -07:00