diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-08-22 14:44:11 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-08-22 15:19:11 +0300 |
| commit | 7bfdf87bf0138d602888fc3167921bc1d029b0ab (patch) | |
| tree | 48664b930f00be78f4c232a838b8ea4c5254db49 /src/layout/workspace.rs | |
| parent | cf357d7058910864018c3e3702a9723194fce916 (diff) | |
| download | niri-7bfdf87bf0138d602888fc3167921bc1d029b0ab.tar.gz niri-7bfdf87bf0138d602888fc3167921bc1d029b0ab.tar.bz2 niri-7bfdf87bf0138d602888fc3167921bc1d029b0ab.zip | |
Implement resize transactions
Diffstat (limited to 'src/layout/workspace.rs')
| -rw-r--r-- | src/layout/workspace.rs | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs index 8f0ae6e3..7548dc10 100644 --- a/src/layout/workspace.rs +++ b/src/layout/workspace.rs @@ -22,6 +22,7 @@ use crate::niri_render_elements; use crate::render_helpers::renderer::NiriRenderer; use crate::render_helpers::RenderTarget; use crate::utils::id::IdCounter; +use crate::utils::transaction::Transaction; use crate::utils::{output_size, send_scale_transform, ResizeEdge}; use crate::window::ResolvedWindowRules; @@ -2740,6 +2741,27 @@ impl<W: LayoutElement> Workspace<W> { } } + let intent = if self.options.disable_resize_throttling { + ConfigureIntent::CanSend + } else if self.options.disable_transactions { + // When transactions are disabled, we don't use combined throttling, but rather + // compute throttling individually below. + ConfigureIntent::CanSend + } else { + col.tiles + .iter() + .fold(ConfigureIntent::NotNeeded, |intent, tile| { + match (intent, tile.window().configure_intent()) { + (_, ConfigureIntent::ShouldSend) => ConfigureIntent::ShouldSend, + (ConfigureIntent::NotNeeded, tile_intent) => tile_intent, + (ConfigureIntent::CanSend, ConfigureIntent::Throttled) => { + ConfigureIntent::Throttled + } + (intent, _) => intent, + } + }) + }; + for (tile_idx, tile) in col.tiles.iter_mut().enumerate() { let win = tile.window_mut(); @@ -2759,7 +2781,13 @@ impl<W: LayoutElement> Workspace<W> { ); win.set_bounds(bounds); - let intent = win.configure_intent(); + // If transactions are disabled, also disable combined throttling, for more + // intuitive behavior. + let intent = if self.options.disable_transactions { + win.configure_intent() + } else { + intent + }; if matches!( intent, @@ -3167,13 +3195,14 @@ impl<W: LayoutElement> Column<W> { assert_eq!(auto_tiles_left, 0); } + let transaction = Transaction::new(); for (tile, h) in zip(&mut self.tiles, heights) { let WindowHeight::Fixed(height) = h else { unreachable!() }; let size = Size::from((width, height)); - tile.request_tile_size(size, animate); + tile.request_tile_size(size, animate, Some(transaction.clone())); } } |
