From 31747cef4a72e00635155943b9b5a753ff8688f2 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Mon, 24 Feb 2025 11:14:19 +0100 Subject: [PATCH 1/2] render: bound all textures --- src/renderer.rs | 18 +++++++----------- src/renderer/renderer_base.rs | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/renderer.rs b/src/renderer.rs index a2bdfdbf..b69d1a3b 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -85,15 +85,11 @@ impl Renderer<'_> { let non_exclusive_rect = output.non_exclusive_rect_rel.get(); let (x, y) = non_exclusive_rect.translate_inv(x, y); { + let bar_bg = Rect::new_sized(0, 0, non_exclusive_rect.width(), th).unwrap(); + let bar_bg = self.base.scale_rect(bar_bg); let c = theme.colors.bar_background.get(); - self.base.fill_boxes2( - slice::from_ref( - &Rect::new_sized(0, 0, non_exclusive_rect.width(), th).unwrap(), - ), - &c, - x, - y, - ); + self.base + .fill_boxes3(slice::from_ref(&bar_bg), &c, x, y, true); let rd = output.render_data.borrow_mut(); if let Some(aw) = &rd.active_workspace { let c = match aw.captured { @@ -124,7 +120,7 @@ impl Renderer<'_> { None, None, scale, - None, + Some(&bar_bg), None, AcquireSync::None, ReleaseSync::None, @@ -141,7 +137,7 @@ impl Renderer<'_> { None, None, scale, - None, + Some(&bar_bg), None, AcquireSync::None, ReleaseSync::None, @@ -219,7 +215,7 @@ impl Renderer<'_> { None, None, self.base.scale, - None, + bounds, None, AcquireSync::None, ReleaseSync::None, diff --git a/src/renderer/renderer_base.rs b/src/renderer/renderer_base.rs index d234ffea..5230e0d4 100644 --- a/src/renderer/renderer_base.rs +++ b/src/renderer/renderer_base.rs @@ -76,7 +76,7 @@ impl RendererBase<'_> { self.fill_boxes3(boxes, color, dx, dy, false); } - fn fill_boxes3(&mut self, boxes: &[Rect], color: &Color, dx: i32, dy: i32, scaled: bool) { + pub fn fill_boxes3(&mut self, boxes: &[Rect], color: &Color, dx: i32, dy: i32, scaled: bool) { if boxes.is_empty() || *color == Color::TRANSPARENT { return; } From 68f0966b161dd5b3907613237296157df72ae1f1 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Mon, 24 Feb 2025 11:24:33 +0100 Subject: [PATCH 2/2] render: apply correct damage after bar-size changes --- src/tasks/connector.rs | 18 +++--------------- src/tree/output.rs | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/src/tasks/connector.rs b/src/tasks/connector.rs index 6f8c70a1..b763533b 100644 --- a/src/tasks/connector.rs +++ b/src/tasks/connector.rs @@ -8,14 +8,10 @@ use { }, output_schedule::OutputSchedule, state::{ConnectorData, OutputData, State}, - tree::{OutputNode, OutputRenderData, WsMoveConfig, move_ws_to_output}, + tree::{OutputNode, WsMoveConfig, move_ws_to_output}, utils::{asyncevent::AsyncEvent, clonecell::CloneCell, hash_map_ext::HashMapExt}, }, - std::{ - cell::{Cell, RefCell}, - collections::VecDeque, - rc::Rc, - }, + std::{cell::Cell, collections::VecDeque, rc::Rc}, }; pub fn handle(state: &Rc, connector: &Rc) { @@ -166,15 +162,7 @@ impl ConnectorHandler { workspace_rect: Default::default(), non_exclusive_rect: Default::default(), non_exclusive_rect_rel: Default::default(), - render_data: RefCell::new(OutputRenderData { - active_workspace: None, - underline: Default::default(), - inactive_workspaces: Default::default(), - attention_requested_workspaces: Default::default(), - captured_inactive_workspaces: Default::default(), - titles: Default::default(), - status: None, - }), + render_data: Default::default(), state: self.state.clone(), is_dummy: false, status: self.state.status.clone(), diff --git a/src/tree/output.rs b/src/tree/output.rs index 9dbad4c9..44fceb82 100644 --- a/src/tree/output.rs +++ b/src/tree/output.rs @@ -594,15 +594,16 @@ impl OutputNode { status.tex_x = pos; } } + let old_full_area = rd.full_area; + rd.full_area = Rect::new_sized( + non_exclusive_rect.x1(), + non_exclusive_rect.y1(), + non_exclusive_rect.width(), + th + 1, + ) + .unwrap(); if self.title_visible.get() { - let title_rect = Rect::new_sized( - non_exclusive_rect.x1(), - non_exclusive_rect.y1(), - non_exclusive_rect.width(), - th, - ) - .unwrap(); - self.state.damage(title_rect); + self.state.damage(rd.full_area.union(old_full_area)); } } @@ -1246,6 +1247,7 @@ pub struct OutputWorkspaceRenderData { #[derive(Default)] pub struct OutputRenderData { + pub full_area: Rect, pub active_workspace: Option, pub underline: Rect, pub inactive_workspaces: Vec,