wayland: Pass through event timestamps of 0

Always pass through event timestamps of 0 so the current time will be used for the event.
main
Frank Praznik 2022-12-05 18:50:22 -05:00 committed by Sam Lantinga
parent 39eab4bf44
commit 30bb8f616d
1 changed files with 20 additions and 8 deletions

View File

@ -180,10 +180,6 @@ Uint64 Wayland_GetEventTimestamp(Uint64 nsTimestamp)
static Uint64 timestamp_offset;
const Uint64 now = SDL_GetTicksNS();
if (!nsTimestamp) {
return 0;
}
if (nsTimestamp < last) {
/* 32-bit timer rollover, bump the offset */
timestamp_offset += SDL_MS_TO_NS(0x100000000LLU);
@ -215,24 +211,40 @@ static const struct zwp_input_timestamps_v1_listener timestamp_listener = {
static Uint64 Wayland_GetKeyboardTimestamp(struct SDL_WaylandInput *input, Uint32 wl_timestamp_ms)
{
if (wl_timestamp_ms) {
return Wayland_GetEventTimestamp(input->keyboard_timestamp_ns ? input->keyboard_timestamp_ns : SDL_MS_TO_NS(wl_timestamp_ms));
}
return 0;
}
static Uint64 Wayland_GetKeyboardTimestampRaw(struct SDL_WaylandInput *input, Uint32 wl_timestamp_ms)
{
if (wl_timestamp_ms) {
return input->keyboard_timestamp_ns ? input->keyboard_timestamp_ns : SDL_MS_TO_NS(wl_timestamp_ms);
}
return 0;
}
static Uint64 Wayland_GetPointerTimestamp(struct SDL_WaylandInput *input, Uint32 wl_timestamp_ms)
{
if (wl_timestamp_ms) {
return Wayland_GetEventTimestamp(input->pointer_timestamp_ns ? input->pointer_timestamp_ns : SDL_MS_TO_NS(wl_timestamp_ms));
}
return 0;
}
Uint64 Wayland_GetTouchTimestamp(struct SDL_WaylandInput *input, Uint32 wl_timestamp_ms)
{
if (wl_timestamp_ms) {
return Wayland_GetEventTimestamp(input->touch_timestamp_ns ? input->touch_timestamp_ns : SDL_MS_TO_NS(wl_timestamp_ms));
}
return 0;
}
void Wayland_RegisterTimestampListeners(struct SDL_WaylandInput *input)
{
SDL_VideoData *viddata = input->display;