aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/layout/mod.rs37
-rw-r--r--src/tests/fullscreen.rs41
2 files changed, 50 insertions, 28 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index 79da17b5..134c9643 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -3838,11 +3838,19 @@ impl<W: LayoutElement> Layout<W> {
// in the middle of interactive_move_update() and the confusion that causes.
self.interactive_move = None;
+ // Unset fullscreen before removing the tile. This will restore its size properly,
+ // and move it to floating if needed, so we don't have to deal with that here.
+ let ws = self
+ .workspaces_mut()
+ .find(|ws| ws.has_window(&window_id))
+ .unwrap();
+ ws.set_fullscreen(window, false);
+
let RemovedTile {
mut tile,
width,
is_full_width,
- mut is_floating,
+ is_floating,
} = self.remove_window(window, Transaction::new()).unwrap();
tile.stop_move_animations();
@@ -3861,33 +3869,6 @@ impl<W: LayoutElement> Layout<W> {
.adjusted_for_scale(scale);
tile.update_config(view_size, scale, Rc::new(options));
- // Unfullscreen.
- let floating_size = tile.floating_window_size;
- let unfullscreen_to_floating = tile.unfullscreen_to_floating;
- let win = tile.window_mut();
- if win.is_pending_fullscreen() {
- // If we're unfullscreening to floating, use the stored floating size,
- // otherwise use (0, 0).
- let mut size = if unfullscreen_to_floating {
- floating_size.unwrap_or_default()
- } else {
- Size::from((0, 0))
- };
-
- // Apply min/max size window rules. If requesting a concrete size, apply
- // completely; if requesting (0, 0), apply only when min/max results in a fixed
- // size.
- let min_size = win.min_size();
- let max_size = win.max_size();
- size.w = ensure_min_max_size_maybe_zero(size.w, min_size.w, max_size.w);
- size.h = ensure_min_max_size_maybe_zero(size.h, min_size.h, max_size.h);
-
- win.request_size_once(size, true);
-
- // If we're unfullscreening to floating, default to the floating layout.
- is_floating = unfullscreen_to_floating;
- }
-
if is_floating {
// Unlock the view in case we locked it moving a fullscreen window that is
// going to unfullscreen to floating.
diff --git a/src/tests/fullscreen.rs b/src/tests/fullscreen.rs
index f9391ce5..b10a7821 100644
--- a/src/tests/fullscreen.rs
+++ b/src/tests/fullscreen.rs
@@ -1,5 +1,6 @@
use client::ClientId;
use insta::assert_snapshot;
+use smithay::utils::Point;
use wayland_client::protocol::wl_surface::WlSurface;
use super::*;
@@ -214,3 +215,43 @@ fn unfullscreen_before_fullscreen_ack_doesnt_prevent_view_offset_save_restore()
// The view position should restore to the first window.
assert_snapshot!(f.niri().layout.active_workspace().unwrap().scrolling().view_pos(), @"-16");
}
+
+#[test]
+fn interactive_move_unfullscreen_to_scrolling_restores_size() {
+ let (mut f, id, surface) = set_up();
+
+ let _ = f.client(id).window(&surface).recent_configures();
+
+ let niri = f.niri();
+ let mapped = niri.layout.windows().next().unwrap().1;
+ let window = mapped.window.clone();
+ niri.layout.set_fullscreen(&window, true);
+ f.double_roundtrip(id);
+
+ // This should request a fullscreen size.
+ assert_snapshot!(
+ f.client(id).window(&surface).format_recent_configures(),
+ @"size: 1920 × 1080, bounds: 1888 × 1048, states: [Activated, Fullscreen]"
+ );
+
+ // Start an interactive move which causes an unfullscreen.
+ let output = f.niri_output(1);
+ let niri = f.niri();
+ let mapped = niri.layout.windows().next().unwrap().1;
+ let window = mapped.window.clone();
+ niri.layout
+ .interactive_move_begin(window.clone(), &output, Point::default());
+ niri.layout.interactive_move_update(
+ &window,
+ Point::from((1000., 0.)),
+ output,
+ Point::default(),
+ );
+ f.double_roundtrip(id);
+
+ // This should request the tiled size.
+ assert_snapshot!(
+ f.client(id).window(&surface).format_recent_configures(),
+ @"size: 936 × 1048, bounds: 1920 × 1080, states: [Activated]"
+ );
+}