diff --git a/xdg_shell.c b/xdg_shell.c index cc86bf6..117a344 100644 --- a/xdg_shell.c +++ b/xdg_shell.c @@ -293,6 +293,7 @@ popup_handle_destroy(struct wl_listener *listener, void *data) struct cg_xdg_popup *popup = wl_container_of(listener, popup, destroy); wl_list_remove(&popup->destroy.link); wl_list_remove(&popup->commit.link); + wl_list_remove(&popup->reposition.link); free(popup); } @@ -306,6 +307,14 @@ popup_handle_commit(struct wl_listener *listener, void *data) } } +static void +popup_handle_reposition(struct wl_listener *listener, void *data) +{ + struct cg_xdg_popup *popup = wl_container_of(listener, popup, reposition); + + popup_unconstrain(popup->xdg_popup); +} + void handle_new_xdg_popup(struct wl_listener *listener, void *data) { @@ -350,6 +359,9 @@ handle_new_xdg_popup(struct wl_listener *listener, void *data) popup->commit.notify = popup_handle_commit; wl_signal_add(&wlr_popup->base->surface->events.commit, &popup->commit); + popup->reposition.notify = popup_handle_reposition; + wl_signal_add(&wlr_popup->events.reposition, &popup->reposition); + struct wlr_scene_tree *popup_scene_tree = wlr_scene_xdg_surface_create(parent_scene_tree, wlr_popup->base); if (popup_scene_tree == NULL) { wlr_log(WLR_ERROR, "Failed to allocate scene-graph node for XDG popup"); diff --git a/xdg_shell.h b/xdg_shell.h index 1fc000a..f819549 100644 --- a/xdg_shell.h +++ b/xdg_shell.h @@ -31,6 +31,7 @@ struct cg_xdg_popup { struct wl_listener destroy; struct wl_listener commit; + struct wl_listener reposition; }; void handle_new_xdg_toplevel(struct wl_listener *listener, void *data);