all: inherit metadeta from cargo workspace
This commit is contained in:
parent
1c21bd1259
commit
d920e554cf
52 changed files with 328 additions and 320 deletions
|
|
@ -1,12 +1,12 @@
|
|||
[package]
|
||||
name = "jay-libinput"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
license = "GPL-3.0-only"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
jay-utils = { version = "0.1.0", path = "../utils" }
|
||||
jay-utils = { path = "../utils" }
|
||||
|
||||
bstr = { version = "1.9.0", default-features = false, features = ["std"] }
|
||||
isnt = "0.2.0"
|
||||
|
|
@ -17,4 +17,5 @@ uapi = "0.2.13"
|
|||
|
||||
[build-dependencies]
|
||||
anyhow = "1.0.79"
|
||||
cc = "1.0.86"
|
||||
repc = "0.1.1"
|
||||
|
|
|
|||
|
|
@ -74,6 +74,11 @@ fn write_ty<W: Write>(f: &mut W, vals: &[i32], ty: &str) -> anyhow::Result<()> {
|
|||
}
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
println!("cargo:rerun-if-changed=src/bridge.c");
|
||||
cc::Build::new()
|
||||
.file("src/bridge.c")
|
||||
.compile("jay-libinput-bridge");
|
||||
|
||||
let mut f = open("libinput_tys.rs")?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
|
|
|
|||
32
crates/libinput/src/bridge.c
Normal file
32
crates/libinput/src/bridge.c
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static char *fmt(const char *format, va_list args) {
|
||||
char *line;
|
||||
int ret = vasprintf(&line, format, args);
|
||||
if (ret < 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return line;
|
||||
}
|
||||
}
|
||||
|
||||
void jay_libinput_log_handler(
|
||||
void *libinput,
|
||||
int priority,
|
||||
const char *line
|
||||
);
|
||||
|
||||
void jay_libinput_log_handler_bridge(
|
||||
void *libinput,
|
||||
int priority,
|
||||
const char *format,
|
||||
va_list args
|
||||
) {
|
||||
char *line = fmt(format, args);
|
||||
jay_libinput_log_handler(libinput, priority, line);
|
||||
free(line);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue