fix(inject): fix compilation warnings

This commit is contained in:
Federico Terzi 2021-03-28 18:35:50 +02:00
parent 1f0fe74ac1
commit e29dbfc9d5
2 changed files with 10 additions and 9 deletions

View File

@ -38,7 +38,7 @@ fn cc_config() {
println!("cargo:rerun-if-changed=src/evdev/native.h"); println!("cargo:rerun-if-changed=src/evdev/native.h");
println!("cargo:rerun-if-changed=src/evdev/native.c"); println!("cargo:rerun-if-changed=src/evdev/native.c");
cc::Build::new() cc::Build::new()
.include("src/evdev/native.h") .include("src/evdev")
.file("src/evdev/native.c") .file("src/evdev/native.c")
.compile("espansoinjectev"); .compile("espansoinjectev");

View File

@ -19,6 +19,7 @@
#include "native.h" #include "native.h"
#include <linux/uinput.h> #include <linux/uinput.h>
#include <unistd.h>
#include <memory.h> #include <memory.h>
unsigned long ui_dev_destroy() unsigned long ui_dev_destroy()
@ -56,15 +57,15 @@ int setup_uinput_device(int fd)
void emit(int fd, int type, int code, int val) void emit(int fd, int type, int code, int val)
{ {
struct input_event ie; struct input_event ie;
ie.type = type; ie.type = type;
ie.code = code; ie.code = code;
ie.value = val; ie.value = val;
// timestamp values below are ignored // timestamp values below are ignored
ie.time.tv_sec = 0; ie.time.tv_sec = 0;
ie.time.tv_usec = 0; ie.time.tv_usec = 0;
write(fd, &ie, sizeof(ie)); write(fd, &ie, sizeof(ie));
} }
void uinput_emit(int fd, unsigned int code, int pressed) { void uinput_emit(int fd, unsigned int code, int pressed) {