We don't need to use the hack of setting a timer and waiting for a timer message, MsgWaitForMultipleObjects() will allow us to wait for input directly with a timeout.
Before this change, sleeping for 20 ms would actually sleep for around 30 ms, with this change the sleep time is pretty accurate at 20-21 ms.
(cherry picked from commit 2670eb44afec9311ee8fbec447703c427db1e1c8)
(cherry picked from commit 08caafe2f1044ae9baaf77507bba24c29adf551f)
Note that apparently this has caused some weird-sounding audio
on some Android devices, so we might wrap this in a hint later,
or try to check for specific devices.
Fixes#8888.
(cherry picked from commit 1e016fd5eaa3b78248fc9e14a5958c0a884b76b8)
Fixes a crash if no seat was available at initialization, but still allows for one to still be created later if an input device is added.
Manual backport of 84e47b4
(cherry picked from commit a8eeb181b68b2ee214e9c5f239278147ae0f5fbc)
On my laptop, the battery is configured to stop charging at around 80%
most of the time, to increase the overall useful lifetime of the battery.
When in that state, upower reports UP_DEVICE_STATE_PENDING_CHARGE
(numeric value 5), which SDL previously mapped to SDL_POWERSTATE_UNKNOWN.
This made the platform_testGetPowerInfo automated test fail, because
it assumes that SDL_POWERSTATE_UNKNOWN means no battery is connected,
and does not expect to see a percentage.
Map UP_DEVICE_STATE_PENDING_CHARGE (5) to SDL_POWERSTATE_CHARGED, which
seems close enough.
Also map UP_DEVICE_STATE_PENDING_DISCHARGE (6) to
SDL_POWERSTATE_ON_BATTERY, which matches how at least GNOME presents it.
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit eebd5d18a2af0f3505791d7d40c2ec2bb5c08bb6)
It's reasonable to assume that any of them might need a display and an
audio backend. We run them with SDL_VIDEODRIVER and SDL_AUDIODRIVER
set to dummy anyway.
Signed-off-by: Simon McVittie <smcv@collabora.com>
If a specific audio driver was requested for testing, don't loop over all drivers in the init, open/close, and pause/unpause tests.
Additionally, drivers can fail if attempting to open an audio device when no underlying output is present, which is a valid case if the system has no audio hardware available. Check for the presence of audio output devices before attempting to open them.
Fixes automated tests with various drivers on Windows and Linux.
The dummy driver can be in use on these platforms, so check the actual driver name string.
Fixes the automated video tests with the dummy driver on Win32.
'src/stdlib/SDL_qsort.c:27:5: runtime error: null pointer passed as argument 1, which is declared to never be null`
(cherry picked from commit 2cd583ee13ec4660d7fbe6e6d8293744d3343071)
If the error behaviour in one of these cases was wrong, that could have
been hidden by the error indicator remaining set from a previous test.
Signed-off-by: Simon McVittie <smcv@collabora.com>