From a7b69ad9b5e26abfe48958db6d61a686b3e1df05 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 14 Aug 2024 08:03:48 +0200 Subject: [PATCH] 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. --- gdk/wayland/gdksubsurface-wayland.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gdk/wayland/gdksubsurface-wayland.c b/gdk/wayland/gdksubsurface-wayland.c index ba37326806..407976a96d 100644 --- a/gdk/wayland/gdksubsurface-wayland.c +++ b/gdk/wayland/gdksubsurface-wayland.c @@ -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);