mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-03 21:40:40 +01:00
Move libinput_now() to our timer.c helper functions
This is just general cleanup so libinput_now() is easier to use without needing to include libinput-private.h (which itself opens up most of libinput's internals). Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1216>
This commit is contained in:
parent
5774463dde
commit
d9d4d92ff0
3 changed files with 17 additions and 14 deletions
|
|
@ -908,20 +908,6 @@ switch_notify_toggle(struct libinput_device *device,
|
|||
enum libinput_switch sw,
|
||||
enum libinput_switch_state state);
|
||||
|
||||
static inline uint64_t
|
||||
libinput_now(struct libinput *libinput)
|
||||
{
|
||||
uint64_t now;
|
||||
int rc = now_in_us(&now);
|
||||
|
||||
if (rc < 0) {
|
||||
log_error(libinput, "clock_gettime failed: %s\n", strerror(-rc));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return now;
|
||||
}
|
||||
|
||||
static inline struct device_float_coords
|
||||
device_delta(const struct device_coords a, const struct device_coords b)
|
||||
{
|
||||
|
|
|
|||
14
src/timer.c
14
src/timer.c
|
|
@ -250,3 +250,17 @@ libinput_timer_flush(struct libinput *libinput, uint64_t now)
|
|||
|
||||
libinput_timer_handler(libinput, now);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
libinput_now(struct libinput *libinput)
|
||||
{
|
||||
uint64_t now;
|
||||
int rc = now_in_us(&now);
|
||||
|
||||
if (rc < 0) {
|
||||
log_error(libinput, "clock_gettime failed: %s\n", strerror(-rc));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return now;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,4 +76,7 @@ libinput_timer_subsys_destroy(struct libinput *libinput);
|
|||
void
|
||||
libinput_timer_flush(struct libinput *libinput, uint64_t now);
|
||||
|
||||
uint64_t
|
||||
libinput_now(struct libinput *libinput);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue