Settle hidden window presentation on workspace return
This commit is contained in:
1 parent
c73d11b2c9
commit
a840db5946
2 files changed
+28
No files matched your search
@@ -1473,6 +1473,7 @@ impl Ferese {
|
||||
for (window, id, rect, is_fullscreen, is_maximized, is_floating, scrolling, couple_width) in
|
||||
placements
|
||||
{
|
||||
let was_mapped = self.space.element_location(&window).is_some();
|
||||
// A viewport-coupled width must never override fullscreen/floating geometry.
|
||||
if scrolling.is_none() {
|
||||
self.viewport_coupled_widths.remove(&id);
|
||||
@@ -1493,6 +1494,9 @@ impl Ferese {
|
||||
};
|
||||
layout_changed |= !had_geometry || geometry.logical != rect;
|
||||
let mut requested_size = geometry.set_presentation_mode(rect, mode, now);
|
||||
if !was_mapped && (had_geometry || is_fullscreen) {
|
||||
geometry.settle_presentation();
|
||||
}
|
||||
if !self.animations_enabled {
|
||||
geometry.advance(Duration::ZERO, self.spring_config, false);
|
||||
requested_size = geometry.presentation_size_request(now).or(requested_size);
|
||||
|
||||
@@ -396,6 +396,13 @@ impl WindowGeometry {
|
||||
self.mode == PresentationMode::Fullscreen
|
||||
}
|
||||
|
||||
pub fn settle_presentation(&mut self) {
|
||||
self.visual.snap();
|
||||
self.zoom = None;
|
||||
self.decorations = if self.is_fullscreen() { 0.0 } else { 1.0 };
|
||||
self.presentation_changed = true;
|
||||
}
|
||||
|
||||
pub fn follow_pointer(&mut self, rect: Rect, now: Duration) -> Option<ClientSize> {
|
||||
self.zoom = None;
|
||||
let requested_size = self.set_logical_target(rect, now);
|
||||
@@ -573,6 +580,23 @@ fn finite_or(value: f64, fallback: f64) -> f64 {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn returning_fullscreen_window_does_not_resume_hidden_zoom() {
|
||||
let normal = Rect::new(100.0, 50.0, 900.0, 700.0);
|
||||
let fullscreen = Rect::new(0.0, 0.0, 1920.0, 1080.0);
|
||||
let mut geometry = WindowGeometry::new(normal, None);
|
||||
geometry.set_presentation_mode(fullscreen, PresentationMode::Fullscreen, Duration::ZERO);
|
||||
geometry.advance(Duration::from_millis(16), SpringConfig::default(), true);
|
||||
assert!(geometry.is_zooming());
|
||||
|
||||
geometry.settle_presentation();
|
||||
|
||||
assert_eq!(geometry.visual.current, fullscreen);
|
||||
assert_eq!(geometry.decorations, 0.0);
|
||||
assert!(!geometry.is_zooming());
|
||||
assert!(!geometry.advance(Duration::from_millis(16), SpringConfig::default(), true));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn maximized_zoom_keeps_decorations_and_restores_through_fullscreen() {
|
||||
let normal = Rect::new(800.0, 50.0, 600.0, 700.0);
|
||||
|
||||
Reference in new issue
Block a user