mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-02 03:01:04 +02:00
refactor: standardise error messages
This commit is contained in:
parent
fd2d7e5c7a
commit
9d5049dde0
19 changed files with 117 additions and 110 deletions
|
@ -18,6 +18,7 @@ use wayland_protocols::wlr::unstable::foreign_toplevel::v1::client::{
|
|||
zwlr_foreign_toplevel_handle_v1::ZwlrForeignToplevelHandleV1,
|
||||
zwlr_foreign_toplevel_manager_v1::ZwlrForeignToplevelManagerV1,
|
||||
};
|
||||
use crate::error as err;
|
||||
|
||||
pub struct WaylandClient {
|
||||
pub outputs: Vec<OutputInfo>,
|
||||
|
@ -48,7 +49,7 @@ impl WaylandClient {
|
|||
let outputs = Self::get_outputs(&env);
|
||||
output_tx
|
||||
.send(outputs)
|
||||
.expect("Failed to send outputs out of task");
|
||||
.expect(err::ERR_CHANNEL_SEND);
|
||||
|
||||
let seats = env.get_all_seats();
|
||||
seat_tx
|
||||
|
@ -58,7 +59,7 @@ impl WaylandClient {
|
|||
.map(|seat| seat.detach())
|
||||
.collect::<Vec<WlSeat>>(),
|
||||
)
|
||||
.expect("Failed to send seats out of task");
|
||||
.expect(err::ERR_CHANNEL_SEND);
|
||||
|
||||
let _toplevel_manager = env.require_global::<ZwlrForeignToplevelManagerV1>();
|
||||
|
||||
|
@ -68,18 +69,18 @@ impl WaylandClient {
|
|||
if event.change == ToplevelChange::Close {
|
||||
toplevels2
|
||||
.write()
|
||||
.expect("Failed to get write lock on toplevels")
|
||||
.expect(err::ERR_WRITE_LOCK)
|
||||
.remove(&event.toplevel.id);
|
||||
} else {
|
||||
toplevels2
|
||||
.write()
|
||||
.expect("Failed to get write lock on toplevels")
|
||||
.expect(err::ERR_WRITE_LOCK)
|
||||
.insert(event.toplevel.id, (event.toplevel.clone(), handle));
|
||||
}
|
||||
|
||||
toplevel_tx2
|
||||
.send(event)
|
||||
.expect("Failed to send toplevel event");
|
||||
.expect(err::ERR_CHANNEL_SEND);
|
||||
});
|
||||
|
||||
let mut event_loop =
|
||||
|
@ -101,9 +102,9 @@ impl WaylandClient {
|
|||
|
||||
let outputs = output_rx
|
||||
.await
|
||||
.expect("Failed to receive outputs from task");
|
||||
.expect(err::ERR_CHANNEL_RECV);
|
||||
|
||||
let seats = seat_rx.await.expect("Failed to receive seats from task");
|
||||
let seats = seat_rx.await.expect(err::ERR_CHANNEL_RECV);
|
||||
|
||||
Self {
|
||||
outputs,
|
||||
|
|
|
@ -4,6 +4,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
|
|||
use tracing::trace;
|
||||
use wayland_client::{DispatchData, Main};
|
||||
use wayland_protocols::wlr::unstable::foreign_toplevel::v1::client::zwlr_foreign_toplevel_handle_v1::{Event, ZwlrForeignToplevelHandleV1};
|
||||
use crate::error;
|
||||
|
||||
const STATE_ACTIVE: u32 = 2;
|
||||
const STATE_FULLSCREEN: u32 = 3;
|
||||
|
@ -144,7 +145,7 @@ impl Toplevel {
|
|||
handle.quick_assign(move |_handle, event, ddata| {
|
||||
let mut inner = inner
|
||||
.write()
|
||||
.expect("Failed to get write lock on toplevel inner state");
|
||||
.expect(error::ERR_WRITE_LOCK);
|
||||
toplevel_implem(event, &mut inner, &mut callback, ddata);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue