From 917e796dfa5bb2122b66250a13e49a651d08e8bd Mon Sep 17 00:00:00 2001 From: Bryan Ndjeutcha Date: Tue, 25 May 2021 11:39:04 -0400 Subject: [PATCH] fix for multiseat Note: It panics if the seat doesn't exist --- Cargo.lock | 12 ++++++++++++ Cargo.toml | 2 +- src/main.rs | 15 ++++++--------- src/wayland/mod.rs | 2 ++ 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 53393a7..3b5891b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -78,6 +78,7 @@ version = "0.1.0" dependencies = [ "wayland-client", "wayland-commons", + "wayland-protocols", "wayland-scanner", ] @@ -120,6 +121,17 @@ dependencies = [ "wayland-sys", ] +[[package]] +name = "wayland-protocols" +version = "0.28.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95df3317872bcf9eec096c864b69aa4769a1d5d6291a5b513f8ba0af0efbd52c" +dependencies = [ + "bitflags", + "wayland-commons", + "wayland-scanner", +] + [[package]] name = "wayland-scanner" version = "0.28.5" diff --git a/Cargo.toml b/Cargo.toml index c9da45c..be82e51 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,6 @@ edition = "2018" wayland-scanner = "0.28.5" [dependencies] -wayland-scanner = "0.28.5" +wayland-protocols = "0.28.5" wayland-commons = "0.28.5" wayland-client = "0.28.5" diff --git a/src/main.rs b/src/main.rs index ec38741..1a89e08 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,15 +4,16 @@ use crate::wayland::river_status_unstable_v1::{ zriver_output_status_v1, zriver_seat_status_v1, zriver_status_manager_v1::ZriverStatusManagerV1, }; use wayland_client::protocol::{ + wl_seat, wl_output::WlOutput, wl_seat::WlSeat, - wl_seat::Event }; use wayland_client::{Display, GlobalManager, Main}; struct Globals { seats: Vec>, outputs: Vec>, + // xdg_outputs: Vec>, status_manager: Option>, } @@ -25,6 +26,7 @@ fn main() { Globals { seats: Vec::new(), outputs: Vec::new(), + // xdg_outputs: Vec::new(), status_manager: None, } }; @@ -106,18 +108,13 @@ fn main() { .get_river_seat_status(&seat); seat.quick_assign(move |_, event, mut seat_name| { match event { - Event::Name{ name } => if String::new().eq(seat_name.get::().unwrap()) - || name.eq(seat_name.get::().unwrap()) { + wl_seat::Event::Name{ name } => if enable_title && seat_name.get::().unwrap().len() == 0 || name.eq(seat_name.get::().unwrap()) { seat_status.quick_assign(move |_, event, _| match event { - zriver_seat_status_v1::Event::FocusedView { title } => { - if enable_title { - println!("{}", title) - } - } + zriver_seat_status_v1::Event::FocusedView { title } => println!("{}", title), _ => {} }) }, - _ => seat_status.quick_assign(move |_, _, _| {}) + _ => {} } }) } diff --git a/src/wayland/mod.rs b/src/wayland/mod.rs index d380142..9113089 100644 --- a/src/wayland/mod.rs +++ b/src/wayland/mod.rs @@ -1,5 +1,6 @@ extern crate wayland_client; extern crate wayland_commons; +extern crate wayland_protocols; // Re-export only the actual code, and then only use this re-export // The `generated` module below is just some boilerplate to properly isolate stuff @@ -25,6 +26,7 @@ pub mod wayland { pub(crate) use wayland_commons::smallvec; pub(crate) use wayland_commons::wire::{Argument, ArgumentType, Message, MessageDesc}; pub(crate) use wayland_commons::{Interface, MessageGroup}; + // pub(crate) use wayland_protocols::unstable::xdg_output::v1::client::zxdg_output_v1::Event; // If you protocol interacts with objects from other protocols, you'll need to import // their modules, like so: pub(crate) use wayland_client::protocol::{wl_region, wl_seat, wl_surface};