diff options
Diffstat (limited to 'src/layout')
| -rw-r--r-- | src/layout/mod.rs | 8 | ||||
| -rw-r--r-- | src/layout/tile.rs | 26 |
2 files changed, 30 insertions, 4 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index c2c4bf4e..7162c3e3 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -49,6 +49,7 @@ use self::workspace::{compute_working_area, Column, ColumnWidth, OutputId, Works use crate::niri_render_elements; use crate::render_helpers::renderer::NiriRenderer; use crate::utils::output_size; +use crate::window::ResolvedWindowRules; pub mod focus_ring; pub mod monitor; @@ -121,6 +122,8 @@ pub trait LayoutElement { /// This *will* switch immediately after a [`LayoutElement::request_fullscreen()`] call. fn is_pending_fullscreen(&self) -> bool; + fn rules(&self) -> &ResolvedWindowRules; + /// Runs periodic clean-up tasks. fn refresh(&self); } @@ -1905,6 +1908,11 @@ mod tests { } fn refresh(&self) {} + + fn rules(&self) -> &ResolvedWindowRules { + static EMPTY: ResolvedWindowRules = ResolvedWindowRules::empty(); + &EMPTY + } } fn arbitrary_bbox() -> impl Strategy<Value = Rectangle<i32, Logical>> { diff --git a/src/layout/tile.rs b/src/layout/tile.rs index 589b2fc0..0609583e 100644 --- a/src/layout/tile.rs +++ b/src/layout/tile.rs @@ -85,11 +85,22 @@ impl<W: LayoutElement> Tile<W> { } pub fn advance_animations(&mut self, current_time: Duration, is_active: bool) { + let draw_border_with_background = self + .window + .rules() + .draw_border_with_background + .unwrap_or_else(|| !self.window.has_ssd()); self.border - .update(self.window.size(), self.window.has_ssd()); + .update(self.window.size(), !draw_border_with_background); self.border.set_active(is_active); - self.focus_ring.update(self.tile_size(), self.has_ssd()); + let draw_focus_ring_with_background = if self.effective_border_width().is_some() { + false + } else { + draw_border_with_background + }; + self.focus_ring + .update(self.tile_size(), !draw_focus_ring_with_background); self.focus_ring.set_active(is_active); match &mut self.open_animation { @@ -295,8 +306,15 @@ impl<W: LayoutElement> Tile<W> { size } - pub fn has_ssd(&self) -> bool { - self.effective_border_width().is_some() || self.window.has_ssd() + pub fn draw_border_with_background(&self) -> bool { + if self.effective_border_width().is_some() { + return false; + } + + self.window + .rules() + .draw_border_with_background + .unwrap_or_else(|| !self.window.has_ssd()) } fn render_inner<R: NiriRenderer>( |
