[PATCH libinput v3 17/17] Change internal timestamps to uint64_t to properly deal with wrapping
Hans de Goede
hdegoede at redhat.com
Tue May 20 07:35:05 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>
Reviewed-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 75e1ff7..9f2d7f9 100644
--- a/src/evdev-mt-touchpad-buttons.c
+++ b/src/evdev-mt-touchpad-buttons.c
@@ -95,7 +95,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;
@@ -286,7 +286,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;
@@ -316,7 +316,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;
@@ -344,7 +344,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;
@@ -359,7 +359,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);
@@ -387,7 +387,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)
@@ -397,7 +397,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);
}
@@ -467,7 +467,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;
@@ -503,7 +503,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;
@@ -535,7 +535,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;
@@ -605,7 +605,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 bcc5700..eee334f 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 05c622b..99a9391 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;
@@ -206,7 +206,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);
@@ -238,7 +238,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);
@@ -261,7 +261,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;
@@ -309,7 +309,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:
@@ -380,7 +380,7 @@ void tp_set_pointer(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);
@@ -414,7 +414,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;
@@ -437,7 +437,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;
@@ -496,7 +496,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;
@@ -532,7 +532,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;
@@ -573,7 +573,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 41f9daf..41e3ca4 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;
};
@@ -204,10 +204,10 @@ void
tp_set_pointer(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);
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);
@@ -224,13 +224,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 57dcca7..08a18fd 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -110,7 +110,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;
@@ -309,7 +309,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:
@@ -358,7 +358,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;
@@ -406,7 +406,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);
@@ -441,7 +441,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;
@@ -491,7 +491,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 36daf3c..bb88074 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -101,7 +101,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