summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/reference/gdk/gdk4-sections.txt1
-rw-r--r--gdk/gdkcairocontext.c2
-rw-r--r--gdk/gdkdrawcontext.c16
-rw-r--r--gdk/gdkdrawcontext.h2
-rw-r--r--gdk/gdkdrawcontextprivate.h2
-rw-r--r--gdk/gdkvulkancontext.c4
-rw-r--r--gdk/wayland/gdkglcontext-wayland.c2
-rw-r--r--gdk/x11/gdkglcontext-x11.c2
8 files changed, 18 insertions, 13 deletions
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index 18ba178c77..ab95d6d6b5 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -1104,6 +1104,7 @@ gdk_draw_context_get_display
gdk_draw_context_get_surface
gdk_draw_context_begin_frame
gdk_draw_context_end_frame
+gdk_draw_context_in_frame
gdk_draw_context_get_frame_region
<SUBSECTION Standard>
diff --git a/gdk/gdkcairocontext.c b/gdk/gdkcairocontext.c
index 34d3c7fa17..3e4a31274e 100644
--- a/gdk/gdkcairocontext.c
+++ b/gdk/gdkcairocontext.c
@@ -88,7 +88,7 @@ gdk_cairo_context_default_cairo_create (GdkCairoContext *self)
g_return_val_if_fail (GDK_IS_CAIRO_CONTEXT (self), NULL);
context = GDK_DRAW_CONTEXT (self);
- if (!gdk_draw_context_is_drawing (context))
+ if (!gdk_draw_context_is_in_frame (context))
return NULL;
surface = gdk_draw_context_get_surface (context);
diff --git a/gdk/gdkdrawcontext.c b/gdk/gdkdrawcontext.c
index 7c5859e859..52728d6ac3 100644
--- a/gdk/gdkdrawcontext.c
+++ b/gdk/gdkdrawcontext.c
@@ -179,21 +179,25 @@ gdk_draw_context_init (GdkDrawContext *self)
{
}
-/*< private >
- * gdk_draw_context_is_drawing:
+/**
+ * gdk_draw_context_is_in_frame:
* @context: a #GdkDrawContext
*
- * Returns %TRUE if @context is in the process of drawing to its surface. In such
- * cases, it will have access to the surface's backbuffer to render the new frame
- * onto it.
+ * Returns %TRUE if @context is in the process of drawing to its surface
+ * after a call to gdk_draw_context_begin_frame() and not yet having called
+ * gdk_draw_context_end_frame().
+ * In this situation, drawing commands may be effecting the contents of a
+ * @context's surface.
*
* Returns: %TRUE if the context is between begin_frame() and end_frame() calls.
*/
gboolean
-gdk_draw_context_is_drawing (GdkDrawContext *context)
+gdk_draw_context_is_in_frame (GdkDrawContext *context)
{
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
+ g_return_val_if_fail (GDK_IS_DRAW_CONTEXT (context), FALSE);
+
return priv->frame_region != NULL;
}
diff --git a/gdk/gdkdrawcontext.h b/gdk/gdkdrawcontext.h
index 4fdc2898d7..6a851d1951 100644
--- a/gdk/gdkdrawcontext.h
+++ b/gdk/gdkdrawcontext.h
@@ -48,6 +48,8 @@ void gdk_draw_context_begin_frame (GdkDrawContext
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
const cairo_region_t * gdk_draw_context_get_frame_region (GdkDrawContext *context);
G_END_DECLS
diff --git a/gdk/gdkdrawcontextprivate.h b/gdk/gdkdrawcontextprivate.h
index ef9efcf73b..9ea9eaed8c 100644
--- a/gdk/gdkdrawcontextprivate.h
+++ b/gdk/gdkdrawcontextprivate.h
@@ -48,8 +48,6 @@ struct _GdkDrawContextClass
void (* surface_resized) (GdkDrawContext *context);
};
-gboolean gdk_draw_context_is_drawing (GdkDrawContext *context);
-
void gdk_draw_context_surface_resized (GdkDrawContext *context);
G_END_DECLS
diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c
index dae1de9632..fca08fed95 100644
--- a/gdk/gdkvulkancontext.c
+++ b/gdk/gdkvulkancontext.c
@@ -718,7 +718,7 @@ gdk_vulkan_context_get_draw_index (GdkVulkanContext *context)
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), 0);
- g_return_val_if_fail (gdk_draw_context_is_drawing (GDK_DRAW_CONTEXT (context)), 0);
+ g_return_val_if_fail (gdk_draw_context_is_in_frame (GDK_DRAW_CONTEXT (context)), 0);
return priv->draw_index;
}
@@ -741,7 +741,7 @@ gdk_vulkan_context_get_draw_semaphore (GdkVulkanContext *context)
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), VK_NULL_HANDLE);
- g_return_val_if_fail (gdk_draw_context_is_drawing (GDK_DRAW_CONTEXT (context)), VK_NULL_HANDLE);
+ g_return_val_if_fail (gdk_draw_context_is_in_frame (GDK_DRAW_CONTEXT (context)), VK_NULL_HANDLE);
return priv->draw_semaphore;
}
diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c
index 03fcea2843..18863c3c8a 100644
--- a/gdk/wayland/gdkglcontext-wayland.c
+++ b/gdk/wayland/gdkglcontext-wayland.c
@@ -504,7 +504,7 @@ gdk_wayland_display_make_gl_context_current (GdkDisplay *display,
context_wayland = GDK_WAYLAND_GL_CONTEXT (context);
surface = gdk_gl_context_get_surface (context);
- if (context_wayland->is_attached || gdk_draw_context_is_drawing (GDK_DRAW_CONTEXT (context)))
+ if (context_wayland->is_attached || gdk_draw_context_is_in_frame (GDK_DRAW_CONTEXT (context)))
egl_surface = gdk_wayland_surface_get_egl_surface (surface->impl_surface, context_wayland->egl_config);
else
{
diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c
index dc89483311..f5d00eeb27 100644
--- a/gdk/x11/gdkglcontext-x11.c
+++ b/gdk/x11/gdkglcontext-x11.c
@@ -1250,7 +1250,7 @@ gdk_x11_display_make_gl_context_current (GdkDisplay *display,
return FALSE;
}
- if (context_x11->is_attached || gdk_draw_context_is_drawing (GDK_DRAW_CONTEXT (context)))
+ if (context_x11->is_attached || gdk_draw_context_is_in_frame (GDK_DRAW_CONTEXT (context)))
drawable = context_x11->attached_drawable;
else
drawable = context_x11->unattached_drawable;