forge
Explore
Log in

Don't you dare go Hollow

layout/scrolling: Add Column ID

Browse files at this commit

361a91a765b7cb85b2652019f852be5078ba1546Ivan MolodetskikhParent: 978c9f2
Not hooked up to anything yet, will need to do that in future commits.
src/layout/scrolling.rsmodified+28 -0
@@ -23,6 +23,7 @@ use crate::niri_render_elements;
2323 use crate::render_helpers::renderer::NiriRenderer;
2424 use crate::render_helpers::xray::XrayPos;
2525 use crate::render_helpers::RenderCtx;
26+use crate::utils::id::IdCounter;
2627 use crate::utils::transaction::{Transaction, TransactionBlocker};
2728 use crate::utils::ResizeEdge;
2829 use crate::window::ResolvedWindowRules;
@@ -142,6 +143,25 @@ pub(super) struct ViewGesture {
142143 dnd_nonzero_start_time: Option<Duration>,
143144 }
144145
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+
145165 #[derive(Debug)]
146166 pub struct Column<W: LayoutElement> {
147167 /// Tiles in this column.
@@ -217,6 +237,9 @@ pub struct Column<W: LayoutElement> {
217237
218238 /// Configurable properties of the layout.
219239 options: Rc<Options>,
240+
241+ /// Unique ID of this column.
242+ id: ColumnId,
220243 }
221244
222245 /// Extra per-tile data.
@@ -3970,6 +3993,7 @@ impl<W: LayoutElement> Column<W> {
39703993 scale,
39713994 clock: tile.clock.clone(),
39723995 options,
3996+ id: ColumnId::next(),
39733997 };
39743998
39753999 let pending_sizing_mode = tile.window().pending_sizing_mode();
@@ -3996,6 +4020,10 @@ impl<W: LayoutElement> Column<W> {
39964020 rv
39974021 }
39984022
4023+ pub fn id(&self) -> ColumnId {
4024+ self.id
4025+ }
4026+
39994027 fn update_config(
40004028 &mut self,
40014029 view_size: Size<f64, Logical>,