Skip to content

Commit a4eff3d

Browse files
committed
Linux might be impossible for wayland as it doesn't like showing window data
1 parent 80c1d59 commit a4eff3d

File tree

2 files changed

+29
-28
lines changed

2 files changed

+29
-28
lines changed

src/linux/linux_test.c

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,48 @@
22
#include <linux/uinput.h>
33
#include <unistd.h>
44
#include <fcntl.h>
5+
#include <stdio.h>
56

67
void emit (int fd, int type, int code, int val) {
7-
struct input_event ie;
8+
struct input_event ie;
89

9-
ie.type = type;
10-
ie.code = code;
11-
ie.value = val;
12-
ie.time.tv_sec = 0;
13-
ie.time.tv_usec = 0;
10+
ie.type = type;
11+
ie.code = code;
12+
ie.value = val;
13+
ie.time.tv_sec = 0;
14+
ie.time.tv_usec = 0;
1415

15-
write(fd, & ie, sizeof(ie));
16+
write(fd, &ie, sizeof(ie));
1617
}
1718

18-
int linux_main (void) {
19-
struct uinput_setup usetup;
19+
int main (void) {
20+
struct uinput_setup usetup;
2021

21-
int fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK);
22+
int fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK);
2223

23-
ioctl(fd, UI_SET_EVBIT, EV_KEY);
24-
ioctl(fd, UI_SET_KEYBIT, KEY_SPACE);
24+
ioctl(fd, UI_SET_EVBIT, EV_KEY);
25+
ioctl(fd, UI_SET_KEYBIT, KEY_SPACE);
2526

26-
memset(& usetup, 0, sizeof(usetup));
27-
usetup.id.bustype = BUS_USB;
28-
usetup.id.vendor = 0x1234;
29-
usetup.id.product = 0x5678;
30-
strcpy(usetup.name, "Example Device");
27+
memset(&usetup, 0, sizeof(usetup));
28+
usetup.id.bustype = BUS_USB;
29+
usetup.id.vendor = 0x1234;
30+
usetup.id.product = 0x5678;
31+
strcpy(usetup.name, "Example device");
3132

32-
ioctl(fd, UI_DEV_SETUP, & usetup);
33-
ioctl(fd, UI_DEV_CREATE);
33+
ioctl(fd, UI_DEV_SETUP, &usetup);
34+
ioctl(fd, UI_DEV_CREATE);
3435

35-
sleep(1);
36+
sleep(1);
3637

37-
emit(fd, EV_KEY, KEY_SPACE, 1);
38-
emit(fd, EV_SYN, SYN_REPORT, 0);
39-
emit(fd, EV_KEY, KEY_SPACE, 0);
40-
emit(fd, EV_SYN, SYN_REPORT, 0);
38+
emit(fd, EV_KEY, KEY_SPACE, 1);
39+
emit(fd, EV_SYN, SYN_REPORT, 0);
40+
emit(fd, EV_KEY, KEY_SPACE, 0);
41+
emit(fd, EV_SYN, SYN_REPORT, 0);
4142

42-
sleep(1);
43+
sleep(1);
4344

44-
ioctl(fd, UI_DEV_DESTROY);
45+
ioctl(fd, UI_DEV_DESTROY);
46+
close(fd);
4547

46-
close(fd);
47-
return 0;
48+
return 0;
4849
}

src/linux/linux_test_2.cpp

Whitespace-only changes.

0 commit comments

Comments
 (0)