summaryrefslogtreecommitdiff
path: root/src/evdev-mt-touchpad-buttons.c
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2015-07-27 17:51:52 +0800
committerJonas Ådahl <jadahl@gmail.com>2015-07-28 17:42:32 +0800
commitaa5f55149b23ef2a0ebea097ba5e480e39c57054 (patch)
treed50eea2fbc461a32deba19d885d2a9b26243918b /src/evdev-mt-touchpad-buttons.c
parent98346f6a1aa690a8465d64107792b81c2b1cb7ea (diff)
downloadlibinput-aa5f55149b23ef2a0ebea097ba5e480e39c57054.tar.gz
Change to micro seconds for measuring time internally
In order to provide higher precision event time stamps, change the internal time measuring from milliseconds to microseconds. Microseconds are chosen because it is the most fine grained time stamp we can get from evdev. The API is extended with high precision getters whenever the given information is available. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src/evdev-mt-touchpad-buttons.c')
-rw-r--r--src/evdev-mt-touchpad-buttons.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
index f16d1b87..8822e08c 100644
--- a/src/evdev-mt-touchpad-buttons.c
+++ b/src/evdev-mt-touchpad-buttons.c
@@ -32,8 +32,8 @@
#include "evdev-mt-touchpad.h"
-#define DEFAULT_BUTTON_ENTER_TIMEOUT 100 /* ms */
-#define DEFAULT_BUTTON_LEAVE_TIMEOUT 300 /* ms */
+#define DEFAULT_BUTTON_ENTER_TIMEOUT ms2us(100)
+#define DEFAULT_BUTTON_LEAVE_TIMEOUT ms2us(300)
/*****************************************
* BEFORE YOU EDIT THIS FILE, look at the state diagram in
@@ -913,8 +913,8 @@ tp_notify_clickpadbutton(struct tp_dispatch *tp,
struct evdev_dispatch *dispatch = tp->buttons.trackpoint->dispatch;
struct input_event event;
- event.time.tv_sec = time/1000;
- event.time.tv_usec = (time % 1000) * 1000;
+ event.time.tv_sec = time / ms2us(1000);
+ event.time.tv_usec = time % ms2us(1000);
event.type = EV_KEY;
event.code = button;
event.value = (state == LIBINPUT_BUTTON_STATE_PRESSED) ? 1 : 0;