From 2d77969c7719e72237ec365c3db9e35c3e178631 Mon Sep 17 00:00:00 2001 From: MaxVerevkin Date: Tue, 9 Aug 2022 22:19:56 +0300 Subject: refactoring --- src/bar.rs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/bar.rs') diff --git a/src/bar.rs b/src/bar.rs index b157190..ffc4d7c 100644 --- a/src/bar.rs +++ b/src/bar.rs @@ -133,8 +133,7 @@ impl Bar { .iter() .enumerate() { - let tag = - compute_tag_label(text.to_string(), ss.config.font.clone(), &cairo_ctx); + let tag = compute_tag_label(text, ss.config.font.clone(), &cairo_ctx); self.tags_btns.push(x_offset, tag.width, id); x_offset += tag.width; self.tags_computed.push(tag); @@ -218,9 +217,9 @@ fn render_blocks( }; let comp_full = |block: &Block, min_width: Option| { let markup = block.markup.as_deref() == Some("pango"); - text::Text { - text: block.full_text.clone(), - attr: text::Attributes { + text::ComputedText::new( + &block.full_text, + text::Attributes { font: config.font.clone(), padding_left: 0.0, padding_right: 0.0, @@ -228,15 +227,15 @@ fn render_blocks( align: block.align.unwrap_or_default(), markup, }, - } - .compute(context) + context, + ) }; let comp_short = |block: &Block, min_width: Option| { let markup = block.markup.as_deref() == Some("pango"); block.short_text.as_ref().map(|short_text| { - text::Text { - text: short_text.clone(), - attr: text::Attributes { + text::ComputedText::new( + short_text, + text::Attributes { font: config.font.clone(), padding_left: 0.0, padding_right: 0.0, @@ -244,8 +243,8 @@ fn render_blocks( align: block.align.unwrap_or_default(), markup, }, - } - .compute(context) + context, + ) }) }; -- cgit v1.3.1