commit d0ee3ac6e1481411cc0dcdb3df9828246fcdae9e
parent 9874689e2d14a0bec9c41aeee55a3c7ab5195f8c
Author: shrub <maybeshrub@gmail.com>
Date: Wed, 29 Apr 2026 17:30:41 +0000
comments
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/libswc/decor.c b/libswc/decor.c
@@ -41,6 +41,7 @@ decor_title_length(struct wld_font *font, const char *title, uint32_t max_width)
while (title[len]) {
uint32_t next = len + 1;
+ /* we skip utf-8 continuation bytes */
while ((title[next] & 0xc0) == 0x80) {
next++;
}
@@ -262,6 +263,9 @@ close_decor_string(struct compositor_view *view)
view->decor.string = NULL;
}
+/* draw decor part by tiling it across the target region.
+ * the part buffer is repeated to fill the entirety of some width x height area,
+ * but only damaged regions are actually rendred*/
static void
draw_decor_part(struct wld_renderer *renderer,
const struct swc_rectangle *target_geom,
@@ -450,6 +454,10 @@ decor_repaint(struct wld_renderer *renderer,
return;
}
+ /* calculate text position based on which edge
+ * the decor is on. base_x base_y is the top-left corner,
+ * max_width is available space
+ * decor_size is perpendicular dimension of the edge where text is being drawn */
switch (text->edge) {
case SWC_DECOR_EDGE_TOP:
if (!view->decor.top) {