fix: popup surface set error geom

it will cause xfce4-panel can't see any popup menu when use right
button click the dock panel
This commit is contained in:
DreamMaoMao 2025-06-12 14:45:10 +08:00
parent c0aa0a0d19
commit 6fee372144

View file

@ -2737,7 +2737,8 @@ buttonpress(struct wl_listener *listener, void *data) {
Client *tmpc; Client *tmpc;
int ji; int ji;
const MouseBinding *b; const MouseBinding *b;
struct wlr_surface *old_pointer_focus_surface = seat->pointer_state.focused_surface; struct wlr_surface *old_pointer_focus_surface =
seat->pointer_state.focused_surface;
handlecursoractivity(); handlecursoractivity();
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat); wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
@ -3177,11 +3178,13 @@ void commitpopup(struct wl_listener *listener, void *data) {
return; return;
popup->base->surface->data = popup->base->surface->data =
wlr_scene_xdg_surface_create(popup->parent->data, popup->base); wlr_scene_xdg_surface_create(popup->parent->data, popup->base);
if ((l && !l->mon) || (c && !c->mon)) if ((l && !l->mon) || (c && !c->mon)) {
wlr_xdg_popup_destroy(popup);
return; return;
}
box = type == LayerShell ? l->mon->m : c->mon->w; box = type == LayerShell ? l->mon->m : c->mon->w;
box.x -= (type == LayerShell ? l->geom.x : c->geom.x); box.x -= (type == LayerShell ? l->scene->node.x : c->geom.x);
box.y -= (type == LayerShell ? l->geom.y : c->geom.y); box.y -= (type == LayerShell ? l->scene->node.y : c->geom.y);
wlr_xdg_popup_unconstrain_from_box(popup, &box); wlr_xdg_popup_unconstrain_from_box(popup, &box);
wl_list_remove(&listener->link); wl_list_remove(&listener->link);
free(listener); free(listener);