layout/tile: Don't take fullscreen into account in min/max size
Browse files at this commit6a80ec4704b767483866eec41f9f08432991c35aParent: e8b15862 changed files +18 -8
- src/layout/scrolling.rs +8 -4
- src/layout/tile.rs +10 -4
src/layout/scrolling.rsmodified+8 -4
| @@ -4018,14 +4018,18 @@ impl<W: LayoutElement> Column<W> { | |||
| 4018 | let min_size: Vec<_> = self | 4018 | let min_size: Vec<_> = self |
| 4019 | .tiles | 4019 | .tiles |
| 4020 | .iter() | 4020 | .iter() |
| 4021 | - .map(Tile::min_size) | 4021 | + .map(Tile::min_size_nonfullscreen) |
| 4022 | .map(|mut size| { | 4022 | .map(|mut size| { |
| 4023 | size.w = size.w.max(1.); | 4023 | size.w = size.w.max(1.); |
| 4024 | size.h = size.h.max(1.); | 4024 | size.h = size.h.max(1.); |
| 4025 | size | 4025 | size |
| 4026 | }) | 4026 | }) |
| 4027 | .collect(); | 4027 | .collect(); |
| 4028 | - let max_size: Vec<_> = self.tiles.iter().map(Tile::max_size).collect(); | 4028 | + let max_size: Vec<_> = self |
| 4029 | + .tiles | ||
| 4030 | + .iter() | ||
| 4031 | + .map(Tile::max_size_nonfullscreen) | ||
| 4032 | + .collect(); | ||
| 4029 | 4033 | ||
| 4030 | // Compute the column width. | 4034 | // Compute the column width. |
| 4031 | let min_width = min_size | 4035 | let min_width = min_size |
| @@ -4517,7 +4521,7 @@ impl<W: LayoutElement> Column<W> { | |||
| 4517 | .iter() | 4521 | .iter() |
| 4518 | .enumerate() | 4522 | .enumerate() |
| 4519 | .filter(|(idx, _)| *idx != tile_idx) | 4523 | .filter(|(idx, _)| *idx != tile_idx) |
| 4520 | - .map(|(_, tile)| f64::max(1., tile.min_size().h) + gaps) | 4524 | + .map(|(_, tile)| f64::max(1., tile.min_size_nonfullscreen().h) + gaps) |
| 4521 | .sum::<f64>() | 4525 | .sum::<f64>() |
| 4522 | }; | 4526 | }; |
| 4523 | let height_left = working_size - extra_size - gaps - min_height_taken - gaps; | 4527 | let height_left = working_size - extra_size - gaps - min_height_taken - gaps; |
| @@ -4947,7 +4951,7 @@ impl<W: LayoutElement> Column<W> { | |||
| 4947 | let requested_size = tile.window().requested_size().unwrap(); | 4951 | let requested_size = tile.window().requested_size().unwrap(); |
| 4948 | let requested_tile_height = | 4952 | let requested_tile_height = |
| 4949 | tile.tile_height_for_window_height(f64::from(requested_size.h)); | 4953 | tile.tile_height_for_window_height(f64::from(requested_size.h)); |
| 4950 | - let min_tile_height = f64::max(1., tile.min_size().h); | 4954 | + let min_tile_height = f64::max(1., tile.min_size_nonfullscreen().h); |
| 4951 | 4955 | ||
| 4952 | if !self.is_fullscreen | 4956 | if !self.is_fullscreen |
| 4953 | && self.scale.round() == self.scale | 4957 | && self.scale.round() == self.scale |
src/layout/tile.rsmodified+10 -4
| @@ -758,10 +758,13 @@ impl<W: LayoutElement> Tile<W> { | |||
| 758 | .request_size(self.view_size.to_i32_round(), true, animate, transaction); | 758 | .request_size(self.view_size.to_i32_round(), true, animate, transaction); |
| 759 | } | 759 | } |
| 760 | 760 | ||
| 761 | - pub fn min_size(&self) -> Size<f64, Logical> { | 761 | + pub fn min_size_nonfullscreen(&self) -> Size<f64, Logical> { |
| 762 | let mut size = self.window.min_size().to_f64(); | 762 | let mut size = self.window.min_size().to_f64(); |
| 763 | 763 | ||
| 764 | - if let Some(width) = self.effective_border_width() { | 764 | + // Can't go through effective_border_width() because we might be fullscreen. |
| 765 | + if !self.border.is_off() { | ||
| 766 | + let width = self.border.width(); | ||
| 767 | + | ||
| 765 | size.w = f64::max(1., size.w); | 768 | size.w = f64::max(1., size.w); |
| 766 | size.h = f64::max(1., size.h); | 769 | size.h = f64::max(1., size.h); |
| 767 | 770 | ||
| @@ -772,10 +775,13 @@ impl<W: LayoutElement> Tile<W> { | |||
| 772 | size | 775 | size |
| 773 | } | 776 | } |
| 774 | 777 | ||
| 775 | - pub fn max_size(&self) -> Size<f64, Logical> { | 778 | + pub fn max_size_nonfullscreen(&self) -> Size<f64, Logical> { |
| 776 | let mut size = self.window.max_size().to_f64(); | 779 | let mut size = self.window.max_size().to_f64(); |
| 777 | 780 | ||
| 778 | - if let Some(width) = self.effective_border_width() { | 781 | + // Can't go through effective_border_width() because we might be fullscreen. |
| 782 | + if !self.border.is_off() { | ||
| 783 | + let width = self.border.width(); | ||
| 784 | + | ||
| 779 | if size.w > 0. { | 785 | if size.w > 0. { |
| 780 | size.w += width * 2.; | 786 | size.w += width * 2.; |
| 781 | } | 787 | } |