aboutsummaryrefslogtreecommitdiff
path: root/src/layout/scrolling.rs
diff options
context:
space:
mode:
authoryrkv <yegor@tydbits.com>2025-08-16 01:42:08 -0700
committerGitHub <noreply@github.com>2025-08-16 11:42:08 +0300
commitaf30cc8df68b29973c8b9eec290f9e6b93463929 (patch)
treec216831fe217e191c958545b7536183d67b1b186 /src/layout/scrolling.rs
parenta003e013074b5188a2b1f2364fff90fb4caf972a (diff)
downloadniri-af30cc8df68b29973c8b9eec290f9e6b93463929.tar.gz
niri-af30cc8df68b29973c8b9eec290f9e6b93463929.tar.bz2
niri-af30cc8df68b29973c8b9eec290f9e6b93463929.zip
niri-ipc: Add window positions and sizes (#1265)
* Add window sizes and positions to the IPC * basic fixes * report window_loc instead of window pos * clean ups * make scrolling indices 1-based * add printing to niri msg windows * don't include render offset in floating tile pos --------- Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
Diffstat (limited to 'src/layout/scrolling.rs')
-rw-r--r--src/layout/scrolling.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/layout/scrolling.rs b/src/layout/scrolling.rs
index a60581af..551fa692 100644
--- a/src/layout/scrolling.rs
+++ b/src/layout/scrolling.rs
@@ -4,7 +4,7 @@ use std::rc::Rc;
use std::time::Duration;
use niri_config::{CenterFocusedColumn, PresetSize, Struts};
-use niri_ipc::{ColumnDisplay, SizeChange};
+use niri_ipc::{ColumnDisplay, SizeChange, WindowLayout};
use ordered_float::NotNan;
use smithay::backend::renderer::gles::GlesRenderer;
use smithay::utils::{Logical, Point, Rectangle, Scale, Serial, Size};
@@ -2366,6 +2366,22 @@ impl<W: LayoutElement> ScrollingSpace<W> {
})
}
+ pub fn tiles_with_ipc_layouts(&self) -> impl Iterator<Item = (&Tile<W>, WindowLayout)> {
+ self.columns
+ .iter()
+ .enumerate()
+ .flat_map(move |(col_idx, col)| {
+ col.tiles().enumerate().map(move |(tile_idx, (tile, _))| {
+ let layout = WindowLayout {
+ // Our indices are 1-based, consistent with the actions.
+ pos_in_scrolling_layout: Some((col_idx + 1, tile_idx + 1)),
+ ..tile.ipc_layout_template()
+ };
+ (tile, layout)
+ })
+ })
+ }
+
pub(super) fn insert_hint_area(
&self,
position: InsertPosition,