Function XdgSurface.getToplevel

assign the xdg_toplevel surface role

XdgToplevel getToplevel();

This creates an xdg_toplevel object for the given xdg_surface and gives the associated wl_surface the xdg_toplevel role.

See the documentation of xdg_toplevel for more details about what an xdg_toplevel is and how it is used.