From af30cc8df68b29973c8b9eec290f9e6b93463929 Mon Sep 17 00:00:00 2001 From: yrkv Date: Sat, 16 Aug 2025 01:42:08 -0700 Subject: 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 --- src/layout/scrolling.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/layout/scrolling.rs') 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 ScrollingSpace { }) } + pub fn tiles_with_ipc_layouts(&self) -> impl Iterator, 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, -- cgit