From 6e7d51972ee781b37e65b362063f4e3aebefa28e Mon Sep 17 00:00:00 2001 From: MaxVerevkin Date: Thu, 9 Jan 2025 01:20:25 +0200 Subject: update wayrs-client and other deps --- src/wm_info_provider/river.rs | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) (limited to 'src/wm_info_provider') diff --git a/src/wm_info_provider/river.rs b/src/wm_info_provider/river.rs index 61b7e2b..9cf8c47 100644 --- a/src/wm_info_provider/river.rs +++ b/src/wm_info_provider/river.rs @@ -1,6 +1,5 @@ use std::ffi::CString; -use wayrs_client::global::*; use wayrs_client::proxy::Proxy; use wayrs_client::EventCtx; @@ -11,7 +10,7 @@ pub struct RiverInfoProvider { control: ZriverControlV1, output_statuses: Vec, max_tag: u8, - seat_status: SeatStatus, + mode: Option, } struct OutputStatus { @@ -23,33 +22,21 @@ struct OutputStatus { layout_name: Option, } -struct SeatStatus { - _status: ZriverSeatStatusV1, - mode: Option, -} - impl RiverInfoProvider { - pub fn bind( - conn: &mut Connection, - globals: &Globals, - config: &WmConfig, - ) -> Option { - let status_manager: ZriverStatusManagerV1 = globals.bind(conn, 1..=4).ok()?; - let wl_seat: WlSeat = globals.bind(conn, ..=5).ok()?; // river supports just one seat - let seat_status = - status_manager.get_river_seat_status_with_cb(conn, wl_seat, seat_status_cb); + pub fn bind(conn: &mut Connection, config: &WmConfig) -> Option { + let control = conn.bind_singleton(1).ok()?; + let status_manager: ZriverStatusManagerV1 = conn.bind_singleton(..=4).ok()?; + let wl_seat = conn.bind_singleton(..=5).ok()?; // river supports just one seat + status_manager.get_river_seat_status_with_cb(conn, wl_seat, seat_status_cb); if wl_seat.version() >= 5 { wl_seat.release(conn); } Some(Self { status_manager, - control: globals.bind(conn, 1).ok()?, + control, output_statuses: Vec::new(), max_tag: config.river.max_tag, - seat_status: SeatStatus { - _status: seat_status, - mode: None, - }, + mode: None, }) } @@ -112,7 +99,7 @@ impl WmInfoProvider for RiverInfoProvider { } fn get_mode_name(&self, _output: &Output) -> Option { - self.seat_status.mode.clone() + self.mode.clone() } fn click_on_tag( @@ -204,7 +191,7 @@ fn seat_status_cb(ctx: EventCtx) { if let zriver_seat_status_v1::Event::Mode(mode) = ctx.event { let river = ctx.state.shared_state.get_river().unwrap(); let mode = mode.to_string_lossy().into_owned(); - river.seat_status.mode = (mode != "normal").then_some(mode); + river.mode = (mode != "normal").then_some(mode); ctx.state.mode_name_updated(ctx.conn, None); } } -- cgit v1.3.1