Improve menu rendering: separators, bevel edges, cascade arrows, title

- Entry separators: light line on top, dark line on bottom between entries
- Left/right bevel edges on each entry
- Cascade arrow (triangle) for submenu entries
- Paint menu frame title bar (wl_frame_paint) when menu is shown
- Matches X11 menu_draw_frame behavior
This commit is contained in:
Levi Neely 2026-05-13 16:52:06 +02:00
parent b9dbd23dfc
commit 40a10a0785
2 changed files with 32 additions and 0 deletions

View File

@ -6558,6 +6558,35 @@ static void wl_menu_paint_entry(WMenu *menu, int index, int selected)
w - 8 - tw, text_y, entry->rtext, strlen(entry->rtext));
}
/* Draw cascade arrow for submenus */
if (entry->cascade >= 0) {
int ay = y + h / 2;
for (int i = 0; i < 5; i++)
for (int j = -i; j <= i; j++)
if (w - 12 + i < w && ay + j >= 0 && ay + j < fb->height)
dst[(ay + j) * stride + (w - 12 + i)] = selected ? 0xFFFFFFFF : 0xFF000000;
}
/* Bevel lines (separators between entries) */
uint32_t light = 0xFFDDDDDD;
uint32_t dark = 0xFF555555;
/* Left edge - light */
for (int row = y; row < y + h && row < fb->height; row++)
dst[row * stride] = light;
/* Right edge - dark */
for (int row = y; row < y + h && row < fb->height; row++)
if (w - 1 < fb->width)
dst[row * stride + (w - 1)] = dark;
/* Top line - light (skip first entry) */
if (index > 0 && y < fb->height)
for (int col = 0; col < w && col < fb->width; col++)
dst[y * stride + col] = light;
/* Bottom line - dark (skip last entry) */
if (index < menu->entry_no - 1 && y + h - 1 < fb->height)
for (int col = 0; col < w && col < fb->width; col++)
dst[(y + h - 1) * stride + col] = dark;
wlr_scene_buffer_set_buffer(fb->scene_buf, &fb->base);
}

View File

@ -983,6 +983,9 @@ void wMenuPaint(WMenu * menu)
return;
}
/* paint frame title bar */
wm_backend->frame_paint(menu->frame);
/* paint entries */
for (i = 0; i < menu->entry_no; i++) {
wMenuPaintEntry(menu, i, i == menu->selected_entry);