This repository has been archived on 2022-06-29. You can view files and clone it, but cannot push or open issues or pull requests.
Jon Chen 737231705f
adds vendor directory
vendors dependencies in standard `vendor` directory, managed by glide
2017-05-14 19:35:03 -07:00

29 lines
656 B
C

#ifndef GO_GTKGL_H
#define GO_GTKGL_H
#include <gtkgl/gdkgl.h>
#include <gtkgl/gtkglarea.h>
#include <stdlib.h>
#include <string.h>
void *make_area(int attr_count, int *attrs) {
if (attr_count > 0 && attrs[attr_count-1] == 0) {
// already null terminated; use the pointer directly
return gtk_gl_area_new(attrs);
} else {
// make a null terminated copy of the attribute list
GtkWidget *area = NULL;
int *zattrs = malloc((attr_count+1)*sizeof(int));
if (!zattrs) {
return NULL;
}
memcpy(zattrs, attrs, attr_count * sizeof(attrs));
zattrs[attr_count] = 0;
area = gtk_gl_area_new(zattrs);
free(zattrs);
return area;
}
}
#endif