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.
This commit is contained in:
lkn 2026-06-21 19:03:08 +02:00
parent 69a57062b7
commit 134594e0bc
1 changed files with 28 additions and 0 deletions

View File

@ -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));