From 7aee2e53a9cb8353ec1fdd1b95030b0bc4886b50 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 30 Oct 2026 20:30:57 -0700 Subject: [PATCH] refactor(lockable): define Lockable next to LockableSequence in the Windows tree Windows lockable_sequence.rs becomes the KDE version (module docs, Lockable defined inline); the trait is removed from lib.rs and re-exported there as pub use lockable_sequence::Lockable, so crate::Lockable paths keep working. Prepares one shared file across the three trees. Verified: fast-check Windows clippy --all-targets -D warnings: PASS. --- komorebi/src/lib.rs | 9 +-------- komorebi/src/lockable_sequence.rs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/komorebi/src/lib.rs b/komorebi/src/lib.rs index 4149a2f3..fd14e174 100644 --- a/komorebi/src/lib.rs +++ b/komorebi/src/lib.rs @@ -11,6 +11,7 @@ pub mod core; pub mod focus_manager; pub mod live_resize; pub mod lockable_sequence; +pub use lockable_sequence::Lockable; pub mod monitor; pub mod monitor_reconciliator; pub mod pan; @@ -280,14 +281,6 @@ pub struct License { pub signature: String, } -/// A trait for types that can be marked as locked or unlocked. -pub trait Lockable { - /// Returns `true` if the item is locked. - fn locked(&self) -> bool; - /// Sets the locked state of the item. - fn set_locked(&mut self, locked: bool) -> &mut Self; -} - #[must_use] pub fn current_virtual_desktop() -> Option> { let hkcu = RegKey::predef(HKEY_CURRENT_USER); diff --git a/komorebi/src/lockable_sequence.rs b/komorebi/src/lockable_sequence.rs index b895d697..421eb22d 100644 --- a/komorebi/src/lockable_sequence.rs +++ b/komorebi/src/lockable_sequence.rs @@ -1,6 +1,17 @@ +//! Lists in which some elements are locked in place. +//! +//! A locked container keeps its position in the layout when others are inserted, removed or +//! swapped around it. [`LockableSequence`] does that bookkeeping for a [`VecDeque`]. + use std::collections::VecDeque; -use crate::Lockable; +/// A trait for types that can be marked as locked or unlocked. +pub trait Lockable { + /// Returns `true` if the item is locked. + fn locked(&self) -> bool; + /// Sets the locked state of the item. + fn set_locked(&mut self, locked: bool) -> &mut Self; +} /// A sequence supporting insertion, removal, and swapping of elements while preserving the absolute /// positions of locked items.