-
Notifications
You must be signed in to change notification settings - Fork 343
scene: add wlr_scene_xdg_popup_create #3298
base: master
Are you sure you want to change the base?
Conversation
dae014c
to
355b9db
Compare
Example usage in cage: emersion/cage@bf2a40d |
Added a commit to the tinywl scene PR to use this as well: 346e648 |
types/scene/xdg_shell.c
Outdated
static void scene_popup_handle_popup_configure(struct wl_listener *listener, | ||
void *data) { | ||
struct wlr_scene_xdg_popup *scene_popup = | ||
wl_container_of(listener, scene_popup, popup_configure); | ||
scene_popup_update_position(scene_popup); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this new state applied on the next commit after the client acks the configure? Is updating the position immediately ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this needs to be changed to use ack_configure
. But this reveals an additional issue: wlr_xdg_popup.geometry
might be overwritten by the compositor in a new configure event before the client acks. So we'd need to have more geometry fields: one for the last one configured by the compositor, one for the last one ack'ed by the client.
None of this matters in practice currently since we don't support repositioning xdg_popup yet (#2045).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we just remove this listener entirely then and leave a note saying that this feature needs to be implemented with #2045?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There would be a footgun with this approach: the compositor would need to be careful to unconstrain the popup before wlr_scene_xdg_popup_create
is created, otherwise the node position in the scene-graph will be (and stay) invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are times (some moving and/or resizing of the view) when a popup needs to be re-unconstrained, fwiw, so not even fixing the position before adding the popup to the scene would suffice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Popups shouldn't be implicitly re-positionned by the compositor unless the client has enabled the set_reactive
flag on the popup.
Could this support popups on layer-shell as well? Currently an assert fails in |
This allows compositors to easily add an xdg_popup to the scene-graph while retaining the ability to unconstraint the popup and decide its final position. Compositors can handle new popups with the wlr_xdg_shell.new_surface event, get the parent scene-graph node via wlr_xdg_popup.parent.data, create a new scene-graph node via wlr_scene_xdg_popup_tree_create, and unconstraint the popup if they want to.
355b9db
to
bb79d90
Compare
Updated to listen to |
wlroots has migrated to gitlab.freedesktop.org. This pull request has been moved to: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3298 |
This allows compositors to easily add an xdg_popup to the
scene-graph while retaining the ability to unconstraint the popup
and decide its final position.
Compositors can handle new popups with the wlr_xdg_shell.new_surface
event, get the parent scene-graph node via wlr_xdg_popup.parent.data,
create a new scene-graph node via wlr_scene_xdg_popup_tree_create,
and unconstraint the popup if they want to.