diff --git a/CHANGELOG.md b/CHANGELOG.md index b27504a..88880fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/bar/bar.c b/bar/bar.c index 4f1895f..ab9a587 100644 --- a/bar/bar.c +++ b/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);