GtkGraphView: Add relaize signal callback to gl area to setup opengl stuff
This commit is contained in:
parent
c2439df2ef
commit
933120ed85
@ -16,6 +16,7 @@
|
||||
|
||||
#include <gtk-graph-view.h>
|
||||
#include <epoxy/gl.h>
|
||||
#include <shimatta-opengl-program.h>
|
||||
|
||||
struct _GtkGraphView {
|
||||
GtkBox super;
|
||||
@ -24,7 +25,7 @@ struct _GtkGraphView {
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief The gl area displaying the graph view.
|
||||
* @note This variable is not referenced, because the gl_area is tightly bound to the GrapgView widget itself.
|
||||
* @note This variable is not referenced, because the gl_area is tightly bound to the GraphView widget itself.
|
||||
*/
|
||||
GtkWidget *gl_area;
|
||||
GdkRGBA background_color;
|
||||
@ -111,6 +112,13 @@ static void gtk_graph_view_class_init(GtkGraphViewClass *klass)
|
||||
g_object_class_install_properties(oclass, N_PROPERTIES, gtk_graph_view_properties);
|
||||
}
|
||||
|
||||
static void gl_area_realize(GtkGLArea *area, gpointer data)
|
||||
{
|
||||
(void)data;
|
||||
gtk_gl_area_make_current(area);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Init a new GtkGraphView GObject
|
||||
* @param obj Object to initialize
|
||||
@ -124,6 +132,7 @@ static void gtk_graph_view_init(GtkGraphView *obj)
|
||||
/* Create new GTK GL_Area as only child of the box */
|
||||
priv->gl_area = gtk_gl_area_new();
|
||||
g_signal_connect(priv->gl_area, "render", G_CALLBACK(gl_render), obj);
|
||||
g_signal_connect(priv->gl_area, "realize", G_CALLBACK(gl_area_realize), obj);
|
||||
gtk_container_add(GTK_CONTAINER(obj), priv->gl_area);
|
||||
gtk_box_set_child_packing(GTK_BOX(obj), priv->gl_area, TRUE, TRUE, 0, GTK_PACK_START);
|
||||
gtk_widget_show(priv->gl_area);
|
||||
|
Loading…
Reference in New Issue
Block a user