summaryrefslogtreecommitdiff
path: root/src/evdev-mt-touchpad.h
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2014-04-08 12:29:45 +0200
committerHans de Goede <hdegoede@redhat.com>2014-05-22 14:51:41 +0200
commit89165da6d6b90d466edf3283b710c0931bdcc8dd (patch)
tree35ec258a54fa45da2637cda0f144f3100e8ff08a /src/evdev-mt-touchpad.h
parented6ccad449fe07494616e5bf362670907fbbcc8a (diff)
downloadlibinput-89165da6d6b90d466edf3283b710c0931bdcc8dd.tar.gz
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>
Diffstat (limited to 'src/evdev-mt-touchpad.h')
-rw-r--r--src/evdev-mt-touchpad.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index 41f9daf7..41e3ca43 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);