From a7fab79fa1de88d1b5f1cb8575d8b91e1410667c Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Mon, 31 Jul 2023 15:29:41 +0200 Subject: [PATCH] wip --- Cargo.lock | 154 +++++++++++++++++++++++++++------- Cargo.toml | 6 +- src/frame/capturer/wlroots.rs | 14 ++-- 3 files changed, 133 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8603a92..3844d3f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -165,7 +165,7 @@ checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" dependencies = [ "glob", "libc", - "libloading", + "libloading 0.7.4", ] [[package]] @@ -286,6 +286,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" +[[package]] +name = "dlib" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" +dependencies = [ + "libloading 0.8.0", +] + [[package]] name = "downcast" version = "0.11.0" @@ -523,6 +532,17 @@ dependencies = [ "mach 0.2.3", ] +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys", +] + [[package]] name = "is-terminal" version = "0.4.9" @@ -595,6 +615,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "libloading" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d580318f95776505201b28cf98eb1fa5e4be3b689633ba6a3e6cd880ff22d8cb" +dependencies = [ + "cfg-if", + "windows-sys", +] + [[package]] name = "libudev-sys" version = "0.1.4" @@ -690,9 +720,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" -version = "0.6.5" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" dependencies = [ "autocfg", ] @@ -752,14 +782,15 @@ dependencies = [ [[package]] name = "nix" -version = "0.24.3" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" +checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ "bitflags 1.3.2", "cfg-if", "libc", "memoffset", + "static_assertions", ] [[package]] @@ -900,6 +931,15 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "quick-xml" +version = "0.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1" +dependencies = [ + "memchr 2.5.0", +] + [[package]] name = "quote" version = "1.0.32" @@ -978,6 +1018,12 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "serde" version = "1.0.179" @@ -1045,6 +1091,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "syn" version = "1.0.109" @@ -1266,61 +1318,103 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] -name = "wayland-client" -version = "0.29.5" +name = "wayland-backend" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" +checksum = "41b48e27457e8da3b2260ac60d0a94512f5cba36448679f3747c0865b7893ed8" dependencies = [ - "bitflags 1.3.2", + "cc", "downcast-rs", - "libc", + "io-lifetimes", "nix", - "wayland-commons", - "wayland-scanner", - "wayland-sys", + "scoped-tls", + "smallvec", + "wayland-sys 0.30.1", ] [[package]] -name = "wayland-commons" -version = "0.29.5" +name = "wayland-backend" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902" +checksum = "a8978b1aa3ab65bfcef1b50b4ae2400be3a78315e5e7a92fe636f01ac8426d46" dependencies = [ + "cc", + "downcast-rs", + "io-lifetimes", "nix", - "once_cell", + "scoped-tls", "smallvec", - "wayland-sys", + "wayland-sys 0.31.1", +] + +[[package]] +name = "wayland-client" +version = "0.30.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "489c9654770f674fc7e266b3c579f4053d7551df0ceb392f153adb1f9ed06ac8" +dependencies = [ + "bitflags 1.3.2", + "nix", + "wayland-backend 0.1.2", + "wayland-scanner", ] [[package]] name = "wayland-protocols" -version = "0.29.5" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b28101e5ca94f70461a6c2d610f76d85ad223d042dd76585ab23d3422dd9b4d" +dependencies = [ + "bitflags 1.3.2", + "wayland-backend 0.1.2", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" +checksum = "fce991093320e4a6a525876e6b629ab24da25f9baef0c2e0080ad173ec89588a" dependencies = [ "bitflags 1.3.2", + "wayland-backend 0.1.2", "wayland-client", - "wayland-commons", + "wayland-protocols", "wayland-scanner", ] [[package]] name = "wayland-scanner" -version = "0.29.5" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" +checksum = "b9b873b257fbc32ec909c0eb80dea312076a67014e65e245f5eb69a6b8ab330e" dependencies = [ "proc-macro2", + "quick-xml", "quote", - "xml-rs", ] [[package]] name = "wayland-sys" -version = "0.29.5" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b2a02ac608e07132978689a6f9bf4214949c85998c247abadd4f4129b1aa06" +dependencies = [ + "dlib", + "log", + "pkg-config", +] + +[[package]] +name = "wayland-sys" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4" +checksum = "15a0c8eaff5216d07f226cb7a549159267f3467b289d9a2e52fd3ef5aae2b7af" dependencies = [ + "dlib", + "log", + "once_cell", "pkg-config", ] @@ -1464,8 +1558,10 @@ dependencies = [ "serde_yaml 0.9.25", "toml", "v4l", + "wayland-backend 0.2.0", "wayland-client", "wayland-protocols", + "wayland-protocols-wlr", "xdg", ] @@ -1475,12 +1571,6 @@ version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546" -[[package]] -name = "xml-rs" -version = "0.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1" - [[package]] name = "yaml-rust" version = "0.4.5" diff --git a/Cargo.toml b/Cargo.toml index 7530744..562edb6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,10 @@ authors = ["Maxim Baz", "Cyril Levis"] edition = "2021" [dependencies] -wayland-client = { version = "0.29" } -wayland-protocols = { version = "0.29", features = ["client", "unstable_protocols"] } +wayland-client = { version = "0.30" } +wayland-backend = { version = "0.2", features = ["dlopen"] } +wayland-protocols = { version = "0.30", features = ["client", "unstable"] } +wayland-protocols-wlr = { version = "0.1", features = ["client"] } serde = { version = "1.0", features = ["derive"] } serde_yaml = "0.9" toml = { git = "https://github.com/HarveyHunt/toml", branch = "dotted-table-parsing-toml" } diff --git a/src/frame/capturer/wlroots.rs b/src/frame/capturer/wlroots.rs index 90d5e58..3498a84 100644 --- a/src/frame/capturer/wlroots.rs +++ b/src/frame/capturer/wlroots.rs @@ -3,15 +3,15 @@ use crate::predictor::Controller; use std::{cell::RefCell, rc::Rc, thread, time::Duration}; use wayland_client::{ protocol::{wl_output::WlOutput, wl_registry::WlRegistry}, - Display, EventQueue, GlobalManager, Main, + Connection, EventQueue, GlobalManager, Main, }; -use wayland_protocols::wlr::unstable::export_dmabuf::v1::client::{ +use wayland_protocols_wlr::export_dmabuf::v1::client::{ zwlr_export_dmabuf_frame_v1::{CancelReason, Event}, zwlr_export_dmabuf_manager_v1::ZwlrExportDmabufManagerV1, }; -use wayland_protocols::unstable::xdg_output::v1::client::zxdg_output_manager_v1::ZxdgOutputManagerV1; -use wayland_protocols::unstable::xdg_output::v1::client::zxdg_output_v1::Event::Description; +use wayland_protocols::xdg::xdg_output::zv1::client::zxdg_output_manager_v1::ZxdgOutputManagerV1; +use wayland_protocols::xdg::xdg_output::zv1::client::zxdg_output_v1::Event::Description; const DELAY_SUCCESS: Duration = Duration::from_millis(100); const DELAY_FAILURE: Duration = Duration::from_millis(1000); @@ -67,9 +67,9 @@ impl super::Capturer for Capturer { impl Default for Capturer { fn default() -> Self { - let display = Display::connect_to_env().unwrap(); - let mut event_queue = display.create_event_queue(); - let attached_display = display.attach(event_queue.token()); + let connection = Connection::connect_to_env().unwrap(); + let mut event_queue = connection.new_event_queue(); + let attached_display = connection.attach(event_queue.token()); let registry = attached_display.get_registry(); let globals = GlobalManager::new(&attached_display);