subsurface: Don't create a bg_subsurface until we need it

There's a ton of error checking happening that we want to do.

Because it turns out it is not really useful to create a subsurface for
the single pixel buffer when we don't even support single pixel buffers.
This commit is contained in:
Benjamin Otte 2024-08-14 08:03:48 +02:00
parent 3cd25516ab
commit a7b69ad9b5

View File

@ -491,9 +491,6 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
has_background = self->bg_rect.width > 0 && self->bg_rect.height > 0;
if (has_background)
ensure_bg_surface (self);
if (!scaled_rect_is_integral (dest, 1, &device_rect))
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
@ -669,6 +666,8 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
if (has_background)
{
ensure_bg_surface (self);
if (background_changed)
{
wl_subsurface_set_position (self->bg_subsurface, self->bg_rect.x, self->bg_rect.y);