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/mod.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/layout/mod.rs') diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 7bf25b42..52e3173b 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -42,7 +42,7 @@ use niri_config::{ CenterFocusedColumn, Config, CornerRadius, FloatOrInt, PresetSize, Struts, Workspace as WorkspaceConfig, WorkspaceReference, }; -use niri_ipc::{ColumnDisplay, PositionChange, SizeChange}; +use niri_ipc::{ColumnDisplay, PositionChange, SizeChange, WindowLayout}; use scrolling::{Column, ColumnWidth}; use smithay::backend::renderer::element::surface::WaylandSurfaceRenderElement; use smithay::backend::renderer::element::utils::RescaleRenderElement; @@ -1742,25 +1742,30 @@ impl Layout { moving_window.chain(mon_windows) } - pub fn with_windows(&self, mut f: impl FnMut(&W, Option<&Output>, Option)) { + pub fn with_windows( + &self, + mut f: impl FnMut(&W, Option<&Output>, Option, WindowLayout), + ) { if let Some(InteractiveMoveState::Moving(move_)) = &self.interactive_move { - f(move_.tile.window(), Some(&move_.output), None); + // We don't fill any positions for interactively moved windows. + let layout = move_.tile.ipc_layout_template(); + f(move_.tile.window(), Some(&move_.output), None, layout); } match &self.monitor_set { MonitorSet::Normal { monitors, .. } => { for mon in monitors { for ws in &mon.workspaces { - for win in ws.windows() { - f(win, Some(&mon.output), Some(ws.id())); + for (tile, layout) in ws.tiles_with_ipc_layouts() { + f(tile.window(), Some(&mon.output), Some(ws.id()), layout); } } } } MonitorSet::NoOutputs { workspaces } => { for ws in workspaces { - for win in ws.windows() { - f(win, None, Some(ws.id())); + for (tile, layout) in ws.tiles_with_ipc_layouts() { + f(tile.window(), None, Some(ws.id()), layout); } } } -- cgit