mirror of
https://github.com/labwc/labwc.git
synced 2025-11-08 13:30:00 -05:00
xdg: support xdg-shell v3 with popup repositioning
See https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3514 which added support on the wlroots side. We now re-run popup positioning (for both xdg-shell and layer-shell popups) when the "reposition" event is received. This allows popups that change size (such as qmpanel's applications menu) to be positioned correctly. xdg-shell v3 also gives the compositor some additional "hints" for popup positioning (reactive, parent_size, and parent_configure_serial) which are available but we don't make use of currently.
This commit is contained in:
parent
45b197b8a4
commit
a98f2635ea
4 changed files with 27 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ struct xdg_popup {
|
|||
struct wl_listener commit;
|
||||
struct wl_listener destroy;
|
||||
struct wl_listener new_popup;
|
||||
struct wl_listener reposition;
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
@ -47,6 +48,7 @@ handle_xdg_popup_destroy(struct wl_listener *listener, void *data)
|
|||
struct xdg_popup *popup = wl_container_of(listener, popup, destroy);
|
||||
wl_list_remove(&popup->destroy.link);
|
||||
wl_list_remove(&popup->new_popup.link);
|
||||
wl_list_remove(&popup->reposition.link);
|
||||
|
||||
/* Usually already removed unless there was no commit at all */
|
||||
if (popup->commit.notify) {
|
||||
|
|
@ -69,6 +71,13 @@ handle_xdg_popup_commit(struct wl_listener *listener, void *data)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
handle_xdg_popup_reposition(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct xdg_popup *popup = wl_container_of(listener, popup, reposition);
|
||||
popup_unconstrain(popup);
|
||||
}
|
||||
|
||||
static void
|
||||
popup_handle_new_xdg_popup(struct wl_listener *listener, void *data)
|
||||
{
|
||||
|
|
@ -100,6 +109,9 @@ xdg_popup_create(struct view *view, struct wlr_xdg_popup *wlr_popup)
|
|||
popup->commit.notify = handle_xdg_popup_commit;
|
||||
wl_signal_add(&wlr_popup->base->surface->events.commit, &popup->commit);
|
||||
|
||||
popup->reposition.notify = handle_xdg_popup_reposition;
|
||||
wl_signal_add(&wlr_popup->events.reposition, &popup->reposition);
|
||||
|
||||
/*
|
||||
* We must add xdg popups to the scene graph so they get rendered. The
|
||||
* wlroots scene graph provides a helper for this, but to use it we must
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue