Commit Graph

7572 Commits (9d457aa44684f0b759c11e6210eabedee0ba591c)

Author SHA1 Message Date
Ozkan Sezer bc51de2f87 regenerated configure script. 2021-06-22 18:11:24 +03:00
Cameron Cawley 23575a42e0 Ensure that libgcc is linked statically on Windows 2021-06-22 18:10:11 +03:00
Sam Lantinga 41fab8532d ControllerList: set the default deadzone for Ps5 controller back to same one as Xbox controllers. Too many users complained about drift. 2021-06-18 18:10:24 -07:00
Sam Lantinga a8b28939a6 ControllerList: add more Xbox controllers from minidumps 2021-06-18 18:10:23 -07:00
Sam Lantinga 08eff56a5b ControllerList: add Brooks Mars controller to PS4 controller list 2021-06-18 18:10:22 -07:00
Sam Lantinga afd100f02b Added support for the PowerA Fusion Pro 2 and the PDP Xbox Series X Afterglow and Blue controllers 2021-06-18 17:37:46 -07:00
Ryan C. Gordon 839387ed0a
video/dummy: Don't zero out the fake display mode before adding it.
The SDL_zero call was in the wrong place as a historical accident, I think.
2021-06-17 22:11:10 -04:00
Sam Lantinga 268fbcd460 Fixed compiler warning on Visual Studio 2021-06-17 11:23:47 -07:00
Sam Lantinga d8dba5bcf3 Added support for the Logitech G923 racing wheel 2021-06-17 11:22:08 -07:00
Ethan Lee 7f261d3b76 wayland: Fix returning to a window from fullscreen without calling SetWindowSize 2021-06-15 09:00:18 -07:00
Ivan Epifanov 8da0dd17a1 Oops. Renderer already queues viewport change 2021-06-15 08:58:53 -07:00
Ivan Epifanov 1fc519880d Reset/re-apply viewport on frame start/target change. Fixes SDL_RenderSetLogicalSize on PSVita 2021-06-15 08:58:53 -07:00
Gianfranco Berardi 0cad302346 Removed reference to ant project.
The android-project-ant directory does not exist anymore.
2021-06-14 12:58:48 -07:00
Ivan Epifanov 2465444fba Add missing dependencies 2021-06-14 11:53:19 -07:00
Phillip Trudeau bc7ac134db Windows: Fix SDL_GetBasePath() truncating paths
SDL_GetBasePath grows its path buffer for long paths, but GetModuleFileNameExW always truncates and succeeds,
so `len` was always equal to (buflen - 1) which is 127. This is easily fixed by checking for (buflen - 1) instead of buflen.
For paths longer than MAX_PATH, this problem sometimes got hidden by Windows path shortening ("C:\PROGRA~1\" etc.).

Tested on Windows 10 x64 19041 and 10586.
2021-06-12 23:07:46 -04:00
Paul Cercueil db5cd8c694 joystick: virtual: Fix event injection for axes/hats
SDL_JoystickSetVirtualAxisInner() and SDL_JoystickSetVirtualHatInner()
did not properly sanitize the 'axis' and 'hat' parameters.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2021-06-12 17:55:03 +03:00
Paul Cercueil f3cf019ecb joystick: Add missing comma in joystick drivers list
Without this comma it is impossible to enable both the Vita and Dummy
drivers at the same time.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2021-06-12 15:50:02 +03:00
nia 98f2e38b26 Use <sys/endian.h> for endian detection on NetBSD
Signed-off-by: Nia Alarie <nia@NetBSD.org>
2021-06-12 15:49:36 +03:00
Ozkan Sezer bc9888c9b5 OS2_GetDisplayModes: malloc a new copy of mode's driver data.
Based on a patch by Jochen Schäfer <josch1710@live.de> :

The problem is, that in the initialization code uses the same structure for
desktop_mode and current_mode.  See SDL_os2video.c:OS2_VideoInit():

  stSDLDisplay.desktop_mode = stSDLDisplayMode;
  stSDLDisplay.current_mode = stSDLDisplayMode;
  ...
  stSDLDisplayMode.driverdata = pDisplayData;

Then, if you call GetDisplayModes, current_mode will added to the modes
list, with the same driverdata pointer to desktop_mode.

  SDL_AddDisplayMode( display, &display->current_mode );

When VideoQuit gets called, first the modes list gets freed including the
driverdata, the desktop_mode gets freed.  See SDL_video.c:SDL_VideoQuit():

  for (j = display->num_display_modes; j--;) {
      SDL_free(display->display_modes[j].driverdata);
      display->display_modes[j].driverdata = NULL;
  }
  SDL_free(display->display_modes);
  display->display_modes = NULL;
  SDL_free(display->desktop_mode.driverdata);
  display->desktop_mode.driverdata = NULL;

So, the display_modes[j].driverdata gets freed, but desktop_mode->driverdata
points to the same memory, but is not NULL'ed. When desktop_mode->driverdata
gets freed the memory is already freed, and libcx crashes the application on
SDL_Quit.
2021-06-12 14:55:24 +03:00
Ozkan Sezer d28437de3c SDL_keyboard.c: Add bounds guards when assigning to the scancode array.
Based on a patch by Jochen Schäfer <josch1710@live.de> :
On a T420 pressing the ACPI button for volume control, big scancodes
were emitted. This was causing an overflow, because missing guards.
2021-06-12 08:00:50 +03:00
Ethan Lee eb15b4e962 wayland: Drop SwapWindow calls for hidden windows 2021-06-11 21:50:18 -07:00
Ryan C. Gordon 37d35a3e34
kmsdrm: hook up KMSDRM_GLES_DefaultProfileConfig for use.
Fixes #3678.
2021-06-11 21:03:35 -04:00
Ivan Epifanov 3c02814194 Update docs and fix typos 2021-06-11 13:21:07 -04:00
Ivan Epifanov bbdd08e0b2 Build without PIB support by default and add flag to enable it 2021-06-11 13:21:07 -04:00
Ivan Epifanov a4442476df Cleanup dead and duplicate code 2021-06-11 13:21:07 -04:00
Ivan Epifanov c2b8b55634 Older api, not needed 2021-06-11 13:21:07 -04:00
Ivan Epifanov dd2a285825 Remove leftovers 2021-06-11 13:21:07 -04:00
Ozkan Sezer 2f248a2a31 SDL_cocoaevents.m: fix build against SDK < 10.12 after commit 0dd7024d. 2021-06-11 04:00:32 +03:00
Dimitriy Ryazantcev f5122377c9 Move SDL_IsXInputDevice check above actual joystick allocation 2021-06-10 16:41:09 -07:00
Dimitriy Ryazantcev 766d81ec86 Rewrite SDL_DINPUT_JoystickPresent method to avoid costly IDirectInput8_CreateDevice calls 2021-06-10 16:41:09 -07:00
Dimitriy Ryazantcev a6da2fbf73 Rename haptic methods to avoid confusion with joystick:
`SDL_DINPUT_MaybeAddDevice`->`SDL_DINPUT_HapticMaybeAddDevice`
`SDL_DINPUT_MaybeRemoveDevice`->`SDL_DINPUT_HapticMaybeRemoveDevice`
`SDL_XINPUT_MaybeAddDevice`->`SDL_XINPUT_HapticMaybeAddDevice`
`SDL_XINPUT_MaybeRemoveDevice`->`SDL_XINPUT_HapticMaybeRemoveDevice`
2021-06-10 16:41:09 -07:00
Dimitriy Ryazantcev 73dc68a7ae Simplify and cleanup DirectInput joystick backend code:
- Do not call IDirectInputDevice8_QueryInterface(device, &IID_IDirectInputDevice8,...) on DIRECTINPUTDEVICE8 device
- Get joystick VendorID and ProductID via IDirectInputDevice8_GetProperty(.., DIPROP_VIDPID, ..) call instead of messing with DIDEVICEINSTANCE.guidProduct
- Normalize HID device interface path to upper case for stable operation of XInput check
- Remove useless RawInput calls in SDL_IsXInputDevice() - just check for "IG_" string in HID device interface path that we already have

There shouldn't be any observable behavior changes.
2021-06-10 16:41:09 -07:00
Dimitriy Ryazantcev f2f759dca3 Remove not used DirectInput ignored_devices list 2021-06-10 16:41:09 -07:00
Dimitriy Ryazantcev adc2d362ba Remove outdated and not used WIN_IsXInputDevice code 2021-06-10 16:41:09 -07:00
Sam Lantinga 0e62926ec5 Fixed crash if vendor or product strings are empty 2021-06-10 16:28:32 -07:00
Ryan C. Gordon 25fc40b0bd
stdinc: Silence clang warning for -Wimplicit-fallthrough.
In a more ideal world, we'd use the appropriate `__attribute__` here, but
it's one thing in a public header that probably shouldn't be there at all, so
this is good enough for now.

Fixes #4307.
2021-06-10 13:59:01 -04:00
Ryan C. Gordon e65a658320
x11: Add a hint to force override-redirect.
Fixes #3776.
2021-06-09 22:10:20 -04:00
Ryan C. Gordon 642fa0e3cf
configure: Enable KMSDRM target by default. 2021-06-09 21:18:11 -04:00
Ryan C. Gordon 56e96254c2
build-scripts: modernized gcc-fat.sh for Big Sur and ARM64.
Put these in "clang-fat.sh" and "clang++-fat.sh" in case someone still needs
32-bit x86 support from the old scripts.

Fixes #4350.
2021-06-09 14:01:40 -04:00
Sam Lantinga cb5e86353b Fixed crash after reinitializing libusb HID support 2021-06-08 13:15:24 -07:00
Eric Wasylishen c33e3c15fb testwm2: draw various debug logging into the window itself
Renderer output size, window position/size, display bounds, etc.
Uses new SDLTest_CommonDrawWindowInfo function in test_common.
2021-06-08 05:29:29 +03:00
Cameron Gutman e13b43ac21 Don't skip sending wakeups for the current thread
We can be in a situation where we receive a win32 hook callback on the same
thread that is currently waiting. In that case, we do still need to trigger
a wakeup when an event is pushed because the hook itself won't necessarily
do that (depending on what we return from the hook).
2021-06-05 14:35:21 -07:00
Cameron Gutman b992b915e5 Optimize SDL_WaitEventTimeout() for the SDL_PollEvent() case
There's no sense in doing all the setup for waiting if we're just polling.
2021-06-05 14:35:21 -07:00
Cameron Gutman 85b51e6c92 Fall back to polling normally if not operating the win32 message loop
In this condition, we cannot safely wait/wake on events.
2021-06-05 14:35:21 -07:00
Cameron Gutman e13d5df00b Call SDL_SendWakeupEvent() directly from SDL_PeepEvent()
SDL_PeepEvent() is a documented public API, so we must properly support
waking a waiting thread in SDL_WaitEventTimeout() with SDL_PeepEvent().
2021-06-05 14:35:21 -07:00
Ethan Lee d956636c85 wayland: Implement FlashWindow 2021-06-04 16:26:03 -07:00
Jupeyy 64724db0a1 Implement bare minimum for SDL_FlashWindow 2021-06-04 15:07:55 -07:00
Sam Lantinga 64c40b9028 Updated copyright date 2021-06-04 14:34:21 -07:00
Ozkan Sezer 37b093eaf2 test/checkkeysthreads: build fixes, and add to os2 makefile. 2021-06-05 00:05:56 +03:00
Francesco Abbate 0dd7024d55 Modifies WaitEvent and WaitEventTimeout to actually wait instead of polling
When possible use native os functions to make a blocking call waiting for
an incoming event. Previous behavior was to continuously poll the event
queue with a small delay between each poll.

The blocking call uses a new optional video driver event,
WaitEventTimeout, if available. It is called only if an window
already shown is available. If present the window is designated
using the variable wakeup_window to receive a wakeup event if
needed.

The WaitEventTimeout function accept a timeout parameter. If
positive the call will wait for an event or return if the timeout
expired without any event. If the timeout is zero it will
implement a polling behavior. If the timeout is negative the
function will block indefinetely waiting for an event.

To let the main thread sees events sent form a different thread
a "wake-up" signal is sent to the main thread if the main thread
is in a blocking state. The wake-up event is sent to the designated
wakeup_window if present.

The wake-up event is sent only if the PushEvent call is coming
from a different thread. Before sending the wake-up event
the ID of the thread making the blocking call is saved using the
variable blocking_thread_id and it is compared to the current
thread's id to decide if the wake-up event should be sent.

Two new optional video device methods are introduced:

WaitEventTimeout
SendWakeupEvent

in addition the mutex

wakeup_lock

which is defined and initialized but only for the drivers supporting the
methods above.

If the methods are not present the system behaves as previously
performing a periodic polling of the events queue.

The blocking call is disabled if a joystick or sensor is detected
and falls back to previous behavior.
2021-06-04 13:50:50 -07:00