popUpMenu: map before render, use makeMenuPixmap for robust initial content
Reorder popUpMenu to: 1. Resize menuView before map (correct backing dimensions) 2. W_MapView first (wl_map calls wl_redisplay which fills background and dispatches WME_EXPOSE — the old redisplay() before map was a no-op on Wayland because wl_redisplay returns early when !mapped) 3. Copy makeMenuPixmap() output into menuView->window backing as a safety net, ensuring the buffer has complete menu content independent of expose-timing correctness 4. paintMenuEntry for initial highlighted item This ensures the first visible popup buffer has all menu items rendered regardless of the order in which the Wayland configure and commit events arrive.
This commit is contained in:
parent
e063d8fa87
commit
2c3a1764a4
|
|
@ -455,13 +455,33 @@ static void popUpMenu(PopUpButton * bPtr)
|
|||
}
|
||||
W_MoveView(bPtr->menuView, x, y);
|
||||
|
||||
scr->viewBackend->redisplay(scr->viewBackendCtx, bPtr->menuView);
|
||||
|
||||
/* Resize before map so the backing has the correct dimensions
|
||||
* before any rendering or commit happens. */
|
||||
if (W_VIEW_WIDTH(bPtr->menuView) != W_VIEW_WIDTH(bPtr->view))
|
||||
resizeMenu(bPtr);
|
||||
|
||||
/* Map first — wl_map calls wl_redisplay internally, which fills
|
||||
* the background and dispatches WME_EXPOSE to paint all entries.
|
||||
* The old code called redisplay() here BEFORE the map, which was
|
||||
* a no-op on Wayland (wl_redisplay returns early when !mapped). */
|
||||
W_MapView(bPtr->menuView);
|
||||
|
||||
/* Pre-render the full menu into the backing as a safety net,
|
||||
* independent of expose-timing. makeMenuPixmap draws every item
|
||||
* with relief, text, indicator, and disabled shading. */
|
||||
{
|
||||
WMNativePixmap pm = makeMenuPixmap(bPtr);
|
||||
if (pm) {
|
||||
const W_RenderBackend *R = scr->renderBackend;
|
||||
void *rctx = scr->renderBackendCtx;
|
||||
int total_h = WMGetArrayItemCount(bPtr->items)
|
||||
* bPtr->view->size.height;
|
||||
R->pixmap_copy(rctx, pm, (WMDrawable)bPtr->menuView->window,
|
||||
0, 0, bPtr->view->size.width, total_h, 0, 0);
|
||||
R->pixmap_free(rctx, pm);
|
||||
}
|
||||
}
|
||||
|
||||
bPtr->highlightedItem = 0;
|
||||
if (!bPtr->flags.pullsDown && bPtr->selectedItemIndex < 0)
|
||||
paintMenuEntry(bPtr, bPtr->selectedItemIndex, True);
|
||||
|
|
|
|||
Loading…
Reference in New Issue