view: save and restore floating dimensions

When a floating view is fullscreened and returned to floating, it should
remember its previous floating size/position.
This commit is contained in:
Isaac Freund
2020-06-29 11:15:55 +02:00
parent 5474b656ee
commit c78d31acf4
5 changed files with 25 additions and 23 deletions

View File

@ -34,7 +34,7 @@ pub fn toggleFloat(
// Don't float fullscreen views
if (view.pending.fullscreen) return;
if (!view.pending.float) view.pending.box = view.getDefaultFloatBox();
if (!view.pending.float) view.pending.box = view.float_box;
view.pending.float = !view.pending.float;
view.output.root.arrange();
}

View File

@ -30,6 +30,9 @@ pub fn toggleFullscreen(
if (args.len > 1) return Error.TooManyArguments;
if (seat.focused_view) |view| {
// If transitionng from fullscreen -> float, return to the saved
// floating dimensions.
if (view.pending.fullscreen and view.pending.float) view.pending.box = view.float_box;
view.setFullscreen(!view.pending.fullscreen);
view.output.root.arrange();
}