mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-21 16:11:37 +01:00
Step 11(ii), the pure part. macOS cannot act on a window from its id: it needs the Accessibility element, the pid and the observer. Registry<H> is that table, generic over the handle so that its rules run on any host. Rules, written at the top of registry.rs and tested: thread-safe; a lookup clones the handle and releases the lock before anything is done to it; a removed or replaced handle is handed back to the caller instead of being dropped under the lock (dropping a macOS handle can make an AX round trip, which must never happen with a lock held: seam.md 3.3); a stale or unknown id is Error::WindowGone, never a panic; an entry ends on remove, remove_pid (application quit) or a failed call; re-inserting replaces. Nothing uses it yet; no daemon changes. Verified: native cargo test -p komorebi-backend: 38 unit (9 new) + 7 doc (1 new) + 1 compile_fail passed, 0 failed. Not run: the Windows, KDE and macOS checks (the new module is std-only and no other file changed).
47 lines
1.9 KiB
Rust
47 lines
1.9 KiB
Rust
//! What every komorebi daemon asks of its platform.
|
|
//!
|
|
//! The window manager logic should talk to a [`Backend`], never to KWin, Win32 or the macOS
|
|
//! Accessibility API. This crate holds the vocabulary of that conversation and nothing that
|
|
//! belongs to one platform:
|
|
//!
|
|
//! - [`WindowId`] and [`MonitorId`], the names a backend gives windows and monitors;
|
|
//! - [`WindowInfo`] and [`MonitorInfo`], plain data, with an [`Option`] for everything that is
|
|
//! not available on every platform;
|
|
//! - [`Error`], which can say that "the window is gone" and that "this platform cannot do that";
|
|
//! - the [`Backend`] trait, with only the operations that at least two platforms have
|
|
//! (`docs/dev/seam.md`, section 2.1), a [`Capability`] query for the ones only some platforms
|
|
//! have, and a [`Batch`] scope for writes that should appear together;
|
|
//! - [`fake::FakeBackend`], an in-memory desktop with failure injection and frame offsets,
|
|
//! and [`contract`], the checks that every backend has to pass.
|
|
//!
|
|
//! The evidence for each choice, and the status of every claim (confirmed, corrected or target),
|
|
//! is in `docs/dev/seam.md`. The doc comment of each item says which platforms implement it.
|
|
//!
|
|
//! # Platform-specific operations
|
|
//!
|
|
//! Borders and their colours, the look, the wallpaper, drag origin and end frames, stackbars,
|
|
//! observers and event taps are not here: they are one platform's business and live in that
|
|
//! platform's own trait or crate (for KDE, `komorebi::backend::Backend` still has them).
|
|
|
|
#![deny(missing_docs)]
|
|
|
|
mod backend;
|
|
pub mod contract;
|
|
mod error;
|
|
pub mod fake;
|
|
mod id;
|
|
mod info;
|
|
mod registry;
|
|
|
|
pub use backend::Backend;
|
|
pub use backend::Batch;
|
|
pub use backend::Capability;
|
|
pub use error::Error;
|
|
pub use error::Result;
|
|
pub use id::MonitorId;
|
|
pub use id::WindowId;
|
|
pub use info::MonitorInfo;
|
|
pub use info::WindowInfo;
|
|
pub use registry::Registry;
|
|
pub use komorebi_layouts::Rect;
|