Fix unfullscreening not always updating view offset

This commit is contained in:
Ivan Molodetskikh
2023-12-28 10:49:31 +04:00
parent 249f2b7a21
commit 2d16c04869
2 changed files with 17 additions and 5 deletions
+7 -5
View File
@@ -54,6 +54,13 @@ impl<W: LayoutElement> Tile<W> {
self.options = options;
}
pub fn update_window(&mut self) {
// FIXME: remove when we can get a fullscreen size right away.
if self.fullscreen_size != Size::from((0, 0)) {
self.is_fullscreen = self.window.is_fullscreen();
}
}
pub fn advance_animations(&mut self, _current_time: Duration, is_active: bool) {
let width = self.border.width();
self.border.update(
@@ -62,11 +69,6 @@ impl<W: LayoutElement> Tile<W> {
self.window.has_ssd(),
);
self.border.set_active(is_active);
// FIXME: remove when we can get a fullscreen size right away.
if self.fullscreen_size != Size::from((0, 0)) {
self.is_fullscreen = self.window.is_fullscreen();
}
}
pub fn window(&self) -> &W {
+10
View File
@@ -569,6 +569,7 @@ impl<W: LayoutElement> Workspace<W> {
.enumerate()
.find(|(_, col)| col.contains(window))
.unwrap();
column.update_window(window);
column.update_tile_sizes();
if idx == self.active_column_idx {
@@ -1080,6 +1081,15 @@ impl<W: LayoutElement> Column<W> {
self.update_tile_sizes();
}
fn update_window(&mut self, window: &W) {
let tile = self
.tiles
.iter_mut()
.find(|tile| tile.window() == window)
.unwrap();
tile.update_window();
}
fn update_tile_sizes(&mut self) {
if self.is_fullscreen {
self.tiles[0].request_fullscreen(self.view_size);