mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
floating: Update stored size only on removal
This commit is contained in:
+4
-11
@@ -465,7 +465,7 @@ impl<W: LayoutElement> FloatingSpace<W> {
|
||||
}
|
||||
|
||||
fn remove_tile_by_idx(&mut self, idx: usize) -> RemovedTile<W> {
|
||||
let tile = self.tiles.remove(idx);
|
||||
let mut tile = self.tiles.remove(idx);
|
||||
self.data.remove(idx);
|
||||
|
||||
if self.tiles.is_empty() {
|
||||
@@ -482,6 +482,9 @@ impl<W: LayoutElement> FloatingSpace<W> {
|
||||
}
|
||||
}
|
||||
|
||||
// Store the floating size.
|
||||
tile.set_floating_window_size(tile.window().expected_size());
|
||||
|
||||
let width = ColumnWidth::Fixed(tile.window_size().w);
|
||||
RemovedTile {
|
||||
tile,
|
||||
@@ -602,9 +605,6 @@ impl<W: LayoutElement> FloatingSpace<W> {
|
||||
|
||||
let win_size = Size::from((win_width, win_height));
|
||||
win.request_size_once(win_size, animate);
|
||||
|
||||
// Store it right away so pending resizes are not lost when moving across floating spaces.
|
||||
tile.set_floating_window_size(win_size);
|
||||
}
|
||||
|
||||
pub fn set_window_height(&mut self, id: Option<&W::Id>, change: SizeChange, animate: bool) {
|
||||
@@ -631,9 +631,6 @@ impl<W: LayoutElement> FloatingSpace<W> {
|
||||
|
||||
let win_size = Size::from((win_width, win_height));
|
||||
win.request_size_once(win_size, animate);
|
||||
|
||||
// Store it right away so pending resizes are not lost when moving across floating spaces.
|
||||
tile.set_floating_window_size(win_size);
|
||||
}
|
||||
|
||||
fn focus_directional(
|
||||
@@ -762,10 +759,6 @@ impl<W: LayoutElement> FloatingSpace<W> {
|
||||
tile.update_window();
|
||||
data.update(tile);
|
||||
|
||||
// Update the stored floating window size.
|
||||
let floating_size = tile.window().expected_size();
|
||||
tile.set_floating_window_size(floating_size);
|
||||
|
||||
// When resizing by top/left edge, update the position accordingly.
|
||||
if let Some(resize) = resize {
|
||||
let mut offset = Point::from((0., 0.));
|
||||
|
||||
+7
-7
@@ -1164,12 +1164,6 @@ impl<W: LayoutElement> Layout<W> {
|
||||
if let Some(InteractiveMoveState::Moving(move_)) = &mut self.interactive_move {
|
||||
if move_.tile.window().id() == window {
|
||||
move_.tile.update_window();
|
||||
|
||||
// Update the floating size in case the window resizes itself during an interactive
|
||||
// move.
|
||||
let floating_size = move_.tile.window().expected_size();
|
||||
move_.tile.set_floating_window_size(floating_size);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -3464,7 +3458,13 @@ impl<W: LayoutElement> Layout<W> {
|
||||
}
|
||||
InsertPosition::Floating => {
|
||||
let pos = move_.tile_render_location() - offset;
|
||||
mon.add_floating_tile(ws_idx, move_.tile, Some(pos), true);
|
||||
|
||||
// Set the floating size so it takes into account any window resizing that
|
||||
// took place during the move.
|
||||
let mut tile = move_.tile;
|
||||
tile.set_floating_window_size(tile.window().expected_size());
|
||||
|
||||
mon.add_floating_tile(ws_idx, tile, Some(pos), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user