xwayland: keep the xdg_toplevel around

The xdg_toplevel object was used solely when creating the window
surface, and the value of the object discarded.

To be able to make the surface fullscreen using the xdg_toplevel
protocol, we need to have access that object, so keep it around along
with the xwl_window.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Olivier Fourdan 2022-05-12 15:24:49 +02:00
parent c7a50db7ff
commit f3e32cae51
2 changed files with 10 additions and 2 deletions

View File

@ -483,14 +483,19 @@ ensure_surface_for_window(WindowPtr window)
goto err_surf;
}
xwl_window->xdg_toplevel =
xdg_surface_get_toplevel(xwl_window->xdg_surface);
if (xwl_window->xdg_surface == NULL) {
ErrorF("Failed creating xdg_toplevel\n");
goto err_surf;
}
wl_surface_add_listener(xwl_window->surface,
&surface_listener, xwl_window);
xdg_surface_add_listener(xwl_window->xdg_surface,
&xdg_surface_listener, xwl_window);
xdg_surface_get_toplevel(xwl_window->xdg_surface);
wl_surface_commit(xwl_window->surface);
region = wl_compositor_create_region(xwl_screen->compositor);
@ -540,6 +545,8 @@ ensure_surface_for_window(WindowPtr window)
return TRUE;
err_surf:
if (xwl_window->xdg_toplevel)
xdg_toplevel_destroy(xwl_window->xdg_toplevel);
if (xwl_window->xdg_surface)
xdg_surface_destroy(xwl_window->xdg_surface);
wl_surface_destroy(xwl_window->surface);

View File

@ -43,6 +43,7 @@ struct xwl_window {
struct wp_viewport *viewport;
float scale_x, scale_y;
struct xdg_surface *xdg_surface;
struct xdg_toplevel *xdg_toplevel;
WindowPtr window;
struct xorg_list link_damage;
struct xorg_list link_window;