floating: Restore size of moved maximized windows correctly
This commit is contained in:
parent
d6434d322e
commit
5b7efa3a8b
5 changed files with 47 additions and 2 deletions
|
|
@ -370,6 +370,14 @@ impl CosmicMapped {
|
||||||
window.is_activated(pending)
|
window.is_activated(pending)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn pending_size(&self) -> Option<Size<i32, Logical>> {
|
||||||
|
match &self.element {
|
||||||
|
CosmicMappedInternal::Stack(s) => s.pending_size(),
|
||||||
|
CosmicMappedInternal::Window(w) => w.pending_size(),
|
||||||
|
_ => unreachable!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_geometry(&self, geo: Rectangle<i32, Global>) {
|
pub fn set_geometry(&self, geo: Rectangle<i32, Global>) {
|
||||||
match &self.element {
|
match &self.element {
|
||||||
CosmicMappedInternal::Stack(s) => s.set_geometry(geo),
|
CosmicMappedInternal::Stack(s) => s.set_geometry(geo),
|
||||||
|
|
|
||||||
|
|
@ -408,6 +408,16 @@ impl CosmicStack {
|
||||||
Point::from((0, TAB_HEIGHT))
|
Point::from((0, TAB_HEIGHT))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn pending_size(&self) -> Option<Size<i32, Logical>> {
|
||||||
|
self.0.with_program(|p| {
|
||||||
|
p.geometry
|
||||||
|
.lock()
|
||||||
|
.unwrap()
|
||||||
|
.clone()
|
||||||
|
.map(|geo| geo.size.as_logical())
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_geometry(&self, geo: Rectangle<i32, Global>) {
|
pub fn set_geometry(&self, geo: Rectangle<i32, Global>) {
|
||||||
self.0.with_program(|p| {
|
self.0.with_program(|p| {
|
||||||
let loc = (geo.loc.x, geo.loc.y + TAB_HEIGHT);
|
let loc = (geo.loc.x, geo.loc.y + TAB_HEIGHT);
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,16 @@ impl CosmicSurface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn pending_size(&self) -> Option<Size<i32, Logical>> {
|
||||||
|
match self {
|
||||||
|
CosmicSurface::Wayland(window) => {
|
||||||
|
window.toplevel().with_pending_state(|state| state.size)
|
||||||
|
}
|
||||||
|
CosmicSurface::X11(surface) => Some(surface.geometry().size),
|
||||||
|
_ => unreachable!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_geometry(&self, geo: Rectangle<i32, Global>) {
|
pub fn set_geometry(&self, geo: Rectangle<i32, Global>) {
|
||||||
match self {
|
match self {
|
||||||
CosmicSurface::Wayland(window) => window
|
CosmicSurface::Wayland(window) => window
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,16 @@ impl CosmicWindow {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn pending_size(&self) -> Option<Size<i32, Logical>> {
|
||||||
|
self.0.with_program(|p| {
|
||||||
|
let mut size = p.window.pending_size()?;
|
||||||
|
if p.has_ssd(true) {
|
||||||
|
size.h += SSD_HEIGHT;
|
||||||
|
}
|
||||||
|
Some(size)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_geometry(&self, geo: Rectangle<i32, Global>) {
|
pub fn set_geometry(&self, geo: Rectangle<i32, Global>) {
|
||||||
self.0.with_program(|p| {
|
self.0.with_program(|p| {
|
||||||
let loc = (
|
let loc = (
|
||||||
|
|
|
||||||
|
|
@ -157,8 +157,15 @@ impl FloatingLayout {
|
||||||
pub fn unmap(&mut self, window: &CosmicMapped) -> bool {
|
pub fn unmap(&mut self, window: &CosmicMapped) -> bool {
|
||||||
if !window.is_maximized(true) || !window.is_fullscreen(true) {
|
if !window.is_maximized(true) || !window.is_fullscreen(true) {
|
||||||
if let Some(location) = self.space.element_location(window) {
|
if let Some(location) = self.space.element_location(window) {
|
||||||
*window.last_geometry.lock().unwrap() =
|
*window.last_geometry.lock().unwrap() = Some(
|
||||||
Some(Rectangle::from_loc_and_size(location, window.geometry().size).as_local());
|
Rectangle::from_loc_and_size(
|
||||||
|
location,
|
||||||
|
window
|
||||||
|
.pending_size()
|
||||||
|
.unwrap_or_else(|| window.geometry().size),
|
||||||
|
)
|
||||||
|
.as_local(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue