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:
parent
1118aa2877
commit
9b78a2d780
6 changed files with 103 additions and 80 deletions
|
|
@ -55,10 +55,10 @@ use std::{
|
|||
};
|
||||
use wayland_backend::server::ObjectId;
|
||||
|
||||
use super::{
|
||||
surface::{RESIZE_BORDER, SSD_HEIGHT},
|
||||
CosmicSurface,
|
||||
};
|
||||
use super::CosmicSurface;
|
||||
|
||||
pub const SSD_HEIGHT: i32 = 36;
|
||||
pub const RESIZE_BORDER: i32 = 10;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Hash)]
|
||||
pub struct CosmicWindow(pub(super) IcedElement<CosmicWindowInternal>);
|
||||
|
|
@ -386,6 +386,29 @@ impl CosmicWindow {
|
|||
pub(crate) fn force_redraw(&self) {
|
||||
self.0.force_redraw();
|
||||
}
|
||||
|
||||
pub fn min_size(&self) -> Option<Size<i32, Logical>> {
|
||||
self.0
|
||||
.with_program(|p| p.window.min_size_without_ssd())
|
||||
.map(|size| {
|
||||
if self.0.with_program(|p| !p.window.is_decorated(false)) {
|
||||
size + (0, SSD_HEIGHT).into()
|
||||
} else {
|
||||
size
|
||||
}
|
||||
})
|
||||
}
|
||||
pub fn max_size(&self) -> Option<Size<i32, Logical>> {
|
||||
self.0
|
||||
.with_program(|p| p.window.max_size_without_ssd())
|
||||
.map(|size| {
|
||||
if self.0.with_program(|p| !p.window.is_decorated(false)) {
|
||||
size + (0, SSD_HEIGHT).into()
|
||||
} else {
|
||||
size
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue