diff --git a/.gitignore b/.gitignore index cbaca32..5695fcc 100644 --- a/.gitignore +++ b/.gitignore @@ -10,5 +10,4 @@ # Rust /Cargo.lock /rust-polytreewm/Cargo.lock -/rust-winproto/Cargo.lock /target/ diff --git a/Cargo.toml b/Cargo.toml index b7ed957..72d75ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,4 @@ [workspace] members = [ "rust-polytreewm", - "rust-winproto", ] diff --git a/Makefile b/Makefile index 1088f1e..a57cacb 100644 --- a/Makefile +++ b/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 # ######### diff --git a/rust-polytreewm/Cargo.toml b/rust-polytreewm/Cargo.toml index 101c0c2..8c1406c 100644 --- a/rust-polytreewm/Cargo.toml +++ b/rust-polytreewm/Cargo.toml @@ -20,3 +20,4 @@ crate-type = ["staticlib"] ctor = "0.1.23" env_logger = "0.9.0" log = "0.4.17" +x11 = "2.20.0" diff --git a/rust-polytreewm/src/lib.rs b/rust-polytreewm/src/lib.rs index 62f0b75..6994c5d 100644 --- a/rust-polytreewm/src/lib.rs +++ b/rust-polytreewm/src/lib.rs @@ -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; diff --git a/rust-winproto/src/lib.rs b/rust-polytreewm/src/xbase.rs similarity index 70% rename from rust-winproto/src/lib.rs rename to rust-polytreewm/src/xbase.rs index 8c2970d..8514ae8 100644 --- a/rust-winproto/src/lib.rs +++ b/rust-polytreewm/src/xbase.rs @@ -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> { + pub fn new( + program_title: String, + ) -> Result> { 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, + }) } } } diff --git a/rust-winproto/Cargo.toml b/rust-winproto/Cargo.toml deleted file mode 100644 index 06b6880..0000000 --- a/rust-winproto/Cargo.toml +++ /dev/null @@ -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"