]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/gtkutil/glwidget.cpp
libs/gtkutil/glwidget: rework a bit shared context GL callbacks
[xonotic/netradiant.git] / libs / gtkutil / glwidget.cpp
index c597c4a9640a65431a3e021372fdf66843e98536..8581f7a4a4ef779a0840126e070dd40f21286e12 100644 (file)
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-// OpenGL widget based on GtkGLExt
+// OpenGL widget based on GtkGLExt / GtkGLArea
 
 #include "glwidget.h"
 
 #include "igl.h"
 
-void (*GLWidget_sharedContextCreated)() = 0;
-
-void (*GLWidget_sharedContextDestroyed)() = 0;
+// Function callbacks
+static void (*sharedContextCreated)() = nullptr;
+static void (*sharedContextDestroyed)() = nullptr;
 
 unsigned int g_context_count = 0;
 
@@ -42,7 +42,7 @@ static void _glwidget_context_created(ui::GLArea self, void *data)
         glwidget_make_current(g_shared);
         GlobalOpenGL().contextValid = true;
 
-        GLWidget_sharedContextCreated();
+        sharedContextCreated();
     }
 }
 
@@ -51,19 +51,18 @@ static void _glwidget_context_destroyed(ui::GLArea self, void *data)
     if (--g_context_count == 0) {
         GlobalOpenGL().contextValid = false;
 
-        GLWidget_sharedContextDestroyed();
+        sharedContextDestroyed();
 
         g_shared.unref();
         g_shared = ui::GLArea(ui::null);
     }
 }
 
-void glwidget_destroy_context(ui::GLArea self)
-{
-}
-
-void glwidget_create_context(ui::GLArea self)
+void glwidget_set_shared_context_constructors(
+               void created(), void destroyed() )
 {
+       sharedContextCreated = created;
+       sharedContextDestroyed = destroyed;
 }
 
 #if GTK_TARGET == 3