gdk: Introduce empty frames in GdkDrawContext

We need a way to commit pending subsurface changes, even when no
drawing happened for the frame. empty_frame() is that way.
This commit is contained in:
Matthias Clasen 2023-11-09 22:41:10 +01:00
parent 272168c94b
commit 9eef566b54
3 changed files with 27 additions and 0 deletions

View File

@ -68,6 +68,12 @@ gdk_draw_context_default_surface_resized (GdkDrawContext *context)
{
}
static void
gdk_draw_context_default_empty_frame (GdkDrawContext *context)
{
g_warning ("FIXME: Implement");
}
static void
gdk_draw_context_dispose (GObject *gobject)
{
@ -161,6 +167,7 @@ gdk_draw_context_class_init (GdkDrawContextClass *klass)
gobject_class->dispose = gdk_draw_context_dispose;
klass->surface_resized = gdk_draw_context_default_surface_resized;
klass->empty_frame = gdk_draw_context_default_empty_frame;
/**
* GdkDrawContext:display: (attributes org.gtk.Property.get=gdk_draw_context_get_display)
@ -470,3 +477,17 @@ gdk_draw_context_get_frame_region (GdkDrawContext *context)
return priv->frame_region;
}
void
gdk_draw_context_empty_frame (GdkDrawContext *context)
{
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
g_return_if_fail (GDK_IS_DRAW_CONTEXT (context));
g_return_if_fail (priv->surface != NULL);
if (GDK_SURFACE_DESTROYED (priv->surface))
return;
GDK_DRAW_CONTEXT_GET_CLASS (context)->empty_frame (context);
}

View File

@ -45,6 +45,7 @@ void gdk_draw_context_begin_frame (GdkDrawContext
const cairo_region_t *region);
GDK_AVAILABLE_IN_ALL
void gdk_draw_context_end_frame (GdkDrawContext *context);
GDK_AVAILABLE_IN_ALL
gboolean gdk_draw_context_is_in_frame (GdkDrawContext *context);
GDK_AVAILABLE_IN_ALL

View File

@ -46,6 +46,7 @@ struct _GdkDrawContextClass
cairo_region_t *update_area);
void (* end_frame) (GdkDrawContext *context,
cairo_region_t *painted);
void (* empty_frame) (GdkDrawContext *context);
void (* surface_resized) (GdkDrawContext *context);
};
@ -54,5 +55,9 @@ void gdk_draw_context_surface_resized (GdkDrawContext
void gdk_draw_context_begin_frame_full (GdkDrawContext *context,
GdkMemoryDepth depth,
const cairo_region_t *region);
void gdk_draw_context_empty_frame (GdkDrawContext *context);
G_END_DECLS