aboutsummaryrefslogtreecommitdiff
path: root/src/layout/mod.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/mod.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/mod.rs')
-rw-r--r--src/layout/mod.rs19
1 files changed, 12 insertions, 7 deletions
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<W: LayoutElement> Layout<W> {
moving_window.chain(mon_windows)
}
- pub fn with_windows(&self, mut f: impl FnMut(&W, Option<&Output>, Option<WorkspaceId>)) {
+ pub fn with_windows(
+ &self,
+ mut f: impl FnMut(&W, Option<&Output>, Option<WorkspaceId>, 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);
}
}
}