Commit Graph

8187 Commits (67c42cb44c01f85df89b2bb4450a0fc4a3e5f419)

Author SHA1 Message Date
Sam Lantinga 67c42cb44c Fixed Windows build 2021-11-08 22:16:01 -08:00
Sam Lantinga fd79607eb0 Added SDL_GetWindowMouseRect()
Also guarantee that we won't get mouse movement outside the confining area, even if the OS implementation allows it (e.g. macOS)
2021-11-08 21:34:48 -08:00
Sam Lantinga 4db546b092 Implemented SDL_SetWindowMouseRect() on macOS 2021-11-08 20:35:56 -08:00
Sam Lantinga 037030a7a2 Install SDL_hidapi.h 2021-11-08 20:35:56 -08:00
Cameron Gutman 9c95c2491c x11: Use XCheckIfEvent() instead of XNextEvent() for thread-safety
A racing reader could read from our fd between SDL_IOReady()/X11_Pending()
and our call to XNextEvent() which will cause XNextEvent() to block for
more data. Avoid this by using XCheckIfEvent() which will never block.

This also fixes a bug where we could poll() for data, even when events were
already read and pending in the queue. Unlike the Wayland implementation,
this isn't totally thread-safe because nothing prevents a racing reader
from reading events into the queue between our XCheckIfEvent() and
SDL_IOReady() calls, but I think this is the best we can do with Xlib.
2021-11-08 19:17:18 -08:00
Cameron Gutman e9dae813d9 CI: disable fail-fast to avoid aborting build when one platform fails 2021-11-08 20:14:08 -06:00
Sam Lantinga 2d23d66a61 Fixed SetWindowMouseRect return value on Windows 2021-11-08 16:33:50 -08:00
Sam Lantinga 7d21322df1 Implemented SDL_SetWindowMouseRect() on Windows 2021-11-08 16:29:19 -08:00
Ozkan Sezer 684b3b312a regenerated configure script. 2021-11-09 02:30:28 +03:00
Ethan Lee 4b42c05ba1 video: Add SDL_SetWindowMouseRect.
This API and implementation comes from the Unreal Engine branch of SDL, which
originally called this "SDL_ConfineCursor".

Some minor cleanup and changes for consistency with the rest of SDL_video, but
there are two major changes:

1. The coordinate system has been changed so that `rect` is _window_ relative
   and not _screen_ relative, making it easier to implement without having
   global access to the display.
2. The UE version unset all rects when passing `NULL` as a parameter for
   `window`, this has been removed as it was an unused feature anyhow.

Currently this is only implemented for X, but can be supported on Wayland and
Windows at minimum too.
2021-11-08 14:16:54 -08:00
Ryan C. Gordon 1a98dcb6aa
Revert "include: Updated SDL_config_emscripten.h from emscripten-ports."
Apparently we already had the newer version, sorry!

This reverts commit 6657cbce8d.

Reference issue #4623.
2021-11-08 15:16:18 -05:00
Ozkan Sezer dcc919096f autotools: initial adjustments after the recent hidapi changes. 2021-11-08 22:28:00 +03:00
Ozkan Sezer 2636d839e3 cmake: add hidapi to 'SDL_SUBSYSTEMS' 2021-11-08 22:25:32 +03:00
Ozkan Sezer 1739ef3ee1 sdlchecks.cmake: remove libusb/hid.c and SDL_hidapi.c additions to srcs 2021-11-08 22:00:02 +03:00
Ozkan Sezer 36067fa129 cmake: include hid.cpp in android sources 2021-11-08 21:35:24 +03:00
Ozkan Sezer 84138b7719 minor update to os2 config file. 2021-11-08 21:15:04 +03:00
Ozkan Sezer 001aa4dab8 cmake: more hidapi fixes. 2021-11-08 21:12:02 +03:00
Sam Lantinga a3e8fd49e6 Cancel any accumulated mouse wheel motion in the opposite direction when the wheel direction changes
Fixes https://github.com/libsdl-org/SDL/issues/2912
2021-11-08 09:58:11 -08:00
Sam Lantinga 5dbbc8e61f Added mouse wheel deltas with floating point precision
Fixes https://github.com/libsdl-org/SDL/issues/4888
2021-11-08 09:44:31 -08:00
Sam Lantinga d95a52c9a5 Fixed comment typo 2021-11-08 09:39:21 -08:00
Ethan Lee fc998b8ec9
wayland: Return true for HasScreenKeyboardSupport only if no physical keyboard exists 2021-11-08 12:37:10 -05:00
Sam Lantinga 4bbbe5f84c Fixed CMake build by adding hidapi files
This needs more work to remove the hidapi shared library build, but at least Linux builds are unblocked
2021-11-08 09:28:36 -08:00
Sam Lantinga b8327a4a48 Added SDL_HIDAPI_DISABLED so it can be disabled like other SDL subsystems 2021-11-08 07:19:45 -08:00
Sam Lantinga 2a6feb5011 Removed accidental debugging commit (thanks @DomGries!) 2021-11-08 07:10:38 -08:00
Sam Lantinga 6c56e27511 Set both _NET_WM_NAME and WM_NAME so SDL windows can be shared in the browser.
Fixes https://github.com/libsdl-org/SDL/issues/4924
2021-11-08 07:05:17 -08:00
Yufei Huang 301819cd1d SDL_windowsmouse.c: Fix WIN_CreateCursor does not scale with system cursor size preference 2021-11-08 06:59:36 -08:00
Sam Lantinga f61b10dcf1 Do more robust validation of devices passed to the SDL HIDAPI functions 2021-11-08 06:34:32 -08:00
Ozkan Sezer dd8c354843 SDL_hidapi.c: avoid possible NULL pointer dereferences. 2021-11-08 17:00:56 +03:00
Ozkan Sezer 2a904aa1c9 os2: remove SDL_hidapi duplications in makefile, disable it in config. 2021-11-08 17:00:28 +03:00
Sam Lantinga 5b646cd19e Build hidapi code into SDL as a new public API
This prevents conflicts with hidapi linked with applications, as well as allowing applications to make use of HIDAPI on Android and other platforms that might not normally have an implementation available.
2021-11-07 23:00:59 -08:00
Thomas Ballinger 94c1276a5f
emscripten: Decrease vertical scroll speed by using deltaMode
Reference issue #4623.
2021-11-07 20:50:07 -05:00
Ryan C. Gordon 6657cbce8d
include: Updated SDL_config_emscripten.h from emscripten-ports.
Reference issue #4623.
2021-11-07 20:45:31 -05:00
Cameron Gutman f6dc47caef WGI/DInput: Fix SDL_IsXInputDevice() checks when RawInput is enabled
Enabling the RawInput backend causes SDL_XINPUT_Enabled() to return false.
That causes WGI and DInput backends to take ownership of XInput-compatible
controllers, because they think there's no XInput-specific backend enabled.

In WGI's case, it will actually race with RawInput to open the device. By
properly excluding XInput devices from WGI, we can ensure that the sets of
devices managed by WGI and RawInput don't intersect. This makes the race
harmless, since they'll never both go after the same device.
2021-11-07 16:14:33 -06:00
Sam Lantinga 74f35a7cbd Fixed documentation 2021-11-07 14:10:04 -08:00
Sam Lantinga 301389cecc Fixed iOS build 2021-11-07 13:53:12 -08:00
Cameron Gutman b3e909dc41 WGI: Fix SDL_IsXInputDevice() for Xbox One controllers
The Xbox One driver stack doesn't propagate the VID/PID down to the
HID devices that end up in the GetRawInputDeviceList() output. This
means we end up matching against the wrong VID/PID and can't properly
exclude Xbox One controllers from WGI.

Fortunately, it is possible to walk back up the device tree to find
the parent with the matching VID/PID.
2021-11-07 13:33:18 -08:00
Sam Lantinga dd85cc0195 Fixed whitespace 2021-11-07 13:17:54 -08:00
FormularSumo 80d19282f7 If Android version >= API 23 PendingIntent.FLAGIMMUTABLE
"If your app targets Android 12, you must specify the mutability of each PendingIntent object that your app creates. This additional requirement improves your app's security."

FLAG_IMMUTABLE was added in API 23 so that's why I'm using "> API 23". Using API 30 would also fix the Android 12 issue. Alternatively if PendingIntents should be mutable you could change it to "FLAG_MUTABLE".
2021-11-07 13:16:13 -08:00
Sam Lantinga b8c00bf914 Allow opening joysticks that are read-only on Linux
Fixes https://github.com/libsdl-org/SDL/issues/4713
2021-11-07 13:11:29 -08:00
Sam Lantinga 0323d983c6 Add the platform to the game controller mapping so it can be read back in without changes
Fixes https://github.com/libsdl-org/SDL/issues/4848
2021-11-07 12:52:48 -08:00
Charlie Birks d950b9e2d9
emscripten: Make timers work (if used with emscripten_set_main_loop)
Co-authored-by: aidanhs <aidanhs@cantab.net>
2021-11-07 15:40:54 -05:00
Sam Lantinga fe2fe29049 Backed out accidentally committed PR https://github.com/libsdl-org/SDL/pull/4849 2021-11-07 11:48:16 -08:00
Sam Lantinga 86bc65a741 Fixed non-Apple builds 2021-11-07 11:35:12 -08:00
Sam Lantinga 637bcd0b72 Fixed build warnings 2021-11-07 11:19:07 -08:00
Sam Lantinga e14358265e Cleanup sfSymbolName support and add them to the dynamic API functions 2021-11-07 11:16:48 -08:00
Patrick Hogan 149e5c656a Support returning sfSymbolsName for gamepad controls on macOS / iOS / tvOS 2021-11-07 10:58:37 -08:00
Sam Lantinga cdb4d8f22f Added a test case for snprintf of 0.0
This verifies regressions in https://github.com/libsdl-org/SDL/issues/4795
2021-11-07 09:39:57 -08:00
Ryan C. Gordon 3acb172531 stdlib: SDL_snprintf now adds decimal places for ("%f", 0.0).
This patch was from @Markvy (thanks!).

Fixes #4795.
2021-11-07 09:34:55 -08:00
Eric Wasylishen 2008f2a8a6 SDL_test_font.c: fix type of SDLTest_CharTextureCacheList 2021-11-07 08:42:09 -08:00
Eric Wasylishen a0e055a7f9 testwm2: add mode menu, click on a mode to call SDL_SetWindowDisplayMode 2021-11-07 08:42:09 -08:00