summaryrefslogtreecommitdiff
path: root/gdk/gdksurface.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2021-07-09 02:50:32 +0200
committerBenjamin Otte <otte@redhat.com>2021-07-22 16:27:32 +0200
commite06e0e855527bb841d45a7597860054675b8b1c5 (patch)
tree8ee6e109f250a28996486a485d30cdd09ebb0ec3 /gdk/gdksurface.c
parent9f1d6e1f4474707aa9931660da6c3154b2281705 (diff)
downloadgtk+-e06e0e855527bb841d45a7597860054675b8b1c5.tar.gz
gdk: Move GL context construction to GdkGLContext
Now that we have the display's context to hook into, we can use it to construct other GL contexts and don't need a GdkSurface vfunc anymore. This has the added benefit that backends can have different GdkGLContext classes on the display and get new GLContexts generated from them, so we get multiple GL backend support per GDK backend for free. I originally wanted to make this a vfunc on GdkGLContextClass, but it turns out all the abckends would just call g_object_new() anyway.
Diffstat (limited to 'gdk/gdksurface.c')
-rw-r--r--gdk/gdksurface.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index f56b0e8c17..3f2b5189ff 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -1069,31 +1069,19 @@ GdkGLContext *
gdk_surface_get_paint_gl_context (GdkSurface *surface,
GError **error)
{
- GError *internal_error = NULL;
-
if (!gdk_display_prepare_gl (surface->display, error))
return NULL;
if (surface->gl_paint_context == NULL)
{
- GdkSurfaceClass *class = GDK_SURFACE_GET_CLASS (surface);
-
- surface->gl_paint_context =
- class->create_gl_context (surface, &internal_error);
- }
-
- if (internal_error != NULL)
- {
- g_propagate_error (error, internal_error);
- g_clear_object (&(surface->gl_paint_context));
- return NULL;
+ surface->gl_paint_context = gdk_surface_create_gl_context (surface, error);
+ if (surface->gl_paint_context == NULL)
+ return NULL;
}
- gdk_gl_context_realize (surface->gl_paint_context, &internal_error);
- if (internal_error != NULL)
+ if (!gdk_gl_context_realize (surface->gl_paint_context, error))
{
- g_propagate_error (error, internal_error);
- g_clear_object (&(surface->gl_paint_context));
+ g_clear_object (&surface->gl_paint_context);
return NULL;
}
@@ -1124,8 +1112,7 @@ gdk_surface_create_gl_context (GdkSurface *surface,
if (!gdk_display_prepare_gl (surface->display, error))
return NULL;
- return GDK_SURFACE_GET_CLASS (surface)->create_gl_context (surface,
- error);
+ return gdk_gl_context_new_for_surface (surface);
}
/**