Now it's much clearer and easier to tweak the defaults
(cherry picked from commit 4fba6633687b53e714c3422b6a28fe7dace48674)
(cherry picked from commit 6ec3f5a28ea7194d57827d6bb34acc969db3b0a0)
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)
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)
Otherwise we'll miss it when XWarpPointer() is used. x11vnc may do this to
manage mouse input in some circumstances, so it can be possible for _all_
mouse motion to go through this path, breaking SDL_GetGlobalMouseState().
Thanks to @chrismile for all the detective work to figure this out!
Fixes#8827.
These are faster and more precise.
This did not change the Uint16 versions (as SDL3 dropped them, and honestly
no one should be using them in SDL2), nor the NEON converters (as this was
not changed in SDL3, so far).
Fixes#8786.
Matches the one in `GetMouseMessageSource()`.
From my testing on Windows 11, the lower 8 bits in touch events cycle
trough the values 0x8c-0x95 in order.
(cherry picked from commit d747daf03d3210a794d609b8cc662f28beaedaf6)
like SDL_triangle.c:305:30: runtime error: left shift of negative value -672
(even if the value was correctly computed)
(cherry picked from commit 4033a0a83b3a675c6b7803e36fb13114579d0b5b)