Commit Graph

7177 Commits

Author SHA1 Message Date
Sam Lantinga
bec9d740ec Fixed compile warning 2021-02-10 10:22:17 -05:00
Sam Lantinga
a4db44fa71 The Sharkoon Skiller SGH2 headset hangs in DirectInput enumeration, so avoid it here just in case.
See bug 5485 for details.
2021-02-10 10:22:17 -05:00
Sam Lantinga
06ad887f44 Fixed bug 3816 - asm code in video/SDL_stretch.c
Ozkan Sezer

- adds MSVC __declspec(align(x)) support,
- disables asm if PAGE_ALIGNED no macro is defined,
- still disables asm for gcc < 4.6, need more info,
- drops Watcom support.
2021-02-10 10:22:17 -05:00
Sam Lantinga
1e5f0073c6 Fixed building with mingw64 2021-02-10 10:22:17 -05:00
Sylvain Becker
70b353d1a5 SDL_Update{YUV,NV}Texture: also intersect rect with texture dimension 2021-02-10 10:22:17 -05:00
Sylvain Becker
13626c3681 SDL_UpdateTexture: intersect update rect with texture dimension
- fix crash with software renderer
- fix non texture update with opengl/gles2
2021-02-10 10:22:17 -05:00
Sylvain Becker
5e3cf0d1f4 SDL_SoftStretch: disable asm path if mprotect isn't available (see bug #3816) 2021-02-10 10:22:17 -05:00
Cameron Gutman
6b057c6783 Expose separate keyboard and mouse grab support
This adds SDL_SetWindowKeyboardGrab(), SDL_GetWindowKeyboardGrab(),
SDL_SetWindowMouseGrab(), SDL_GetWindowMouseGrab(), and new
SDL_WINDOW_KEYBOARD_GRABBED flag. It also updates the test harness to exercise
this functionality and makes a minor fix to X11 that I missed in
https://hg.libsdl.org/SDL/rev/02a2d609369b

To fit in with this new support, SDL_WINDOW_INPUT_CAPTURE has been renamed to
SDL_WINDOW_MOUSE_CAPTURE with the old name remaining as an alias for backwards
compatibility with older code.
2021-02-10 10:22:17 -05:00
Sylvain Becker
ff827fc767 SDL_SoftStretch: re-enable USE_ASM_STRETCH path for gcc >= 4.6 2021-02-10 10:22:17 -05:00
Cameron Gutman
a1d288bea1 DirectFB: Split input grab handling into keyboard and mouse parts
The grabbed_window field is superfluous now since SDL added the
SDL_GetGrabbedWindow() function, so it can be removed.

DirectFB_SetWindowMouseGrab() is also simplified because SDL handles ungrabbing
any previously grabbed window prior to calling SetWindowMouseGrab() now.

Compile-tested only.
2021-02-10 10:22:16 -05:00
Sam Lantinga
de85d61256 Fixed bug 5497 - SDL_COMPOSE_ERROR is wrong
UMU

#define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str

I think SDL_STRINGIFY_ARG should be removed.

#define SDL_COMPOSE_ERROR(str) __FUNCTION__ ", " str

(verified with Visual Studio 2019)
2021-02-10 10:22:16 -05:00
Sam Lantinga
de1c19b3f5 Fixed bug 5481 - iOS-specific main sources not used for CMake build.
Aaron Barany

The CMake build for SDL doesn't set SDLMAIN_SOURCES on iOS to the sources in src/main/ios. As a result, SDL fails to initialize since it falls back to the dummy main. Adding the line file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/uikit/*.c) fixes the issue.
2021-02-10 10:22:16 -05:00
Sam Lantinga
ac72a2ba8e Fixed bug 5493 - Hint to let the user opt out of having Switch controllers' Home button lit when opened
jibb

New hint to let the user opt out of having Switch controllers' Home button lit when opened.

This is more consistent with the Switch itself (which doesn't light the button normally) and may be preferred by users who may disconnect their controller without letting the application close it.

I think this warrants a Switch-specific hint because the default behaviour is unusual (inconsistent with using a Switch controller on a Switch itself or with some other programs on PC), and because of that it's distinct from other lights (the player number on Switch controllers and the player colour on PlayStation controllers).
2021-02-10 10:22:16 -05:00
Sam Lantinga
f23022ef97 Removed non-functional window grab implementations 2021-02-10 10:22:16 -05:00
Cameron Gutman
a0d3c6c63c Rename SetWindowGrab() to SetWindowMouseGrab() 2021-02-10 10:22:16 -05:00
Cameron Gutman
d133a5f6f7 wayland: cancel key repeat when keyboard focus is lost
SDL_SetKeyboardFocus(NULL) will lift any keys still pressed when keyboard focus
leaves the window, but then key repeat comes behind our backs and presses the
key down again. This results in an infinite stream of SDL_KEYDOWN events when
focus leaves the window with a key down (particularly noticeable with Alt+Tab).
2021-02-10 10:22:16 -05:00
Cameron Gutman
2793c9cfb0 Fix grabbing Alt+Tab and Alt+Esc on Windows 7 2021-02-10 10:22:16 -05:00
Cameron Gutman
e1f73e642b Refactor keyboard grab to be managed by the video core
This gives us flexibility to add others hints to control keyboard grab behavior
without having to touch all of the backends. It also allows us to possibly
expose keyboard grab separately from mouse grab for applications that want to
manage those independently.
2021-02-10 10:22:16 -05:00
Sylvain Becker
f40551c5f6 GLES2 SDL_Renderer: remove old ZUNE_HD defines and simplify shader cache 2021-02-10 10:22:16 -05:00
Ozkan Sezer
aa4a6b0b88 better check for clock_gettime_nsec_np() -- cf. bug #5467. 2021-02-10 10:22:16 -05:00
Ozkan Sezer
d327bbfbfd CMakeLists.txt: fix check_symbol_exists() for clock_gettime_nsec_np 2021-02-10 10:22:16 -05:00
Ozkan Sezer
b852590ba5 minor clean-up in SDL_os2audio.c 2021-02-10 10:22:16 -05:00
Brandon DeRosier
141f441633 fix build failure due to -Werror=declaration-after-statement (bug #5500) 2021-02-10 10:22:16 -05:00
Manuel Alfayate Corchete
8e1005f8b0 [KMS/DRM] Bugfix for #5489: Non-FULLSCREEN windows incorrecty use videomode changing to look fullscreen. 2021-01-24 00:51:26 -05:00
Ethan Lee
e787282ba8 Implement Wayland_SetWindowResizable 2021-01-24 00:51:26 -05:00
Sam Lantinga
360e04dd23 Added Stadia controller source file to Visual Studio and Xcode projects 2021-01-24 00:51:26 -05:00
Simon McVittie
c16cfc0e92 waylandtouch: Don't export interface structs
These are explicitly written in C code rather than generated at build
time, so they weren't affected by changing how we invoke
wayland-scanner.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-01-24 00:51:26 -05:00
Sam Lantinga
c857b5e0c9 Minor cleanup 2021-01-24 00:51:26 -05:00
Sam Lantinga
1981d23f4b Fixed bug 5466 - Add haptic support for Stadia Controller
Dimitriy Ryazantcev

Consider adding support for Stadia Controller haptics.

Here is example code how to deal with it:
99314be815/device/gamepad/hid_haptic_gamepad.cc (L45)
2021-01-24 00:51:26 -05:00
Sam Lantinga
96cfb81232 Fixed bug 5467 - SDL sys timer Mac OS update proposal
David Carlier

Change of api from 2016 which reduce code complexity a bit.
2021-01-24 00:51:25 -05:00
JibbSmart
0f57864c9e Hint SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS added so we can recognise a Joy-Con as half a Pro Controller, so we can read its analog input and read its sensors just like we do a Pro Controller. 2021-01-24 00:51:25 -05:00
Cameron Gutman
bd553ea868 Implement support for inhibiting the screensaver on Wayland
We support both the org.freedesktop.ScreenSaver D-Bus API (same as the X11
backend) and the Wayland idle_inhibit_unstable_v1 protocol.

Some Wayland compositors only support one or the other, so we need both to
for broad compatibility.
2021-01-24 00:51:25 -05:00
Cameron Gutman
7ff3832e4d Fix continuous scrolling speed on Wayland
Wayland compositors seem to have standardized on 10 units per "wheel tick" for
continuous scroll events, so we need to convert these axis values to ticks by
dividing by 10 before reporting them in SDL_MOUSEWHEEL events.
2021-01-24 00:51:25 -05:00
Cameron Gutman
8c921d8201 Implement keyboard grab support for Windows
This is implemented via a low-level keyboard hook. Unfortunately, this is
rather invasive, but it's how Microsoft recommends that it be done [0].
We want to do as little as possible in the hook, so we only intercept a few
crucial modifier keys there, while leaving other keys to the normal event
processing flow.

We will only install this hook if SDL_HINT_GRAB_KEYBOARD=1, which is not
the default. This will reduce any compatibility concerns to just the SDL
applications that explicitly ask for this behavior.

We also remove the hook when the grab is terminated to ensure that we're
not unnecessarily staying involved in key event processing when it's not
required anymore.

[0]: https://docs.microsoft.com/en-us/windows/win32/dxtecharts/disabling-shortcut-keys-in-games
2021-01-24 00:51:25 -05:00
Ozkan Sezer
fd65aaa9a8 move outdated winmm and psp joystick codes to struct _SDL_JoystickDriver
build-tested only. (bug #5472.)
2021-01-24 00:51:25 -05:00
Ozkan Sezer
8f1025899a os2audio: changed backend name from MMOS2 to DART (like SDL-1.2) 2021-01-24 00:51:25 -05:00
Ozkan Sezer
2376458841 renamed SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H to SDL_HAVE_MACHINE_JOYSTICK_H 2021-01-24 00:51:25 -05:00
Ozkan Sezer
02e61a88fb added SDL_JOYSTICK_OS2 to SDL_config.h.in and SDL_config.h.cmake 2021-01-24 00:51:25 -05:00
Ozkan Sezer
d0c5097cdc minor autotools build system updates. 2021-01-24 00:51:25 -05:00
Ozkan Sezer
4eb2b9f809 fix permissions of config.guess and config.sub 2021-01-24 00:51:25 -05:00
Sam Lantinga
f68b36df75 Added support for the EVORETRO GameCube Adapter in PC mode 2021-01-24 00:51:25 -05:00
Sam Lantinga
9c88eac856 ControllerList: fix typo 2021-01-24 00:51:25 -05:00
Ozkan Sezer
11fce32162 SDL_dinputjoystick.c: fixes to dfDIJoystick2[] array from Wine git.
Fix V/A/FSlider dwOfs values in c_dfDIJoystick2
af2f419426

Add missing ASPECT flags for c_dfDIJoystick2
e2e100272f

Closes bug #5474.
2021-01-24 00:51:25 -05:00
Ozkan Sezer
4a776557af old os2 analogue joystick code ported from SDL-1.2. disabled by default,
build-tested only.
2021-01-24 00:51:25 -05:00
Ozkan Sezer
e91f83c1e0 hidapi.h: adjust so that it gives a smaller diff against mainstream 2021-01-24 00:51:25 -05:00
Sam Lantinga
d4794028bb Fixed build 2021-01-24 00:51:25 -05:00
Sam Lantinga
9e45372a2f Fixed build on Android and iOS 2021-01-24 00:51:25 -05:00
Cameron Gutman
19236b462a Implement support for minimizing windows on Wayland
This required a bit of extra code to deal with the transition from minimized
back to fullscreen
2021-01-24 00:51:25 -05:00
Cameron Gutman
cf84ec441f Improve reliability of cursor hiding on GNOME Wayland
Hiding the cursor doesn't appear to work reliably on GNOME when another window
steals mouse focus right as we call SDL_ShowCursor(SDL_DISABLE). This can happen
when the keyboard shortcut inhibition permission prompt appears in response to a
call to SDL_SetRelativeMouseMode() with SDL_HINT_GRAB_KEYBOARD=1. The result is
that the default cursor is stuck locked in position and visible on screen
indefinitely.

By redrawing the cursor on pointer focus enter, the cursor now disappears upon
the first mouse motion event. It's not perfect but it's way better than the
current behavior.
2021-01-24 00:51:25 -05:00
Sam Lantinga
bf53651d73 Make sure we only do GameCube adapter initialization if we were able to load libusb 2021-01-24 00:51:24 -05:00