diff options
| author | yrkv <yegor@tydbits.com> | 2025-08-16 01:42:08 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-16 11:42:08 +0300 |
| commit | af30cc8df68b29973c8b9eec290f9e6b93463929 (patch) | |
| tree | c216831fe217e191c958545b7536183d67b1b186 /src/layout/floating.rs | |
| parent | a003e013074b5188a2b1f2364fff90fb4caf972a (diff) | |
| download | niri-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/floating.rs')
| -rw-r--r-- | src/layout/floating.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/layout/floating.rs b/src/layout/floating.rs index 98927c0d..bd976d7d 100644 --- a/src/layout/floating.rs +++ b/src/layout/floating.rs @@ -3,7 +3,7 @@ use std::iter::zip; use std::rc::Rc; use niri_config::{PresetSize, RelativeTo}; -use niri_ipc::{PositionChange, SizeChange}; +use niri_ipc::{PositionChange, SizeChange, WindowLayout}; use smithay::backend::renderer::gles::GlesRenderer; use smithay::utils::{Logical, Point, Rectangle, Scale, Serial, Size}; @@ -322,6 +322,22 @@ impl<W: LayoutElement> FloatingSpace<W> { }) } + pub fn tiles_with_ipc_layouts(&self) -> impl Iterator<Item = (&Tile<W>, WindowLayout)> { + let scale = self.scale; + self.tiles_with_offsets().map(move |(tile, offset)| { + // Do not include animated render offset here to avoid IPC spam. + let pos = offset; + // Round to physical pixels. + let pos = pos.to_physical_precise_round(scale).to_logical(scale); + + let layout = WindowLayout { + tile_pos_in_workspace_view: Some(pos.into()), + ..tile.ipc_layout_template() + }; + (tile, layout) + }) + } + pub fn new_window_toplevel_bounds(&self, rules: &ResolvedWindowRules) -> Size<i32, Logical> { let border_config = rules.border.resolve_against(self.options.border); compute_toplevel_bounds(border_config, self.working_area.size) |
