floating: Update stored size only on removal
Browse files at this commite409453fbd49a30e2059271b78567b430dc5800aParent: 309bf132 changed files +11 -18
- src/layout/floating.rs +4 -11
- src/layout/mod.rs +7 -7
src/layout/floating.rsmodified+4 -11
| @@ -465,7 +465,7 @@ impl<W: LayoutElement> FloatingSpace<W> { | |||
| 465 | } | 465 | } |
| 466 | 466 | ||
| 467 | fn remove_tile_by_idx(&mut self, idx: usize) -> RemovedTile<W> { | 467 | fn remove_tile_by_idx(&mut self, idx: usize) -> RemovedTile<W> { |
| 468 | - let tile = self.tiles.remove(idx); | 468 | + let mut tile = self.tiles.remove(idx); |
| 469 | self.data.remove(idx); | 469 | self.data.remove(idx); |
| 470 | 470 | ||
| 471 | if self.tiles.is_empty() { | 471 | if self.tiles.is_empty() { |
| @@ -482,6 +482,9 @@ impl<W: LayoutElement> FloatingSpace<W> { | |||
| 482 | } | 482 | } |
| 483 | } | 483 | } |
| 484 | 484 | ||
| 485 | + // Store the floating size. | ||
| 486 | + tile.set_floating_window_size(tile.window().expected_size()); | ||
| 487 | + | ||
| 485 | let width = ColumnWidth::Fixed(tile.window_size().w); | 488 | let width = ColumnWidth::Fixed(tile.window_size().w); |
| 486 | RemovedTile { | 489 | RemovedTile { |
| 487 | tile, | 490 | tile, |
| @@ -602,9 +605,6 @@ impl<W: LayoutElement> FloatingSpace<W> { | |||
| 602 | 605 | ||
| 603 | let win_size = Size::from((win_width, win_height)); | 606 | let win_size = Size::from((win_width, win_height)); |
| 604 | win.request_size_once(win_size, animate); | 607 | win.request_size_once(win_size, animate); |
| 605 | - | ||
| 606 | - // Store it right away so pending resizes are not lost when moving across floating spaces. | ||
| 607 | - tile.set_floating_window_size(win_size); | ||
| 608 | } | 608 | } |
| 609 | 609 | ||
| 610 | pub fn set_window_height(&mut self, id: Option<&W::Id>, change: SizeChange, animate: bool) { | 610 | pub fn set_window_height(&mut self, id: Option<&W::Id>, change: SizeChange, animate: bool) { |
| @@ -631,9 +631,6 @@ impl<W: LayoutElement> FloatingSpace<W> { | |||
| 631 | 631 | ||
| 632 | let win_size = Size::from((win_width, win_height)); | 632 | let win_size = Size::from((win_width, win_height)); |
| 633 | win.request_size_once(win_size, animate); | 633 | win.request_size_once(win_size, animate); |
| 634 | - | ||
| 635 | - // Store it right away so pending resizes are not lost when moving across floating spaces. | ||
| 636 | - tile.set_floating_window_size(win_size); | ||
| 637 | } | 634 | } |
| 638 | 635 | ||
| 639 | fn focus_directional( | 636 | fn focus_directional( |
| @@ -762,10 +759,6 @@ impl<W: LayoutElement> FloatingSpace<W> { | |||
| 762 | tile.update_window(); | 759 | tile.update_window(); |
| 763 | data.update(tile); | 760 | data.update(tile); |
| 764 | 761 | ||
| 765 | - // Update the stored floating window size. | ||
| 766 | - let floating_size = tile.window().expected_size(); | ||
| 767 | - tile.set_floating_window_size(floating_size); | ||
| 768 | - | ||
| 769 | // When resizing by top/left edge, update the position accordingly. | 762 | // When resizing by top/left edge, update the position accordingly. |
| 770 | if let Some(resize) = resize { | 763 | if let Some(resize) = resize { |
| 771 | let mut offset = Point::from((0., 0.)); | 764 | let mut offset = Point::from((0., 0.)); |
src/layout/mod.rsmodified+7 -7
| @@ -1164,12 +1164,6 @@ impl<W: LayoutElement> Layout<W> { | |||
| 1164 | if let Some(InteractiveMoveState::Moving(move_)) = &mut self.interactive_move { | 1164 | if let Some(InteractiveMoveState::Moving(move_)) = &mut self.interactive_move { |
| 1165 | if move_.tile.window().id() == window { | 1165 | if move_.tile.window().id() == window { |
| 1166 | move_.tile.update_window(); | 1166 | move_.tile.update_window(); |
| 1167 | - | ||
| 1168 | - // Update the floating size in case the window resizes itself during an interactive | ||
| 1169 | - // move. | ||
| 1170 | - let floating_size = move_.tile.window().expected_size(); | ||
| 1171 | - move_.tile.set_floating_window_size(floating_size); | ||
| 1172 | - | ||
| 1173 | return; | 1167 | return; |
| 1174 | } | 1168 | } |
| 1175 | } | 1169 | } |
| @@ -3464,7 +3458,13 @@ impl<W: LayoutElement> Layout<W> { | |||
| 3464 | } | 3458 | } |
| 3465 | InsertPosition::Floating => { | 3459 | InsertPosition::Floating => { |
| 3466 | let pos = move_.tile_render_location() - offset; | 3460 | let pos = move_.tile_render_location() - offset; |
| 3467 | - mon.add_floating_tile(ws_idx, move_.tile, Some(pos), true); | 3461 | + |
| 3462 | + // Set the floating size so it takes into account any window resizing that | ||
| 3463 | + // took place during the move. | ||
| 3464 | + let mut tile = move_.tile; | ||
| 3465 | + tile.set_floating_window_size(tile.window().expected_size()); | ||
| 3466 | + | ||
| 3467 | + mon.add_floating_tile(ws_idx, tile, Some(pos), true); | ||
| 3468 | } | 3468 | } |
| 3469 | } | 3469 | } |
| 3470 | 3470 | ||