layout: Preserve the Tile when moving across workspaces
Browse files at this commit76a56352980fc9a646034c45e6f02093cc72fdb6Parent: f4f2a1f2 changed files +42 -24
- src/layout/floating.rs +6 -0
- src/layout/monitor.rs +36 -24
src/layout/floating.rsmodified+6 -0
| @@ -606,6 +606,9 @@ impl<W: LayoutElement> FloatingSpace<W> { | |||
| 606 | 606 | ||
| 607 | let win_size = Size::from((win_width, win_height)); | 607 | let win_size = Size::from((win_width, win_height)); |
| 608 | win.request_size_once(win_size, animate); | 608 | win.request_size_once(win_size, animate); |
| 609 | + | ||
| 610 | + // Store it right away so pending resizes are not lost when moving across floating spaces. | ||
| 611 | + tile.set_floating_window_size(win_size); | ||
| 609 | } | 612 | } |
| 610 | 613 | ||
| 611 | pub fn set_window_height(&mut self, id: Option<&W::Id>, change: SizeChange, animate: bool) { | 614 | pub fn set_window_height(&mut self, id: Option<&W::Id>, change: SizeChange, animate: bool) { |
| @@ -636,6 +639,9 @@ impl<W: LayoutElement> FloatingSpace<W> { | |||
| 636 | 639 | ||
| 637 | let win_size = Size::from((win_width, win_height)); | 640 | let win_size = Size::from((win_width, win_height)); |
| 638 | win.request_size_once(win_size, animate); | 641 | win.request_size_once(win_size, animate); |
| 642 | + | ||
| 643 | + // Store it right away so pending resizes are not lost when moving across floating spaces. | ||
| 644 | + tile.set_floating_window_size(win_size); | ||
| 639 | } | 645 | } |
| 640 | 646 | ||
| 641 | fn focus_directional( | 647 | fn focus_directional( |
src/layout/monitor.rsmodified+36 -24
| @@ -530,14 +530,18 @@ impl<W: LayoutElement> Monitor<W> { | |||
| 530 | return; | 530 | return; |
| 531 | }; | 531 | }; |
| 532 | 532 | ||
| 533 | - self.add_window( | 533 | + if removed.is_floating { |
| 534 | - new_idx, | 534 | + self.add_floating_tile(new_idx, removed.tile, None, true); |
| 535 | - removed.tile.into_window(), | 535 | + } else { |
| 536 | - true, | 536 | + self.add_tile( |
| 537 | - removed.width, | 537 | + new_idx, |
| 538 | - removed.is_full_width, | 538 | + None, |
| 539 | - removed.is_floating, | 539 | + removed.tile, |
| 540 | - ); | 540 | + true, |
| 541 | + removed.width, | ||
| 542 | + removed.is_full_width, | ||
| 543 | + ); | ||
| 544 | + } | ||
| 541 | } | 545 | } |
| 542 | 546 | ||
| 543 | pub fn move_to_workspace_down(&mut self) { | 547 | pub fn move_to_workspace_down(&mut self) { |
| @@ -553,14 +557,18 @@ impl<W: LayoutElement> Monitor<W> { | |||
| 553 | return; | 557 | return; |
| 554 | }; | 558 | }; |
| 555 | 559 | ||
| 556 | - self.add_window( | 560 | + if removed.is_floating { |
| 557 | - new_idx, | 561 | + self.add_floating_tile(new_idx, removed.tile, None, true); |
| 558 | - removed.tile.into_window(), | 562 | + } else { |
| 559 | - true, | 563 | + self.add_tile( |
| 560 | - removed.width, | 564 | + new_idx, |
| 561 | - removed.is_full_width, | 565 | + None, |
| 562 | - removed.is_floating, | 566 | + removed.tile, |
| 563 | - ); | 567 | + true, |
| 568 | + removed.width, | ||
| 569 | + removed.is_full_width, | ||
| 570 | + ); | ||
| 571 | + } | ||
| 564 | } | 572 | } |
| 565 | 573 | ||
| 566 | pub fn move_to_workspace(&mut self, window: Option<&W::Id>, idx: usize) { | 574 | pub fn move_to_workspace(&mut self, window: Option<&W::Id>, idx: usize) { |
| @@ -592,14 +600,18 @@ impl<W: LayoutElement> Monitor<W> { | |||
| 592 | return; | 600 | return; |
| 593 | }; | 601 | }; |
| 594 | 602 | ||
| 595 | - self.add_window( | 603 | + if removed.is_floating { |
| 596 | - new_idx, | 604 | + self.add_floating_tile(new_idx, removed.tile, None, activate); |
| 597 | - removed.tile.into_window(), | 605 | + } else { |
| 598 | - activate, | 606 | + self.add_tile( |
| 599 | - removed.width, | 607 | + new_idx, |
| 600 | - removed.is_full_width, | 608 | + None, |
| 601 | - removed.is_floating, | 609 | + removed.tile, |
| 602 | - ); | 610 | + activate, |
| 611 | + removed.width, | ||
| 612 | + removed.is_full_width, | ||
| 613 | + ); | ||
| 614 | + } | ||
| 603 | 615 | ||
| 604 | if self.workspace_switch.is_none() { | 616 | if self.workspace_switch.is_none() { |
| 605 | self.clean_up_workspaces(); | 617 | self.clean_up_workspaces(); |