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/tile.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/layout/tile.rs') diff --git a/src/layout/tile.rs b/src/layout/tile.rs index a4fe8a57..1555b129 100644 --- a/src/layout/tile.rs +++ b/src/layout/tile.rs @@ -2,6 +2,7 @@ use core::f64; use std::rc::Rc; use niri_config::{Color, CornerRadius, GradientInterpolation}; +use niri_ipc::WindowLayout; use smithay::backend::renderer::element::{Element, Kind}; use smithay::backend::renderer::gles::GlesRenderer; use smithay::utils::{Logical, Point, Rectangle, Scale, Size}; @@ -688,6 +689,19 @@ impl Tile { loc } + /// Returns a partially-filled [`WindowLayout`]. + /// + /// Only the sizing properties that a [`Tile`] can fill are filled. + pub fn ipc_layout_template(&self) -> WindowLayout { + WindowLayout { + pos_in_scrolling_layout: None, + tile_size: self.tile_size().into(), + window_size: self.window().size().into(), + tile_pos_in_workspace_view: None, + window_offset_in_tile: self.window_loc().into(), + } + } + fn is_in_input_region(&self, mut point: Point) -> bool { point -= self.window_loc().to_f64(); self.window.is_in_input_region(point) -- cgit