view: remember floating dimesions

When a floating view is returned to the layout or made fullscreen, it
now saves the dimesions it had while floating and returns to that same
position/size if made to float again.
This commit is contained in:
Isaac Freund 2020-07-31 20:22:37 +02:00
parent d6823fe3a0
commit d2ebd5e4e2
No known key found for this signature in database
GPG key ID: 86DED400DDFD7A11
2 changed files with 10 additions and 1 deletions

View file

@ -41,10 +41,15 @@ pub fn toggleFloat(
view.pending.float = !view.pending.float;
// If switching from layout to float, restore the previous floating dimensions
if (view.pending.float) {
// If switching from layout to float, restore the previous floating
// dimensions.
view.pending.box = view.float_box;
view.configure();
} else {
// If switching from float to layout save the floating dimensions
// for next time.
view.float_box = view.current.box;
}
view.output.root.arrange();

View file

@ -41,6 +41,10 @@ pub fn toggleFullscreen(
view.setFullscreen(!view.pending.fullscreen);
if (view.pending.fullscreen) {
// If transitioning from float -> fullscreen, save the floating
// dimensions.
if (view.pending.float) view.float_box = view.current.box;
const output = view.output;
view.pending.box = Box.fromWlrBox(
c.wlr_output_layout_get_box(output.root.wlr_output_layout, output.wlr_output).*,