From 7bfdf87bf0138d602888fc3167921bc1d029b0ab Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Thu, 22 Aug 2024 14:44:11 +0300 Subject: Implement resize transactions --- src/layout/workspace.rs | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'src/layout/workspace.rs') 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 Workspace { } } + 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 Workspace { ); 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 Column { 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())); } } -- cgit