scene: add wlr_scene_xdg_surface_create

This allows compositors to easily add an xdg_surface to the
scene-graph while retaining the ability to unconstraint popups
and decide their 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_surface_tree_create,
and unconstraint the popup if they want to.
This commit is contained in:
Simon Ser 2021-10-25 18:29:24 +02:00
parent 1d3dd7fc08
commit 585a908a01
3 changed files with 136 additions and 0 deletions

View file

@ -25,6 +25,7 @@
struct wlr_output;
struct wlr_output_layout;
struct wlr_xdg_surface;
enum wlr_scene_node_type {
WLR_SCENE_NODE_ROOT,
@ -298,4 +299,14 @@ bool wlr_scene_attach_output_layout(struct wlr_scene *scene,
struct wlr_scene_node *wlr_scene_subsurface_tree_create(
struct wlr_scene_node *parent, struct wlr_surface *surface);
/**
* Add a node displaying an xdg_surface and all of its sub-surfaces to the
* scene-graph.
*
* The origin of the returned scene-graph node will match the top-left corner
* of the xdg_surface window geometry.
*/
struct wlr_scene_node *wlr_scene_xdg_surface_create(
struct wlr_scene_node *parent, struct wlr_xdg_surface *xdg_surface);
#endif