diff options
| author | Isaac Freund <ifreund@ifreund.xyz> | 2020-07-31 20:22:37 +0200 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2020-07-31 20:22:37 +0200 |
| commit | d2ebd5e4e28c88efaf3afcba64cc83261100043a (patch) | |
| tree | 09e703e579021feb9035a9e974b9dc06dd9550f1 | |
| parent | d6823fe3a08431b097b6f95ed8758185725899ad (diff) | |
| download | river-d2ebd5e4e28c88efaf3afcba64cc83261100043a.tar.gz river-d2ebd5e4e28c88efaf3afcba64cc83261100043a.tar.xz | |
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.
| -rw-r--r-- | river/command/toggle_float.zig | 7 | ||||
| -rw-r--r-- | river/command/toggle_fullscreen.zig | 4 |
2 files changed, 10 insertions, 1 deletions
diff --git a/river/command/toggle_float.zig b/river/command/toggle_float.zig index 8f57454..ac33d45 100644 --- a/river/command/toggle_float.zig +++ b/river/command/toggle_float.zig @@ -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(); diff --git a/river/command/toggle_fullscreen.zig b/river/command/toggle_fullscreen.zig index 6e2ac2d..92f99f3 100644 --- a/river/command/toggle_fullscreen.zig +++ b/river/command/toggle_fullscreen.zig @@ -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).*, |
