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
|
|
@ -94,9 +94,6 @@ struct Sticky(AtomicBool);
|
|||
#[derive(Default)]
|
||||
struct GlobalGeometry(Mutex<Option<Rectangle<i32, Global>>>);
|
||||
|
||||
pub const SSD_HEIGHT: i32 = 36;
|
||||
pub const RESIZE_BORDER: i32 = 10;
|
||||
|
||||
impl CosmicSurface {
|
||||
pub fn title(&self) -> String {
|
||||
match self.0.underlying_surface() {
|
||||
|
|
@ -451,7 +448,7 @@ impl CosmicSurface {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn min_size(&self) -> Option<Size<i32, Logical>> {
|
||||
pub fn min_size_without_ssd(&self) -> Option<Size<i32, Logical>> {
|
||||
match self.0.underlying_surface() {
|
||||
WindowSurface::Wayland(toplevel) => {
|
||||
Some(with_states(toplevel.wl_surface(), |states| {
|
||||
|
|
@ -465,16 +462,9 @@ impl CosmicSurface {
|
|||
}
|
||||
WindowSurface::X11(surface) => surface.min_size(),
|
||||
}
|
||||
.map(|size| {
|
||||
if self.is_decorated(false) {
|
||||
size
|
||||
} else {
|
||||
size + (0, SSD_HEIGHT).into()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn max_size(&self) -> Option<Size<i32, Logical>> {
|
||||
pub fn max_size_without_ssd(&self) -> Option<Size<i32, Logical>> {
|
||||
match self.0.underlying_surface() {
|
||||
WindowSurface::Wayland(toplevel) => {
|
||||
Some(with_states(toplevel.wl_surface(), |states| {
|
||||
|
|
@ -488,13 +478,6 @@ impl CosmicSurface {
|
|||
}
|
||||
WindowSurface::X11(surface) => surface.max_size(),
|
||||
}
|
||||
.map(|size| {
|
||||
if self.is_decorated(false) {
|
||||
size
|
||||
} else {
|
||||
size + (0, SSD_HEIGHT).into()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn serial_acked(&self, serial: &Serial) -> bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue