From baf021fa0c1a00311a36943b0bc03bedda5710ed Mon Sep 17 00:00:00 2001 From: Window Maker Date: Sun, 24 May 2026 18:53:37 +0200 Subject: [PATCH] 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). --- WPrefs.app/editmenu.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/WPrefs.app/editmenu.c b/WPrefs.app/editmenu.c index a719cba..35a6601 100644 --- a/WPrefs.app/editmenu.c +++ b/WPrefs.app/editmenu.c @@ -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);