summaryrefslogtreecommitdiff
path: root/user/x11vnc/time64.patch
blob: 663684716f8cbdfe0a925f3e2a44d6be9db084d0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
--- x11vnc-0.9.16/src/uinput.c.old	2019-01-05 13:22:11.000000000 +0000
+++ x11vnc-0.9.16/src/uinput.c	2020-01-24 04:49:39.479206612 +0000
@@ -710,6 +710,7 @@
 static void ptr_move(int dx, int dy) {
 #ifdef UINPUT_OK
 	struct input_event ev;
+	struct timeval tv;
 	int d = direct_rel_fd < 0 ? fd : direct_rel_fd;
 
 	if (injectable && strchr(injectable, 'M') == NULL) {
@@ -720,7 +721,9 @@
 
 	if (db) fprintf(stderr, "ptr_move(%d, %d) fd=%d\n", dx, dy, d);
 
-	gettimeofday(&ev.time, NULL);
+	gettimeofday(&tv, NULL);
+	ev.input_event_sec = tv.tv_sec;
+	ev.input_event_usec = tv.tv_usec;
 	ev.type = EV_REL;
 	ev.code = REL_Y;
 	ev.value = dy;
@@ -755,6 +758,7 @@
 static void ptr_abs(int x, int y, int p) {
 #ifdef UINPUT_OK
 	struct input_event ev;
+	struct timeval tv;
 	int x0, y0;
 	int d = direct_abs_fd < 0 ? fd : direct_abs_fd;
 
@@ -773,7 +777,9 @@
 
 	if (db) fprintf(stderr, "ptr_abs(%d, %d => %d %d, p=%d) fd=%d\n", x0, y0, x, y, p, d);
 
-	gettimeofday(&ev.time, NULL);
+	gettimeofday(&tv, NULL);
+	ev.input_event_sec = tv.tv_sec;
+	ev.input_event_usec = tv.tv_usec;
 	ev.type = EV_ABS;
 	ev.code = ABS_Y;
 	ev.value = y;
@@ -950,6 +956,7 @@
 static void button_click(int down, int btn) {
 #ifdef UINPUT_OK
 	struct input_event ev;
+	struct timeval tv;
 	int d = direct_btn_fd < 0 ? fd : direct_btn_fd;
 
 	if (injectable && strchr(injectable, 'B') == NULL) {
@@ -959,7 +966,9 @@
 	if (db) fprintf(stderr, "button_click: btn %d %s fd=%d\n", btn, down ? "down" : "up", d);
 
 	memset(&ev, 0, sizeof(ev));
-	gettimeofday(&ev.time, NULL);
+	gettimeofday(&tv, NULL);
+	ev.input_event_sec = tv.tv_sec;
+	ev.input_event_usec = tv.tv_usec;
 	ev.type = EV_KEY;
 	ev.value = down;
 
@@ -1230,6 +1239,7 @@
 void uinput_key_command(int down, int keysym, rfbClientPtr client) {
 #ifdef UINPUT_OK
 	struct input_event ev;
+	struct timeval tv;
 	int scancode;
 	allowed_input_t input;
 	int d = direct_key_fd < 0 ? fd : direct_key_fd;
@@ -1253,7 +1263,9 @@
 	if (db) fprintf(stderr, "uinput_key_command: %d -> %d %s fd=%d\n", keysym, scancode, down ? "down" : "up", d);
 
 	memset(&ev, 0, sizeof(ev));
-	gettimeofday(&ev.time, NULL);
+	gettimeofday(&tv, NULL);
+	ev.input_event_sec = tv.tv_sec;
+	ev.input_event_usec = tv.tv_usec;
 	ev.type = EV_KEY;
 	ev.code = (unsigned char) scancode;
 	ev.value = down;