floating: animation fixes
This commit is contained in:
parent
7988be12a5
commit
befcdadf88
1 changed files with 38 additions and 19 deletions
|
|
@ -354,13 +354,26 @@ impl FloatingLayout {
|
||||||
mapped.moved_since_mapped.store(true, Ordering::SeqCst);
|
mapped.moved_since_mapped.store(true, Ordering::SeqCst);
|
||||||
|
|
||||||
if animate {
|
if animate {
|
||||||
self.animations.insert(
|
if let Some(existing_anim) = self.animations.get_mut(&mapped) {
|
||||||
mapped.clone(),
|
match existing_anim {
|
||||||
Animation::Tiled {
|
Animation::Unminimize {
|
||||||
start: Instant::now(),
|
target_geometry, ..
|
||||||
previous_geometry,
|
} => {
|
||||||
},
|
*target_geometry = geometry;
|
||||||
);
|
}
|
||||||
|
Animation::Minimize { .. } | Animation::Tiled { .. } => {}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self.animations.insert(
|
||||||
|
mapped.clone(),
|
||||||
|
Animation::Tiled {
|
||||||
|
start: Instant::now(),
|
||||||
|
previous_geometry,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self.animations.remove(&mapped);
|
||||||
}
|
}
|
||||||
if mapped.floating_tiled.lock().unwrap().take().is_some() {
|
if mapped.floating_tiled.lock().unwrap().take().is_some() {
|
||||||
if let Some(state) = mapped.maximized_state.lock().unwrap().as_mut() {
|
if let Some(state) = mapped.maximized_state.lock().unwrap().as_mut() {
|
||||||
|
|
@ -631,11 +644,28 @@ impl FloatingLayout {
|
||||||
window: &CosmicMapped,
|
window: &CosmicMapped,
|
||||||
to: Option<Rectangle<i32, Local>>,
|
to: Option<Rectangle<i32, Local>>,
|
||||||
) -> Option<Rectangle<i32, Local>> {
|
) -> Option<Rectangle<i32, Local>> {
|
||||||
let _ = self.animations.remove(window);
|
|
||||||
let Some(mut mapped_geometry) = self.space.element_geometry(window).map(RectExt::as_local)
|
let Some(mut mapped_geometry) = self.space.element_geometry(window).map(RectExt::as_local)
|
||||||
else {
|
else {
|
||||||
return None;
|
return None;
|
||||||
};
|
};
|
||||||
|
let _ = self.animations.remove(window);
|
||||||
|
|
||||||
|
if let Some(to) = to {
|
||||||
|
self.animations.insert(
|
||||||
|
window.clone(),
|
||||||
|
Animation::Minimize {
|
||||||
|
start: Instant::now(),
|
||||||
|
previous_geometry: if window.is_maximized(false) {
|
||||||
|
let output = self.space.outputs().next().unwrap();
|
||||||
|
let layers = layer_map_for_output(output);
|
||||||
|
layers.non_exclusive_zone().as_local()
|
||||||
|
} else {
|
||||||
|
mapped_geometry
|
||||||
|
},
|
||||||
|
target_geometry: to,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(_) = window.floating_tiled.lock().unwrap().take() {
|
if let Some(_) = window.floating_tiled.lock().unwrap().take() {
|
||||||
if let Some(last_size) = window.last_geometry.lock().unwrap().map(|geo| geo.size) {
|
if let Some(last_size) = window.last_geometry.lock().unwrap().map(|geo| geo.size) {
|
||||||
|
|
@ -652,17 +682,6 @@ impl FloatingLayout {
|
||||||
*window.last_geometry.lock().unwrap() = Some(mapped_geometry);
|
*window.last_geometry.lock().unwrap() = Some(mapped_geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(to) = to {
|
|
||||||
self.animations.insert(
|
|
||||||
window.clone(),
|
|
||||||
Animation::Minimize {
|
|
||||||
start: Instant::now(),
|
|
||||||
previous_geometry: mapped_geometry,
|
|
||||||
target_geometry: to,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
self.space.unmap_elem(&window);
|
self.space.unmap_elem(&window);
|
||||||
if let Some(pos) = self.spawn_order.iter().position(|w| w == window) {
|
if let Some(pos) = self.spawn_order.iter().position(|w| w == window) {
|
||||||
self.spawn_order.truncate(pos);
|
self.spawn_order.truncate(pos);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue