From 601e01de1085356f61de8337c05b685f4f70c28d Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sun, 28 Jan 2024 11:25:29 +0100 Subject: [PATCH 2/7] Fix build on 32bit arches with 64bit time_t time element is deprecated on new input_event structure in kernel's input.h [1] [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=152194fe9c3f --- plugins/UInput/uinput.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plugins/UInput/uinput.cpp b/plugins/UInput/uinput.cpp index e80db50d1..65034ae83 100644 --- a/plugins/UInput/uinput.cpp +++ b/plugins/UInput/uinput.cpp @@ -108,8 +108,11 @@ void UInput::removeMouse() void UInput::moveMouse(int dx, int dy) { struct input_event event; + struct timespec time; memset(&event, 0, sizeof(event)); - clock_gettime(CLOCK_MONOTONIC, (timespec*)&event.time); + clock_gettime(CLOCK_MONOTONIC, &time); + event.input_event_sec = time.tv_sec; + event.input_event_usec = time.tv_nsec / 1000; event.type = EV_REL; event.code = REL_X; event.value = dx; @@ -138,8 +141,11 @@ void UInput::releaseMouse(Button button) void UInput::scrollMouse(int dh, int dv) { struct input_event event; + struct timespec time; memset(&event, 0, sizeof(event)); - clock_gettime(CLOCK_MONOTONIC, (timespec*)&event.time); + clock_gettime(CLOCK_MONOTONIC, &time); + event.input_event_sec = time.tv_sec; + event.input_event_usec = time.tv_nsec / 1000; event.type = EV_REL; event.code = REL_HWHEEL; event.value = dh; @@ -158,8 +164,11 @@ void UInput::scrollMouse(int dh, int dv) void UInput::injectMouse(Button button, int down) { struct input_event event; + struct timespec time; memset(&event, 0, sizeof(event)); - clock_gettime(CLOCK_MONOTONIC, (timespec*)&event.time); + clock_gettime(CLOCK_MONOTONIC, &time); + event.input_event_sec = time.tv_sec; + event.input_event_usec = time.tv_nsec / 1000; event.type = EV_KEY; switch (button) { case ButtonLeft: -- 2.43.0