From 58aebc44478a0c3e8eb66c59aec7390d9d8add56 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 9 Aug 2024 05:46:10 +0200 Subject: [PATCH] surface: Put opaque_region in the priv structure This is in preparation for future patches. --- gdk/gdksurface.c | 23 +++++++++++++++-------- gdk/gdksurfaceprivate.h | 2 -- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c index 9bce2ed66c..438fe29656 100644 --- a/gdk/gdksurface.c +++ b/gdk/gdksurface.c @@ -75,6 +75,8 @@ struct _GdkSurfacePrivate GdkMemoryDepth egl_surface_depth; #endif + cairo_region_t *opaque_region; + gpointer widget; GdkColorState *color_state; @@ -510,6 +512,12 @@ gdk_surface_real_create_subsurface (GdkSurface *surface) return NULL; } +static void +gdk_surface_default_set_opaque_region (GdkSurface *surface, + cairo_region_t *region) +{ +} + static void gdk_surface_constructed (GObject *object) { @@ -533,6 +541,7 @@ gdk_surface_class_init (GdkSurfaceClass *klass) klass->beep = gdk_surface_real_beep; klass->get_scale = gdk_surface_real_get_scale; klass->create_subsurface = gdk_surface_real_create_subsurface; + klass->set_opaque_region = gdk_surface_default_set_opaque_region; /** * GdkSurface:cursor: (attributes org.gtk.Property.get=gdk_surface_get_cursor org.gtk.Property.set=gdk_surface_set_cursor) @@ -771,7 +780,7 @@ gdk_surface_finalize (GObject *object) g_clear_object (&surface->display); - g_clear_pointer (&surface->opaque_region, cairo_region_destroy); + g_clear_pointer (&priv->opaque_region, cairo_region_destroy); if (surface->parent) surface->parent->children = g_list_remove (surface->parent->children, surface); @@ -2660,22 +2669,20 @@ void gdk_surface_set_opaque_region (GdkSurface *surface, cairo_region_t *region) { - GdkSurfaceClass *class; + GdkSurfacePrivate *priv = gdk_surface_get_instance_private (surface); g_return_if_fail (GDK_IS_SURFACE (surface)); g_return_if_fail (!GDK_SURFACE_DESTROYED (surface)); - if (cairo_region_equal (surface->opaque_region, region)) + if (cairo_region_equal (priv->opaque_region, region)) return; - g_clear_pointer (&surface->opaque_region, cairo_region_destroy); + g_clear_pointer (&priv->opaque_region, cairo_region_destroy); if (region != NULL) - surface->opaque_region = cairo_region_reference (region); + priv->opaque_region = cairo_region_reference (region); - class = GDK_SURFACE_GET_CLASS (surface); - if (class->set_opaque_region) - class->set_opaque_region (surface, region); + GDK_SURFACE_GET_CLASS (surface)->set_opaque_region (surface, region); } void diff --git a/gdk/gdksurfaceprivate.h b/gdk/gdksurfaceprivate.h index 2bf94f17b4..411c42c5ee 100644 --- a/gdk/gdksurfaceprivate.h +++ b/gdk/gdksurfaceprivate.h @@ -96,8 +96,6 @@ struct _GdkSurface GSList *draw_contexts; GdkDrawContext *paint_context; - cairo_region_t *opaque_region; - GdkSeat *current_shortcuts_inhibited_seat; GPtrArray *subsurfaces;