diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c index dac4b4ed6..990deb3a8 100644 --- a/hw/xwayland/xwayland-window.c +++ b/hw/xwayland/xwayland-window.c @@ -360,6 +360,13 @@ unregister_damage(struct xwl_window *xwl_window) dixSetPrivate(&surface_window->devPrivates, &xwl_damage_private_key, NULL); } +static void +xwl_window_maybe_commit_surface(struct xwl_window *xwl_window) +{ + if (xwl_window->has_buffer_attached) + wl_surface_commit(xwl_window->surface); +} + static Bool xwl_window_update_fractional_scale(struct xwl_window *xwl_window, int fractional_scale_numerator) @@ -993,7 +1000,7 @@ handle_libdecor_configure(struct libdecor_frame *frame, xwl_window_update_libdecor_size(xwl_window, configuration, round(new_width), round(new_height)); - wl_surface_commit(xwl_window->surface); + xwl_window_maybe_commit_surface(xwl_window); } static void @@ -1039,7 +1046,7 @@ xdg_surface_handle_configure(void *data, xwl_window_set_fullscreen(xwl_window); xdg_surface_ack_configure(xdg_surface, serial); - wl_surface_commit(xwl_window->surface); + xwl_window_maybe_commit_surface(xwl_window); } static const struct xdg_surface_listener xdg_surface_listener = { @@ -1488,6 +1495,7 @@ ensure_surface_for_window(WindowPtr window) xwl_window->viewport_scale_x = 1.0; xwl_window->viewport_scale_y = 1.0; xwl_window->surface_scale = 1; + xwl_window->has_buffer_attached = FALSE; xorg_list_init(&xwl_window->xwl_output_list); xwl_window->surface = wl_compositor_create_surface(xwl_screen->compositor); if (xwl_window->surface == NULL) { @@ -2034,6 +2042,7 @@ xwl_window_attach_buffer(struct xwl_window *xwl_window) } wl_surface_attach(xwl_window->surface, buffer, 0, 0); + xwl_window->has_buffer_attached = TRUE; /* Arbitrary limit to try to avoid flooding the Wayland * connection. If we flood it too much anyway, this could diff --git a/hw/xwayland/xwayland-window.h b/hw/xwayland/xwayland-window.h index ae3e531c6..83cc054c6 100644 --- a/hw/xwayland/xwayland-window.h +++ b/hw/xwayland/xwayland-window.h @@ -109,6 +109,7 @@ struct xwl_window { struct wp_fractional_scale_v1 *fractional_scale; int fractional_scale_numerator; struct wp_linux_drm_syncobj_surface_v1 *surface_sync; + Bool has_buffer_attached; }; struct xwl_window *xwl_window_get(WindowPtr window);