From ddcb5c5e106a83f13fdf7fca03a9dc0f7e964f9e Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 5 Nov 2024 21:08:50 +0300 Subject: layout: Move some types further down --- src/layout/mod.rs | 106 +++++++++++++++++++++++++++--------------------------- 1 file changed, 53 insertions(+), 53 deletions(-) (limited to 'src/layout') diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 8d723627..fcac0ac8 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -87,59 +87,6 @@ niri_render_elements! { pub type LayoutElementRenderSnapshot = RenderSnapshot>, BakedBuffer>; -#[derive(Debug)] -enum InteractiveMoveState { - /// Initial rubberbanding; the window remains in the layout. - Starting { - /// The window we're moving. - window_id: W::Id, - /// Current pointer delta from the starting location. - pointer_delta: Point, - /// Pointer location within the visual window geometry as ratio from geometry size. - /// - /// This helps the pointer remain inside the window as it resizes. - pointer_ratio_within_window: (f64, f64), - }, - /// Moving; the window is no longer in the layout. - Moving(InteractiveMoveData), -} - -#[derive(Debug)] -struct InteractiveMoveData { - /// The window being moved. - pub(self) tile: Tile, - /// Output where the window is currently located/rendered. - pub(self) output: Output, - /// Current pointer position within output. - pub(self) pointer_pos_within_output: Point, - /// Window column width. - pub(self) width: ColumnWidth, - /// Whether the window column was full-width. - pub(self) is_full_width: bool, - /// Pointer location within the visual window geometry as ratio from geometry size. - /// - /// This helps the pointer remain inside the window as it resizes. - pub(self) pointer_ratio_within_window: (f64, f64), -} - -#[derive(Debug, Clone, Copy)] -pub struct InteractiveResizeData { - pub(self) edges: ResizeEdge, -} - -#[derive(Debug, Clone, Copy)] -pub enum ConfigureIntent { - /// A configure is not needed (no changes to server pending state). - NotNeeded, - /// A configure is throttled (due to resizing too fast for example). - Throttled, - /// Can send the configure if it isn't throttled externally (only size changed). - CanSend, - /// Should send the configure regardless of external throttling (something other than size - /// changed). - ShouldSend, -} - pub trait LayoutElement { /// Type that can be used as a unique ID of this element. type Id: PartialEq + std::fmt::Debug + Clone; @@ -333,6 +280,59 @@ impl Default for Options { } } +#[derive(Debug)] +enum InteractiveMoveState { + /// Initial rubberbanding; the window remains in the layout. + Starting { + /// The window we're moving. + window_id: W::Id, + /// Current pointer delta from the starting location. + pointer_delta: Point, + /// Pointer location within the visual window geometry as ratio from geometry size. + /// + /// This helps the pointer remain inside the window as it resizes. + pointer_ratio_within_window: (f64, f64), + }, + /// Moving; the window is no longer in the layout. + Moving(InteractiveMoveData), +} + +#[derive(Debug)] +struct InteractiveMoveData { + /// The window being moved. + pub(self) tile: Tile, + /// Output where the window is currently located/rendered. + pub(self) output: Output, + /// Current pointer position within output. + pub(self) pointer_pos_within_output: Point, + /// Window column width. + pub(self) width: ColumnWidth, + /// Whether the window column was full-width. + pub(self) is_full_width: bool, + /// Pointer location within the visual window geometry as ratio from geometry size. + /// + /// This helps the pointer remain inside the window as it resizes. + pub(self) pointer_ratio_within_window: (f64, f64), +} + +#[derive(Debug, Clone, Copy)] +pub struct InteractiveResizeData { + pub(self) edges: ResizeEdge, +} + +#[derive(Debug, Clone, Copy)] +pub enum ConfigureIntent { + /// A configure is not needed (no changes to server pending state). + NotNeeded, + /// A configure is throttled (due to resizing too fast for example). + Throttled, + /// Can send the configure if it isn't throttled externally (only size changed). + CanSend, + /// Should send the configure regardless of external throttling (something other than size + /// changed). + ShouldSend, +} + /// Tile that was just removed from the layout. pub struct RemovedTile { tile: Tile, -- cgit