refactor(shell/element): refactor how decorations height is accessed

This fixes several things:
- The xwayland code previously incorrectly used the SSD_HEIGHT (for Windows) even when the X11 surface was in a stack
- The SSD_HEIGHT was defined in surface.rs, even though rendering serverside decorations is done in the window/stack

Rename (min|max)_size to (min|max)_size_without_ssd in CosmicSurface and make it act accordingly
Add a new (min|max)_size() in CosmicWindow and CosmicStack, which takes the surface's (min|max)_size and adds the decorations.
Change all callers to use (min|max)_size() from the window or stack respectively, except is_dialog() where it does not matter.
This commit is contained in:
Yureka 2024-12-25 14:11:22 +01:00 committed by Victoria Brekenfeld
parent 1118aa2877
commit 9b78a2d780
6 changed files with 103 additions and 80 deletions

View file

@ -2,10 +2,7 @@ use std::{ffi::OsString, os::unix::io::OwnedFd, process::Stdio};
use crate::{
backend::render::cursor::{load_cursor_theme, Cursor},
shell::{
element::surface::SSD_HEIGHT, focus::target::KeyboardFocusTarget, grabs::ReleaseMode,
CosmicSurface, Shell,
},
shell::{focus::target::KeyboardFocusTarget, grabs::ReleaseMode, CosmicSurface, Shell},
state::State,
utils::prelude::*,
wayland::handlers::{
@ -473,7 +470,7 @@ impl XwmHandler for State {
};
if let Some(current_geo) = current_geo {
let ssd_height = if window.is_decorated() { 0 } else { SSD_HEIGHT };
let ssd_height = mapped.ssd_height(false).unwrap_or(0);
mapped.set_geometry(Rectangle::from_loc_and_size(
current_geo.loc,
(