layout/scrolling: Add Column ID
Browse files at this commit361a91a765b7cb85b2652019f852be5078ba1546Parent: 978c9f21 changed file +28 -0
- src/layout/scrolling.rs +28 -0
src/layout/scrolling.rsmodified+28 -0
| @@ -23,6 +23,7 @@ use crate::niri_render_elements; | ||
| 23 | 23 | use crate::render_helpers::renderer::NiriRenderer; |
| 24 | 24 | use crate::render_helpers::xray::XrayPos; |
| 25 | 25 | use crate::render_helpers::RenderCtx; |
| 26 | +use crate::utils::id::IdCounter; | |
| 26 | 27 | use crate::utils::transaction::{Transaction, TransactionBlocker}; |
| 27 | 28 | use crate::utils::ResizeEdge; |
| 28 | 29 | use crate::window::ResolvedWindowRules; |
| @@ -142,6 +143,25 @@ pub(super) struct ViewGesture { | ||
| 142 | 143 | dnd_nonzero_start_time: Option<Duration>, |
| 143 | 144 | } |
| 144 | 145 | |
| 146 | +static COLUMN_ID_COUNTER: IdCounter = IdCounter::new(); | |
| 147 | + | |
| 148 | +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | |
| 149 | +pub struct ColumnId(u64); | |
| 150 | + | |
| 151 | +impl ColumnId { | |
| 152 | + fn next() -> ColumnId { | |
| 153 | + ColumnId(COLUMN_ID_COUNTER.next()) | |
| 154 | + } | |
| 155 | + | |
| 156 | + pub fn get(self) -> u64 { | |
| 157 | + self.0 | |
| 158 | + } | |
| 159 | + | |
| 160 | + pub fn specific(id: u64) -> Self { | |
| 161 | + Self(id) | |
| 162 | + } | |
| 163 | +} | |
| 164 | + | |
| 145 | 165 | #[derive(Debug)] |
| 146 | 166 | pub struct Column<W: LayoutElement> { |
| 147 | 167 | /// Tiles in this column. |
| @@ -217,6 +237,9 @@ pub struct Column<W: LayoutElement> { | ||
| 217 | 237 | |
| 218 | 238 | /// Configurable properties of the layout. |
| 219 | 239 | options: Rc<Options>, |
| 240 | + | |
| 241 | + /// Unique ID of this column. | |
| 242 | + id: ColumnId, | |
| 220 | 243 | } |
| 221 | 244 | |
| 222 | 245 | /// Extra per-tile data. |
| @@ -3970,6 +3993,7 @@ impl<W: LayoutElement> Column<W> { | ||
| 3970 | 3993 | scale, |
| 3971 | 3994 | clock: tile.clock.clone(), |
| 3972 | 3995 | options, |
| 3996 | + id: ColumnId::next(), | |
| 3973 | 3997 | }; |
| 3974 | 3998 | |
| 3975 | 3999 | let pending_sizing_mode = tile.window().pending_sizing_mode(); |
| @@ -3996,6 +4020,10 @@ impl<W: LayoutElement> Column<W> { | ||
| 3996 | 4020 | rv |
| 3997 | 4021 | } |
| 3998 | 4022 | |
| 4023 | + pub fn id(&self) -> ColumnId { | |
| 4024 | + self.id | |
| 4025 | + } | |
| 4026 | + | |
| 3999 | 4027 | fn update_config( |
| 4000 | 4028 | &mut self, |
| 4001 | 4029 | view_size: Size<f64, Logical>, |