mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-03 18:10:28 +01:00
Change internal timestamps to uint64_t to properly deal with wrapping
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@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
ed6ccad449
commit
89165da6d6
9 changed files with 82 additions and 82 deletions
|
|
@ -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);
|
||||
|
||||
|
|
@ -388,7 +388,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)
|
||||
|
|
@ -398,7 +398,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);
|
||||
}
|
||||
|
|
@ -468,7 +468,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;
|
||||
|
|
@ -504,7 +504,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;
|
||||
|
||||
|
|
@ -536,7 +536,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;
|
||||
|
|
@ -606,7 +606,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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
@ -381,7 +381,7 @@ 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);
|
||||
|
|
@ -415,7 +415,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;
|
||||
|
||||
|
|
@ -438,7 +438,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;
|
||||
|
|
@ -497,7 +497,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;
|
||||
|
|
@ -533,7 +533,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;
|
||||
|
|
@ -574,7 +574,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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
12
src/evdev.c
12
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
16
src/filter.c
16
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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue