[PATCH libinput 20/20] Change internal timestamps to uint64_t to properly deal with wrapping
Hans de Goede
hdegoede at redhat.com
Tue Apr 15 05:28:17 PDT 2014
We store timestamps in ms since system boot (CLOCK_MONOTONIC). This will wrap
after circa 50 days.
I've considered making our code wrapping safe, but that won't work. We also
use our internal timestamps to program timer-fds for timeouts. And we store
ms in a single integer but the kernel uses 2 integers, one for seconds and
one for usec/nanosec. So at 32 bits our ms containing integer will wrap
in 50 days, while the kernels seconds storing integer lasts a lot longer.
So when we wrap our ms timestamps, we will be programming the timer-fds
with a seconds value in the past.
So change all our internal timestamps to uint64_t to avoid the wrapping
when programming the timer-fds. Note that we move from 64-bit timestamps to
32-bit timestamps when calling the foo_notify_bar functions from
libinput-private.h. Having 64 bit timestamps has no use past this point,
since the wayland input protocol uses 32 bit timestamps (and clients will
have to deal with wrapping).
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
Acked-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/evdev-mt-touchpad-buttons.c | 22 ++++++++++-----------
src/evdev-mt-touchpad-tap.c | 42 ++++++++++++++++++++---------------------
src/evdev-mt-touchpad.c | 24 +++++++++++------------
src/evdev-mt-touchpad.h | 14 +++++++-------
src/evdev-touchpad.c | 26 ++++++++++++-------------
src/evdev.c | 12 ++++++------
src/evdev.h | 2 +-
src/filter.c | 16 ++++++++--------
src/filter.h | 6 +++---
9 files changed, 82 insertions(+), 82 deletions(-)
diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
index c40b05c..7b1d27b 100644
--- a/src/evdev-mt-touchpad-buttons.c
+++ b/src/evdev-mt-touchpad-buttons.c
@@ -97,7 +97,7 @@ is_inside_left_area(struct tp_dispatch *tp, struct tp_touch *t)
}
static void
-tp_button_set_timer(struct tp_dispatch *tp, uint32_t timeout)
+tp_button_set_timer(struct tp_dispatch *tp, uint64_t timeout)
{
struct itimerspec its;
its.it_interval.tv_sec = 0;
@@ -287,7 +287,7 @@ static void
tp_button_handle_event(struct tp_dispatch *tp,
struct tp_touch *t,
enum button_event event,
- uint32_t time)
+ uint64_t time)
{
enum button_state current = t->button.state;
@@ -317,7 +317,7 @@ tp_button_handle_event(struct tp_dispatch *tp,
}
int
-tp_button_handle_state(struct tp_dispatch *tp, uint32_t time)
+tp_button_handle_state(struct tp_dispatch *tp, uint64_t time)
{
struct tp_touch *t;
@@ -347,7 +347,7 @@ tp_button_handle_state(struct tp_dispatch *tp, uint32_t time)
}
static void
-tp_button_handle_timeout(struct tp_dispatch *tp, uint32_t now)
+tp_button_handle_timeout(struct tp_dispatch *tp, uint64_t now)
{
struct tp_touch *t;
@@ -362,7 +362,7 @@ tp_button_handle_timeout(struct tp_dispatch *tp, uint32_t now)
int
tp_process_button(struct tp_dispatch *tp,
const struct input_event *e,
- uint32_t time)
+ uint64_t time)
{
uint32_t mask = 1 << (e->code - BTN_LEFT);
@@ -390,7 +390,7 @@ tp_button_timeout_handler(void *data)
uint64_t expires;
int len;
struct timespec ts;
- uint32_t now;
+ uint64_t now;
len = read(tp->buttons.timer_fd, &expires, sizeof expires);
if (len != sizeof expires)
@@ -400,7 +400,7 @@ tp_button_timeout_handler(void *data)
log_error("timerfd read error: %s\n", strerror(errno));
clock_gettime(CLOCK_MONOTONIC, &ts);
- now = ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
+ now = ts.tv_sec * 1000ULL + ts.tv_nsec / 1000000;
tp_button_handle_timeout(tp, now);
}
@@ -469,7 +469,7 @@ tp_destroy_buttons(struct tp_dispatch *tp)
}
static int
-tp_post_clickfinger_buttons(struct tp_dispatch *tp, uint32_t time)
+tp_post_clickfinger_buttons(struct tp_dispatch *tp, uint64_t time)
{
uint32_t current, old, button;
enum libinput_pointer_button_state state;
@@ -505,7 +505,7 @@ tp_post_clickfinger_buttons(struct tp_dispatch *tp, uint32_t time)
}
static int
-tp_post_physical_buttons(struct tp_dispatch *tp, uint32_t time)
+tp_post_physical_buttons(struct tp_dispatch *tp, uint64_t time)
{
uint32_t current, old, button;
@@ -537,7 +537,7 @@ tp_post_physical_buttons(struct tp_dispatch *tp, uint32_t time)
}
static int
-tp_post_softbutton_buttons(struct tp_dispatch *tp, uint32_t time)
+tp_post_softbutton_buttons(struct tp_dispatch *tp, uint64_t time)
{
uint32_t current, old, button;
enum libinput_pointer_button_state state;
@@ -607,7 +607,7 @@ tp_post_softbutton_buttons(struct tp_dispatch *tp, uint32_t time)
}
int
-tp_post_button_events(struct tp_dispatch *tp, uint32_t time)
+tp_post_button_events(struct tp_dispatch *tp, uint64_t time)
{
if (tp->buttons.is_clickpad) {
if (tp->buttons.use_clickfinger)
diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c
index 863e004..9492849 100644
--- a/src/evdev-mt-touchpad-tap.c
+++ b/src/evdev-mt-touchpad-tap.c
@@ -97,7 +97,7 @@ tap_event_to_str(enum tap_event event) {
static void
tp_tap_notify(struct tp_dispatch *tp,
- uint32_t time,
+ uint64_t time,
int nfingers,
enum libinput_pointer_button_state state)
{
@@ -118,9 +118,9 @@ tp_tap_notify(struct tp_dispatch *tp,
}
static void
-tp_tap_set_timer(struct tp_dispatch *tp, uint32_t time)
+tp_tap_set_timer(struct tp_dispatch *tp, uint64_t time)
{
- uint32_t timeout = time + DEFAULT_TAP_TIMEOUT_PERIOD;
+ uint64_t timeout = time + DEFAULT_TAP_TIMEOUT_PERIOD;
struct itimerspec its;
its.it_interval.tv_sec = 0;
@@ -139,7 +139,7 @@ tp_tap_clear_timer(struct tp_dispatch *tp)
}
static void
-tp_tap_idle_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t time)
+tp_tap_idle_handle_event(struct tp_dispatch *tp, enum tap_event event, uint64_t time)
{
switch (event) {
@@ -160,7 +160,7 @@ tp_tap_idle_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t
}
static void
-tp_tap_touch_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t time)
+tp_tap_touch_handle_event(struct tp_dispatch *tp, enum tap_event event, uint64_t time)
{
switch (event) {
@@ -185,7 +185,7 @@ tp_tap_touch_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t
}
static void
-tp_tap_hold_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t time)
+tp_tap_hold_handle_event(struct tp_dispatch *tp, enum tap_event event, uint64_t time)
{
switch (event) {
@@ -206,7 +206,7 @@ tp_tap_hold_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t
}
static void
-tp_tap_tapped_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t time)
+tp_tap_tapped_handle_event(struct tp_dispatch *tp, enum tap_event event, uint64_t time)
{
switch (event) {
@@ -230,7 +230,7 @@ tp_tap_tapped_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_
}
static void
-tp_tap_touch2_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t time)
+tp_tap_touch2_handle_event(struct tp_dispatch *tp, enum tap_event event, uint64_t time)
{
switch (event) {
@@ -256,7 +256,7 @@ tp_tap_touch2_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_
}
static void
-tp_tap_touch2_hold_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t time)
+tp_tap_touch2_hold_handle_event(struct tp_dispatch *tp, enum tap_event event, uint64_t time)
{
switch (event) {
@@ -278,7 +278,7 @@ tp_tap_touch2_hold_handle_event(struct tp_dispatch *tp, enum tap_event event, ui
}
static void
-tp_tap_touch3_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t time)
+tp_tap_touch3_handle_event(struct tp_dispatch *tp, enum tap_event event, uint64_t time)
{
switch (event) {
@@ -303,7 +303,7 @@ tp_tap_touch3_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_
}
static void
-tp_tap_touch3_hold_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t time)
+tp_tap_touch3_hold_handle_event(struct tp_dispatch *tp, enum tap_event event, uint64_t time)
{
switch (event) {
@@ -324,7 +324,7 @@ tp_tap_touch3_hold_handle_event(struct tp_dispatch *tp, enum tap_event event, ui
}
static void
-tp_tap_dragging_or_doubletap_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t time)
+tp_tap_dragging_or_doubletap_handle_event(struct tp_dispatch *tp, enum tap_event event, uint64_t time)
{
switch (event) {
case TAP_EVENT_TOUCH:
@@ -349,7 +349,7 @@ tp_tap_dragging_or_doubletap_handle_event(struct tp_dispatch *tp, enum tap_event
}
static void
-tp_tap_dragging_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t time)
+tp_tap_dragging_handle_event(struct tp_dispatch *tp, enum tap_event event, uint64_t time)
{
switch (event) {
@@ -372,7 +372,7 @@ tp_tap_dragging_handle_event(struct tp_dispatch *tp, enum tap_event event, uint3
}
static void
-tp_tap_dragging_wait_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t time)
+tp_tap_dragging_wait_handle_event(struct tp_dispatch *tp, enum tap_event event, uint64_t time)
{
switch (event) {
@@ -395,7 +395,7 @@ tp_tap_dragging_wait_handle_event(struct tp_dispatch *tp, enum tap_event event,
}
static void
-tp_tap_dragging2_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t time)
+tp_tap_dragging2_handle_event(struct tp_dispatch *tp, enum tap_event event, uint64_t time)
{
switch (event) {
@@ -418,7 +418,7 @@ tp_tap_dragging2_handle_event(struct tp_dispatch *tp, enum tap_event event, uint
}
static void
-tp_tap_dead_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t time)
+tp_tap_dead_handle_event(struct tp_dispatch *tp, enum tap_event event, uint64_t time)
{
switch (event) {
@@ -435,7 +435,7 @@ tp_tap_dead_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t
}
static void
-tp_tap_handle_event(struct tp_dispatch *tp, enum tap_event event, uint32_t time)
+tp_tap_handle_event(struct tp_dispatch *tp, enum tap_event event, uint64_t time)
{
enum tp_tap_state current;
if (!tp->tap.enabled)
@@ -503,7 +503,7 @@ tp_tap_exceeds_motion_threshold(struct tp_dispatch *tp, struct tp_touch *t)
}
int
-tp_tap_handle_state(struct tp_dispatch *tp, uint32_t time)
+tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time)
{
struct tp_touch *t;
int filter_motion = 0;
@@ -554,7 +554,7 @@ tp_tap_timeout_handler(void *data)
uint64_t expires;
int len;
struct timespec ts;
- uint32_t now;
+ uint64_t now;
len = read(touchpad->tap.timer_fd, &expires, sizeof expires);
if (len != sizeof expires)
@@ -564,13 +564,13 @@ tp_tap_timeout_handler(void *data)
log_error("timerfd read error: %s\n", strerror(errno));
clock_gettime(CLOCK_MONOTONIC, &ts);
- now = ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
+ now = ts.tv_sec * 1000ULL + ts.tv_nsec / 1000000;
tp_tap_handle_timeout(touchpad, now);
}
unsigned int
-tp_tap_handle_timeout(struct tp_dispatch *tp, uint32_t time)
+tp_tap_handle_timeout(struct tp_dispatch *tp, uint64_t time)
{
if (!tp->tap.enabled)
return 0;
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index e7ef357..1ac34da 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -51,7 +51,7 @@ static double
tp_accel_profile(struct motion_filter *filter,
void *data,
double velocity,
- uint32_t time)
+ uint64_t time)
{
struct tp_dispatch *tp =
(struct tp_dispatch *) data;
@@ -80,7 +80,7 @@ tp_motion_history_offset(struct tp_touch *t, int offset)
static void
tp_filter_motion(struct tp_dispatch *tp,
- double *dx, double *dy, uint32_t time)
+ double *dx, double *dy, uint64_t time)
{
struct motion_params motion;
@@ -205,7 +205,7 @@ tp_get_delta(struct tp_touch *t, double *dx, double *dy)
static void
tp_process_absolute(struct tp_dispatch *tp,
const struct input_event *e,
- uint32_t time)
+ uint64_t time)
{
struct tp_touch *t = tp_current_touch(tp);
@@ -237,7 +237,7 @@ tp_process_absolute(struct tp_dispatch *tp,
static void
tp_process_absolute_st(struct tp_dispatch *tp,
const struct input_event *e,
- uint32_t time)
+ uint64_t time)
{
struct tp_touch *t = tp_current_touch(tp);
@@ -260,7 +260,7 @@ tp_process_absolute_st(struct tp_dispatch *tp,
static void
tp_process_fake_touch(struct tp_dispatch *tp,
const struct input_event *e,
- uint32_t time)
+ uint64_t time)
{
struct tp_touch *t;
unsigned int fake_touches;
@@ -308,7 +308,7 @@ tp_process_fake_touch(struct tp_dispatch *tp,
static void
tp_process_key(struct tp_dispatch *tp,
const struct input_event *e,
- uint32_t time)
+ uint64_t time)
{
switch (e->code) {
case BTN_LEFT:
@@ -363,7 +363,7 @@ tp_touch_active(struct tp_dispatch *tp, struct tp_touch *t)
}
static void
-tp_process_state(struct tp_dispatch *tp, uint32_t time)
+tp_process_state(struct tp_dispatch *tp, uint64_t time)
{
struct tp_touch *t;
struct tp_touch *first = tp_get_touch(tp, 0);
@@ -411,7 +411,7 @@ tp_process_state(struct tp_dispatch *tp, uint32_t time)
}
static void
-tp_post_process_state(struct tp_dispatch *tp, uint32_t time)
+tp_post_process_state(struct tp_dispatch *tp, uint64_t time)
{
struct tp_touch *t;
@@ -434,7 +434,7 @@ tp_post_process_state(struct tp_dispatch *tp, uint32_t time)
}
static void
-tp_post_twofinger_scroll(struct tp_dispatch *tp, uint32_t time)
+tp_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time)
{
struct tp_touch *t;
int nchanged = 0;
@@ -493,7 +493,7 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint32_t time)
}
static int
-tp_post_scroll_events(struct tp_dispatch *tp, uint32_t time)
+tp_post_scroll_events(struct tp_dispatch *tp, uint64_t time)
{
struct tp_touch *t;
int nfingers_down = 0;
@@ -529,7 +529,7 @@ tp_post_scroll_events(struct tp_dispatch *tp, uint32_t time)
}
static void
-tp_post_events(struct tp_dispatch *tp, uint32_t time)
+tp_post_events(struct tp_dispatch *tp, uint64_t time)
{
struct tp_touch *t = tp_current_touch(tp);
double dx, dy;
@@ -570,7 +570,7 @@ static void
tp_process(struct evdev_dispatch *dispatch,
struct evdev_device *device,
struct input_event *e,
- uint32_t time)
+ uint64_t time)
{
struct tp_dispatch *tp =
(struct tp_dispatch *)dispatch;
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index 0ede9d0..4f90492 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -97,7 +97,7 @@ struct tp_touch {
bool is_pointer; /* the pointer-controlling touch */
int32_t x;
int32_t y;
- uint32_t millis;
+ uint64_t millis;
struct {
struct tp_motion samples[TOUCHPAD_HISTORY_LENGTH];
@@ -125,7 +125,7 @@ struct tp_touch {
enum button_state state;
/* We use button_event here so we can use == on events */
enum button_event curr;
- uint32_t timeout;
+ uint64_t timeout;
} button;
};
@@ -201,10 +201,10 @@ void
tp_get_delta(struct tp_touch *t, double *dx, double *dy);
int
-tp_tap_handle_state(struct tp_dispatch *tp, uint32_t time);
+tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time);
unsigned int
-tp_tap_handle_timeout(struct tp_dispatch *tp, uint32_t time);
+tp_tap_handle_timeout(struct tp_dispatch *tp, uint64_t time);
int
tp_init_tap(struct tp_dispatch *tp);
@@ -221,13 +221,13 @@ tp_destroy_buttons(struct tp_dispatch *tp);
int
tp_process_button(struct tp_dispatch *tp,
const struct input_event *e,
- uint32_t time);
+ uint64_t time);
int
-tp_post_button_events(struct tp_dispatch *tp, uint32_t time);
+tp_post_button_events(struct tp_dispatch *tp, uint64_t time);
int
-tp_button_handle_state(struct tp_dispatch *tp, uint32_t time);
+tp_button_handle_state(struct tp_dispatch *tp, uint64_t time);
int
tp_button_touch_active(struct tp_dispatch *tp, struct tp_touch *t);
diff --git a/src/evdev-touchpad.c b/src/evdev-touchpad.c
index 1a48441..18b6353 100644
--- a/src/evdev-touchpad.c
+++ b/src/evdev-touchpad.c
@@ -211,7 +211,7 @@ static double
touchpad_profile(struct motion_filter *filter,
void *data,
double velocity,
- uint32_t time)
+ uint64_t time)
{
struct touchpad_dispatch *touchpad =
(struct touchpad_dispatch *) data;
@@ -273,7 +273,7 @@ touchpad_get_delta(struct touchpad_dispatch *touchpad, double *dx, double *dy)
static void
filter_motion(struct touchpad_dispatch *touchpad,
- double *dx, double *dy, uint32_t time)
+ double *dx, double *dy, uint64_t time)
{
struct motion_params motion;
@@ -287,7 +287,7 @@ filter_motion(struct touchpad_dispatch *touchpad,
}
static void
-notify_button_pressed(struct touchpad_dispatch *touchpad, uint32_t time)
+notify_button_pressed(struct touchpad_dispatch *touchpad, uint64_t time)
{
pointer_notify_button(
&touchpad->device->base,
@@ -297,7 +297,7 @@ notify_button_pressed(struct touchpad_dispatch *touchpad, uint32_t time)
}
static void
-notify_button_released(struct touchpad_dispatch *touchpad, uint32_t time)
+notify_button_released(struct touchpad_dispatch *touchpad, uint64_t time)
{
pointer_notify_button(
&touchpad->device->base,
@@ -307,16 +307,16 @@ notify_button_released(struct touchpad_dispatch *touchpad, uint32_t time)
}
static void
-notify_tap(struct touchpad_dispatch *touchpad, uint32_t time)
+notify_tap(struct touchpad_dispatch *touchpad, uint64_t time)
{
notify_button_pressed(touchpad, time);
notify_button_released(touchpad, time);
}
static void
-process_fsm_events(struct touchpad_dispatch *touchpad, uint32_t time)
+process_fsm_events(struct touchpad_dispatch *touchpad, uint64_t time)
{
- uint32_t timeout = UINT32_MAX;
+ uint64_t timeout = UINT64_MAX;
enum fsm_event event;
unsigned int i;
@@ -398,7 +398,7 @@ process_fsm_events(struct touchpad_dispatch *touchpad, uint32_t time)
}
}
- if (timeout != UINT32_MAX) {
+ if (timeout != UINT64_MAX) {
struct itimerspec its;
its.it_interval.tv_sec = 0;
@@ -447,7 +447,7 @@ fsm_timeout_handler(void *data)
uint64_t expires;
int len;
struct timespec ts;
- uint32_t now;
+ uint64_t now;
len = read(touchpad->fsm.timer.fd, &expires, sizeof expires);
if (len != sizeof expires)
@@ -458,7 +458,7 @@ fsm_timeout_handler(void *data)
if (touchpad->fsm.events_count == 0) {
clock_gettime(CLOCK_MONOTONIC, &ts);
- now = ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
+ now = ts.tv_sec * 1000ULL + ts.tv_nsec / 1000000;
push_fsm_event(touchpad, FSM_EVENT_TIMEOUT);
process_fsm_events(touchpad, now);
@@ -466,7 +466,7 @@ fsm_timeout_handler(void *data)
}
static void
-touchpad_update_state(struct touchpad_dispatch *touchpad, uint32_t time)
+touchpad_update_state(struct touchpad_dispatch *touchpad, uint64_t time)
{
int motion_index;
int center_x, center_y;
@@ -618,7 +618,7 @@ static inline void
process_key(struct touchpad_dispatch *touchpad,
struct evdev_device *device,
struct input_event *e,
- uint32_t time)
+ uint64_t time)
{
uint32_t code;
@@ -685,7 +685,7 @@ static void
touchpad_process(struct evdev_dispatch *dispatch,
struct evdev_device *device,
struct input_event *e,
- uint32_t time)
+ uint64_t time)
{
struct touchpad_dispatch *touchpad =
(struct touchpad_dispatch *) dispatch;
diff --git a/src/evdev.c b/src/evdev.c
index 901b310..a1980be 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -106,7 +106,7 @@ evdev_device_transform_y(struct evdev_device *device,
}
static void
-evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
+evdev_flush_pending_event(struct evdev_device *device, uint64_t time)
{
int32_t cx, cy;
li_fixed_t x, y;
@@ -283,7 +283,7 @@ evdev_process_key(struct evdev_device *device, struct input_event *e, int time)
static void
evdev_process_touch(struct evdev_device *device,
struct input_event *e,
- uint32_t time)
+ uint64_t time)
{
switch (e->code) {
case ABS_MT_SLOT:
@@ -332,7 +332,7 @@ evdev_process_absolute_motion(struct evdev_device *device,
static inline void
evdev_process_relative(struct evdev_device *device,
- struct input_event *e, uint32_t time)
+ struct input_event *e, uint64_t time)
{
struct libinput_device *base = &device->base;
@@ -380,7 +380,7 @@ evdev_process_relative(struct evdev_device *device,
static inline void
evdev_process_absolute(struct evdev_device *device,
struct input_event *e,
- uint32_t time)
+ uint64_t time)
{
if (device->is_mt) {
evdev_process_touch(device, e, time);
@@ -415,7 +415,7 @@ static void
fallback_process(struct evdev_dispatch *dispatch,
struct evdev_device *device,
struct input_event *event,
- uint32_t time)
+ uint64_t time)
{
int need_frame = 0;
@@ -465,7 +465,7 @@ static inline void
evdev_process_event(struct evdev_device *device, struct input_event *e)
{
struct evdev_dispatch *dispatch = device->dispatch;
- uint32_t time = e->time.tv_sec * 1000 + e->time.tv_usec / 1000;
+ uint64_t time = e->time.tv_sec * 1000ULL + e->time.tv_usec / 1000;
dispatch->interface->process(dispatch, device, e, time);
}
diff --git a/src/evdev.h b/src/evdev.h
index 0ab9572..d540eba 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -100,7 +100,7 @@ struct evdev_dispatch_interface {
void (*process)(struct evdev_dispatch *dispatch,
struct evdev_device *device,
struct input_event *event,
- uint32_t time);
+ uint64_t time);
/* Destroy an event dispatch handler and free all its resources. */
void (*destroy)(struct evdev_dispatch *dispatch);
diff --git a/src/filter.c b/src/filter.c
index 397e0f6..2b1a675 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -32,7 +32,7 @@
void
filter_dispatch(struct motion_filter *filter,
struct motion_params *motion,
- void *data, uint32_t time)
+ void *data, uint64_t time)
{
filter->interface->filter(filter, motion, data, time);
}
@@ -48,7 +48,7 @@ filter_dispatch(struct motion_filter *filter,
struct pointer_tracker {
double dx;
double dy;
- uint32_t time;
+ uint64_t time;
int dir;
};
@@ -128,7 +128,7 @@ get_direction(int dx, int dy)
static void
feed_trackers(struct pointer_accelerator *accel,
double dx, double dy,
- uint32_t time)
+ uint64_t time)
{
int i, current;
struct pointer_tracker *trackers = accel->trackers;
@@ -157,7 +157,7 @@ tracker_by_offset(struct pointer_accelerator *accel, unsigned int offset)
}
static double
-calculate_tracker_velocity(struct pointer_tracker *tracker, uint32_t time)
+calculate_tracker_velocity(struct pointer_tracker *tracker, uint64_t time)
{
int dx;
int dy;
@@ -170,7 +170,7 @@ calculate_tracker_velocity(struct pointer_tracker *tracker, uint32_t time)
}
static double
-calculate_velocity(struct pointer_accelerator *accel, uint32_t time)
+calculate_velocity(struct pointer_accelerator *accel, uint64_t time)
{
struct pointer_tracker *tracker;
double velocity;
@@ -224,14 +224,14 @@ calculate_velocity(struct pointer_accelerator *accel, uint32_t time)
static double
acceleration_profile(struct pointer_accelerator *accel,
- void *data, double velocity, uint32_t time)
+ void *data, double velocity, uint64_t time)
{
return accel->profile(&accel->base, data, velocity, time);
}
static double
calculate_acceleration(struct pointer_accelerator *accel,
- void *data, double velocity, uint32_t time)
+ void *data, double velocity, uint64_t time)
{
double factor;
@@ -273,7 +273,7 @@ apply_softening(struct pointer_accelerator *accel,
static void
accelerator_filter(struct motion_filter *filter,
struct motion_params *motion,
- void *data, uint32_t time)
+ void *data, uint64_t time)
{
struct pointer_accelerator *accel =
(struct pointer_accelerator *) filter;
diff --git a/src/filter.h b/src/filter.h
index 6b2a1d2..0ef3d03 100644
--- a/src/filter.h
+++ b/src/filter.h
@@ -34,13 +34,13 @@ struct motion_filter;
void
filter_dispatch(struct motion_filter *filter,
struct motion_params *motion,
- void *data, uint32_t time);
+ void *data, uint64_t time);
struct motion_filter_interface {
void (*filter)(struct motion_filter *filter,
struct motion_params *motion,
- void *data, uint32_t time);
+ void *data, uint64_t time);
void (*destroy)(struct motion_filter *filter);
};
@@ -54,7 +54,7 @@ create_linear_acceleration_filter(double speed);
typedef double (*accel_profile_func_t)(struct motion_filter *filter,
void *data,
double velocity,
- uint32_t time);
+ uint64_t time);
struct motion_filter *
create_pointer_accelator_filter(accel_profile_func_t filter);
--
1.9.0
More information about the wayland-devel
mailing list