xdg_shell: handle xdg_popup reposition signal

We are advertising xdg-shell v4, but forgot to handle this signal.
This commit is contained in:
Simon Ser 2025-06-01 15:05:37 +02:00
parent 119f98f2b8
commit 60d41fb93c
2 changed files with 13 additions and 0 deletions

View file

@ -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");

View file

@ -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);