Merge Rust creates
This commit is contained in:
parent
2fbe9f00d0
commit
ff9dabe3cd
7 changed files with 15 additions and 26 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -10,5 +10,4 @@
|
|||
# Rust
|
||||
/Cargo.lock
|
||||
/rust-polytreewm/Cargo.lock
|
||||
/rust-winproto/Cargo.lock
|
||||
/target/
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
[workspace]
|
||||
members = [
|
||||
"rust-polytreewm",
|
||||
"rust-winproto",
|
||||
]
|
||||
|
|
11
Makefile
11
Makefile
|
@ -19,10 +19,6 @@ RUST_SRC = \
|
|||
rust-polytreewm/src/*.rs \
|
||||
rust-polytreewm/src/**/*.rs
|
||||
|
||||
RUST_WINPROTO_SRC = \
|
||||
rust-winproto/Cargo.toml \
|
||||
rust-winproto/src/*.rs
|
||||
|
||||
RUST_APIS = src/constraints.h src/geom.h src/helpers.h src/settings.h
|
||||
|
||||
MODULES_SRC = \
|
||||
|
@ -67,10 +63,10 @@ ALL_EXE = polytreewm $(TEST_EXE)
|
|||
# Executables #
|
||||
###############
|
||||
|
||||
polytreewm: src/main.o $(MODULES_OBJ) target/debug/libpolytreewm.a target/debug/libwinproto.a
|
||||
polytreewm: src/main.o $(MODULES_OBJ) target/debug/libpolytreewm.a
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
%.test: %.o tests/main.o $(MODULES_OBJ) target/debug/libpolytreewm.a target/debug/libwinproto.a
|
||||
%.test: %.o tests/main.o $(MODULES_OBJ) target/debug/libpolytreewm.a
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
################
|
||||
|
@ -85,9 +81,6 @@ dwm.o: $(DWM_SRC) $(DWM_HDR)
|
|||
target/debug/libpolytreewm.a: $(RUST_SRC)
|
||||
$(CARGO) build
|
||||
|
||||
target/debug/libwinproto.a: $(RUST_WINPROTO_SRC)
|
||||
$(CARGO) build
|
||||
|
||||
#########
|
||||
# Tasks #
|
||||
#########
|
||||
|
|
|
@ -20,3 +20,4 @@ crate-type = ["staticlib"]
|
|||
ctor = "0.1.23"
|
||||
env_logger = "0.9.0"
|
||||
log = "0.4.17"
|
||||
x11 = "2.20.0"
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
mod api;
|
||||
mod constraints;
|
||||
mod xbase;
|
||||
|
||||
pub mod geom;
|
||||
pub mod settings;
|
||||
pub mod unit;
|
||||
|
||||
pub use settings::Settings;
|
||||
pub use xbase::Xbase;
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::ptr::null;
|
|||
|
||||
use x11::xlib::{self, Display};
|
||||
|
||||
struct Xbase {
|
||||
pub struct Xbase {
|
||||
program_title: String,
|
||||
x_display: *mut Display,
|
||||
x_screen: c_int,
|
||||
|
@ -11,7 +11,9 @@ struct Xbase {
|
|||
}
|
||||
|
||||
impl Xbase {
|
||||
fn new(program_title: String) -> Result<Self, Box<dyn std::error::Error>> {
|
||||
pub fn new(
|
||||
program_title: String,
|
||||
) -> Result<Self, Box<dyn std::error::Error>> {
|
||||
unsafe {
|
||||
if xlib::XSupportsLocale() == 0 {
|
||||
return Err("no locale support in X".into());
|
||||
|
@ -25,7 +27,12 @@ impl Xbase {
|
|||
let x_screen = xlib::XDefaultScreen(x_display);
|
||||
let x_root = xlib::XRootWindow(x_display, x_screen);
|
||||
|
||||
Ok(Self { program_title, x_display, x_screen, x_root })
|
||||
Ok(Self {
|
||||
program_title,
|
||||
x_display,
|
||||
x_screen,
|
||||
x_root,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
[package]
|
||||
name = "winproto"
|
||||
version = "0.0.0"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
name = "winproto"
|
||||
crate-type = ["staticlib"]
|
||||
|
||||
[dependencies]
|
||||
x11 = "2.20.0"
|
Loading…
Reference in a new issue