diff --git a/src/maomao.c b/src/maomao.c index f2daacd..bcad916 100644 --- a/src/maomao.c +++ b/src/maomao.c @@ -2737,7 +2737,8 @@ buttonpress(struct wl_listener *listener, void *data) { Client *tmpc; int ji; 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(); wlr_idle_notifier_v1_notify_activity(idle_notifier, seat); @@ -3177,11 +3178,13 @@ void commitpopup(struct wl_listener *listener, void *data) { return; popup->base->surface->data = 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; + } box = type == LayerShell ? l->mon->m : c->mon->w; - box.x -= (type == LayerShell ? l->geom.x : c->geom.x); - box.y -= (type == LayerShell ? l->geom.y : c->geom.y); + box.x -= (type == LayerShell ? l->scene->node.x : c->geom.x); + box.y -= (type == LayerShell ? l->scene->node.y : c->geom.y); wlr_xdg_popup_unconstrain_from_box(popup, &box); wl_list_remove(&listener->link); free(listener);