aboutsummaryrefslogtreecommitdiff
path: root/src/layout
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/mod.rs18
-rw-r--r--src/layout/tile.rs11
-rw-r--r--src/layout/workspace.rs33
3 files changed, 56 insertions, 6 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index abcf9d43..9fbd1623 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -52,6 +52,7 @@ use crate::render_helpers::snapshot::RenderSnapshot;
use crate::render_helpers::solid_color::{SolidColorBuffer, SolidColorRenderElement};
use crate::render_helpers::texture::TextureBuffer;
use crate::render_helpers::{BakedBuffer, RenderTarget, SplitElements};
+use crate::utils::transaction::Transaction;
use crate::utils::{output_size, round_logical_in_physical_max1, ResizeEdge};
use crate::window::ResolvedWindowRules;
@@ -153,7 +154,12 @@ pub trait LayoutElement {
self.render(renderer, location, scale, alpha, target).popups
}
- fn request_size(&mut self, size: Size<i32, Logical>, animate: bool);
+ fn request_size(
+ &mut self,
+ size: Size<i32, Logical>,
+ animate: bool,
+ transaction: Option<Transaction>,
+ );
fn request_fullscreen(&self, size: Size<i32, Logical>);
fn min_size(&self) -> Size<i32, Logical>;
fn max_size(&self) -> Size<i32, Logical>;
@@ -237,6 +243,7 @@ pub struct Options {
// Debug flags.
pub disable_resize_throttling: bool,
+ pub disable_transactions: bool,
}
impl Default for Options {
@@ -255,6 +262,7 @@ impl Default for Options {
default_width: None,
animations: Default::default(),
disable_resize_throttling: false,
+ disable_transactions: false,
}
}
}
@@ -292,6 +300,7 @@ impl Options {
default_width,
animations: config.animations.clone(),
disable_resize_throttling: config.debug.disable_resize_throttling,
+ disable_transactions: config.debug.disable_transactions,
}
}
@@ -2636,7 +2645,12 @@ mod tests {
SplitElements::default()
}
- fn request_size(&mut self, size: Size<i32, Logical>, _animate: bool) {
+ fn request_size(
+ &mut self,
+ size: Size<i32, Logical>,
+ _animate: bool,
+ _transaction: Option<Transaction>,
+ ) {
self.0.requested_size.set(Some(size));
self.0.pending_fullscreen.set(false);
}
diff --git a/src/layout/tile.rs b/src/layout/tile.rs
index a701e96f..11c266d4 100644
--- a/src/layout/tile.rs
+++ b/src/layout/tile.rs
@@ -23,6 +23,7 @@ use crate::render_helpers::resize::ResizeRenderElement;
use crate::render_helpers::snapshot::RenderSnapshot;
use crate::render_helpers::solid_color::{SolidColorBuffer, SolidColorRenderElement};
use crate::render_helpers::{render_to_encompassing_texture, RenderTarget};
+use crate::utils::transaction::Transaction;
/// Toplevel window with decorations.
#[derive(Debug)]
@@ -503,7 +504,12 @@ impl<W: LayoutElement> Tile<W> {
activation_region.contains(point)
}
- pub fn request_tile_size(&mut self, mut size: Size<f64, Logical>, animate: bool) {
+ pub fn request_tile_size(
+ &mut self,
+ mut size: Size<f64, Logical>,
+ animate: bool,
+ transaction: Option<Transaction>,
+ ) {
// Can't go through effective_border_width() because we might be fullscreen.
if !self.border.is_off() {
let width = self.border.width();
@@ -514,7 +520,8 @@ impl<W: LayoutElement> Tile<W> {
// The size request has to be i32 unfortunately, due to Wayland. We floor here instead of
// round to avoid situations where proportionally-sized columns don't fit on the screen
// exactly.
- self.window.request_size(size.to_i32_floor(), animate);
+ self.window
+ .request_size(size.to_i32_floor(), animate, transaction);
}
pub fn tile_width_for_window_width(&self, size: f64) -> f64 {
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()));
}
}