[gtk+/gtk-3-20] gl: Add a realize() fallback



commit f5e192583a693bcdb20d248fc23696a974f30209
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon May 23 08:31:47 2016 +0100

    gl: Add a realize() fallback
    
    Calling gdk_gl_context_realize() should always result in a valid result,
    so we need to provide a default implementation, to avoid a call to a
    NULL function pointer.

 gdk/gdkglcontext.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 00a33eb..0fdbf82 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -248,11 +248,23 @@ gdk_gl_context_upload_texture (GdkGLContext    *context,
   glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
 }
 
+static gboolean
+gdk_gl_context_real_realize (GdkGLContext  *self,
+                             GError       **error)
+{
+  g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
+                       "The current backend does not support OpenGL");
+
+  return FALSE;
+}
+
 static void
 gdk_gl_context_class_init (GdkGLContextClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
+  klass->realize = gdk_gl_context_real_realize;
+
   /**
    * GdkGLContext:display:
    *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]