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:
parent
d6823fe3a0
commit
d2ebd5e4e2
2 changed files with 10 additions and 1 deletions
|
@ -41,10 +41,15 @@ pub fn toggleFloat(
|
||||||
|
|
||||||
view.pending.float = !view.pending.float;
|
view.pending.float = !view.pending.float;
|
||||||
|
|
||||||
// If switching from layout to float, restore the previous floating dimensions
|
|
||||||
if (view.pending.float) {
|
if (view.pending.float) {
|
||||||
|
// If switching from layout to float, restore the previous floating
|
||||||
|
// dimensions.
|
||||||
view.pending.box = view.float_box;
|
view.pending.box = view.float_box;
|
||||||
view.configure();
|
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.output.root.arrange();
|
||||||
|
|
|
@ -41,6 +41,10 @@ pub fn toggleFullscreen(
|
||||||
view.setFullscreen(!view.pending.fullscreen);
|
view.setFullscreen(!view.pending.fullscreen);
|
||||||
|
|
||||||
if (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;
|
const output = view.output;
|
||||||
view.pending.box = Box.fromWlrBox(
|
view.pending.box = Box.fromWlrBox(
|
||||||
c.wlr_output_layout_get_box(output.root.wlr_output_layout, output.wlr_output).*,
|
c.wlr_output_layout_get_box(output.root.wlr_output_layout, output.wlr_output).*,
|
||||||
|
|
Loading…
Reference in a new issue