summaryrefslogtreecommitdiff
path: root/gtk/gtkgl.override
blob: 016a2ed3e6891d4a3f8e4006fd705f30245468d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* -*- Mode: C; c-basic-offset: 4 -*- */
%%
headers
#define NO_IMPORT_PYGOBJECT
#include "pygobject.h"
#include "pygtk.h"

#include <gtkgl/gtkglarea.h>
#include <gtk/gtk.h>

%%
modulename gl
%%
import gobject.GObject as PyGObject_Type
import gtk.gdk.Visual as PyGdkVisual_Type
import gtk.DrawingArea as PyGtkDrawingArea_Type
%%
ignore
  gtk_gl_area_get_type
  gtk_gl_area_new
  gtk_gl_area_new_vargs
  gtk_gl_area_begingl
  gtk_gl_area_endgl
  gtk_gl_area_swapbuffers
  gtk_gl_area_size
  gdk_gl_choose_visual
  gdk_gl_context_new
  gdk_gl_context_share_new
  gdk_gl_context_attrlist_share_new
  gdk_gl_context_ref
  gdk_gl_context_unref
  gdk_gl_make_current
  gdk_gl_swap_buffers
  gdk_gl_pixmap_new
  gdk_gl_pixmap_ref
  gdk_gl_pixmap_unref
  gdk_gl_pixmap_make_current
%%
override gtk_gl_area_share_new kwargs
static int
_wrap_gtk_gl_area_share_new(PyGObject *self, PyObject *args,
			    PyObject *kwargs)
{
    char *kwlist[] = { "attr_list", "share", NULL };
    gint *attr_list;
    GtkGLArea *share = NULL;
    PyObject *py_attr_list, *py_share = Py_None;
    gint i, len;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:GtkGLArea.__init__",
				     kwlist, &py_attr_list, &py_share))
	return -1;
    if (!PySequence_Check(py_attr_list)) {
	PyErr_SetString(PyExc_TypeError, "attr_list must be a sequence");
	return -1;
    }
    len = PySequence_Length(py_attr_list);
    attr_list = g_new(gint, len+1);
    for (i = 0; i < len; i++) {
	PyObject *item = PySequence_GetItem(py_attr_list, i);

	Py_DECREF(item);
	if (!PyInt_Check(item)) {
	    g_free(attr_list);
	    PyErr_SetString(PyExc_TypeError, "attr_list items must be ints");
	    return -1;
	}
	attr_list[i] = PyInt_AsLong(item);
    }
    attr_list[len] = GDK_GL_NONE; /* sentinel */

    if (!pygobject_check(py_share, &PyGtkGLArea_Type)) {
	if ( pygobject_get(py_share) != NULL )
	    share = GTK_GL_AREA(pygobject_get(py_share));
    } else if (py_share != Py_None) {
	PyErr_SetString(PyExc_TypeError, "share must be a GtkGLArea or None");
	return -1;
    }

    pygobject_get(self) = (GObject *)gtk_gl_area_share_new(attr_list, share);
    if (!self->obj) {
	PyErr_SetString(PyExc_RuntimeError,
			"could not create GtkGLArea object");
	return -1;
    }
    pygobject_register_wrapper((PyObject *)self);
    //Py_INCREF(Py_None);
    //return Py_None;
    return 0;
}
%%
override gdk_gl_wait_gdk noargs
static PyObject *
_wrap_gdk_gl_wait_gdk(PyGObject *self)
{
    pyg_unblock_threads();
    gdk_gl_wait_gdk();
    pyg_block_threads();
    Py_INCREF(Py_None);
    return Py_None;
}
%%
override gdk_gl_wait_gl noargs
static PyObject *
_wrap_gdk_gl_wait_gl(PyGObject *self)
{
    pyg_unblock_threads();
    gdk_gl_wait_gl();
    pyg_block_threads();
    Py_INCREF(Py_None);
    return Py_None;
}

/* you should add appropriate ignore, ignore-glob and
 * override sections here */