summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-03-12 14:23:17 +0000
committerMatthias Clasen <mclasen@redhat.com>2021-03-12 14:23:17 +0000
commite9ee144b7cd9a723ba3b65735247df9614b86b2f (patch)
tree24e08387ca5abddea9416c5d784cbaba9f57d3c6
parent7774d5d85e86f97d9ef7195c808bcd2d88ef49eb (diff)
parenteda758ecf0cbfd897590ec972f0b9ab644f472df (diff)
downloadgtk+-e9ee144b7cd9a723ba3b65735247df9614b86b2f.tar.gz
Merge branch 'cherry-pick-b63c4d67' into 'gtk-4.0'
cherry-pick drawing changes See merge request GNOME/gtk!3287
-rw-r--r--gdk/wayland/gdkcairocontext-wayland.c6
-rw-r--r--gdk/wayland/gdksurface-wayland.c31
2 files changed, 14 insertions, 23 deletions
diff --git a/gdk/wayland/gdkcairocontext-wayland.c b/gdk/wayland/gdkcairocontext-wayland.c
index fcc547ecf6..819daa140e 100644
--- a/gdk/wayland/gdkcairocontext-wayland.c
+++ b/gdk/wayland/gdkcairocontext-wayland.c
@@ -109,6 +109,8 @@ gdk_wayland_cairo_context_buffer_release (void *_data,
/* Get rid of all the extra ones */
gdk_wayland_cairo_context_remove_surface (self, cairo_surface);
+ /* Release the reference the compositor held to this surface */
+ cairo_surface_destroy (cairo_surface);
}
static const struct wl_buffer_listener buffer_listener = {
@@ -194,7 +196,7 @@ gdk_wayland_cairo_context_end_frame (GdkDrawContext *draw_context,
static void
gdk_wayland_cairo_context_clear_all_cairo_surfaces (GdkWaylandCairoContext *self)
{
- self->cached_surface = NULL;
+ g_clear_pointer (&self->cached_surface, cairo_surface_destroy);
while (self->surfaces)
gdk_wayland_cairo_context_remove_surface (self, self->surfaces->data);
}
@@ -221,6 +223,8 @@ gdk_wayland_cairo_context_dispose (GObject *object)
GdkWaylandCairoContext *self = GDK_WAYLAND_CAIRO_CONTEXT (object);
gdk_wayland_cairo_context_clear_all_cairo_surfaces (self);
+ g_assert (self->cached_surface == NULL);
+ g_assert (self->paint_surface == NULL);
G_OBJECT_CLASS (gdk_wayland_cairo_context_parent_class)->dispose (object);
}
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index d31e4ae6ee..ad6e6ee0bc 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -284,11 +284,6 @@ static void gdk_wayland_surface_maybe_resize (GdkSurface *surface,
int height,
int scale);
-static void gdk_wayland_surface_resize (GdkSurface *surface,
- int width,
- int height,
- int scale);
-
static void gdk_wayland_surface_configure (GdkSurface *surface);
static void maybe_set_gtk_surface_dbus_properties (GdkWaylandSurface *impl);
@@ -415,6 +410,8 @@ gdk_wayland_surface_update_size (GdkSurface *surface,
g_object_notify (G_OBJECT (surface), "height");
if (scale_changed)
g_object_notify (G_OBJECT (surface), "scale-factor");
+
+ _gdk_surface_update_size (surface);
}
static const char *
@@ -643,10 +640,10 @@ configure_drag_surface_geometry (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
- gdk_wayland_surface_resize (surface,
- impl->next_layout.configured_width,
- impl->next_layout.configured_height,
- impl->scale);
+ gdk_wayland_surface_update_size (surface,
+ impl->next_layout.configured_width,
+ impl->next_layout.configured_height,
+ impl->scale);
}
static gboolean
@@ -1003,16 +1000,6 @@ is_realized_popup (GdkWaylandSurface *impl)
impl->display_server.zxdg_popup_v6);
}
-static void
-gdk_wayland_surface_resize (GdkSurface *surface,
- int width,
- int height,
- int scale)
-{
- gdk_wayland_surface_update_size (surface, width, height, scale);
- _gdk_surface_update_size (surface);
-}
-
static void gdk_wayland_surface_show (GdkSurface *surface,
gboolean already_mapped);
static void gdk_wayland_surface_hide (GdkSurface *surface);
@@ -1044,7 +1031,7 @@ gdk_wayland_surface_maybe_resize (GdkSurface *surface,
if (is_xdg_popup && is_visible && !impl->initial_configure_received)
gdk_wayland_surface_hide (surface);
- gdk_wayland_surface_resize (surface, width, height, scale);
+ gdk_wayland_surface_update_size (surface, width, height, scale);
if (is_xdg_popup && is_visible && !impl->initial_configure_received)
gdk_wayland_surface_show (surface, FALSE);
@@ -1409,7 +1396,7 @@ configure_toplevel_geometry (GdkSurface *surface)
width, height,
&width, &height);
}
- gdk_wayland_surface_resize (surface, width, height, impl->scale);
+ gdk_wayland_surface_update_size (surface, width, height, impl->scale);
if (!impl->next_layout.toplevel.size_is_fixed)
{
@@ -1427,7 +1414,7 @@ configure_toplevel_geometry (GdkSurface *surface)
gdk_surface_constrain_size (&geometry, mask,
width, height,
&width, &height);
- gdk_wayland_surface_resize (surface, width, height, impl->scale);
+ gdk_wayland_surface_update_size (surface, width, height, impl->scale);
}
}