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
+14
View File
@@ -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<W: LayoutElement> Tile<W> {
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<f64, Logical>) -> bool {
point -= self.window_loc().to_f64();
self.window.is_in_input_region(point)