mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-23 20:35:42 +02:00
bar: set clip region before calling the particles’ expose() methods
This ensures particles that are “too wide” doesn’t try to render outside the bar, possibly overrunning both margins and borders. Or worse, crashes yambar. Closes #198
This commit is contained in:
parent
a8994b9268
commit
9353aa14fe
2 changed files with 15 additions and 0 deletions
|
@ -93,11 +93,14 @@
|
|||
* examples/dwl-tags: updated parsing of `output` name ([#178][178]).
|
||||
* sway-xkb: don’t crash when Sway sends an _”added”_ event for a
|
||||
device yambar is already tracking ([#177][177]).
|
||||
* Crash when a particle is “too wide”, and tries to render outside the
|
||||
bar ([#198][198]).
|
||||
|
||||
[169]: https://codeberg.org/dnkl/yambar/issues/169
|
||||
[172]: https://codeberg.org/dnkl/yambar/issues/172
|
||||
[178]: https://codeberg.org/dnkl/yambar/issues/178
|
||||
[177]: https://codeberg.org/dnkl/yambar/issues/177
|
||||
[198]: https://codeberg.org/dnkl/yambar/issues/198
|
||||
|
||||
|
||||
### Security
|
||||
|
|
12
bar/bar.c
12
bar/bar.c
|
@ -134,6 +134,18 @@ expose(const struct bar *_bar)
|
|||
|
||||
int y = bar->border.top_width;
|
||||
int x = bar->border.left_width + bar->left_margin - bar->left_spacing;
|
||||
pixman_region32_t clip;
|
||||
pixman_region32_init_rect(
|
||||
&clip,
|
||||
bar->border.left_width + bar->left_margin,
|
||||
bar->border.top_width,
|
||||
(bar->width -
|
||||
bar->left_margin - bar->right_margin -
|
||||
bar->border.left_width - bar->border.right_width),
|
||||
bar->height);
|
||||
pixman_image_set_clip_region32(pix, &clip);
|
||||
pixman_region32_fini(&clip);
|
||||
|
||||
for (size_t i = 0; i < bar->left.count; i++) {
|
||||
const struct exposable *e = bar->left.exps[i];
|
||||
e->expose(e, pix, x + bar->left_spacing, y, bar->height);
|
||||
|
|
Loading…
Add table
Reference in a new issue