layout: Move some types further down
Browse files at this commitddcb5c5e106a83f13fdf7fca03a9dc0f7e964f9eParent: cd90dfc1 changed file +53 -53
- src/layout/mod.rs +53 -53
src/layout/mod.rsmodified+53 -53
| @@ -87,59 +87,6 @@ niri_render_elements! { | |||
| 87 | pub type LayoutElementRenderSnapshot = | 87 | pub type LayoutElementRenderSnapshot = |
| 88 | RenderSnapshot<BakedBuffer<TextureBuffer<GlesTexture>>, BakedBuffer<SolidColorBuffer>>; | 88 | RenderSnapshot<BakedBuffer<TextureBuffer<GlesTexture>>, BakedBuffer<SolidColorBuffer>>; |
| 89 | 89 | ||
| 90 | -#[derive(Debug)] | ||
| 91 | -enum InteractiveMoveState<W: LayoutElement> { | ||
| 92 | - /// Initial rubberbanding; the window remains in the layout. | ||
| 93 | - Starting { | ||
| 94 | - /// The window we're moving. | ||
| 95 | - window_id: W::Id, | ||
| 96 | - /// Current pointer delta from the starting location. | ||
| 97 | - pointer_delta: Point<f64, Logical>, | ||
| 98 | - /// Pointer location within the visual window geometry as ratio from geometry size. | ||
| 99 | - /// | ||
| 100 | - /// This helps the pointer remain inside the window as it resizes. | ||
| 101 | - pointer_ratio_within_window: (f64, f64), | ||
| 102 | - }, | ||
| 103 | - /// Moving; the window is no longer in the layout. | ||
| 104 | - Moving(InteractiveMoveData<W>), | ||
| 105 | -} | ||
| 106 | - | ||
| 107 | -#[derive(Debug)] | ||
| 108 | -struct InteractiveMoveData<W: LayoutElement> { | ||
| 109 | - /// The window being moved. | ||
| 110 | - pub(self) tile: Tile<W>, | ||
| 111 | - /// Output where the window is currently located/rendered. | ||
| 112 | - pub(self) output: Output, | ||
| 113 | - /// Current pointer position within output. | ||
| 114 | - pub(self) pointer_pos_within_output: Point<f64, Logical>, | ||
| 115 | - /// Window column width. | ||
| 116 | - pub(self) width: ColumnWidth, | ||
| 117 | - /// Whether the window column was full-width. | ||
| 118 | - pub(self) is_full_width: bool, | ||
| 119 | - /// Pointer location within the visual window geometry as ratio from geometry size. | ||
| 120 | - /// | ||
| 121 | - /// This helps the pointer remain inside the window as it resizes. | ||
| 122 | - pub(self) pointer_ratio_within_window: (f64, f64), | ||
| 123 | -} | ||
| 124 | - | ||
| 125 | -#[derive(Debug, Clone, Copy)] | ||
| 126 | -pub struct InteractiveResizeData { | ||
| 127 | - pub(self) edges: ResizeEdge, | ||
| 128 | -} | ||
| 129 | - | ||
| 130 | -#[derive(Debug, Clone, Copy)] | ||
| 131 | -pub enum ConfigureIntent { | ||
| 132 | - /// A configure is not needed (no changes to server pending state). | ||
| 133 | - NotNeeded, | ||
| 134 | - /// A configure is throttled (due to resizing too fast for example). | ||
| 135 | - Throttled, | ||
| 136 | - /// Can send the configure if it isn't throttled externally (only size changed). | ||
| 137 | - CanSend, | ||
| 138 | - /// Should send the configure regardless of external throttling (something other than size | ||
| 139 | - /// changed). | ||
| 140 | - ShouldSend, | ||
| 141 | -} | ||
| 142 | - | ||
| 143 | pub trait LayoutElement { | 90 | pub trait LayoutElement { |
| 144 | /// Type that can be used as a unique ID of this element. | 91 | /// Type that can be used as a unique ID of this element. |
| 145 | type Id: PartialEq + std::fmt::Debug + Clone; | 92 | type Id: PartialEq + std::fmt::Debug + Clone; |
| @@ -333,6 +280,59 @@ impl Default for Options { | |||
| 333 | } | 280 | } |
| 334 | } | 281 | } |
| 335 | 282 | ||
| 283 | +#[derive(Debug)] | ||
| 284 | +enum InteractiveMoveState<W: LayoutElement> { | ||
| 285 | + /// Initial rubberbanding; the window remains in the layout. | ||
| 286 | + Starting { | ||
| 287 | + /// The window we're moving. | ||
| 288 | + window_id: W::Id, | ||
| 289 | + /// Current pointer delta from the starting location. | ||
| 290 | + pointer_delta: Point<f64, Logical>, | ||
| 291 | + /// Pointer location within the visual window geometry as ratio from geometry size. | ||
| 292 | + /// | ||
| 293 | + /// This helps the pointer remain inside the window as it resizes. | ||
| 294 | + pointer_ratio_within_window: (f64, f64), | ||
| 295 | + }, | ||
| 296 | + /// Moving; the window is no longer in the layout. | ||
| 297 | + Moving(InteractiveMoveData<W>), | ||
| 298 | +} | ||
| 299 | + | ||
| 300 | +#[derive(Debug)] | ||
| 301 | +struct InteractiveMoveData<W: LayoutElement> { | ||
| 302 | + /// The window being moved. | ||
| 303 | + pub(self) tile: Tile<W>, | ||
| 304 | + /// Output where the window is currently located/rendered. | ||
| 305 | + pub(self) output: Output, | ||
| 306 | + /// Current pointer position within output. | ||
| 307 | + pub(self) pointer_pos_within_output: Point<f64, Logical>, | ||
| 308 | + /// Window column width. | ||
| 309 | + pub(self) width: ColumnWidth, | ||
| 310 | + /// Whether the window column was full-width. | ||
| 311 | + pub(self) is_full_width: bool, | ||
| 312 | + /// Pointer location within the visual window geometry as ratio from geometry size. | ||
| 313 | + /// | ||
| 314 | + /// This helps the pointer remain inside the window as it resizes. | ||
| 315 | + pub(self) pointer_ratio_within_window: (f64, f64), | ||
| 316 | +} | ||
| 317 | + | ||
| 318 | +#[derive(Debug, Clone, Copy)] | ||
| 319 | +pub struct InteractiveResizeData { | ||
| 320 | + pub(self) edges: ResizeEdge, | ||
| 321 | +} | ||
| 322 | + | ||
| 323 | +#[derive(Debug, Clone, Copy)] | ||
| 324 | +pub enum ConfigureIntent { | ||
| 325 | + /// A configure is not needed (no changes to server pending state). | ||
| 326 | + NotNeeded, | ||
| 327 | + /// A configure is throttled (due to resizing too fast for example). | ||
| 328 | + Throttled, | ||
| 329 | + /// Can send the configure if it isn't throttled externally (only size changed). | ||
| 330 | + CanSend, | ||
| 331 | + /// Should send the configure regardless of external throttling (something other than size | ||
| 332 | + /// changed). | ||
| 333 | + ShouldSend, | ||
| 334 | +} | ||
| 335 | + | ||
| 336 | /// Tile that was just removed from the layout. | 336 | /// Tile that was just removed from the layout. |
| 337 | pub struct RemovedTile<W: LayoutElement> { | 337 | pub struct RemovedTile<W: LayoutElement> { |
| 338 | tile: Tile<W>, | 338 | tile: Tile<W>, |