popup: fix click selection and blank second-open
Bug 1: Clicks on menu items did not select the correct item. The WME_BUTTON_PRESS handler always called popUpMenu() which re-mapped the already-open menu and reset highlightedItem to selectedItemIndex, ignoring the click position. Since no motion event follows a click-without-drag, the highlight was never corrected. Fix: distinguish menuView vs main button events via event->window. For menuView clicks, compute highlightedItem from click.y directly without re-opening the menu. Bug 2: Second popup open showed a blank gray box. wl_unmap disabled the compositor scene node via W_ViewSceneNodeSetEnabledFn but wl_map never re-enabled it. On re-map, the buffer was committed to the wl_surface but the scene node stayed disabled. Fix: re-enable scene node in wl_map before redisplay.
This commit is contained in:
parent
2c3a1764a4
commit
3ccf87ff4f
|
|
@ -655,13 +655,20 @@ static void handleActionEvents(WMEvent * event, void *data)
|
|||
}
|
||||
break;
|
||||
}
|
||||
popUpMenu(bPtr);
|
||||
if (!bPtr->flags.pullsDown) {
|
||||
bPtr->highlightedItem = bPtr->selectedItemIndex;
|
||||
/* Button press on the menu view: select item under pointer.
|
||||
* Button press on the main button view: open the menu. */
|
||||
if (event->window == bPtr->menuView->window) {
|
||||
bPtr->highlightedItem = event->u.button.y / bPtr->view->size.height;
|
||||
bPtr->flags.insideMenu = 1;
|
||||
} else {
|
||||
bPtr->highlightedItem = -1;
|
||||
bPtr->flags.insideMenu = 0;
|
||||
popUpMenu(bPtr);
|
||||
if (!bPtr->flags.pullsDown) {
|
||||
bPtr->highlightedItem = bPtr->selectedItemIndex;
|
||||
bPtr->flags.insideMenu = 1;
|
||||
} else {
|
||||
bPtr->highlightedItem = -1;
|
||||
bPtr->flags.insideMenu = 0;
|
||||
}
|
||||
}
|
||||
bPtr->view->screen->viewBackend->pointer_grab(
|
||||
bPtr->view->screen->viewBackendCtx, bPtr->menuView, False, WM_CURRENT_TIME);
|
||||
|
|
|
|||
|
|
@ -305,6 +305,10 @@ static void wl_map(void *vctx, W_View *view)
|
|||
child = child->nextSister;
|
||||
}
|
||||
}
|
||||
/* Re-enable scene node after unmap so the surface becomes visible again. */
|
||||
if (W_ViewSceneNodeSetEnabledFn)
|
||||
W_ViewSceneNodeSetEnabledFn((unsigned long)view->window, 1);
|
||||
|
||||
if (view->flags.topLevel) {
|
||||
wl_redisplay(vctx, view);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue