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>
This commit is contained in:
yrkv
2025-08-16 01:42:08 -07:00
committed by GitHub
parent a003e01307
commit af30cc8df6
11 changed files with 223 additions and 19 deletions
+17 -1
View File
@@ -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,