aboutsummaryrefslogtreecommitdiff
path: root/src/layout/tile.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/tile.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/tile.rs')
-rw-r--r--src/layout/tile.rs14
1 files changed, 14 insertions, 0 deletions
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<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)