WPrefs/editmenu: paint with view backColor; default non-title items grey

paintEditMenuItem always filled with scr->white. On X11 the per-window
background was rendered by the X server based on WMSetWidgetBackgroundColor.
On Wayland we have to draw it ourselves.

Use the view's stored backColor if set; default to white otherwise.
Also set the default background of non-title items to grey at creation
time (previously only title items got an explicit colour, so non-title
items had a NULL backColor and rendered white).
This commit is contained in:
Window Maker 2026-05-24 18:53:37 +02:00
parent 931469dbf4
commit baf021fa0c
1 changed files with 9 additions and 1 deletions

View File

@ -142,6 +142,8 @@ WEditMenuItem *WCreateEditMenuItem(WMWidget * parent, const char *title, Bool is
if (isTitle) {
WMSetWidgetBackgroundColor(iPtr, WMBlackColor(scr));
} else {
WMSetWidgetBackgroundColor(iPtr, WMGrayColor(scr));
}
WMCreateEventHandler(iPtr->view, WM_EVMASK_EXPOSURE | WM_EVMASK_STRUCTURE_NOTIFY, handleItemEvents, iPtr);
@ -192,7 +194,13 @@ static void paintEditMenuItem(WEditMenuItem * iPtr)
color = scr->white;
}
scr->renderBackend->fill_rect(scr->renderBackendCtx, win, scr->white, 0, 0, w, h);
/* Use the view's stored background color (set by highlightItem and
* the menu setup code). X11 used to paint backgrounds via the X
* server; on Wayland we have to draw it explicitly. */
{
WMColor *bg = iPtr->view->backColor ? iPtr->view->backColor : scr->white;
scr->renderBackend->fill_rect(scr->renderBackendCtx, win, bg, 0, 0, w, h);
}
W_DrawRelief(scr, win, 0, 0, w + 1, h, WRRaised);