shell: Set xdg_shell v4 bounds

This commit is contained in:
Victoria Brekenfeld 2023-03-31 14:04:35 +02:00
parent bc49507353
commit 8f6ad62017
4 changed files with 18 additions and 0 deletions

View file

@ -411,6 +411,13 @@ impl CosmicMapped {
}
}
pub fn set_bounds(&self, size: impl Into<Option<Size<i32, Logical>>>) {
let size = size.into();
for (surface, _) in self.windows() {
surface.set_bounds(size.clone())
}
}
pub fn configure(&self) {
for window in match &self.element {
CosmicMappedInternal::Stack(s) => {

View file

@ -120,6 +120,15 @@ impl CosmicSurface {
}
}
pub fn set_bounds(&self, size: impl Into<Option<Size<i32, Logical>>>) {
match self {
CosmicSurface::Wayland(window) => window.toplevel().with_pending_state(|state| {
state.bounds = size.into();
}),
_ => {}
}
}
pub fn is_activated(&self) -> bool {
match self {
CosmicSurface::Wayland(window) => window

View file

@ -90,6 +90,7 @@ impl FloatingLayout {
let layers = layer_map_for_output(&output);
let geometry = layers.non_exclusive_zone();
mapped.set_bounds(geometry.size);
let last_geometry = mapped.last_geometry.lock().unwrap().clone();
if let Some(size) = last_geometry.map(|g| g.size) {

View file

@ -322,6 +322,7 @@ impl TilingLayout {
) {
let output = seat.active_output();
window.output_enter(&output, window.bbox());
window.set_bounds(output.geometry().size);
self.map_internal(window, &output, Some(focus_stack));
self.refresh();
}