This feature is meant to be used with VRR / Adaptive Sync.
Currently cursor move drives the display at the poll rate of the mouse.
This adds a deferred delay for a variety situations:
To save power on battery
To maintain smooth video playback (i.e. render video 30fps at 60 or 120fps)
To maintain smooth gaming experience (i.e. only enforce redraw at VRR minimum Hz)
I've tried to make it as unopinionated as possible, while also reducing
complexity for downstream developers.
The design should be backwards compatible, as long as
wlr_set_cursor_max_latency() is never called wlr_cursor_move() should act as
normal
I considered using wl_signals, but I'm not familiar with the interface, and it
felt somewhat overkill.
There's a reference implementation in branch deferred-cursor-move:
github:YellowOnion/sway
0xFFFFFFFF milliseconds is 4,294,967,295 ms so about 50 days.
A little bit too close for comfort.
Use int64_t instead of uint64_t to avoid C's implicit conversion
footguns in computations.
This commit makes `get_current_time_msec` correctly return milliseconds
as opposed to microseconds. It also considers the value of `tv_sec`, so
we don't lose occasionally go back in time by one second. Finally, the
function is moved into `util/time.cc` so that it can be reused elsewhere
without having to consider these pitfalls.