From 134594e0bc99be0a65a809f399cf7780fe238578 Mon Sep 17 00:00:00 2001 From: lkn Date: Sun, 21 Jun 2026 19:03:08 +0200 Subject: [PATCH] wayland: draw title background bar for miniwindow icons Add the solid colored title background rectangle with light/dim bevel edges that X11 draws via drawIconTitleBackground. This gives miniwindow icons their characteristic "flat" title bar appearance, distinguishing them from appicons which lack this bar. --- src/backend/wayland/wl_icon.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/backend/wayland/wl_icon.c b/src/backend/wayland/wl_icon.c index 08130a9..1d7e010 100644 --- a/src/backend/wayland/wl_icon.c +++ b/src/backend/wayland/wl_icon.c @@ -72,6 +72,34 @@ wl_icon_paint(WIcon *icon) RReleaseImage(tile); if (icon->show_title && icon->icon_name && scr->icon_title_font) { + int theight = WMFontHeight(scr->icon_title_font); + + /* Draw title background bar (solid fill + bevel edges) */ + if (scr->icon_title_texture) { + WMColorRGB nc = scr->icon_title_texture->normal; + uint32_t npx = 0xFF000000 | ((uint32_t)nc.red >> 8 << 16) | + ((uint32_t)nc.green >> 8 << 8) | ((uint32_t)nc.blue >> 8); + WMColorRGB lc = scr->icon_title_texture->light; + uint32_t lpx = 0xFF000000 | ((uint32_t)lc.red >> 8 << 16) | + ((uint32_t)lc.green >> 8 << 8) | ((uint32_t)lc.blue >> 8); + WMColorRGB dc = scr->icon_title_texture->dim; + uint32_t dpx = 0xFF000000 | ((uint32_t)dc.red >> 8 << 16) | + ((uint32_t)dc.green >> 8 << 8) | ((uint32_t)dc.blue >> 8); + /* Fill */ + for (int row = 0; row <= theight && row < size; row++) + for (int col = 0; col < size && col < fb->width; col++) + dst[row * stride + col] = npx; + /* Light line: top + left */ + for (int col = 0; col < size && col < fb->width; col++) + dst[0 * stride + col] = lpx; + for (int row = 0; row <= theight && row < size; row++) + dst[row * stride + 0] = lpx; + /* Dim line: right edge */ + if (size - 1 < fb->width) + for (int row = 0; row <= theight && row < size; row++) + dst[row * stride + (size - 1)] = dpx; + } + WMDrawable d = (WMDrawable)(uintptr_t)fb->image; int tw = WMWidthOfString(scr->icon_title_font, icon->icon_name, strlen(icon->icon_name));