fix: No overlines/underlines being drawn when using offsets (#2685)
This commit is contained in:
parent
146c1ac1d7
commit
ab206a5f8e
@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- `custom/script`: Output clearing when `exec-if` fails ([`#2674`](https://github.com/polybar/polybar/issues/2674))
|
- `custom/script`: Output clearing when `exec-if` fails ([`#2674`](https://github.com/polybar/polybar/issues/2674))
|
||||||
- `internal/battery`: `poll-interval` not working ([`#2649`](https://github.com/polybar/polybar/issues/2649), [`#2677`](https://github.com/polybar/polybar/pull/2677))
|
- `internal/battery`: `poll-interval` not working ([`#2649`](https://github.com/polybar/polybar/issues/2649), [`#2677`](https://github.com/polybar/polybar/pull/2677))
|
||||||
- ipc: Polybar failing to open IPC channel after another user already ran polybar, if `XDG_RUNTIME_DIR` is not set ([`#2683`](https://github.com/polybar/polybar/issues/2683), [`#2684`](https://github.com/polybar/polybar/pull/2684))
|
- ipc: Polybar failing to open IPC channel after another user already ran polybar, if `XDG_RUNTIME_DIR` is not set ([`#2683`](https://github.com/polybar/polybar/issues/2683), [`#2684`](https://github.com/polybar/polybar/pull/2684))
|
||||||
|
- No overlines/underlines being drawn when using offsets ([`#2685`](https://github.com/polybar/polybar/pull/2685))
|
||||||
|
|
||||||
## [3.6.2] - 2022-04-03
|
## [3.6.2] - 2022-04-03
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -72,7 +72,7 @@ class renderer : public renderer_interface,
|
|||||||
void fill_overline(rgba color, double x, double w);
|
void fill_overline(rgba color, double x, double w);
|
||||||
void fill_underline(rgba color, double x, double w);
|
void fill_underline(rgba color, double x, double w);
|
||||||
void fill_borders();
|
void fill_borders();
|
||||||
void draw_offset(rgba color, double x, double w);
|
void draw_offset(const tags::context& ctxt, rgba color, double x, double w);
|
||||||
|
|
||||||
double block_x(alignment a) const;
|
double block_x(alignment a) const;
|
||||||
double block_y(alignment a) const;
|
double block_y(alignment a) const;
|
||||||
|
@ -728,8 +728,12 @@ void renderer::render_text(const tags::context& ctxt, const string&& contents) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderer::draw_offset(rgba color, double x, double w) {
|
void renderer::draw_offset(const tags::context& ctxt, rgba color, double x, double w) {
|
||||||
if (w > 0 && color != m_bar.background) {
|
if (w <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (color != m_bar.background) {
|
||||||
m_log.trace_x("renderer: offset(x=%f, w=%f)", x, w);
|
m_log.trace_x("renderer: offset(x=%f, w=%f)", x, w);
|
||||||
m_context->save();
|
m_context->save();
|
||||||
*m_context << m_comp_bg;
|
*m_context << m_comp_bg;
|
||||||
@ -739,6 +743,14 @@ void renderer::draw_offset(rgba color, double x, double w) {
|
|||||||
m_context->fill();
|
m_context->fill();
|
||||||
m_context->restore();
|
m_context->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctxt.has_underline()) {
|
||||||
|
fill_underline(ctxt.get_ul(), x, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxt.has_overline()) {
|
||||||
|
fill_overline(ctxt.get_ol(), x, w);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderer::render_offset(const tags::context& ctxt, const extent_val offset) {
|
void renderer::render_offset(const tags::context& ctxt, const extent_val offset) {
|
||||||
@ -746,7 +758,7 @@ void renderer::render_offset(const tags::context& ctxt, const extent_val offset)
|
|||||||
|
|
||||||
int offset_width = units_utils::extent_to_pixel(offset, m_bar.dpi_x);
|
int offset_width = units_utils::extent_to_pixel(offset, m_bar.dpi_x);
|
||||||
rgba bg = ctxt.get_bg();
|
rgba bg = ctxt.get_bg();
|
||||||
draw_offset(bg, m_blocks[m_align].x, offset_width);
|
draw_offset(ctxt, bg, m_blocks[m_align].x, offset_width);
|
||||||
increase_x(offset_width);
|
increase_x(offset_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user