summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmre Ucan <eucan@de.adit-jv.com>2018-04-10 09:54:28 +0200
committerEmre Ucan <eucan@de.adit-jv.com>2018-04-10 10:39:16 +0200
commitad0b32a6ef84bc1e5198a14178c3f892b12202bc (patch)
tree4697bcc0a725caf6d3e50f5fad1402be7becbaf2
parent39fd1f7d825904f6821891916c4a4ef231ba97e4 (diff)
downloadwayland-ivi-extension-ad0b32a6ef84bc1e5198a14178c3f892b12202bc.tar.gz
ivi-controller: add timespec_to_msec inline function
In weston 4.0, input grab functions are using timespec structs for time information instead of integers. Therefore, we have to convert them. Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
-rw-r--r--weston-ivi-shell/src/ivi-controller.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/weston-ivi-shell/src/ivi-controller.h b/weston-ivi-shell/src/ivi-controller.h
index 7c82fc4..fe82597 100644
--- a/weston-ivi-shell/src/ivi-controller.h
+++ b/weston-ivi-shell/src/ivi-controller.h
@@ -26,6 +26,19 @@
#include "ivi-wm-server-protocol.h"
#include <weston/ivi-layout-export.h>
+/* Convert timespec to milliseconds
+ *
+ * \param a timespec
+ * \return milliseconds
+ *
+ * Rounding to integer milliseconds happens always down (floor()).
+ */
+static inline int64_t
+timespec_to_msec(const struct timespec *a)
+{
+ return (int64_t)a->tv_sec * 1000 + a->tv_nsec / 1000000;
+}
+
struct ivisurface {
struct wl_list link;
struct ivishell *shell;