mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user