utils: New geometry spaces local/global

This commit is contained in:
Victoria Brekenfeld 2023-10-25 19:24:51 +02:00
parent c38a236ffa
commit 42aaafe586
18 changed files with 516 additions and 300 deletions

View file

@ -11,20 +11,21 @@ use smithay::{
Seat,
},
output::Output,
utils::{Buffer, IsAlive, Logical, Monotonic, Point, Rectangle, Time, Transform},
utils::{Buffer, IsAlive, Monotonic, Point, Rectangle, Time, Transform},
wayland::compositor::with_states,
};
pub use super::geometry::*;
pub use crate::shell::{Shell, Workspace};
pub use crate::state::{Common, State};
pub use crate::wayland::handlers::xdg_shell::popup::update_reactive_popups;
pub trait OutputExt {
fn geometry(&self) -> Rectangle<i32, Logical>;
fn geometry(&self) -> Rectangle<i32, Global>;
}
impl OutputExt for Output {
fn geometry(&self) -> Rectangle<i32, Logical> {
fn geometry(&self) -> Rectangle<i32, Global> {
Rectangle::from_loc_and_size(self.current_location(), {
Transform::from(self.current_transform())
.transform_size(
@ -36,6 +37,7 @@ impl OutputExt for Output {
.to_logical(self.current_scale().fractional_scale())
.to_i32_round()
})
.as_global()
}
}