aboutsummaryrefslogtreecommitdiff
path: root/rootston/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'rootston/input.c')
-rw-r--r--rootston/input.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/rootston/input.c b/rootston/input.c
index 84b5acae..b7a5f1ba 100644
--- a/rootston/input.c
+++ b/rootston/input.c
@@ -1,5 +1,7 @@
+#define _POSIX_C_SOURCE 200112L
#include <assert.h>
#include <stdlib.h>
+#include <time.h>
#include <wayland-server.h>
#include <wlr/backend/libinput.h>
#include <wlr/config.h>
@@ -126,3 +128,16 @@ bool input_view_has_focus(struct roots_input *input, struct roots_view *view) {
return false;
}
+
+static inline int64_t timespec_to_msec(const struct timespec *a) {
+ return (int64_t)a->tv_sec * 1000 + a->tv_nsec / 1000000;
+}
+
+void input_update_cursor_focus(struct roots_input *input) {
+ struct roots_seat *seat;
+ struct timespec now;
+ wl_list_for_each(seat, &input->seats, link) {
+ clock_gettime(CLOCK_MONOTONIC, &now);
+ roots_cursor_update_position(seat->cursor, timespec_to_msec(&now));
+ }
+}