summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Henstridge <james@daa.com.au>2001-06-24 06:59:30 +0000
committerJames Henstridge <jamesh@src.gnome.org>2001-06-24 06:59:30 +0000
commit4d34966a127252e4f5665b665776dc8e360e6344 (patch)
tree3a3f445309c5d941f30377a7d7e7a56e177e0030
parent67c148e66f0530464b3c3918c47007cae54c7689 (diff)
downloadpygtk-4d34966a127252e4f5665b665776dc8e360e6344.tar.gz
removed all traces of GdkVisual.
2001-06-24 James Henstridge <james@daa.com.au> * gtk/gtk-types.c: removed all traces of GdkVisual. * gtk/gdk.defs (Visual): add boxed type for visual.
-rw-r--r--ChangeLog4
-rw-r--r--codegen/argtypes.py2
-rw-r--r--codegen/codegen.py1
-rw-r--r--gtk/gdk.defs25
-rw-r--r--gtk/gtk-types.c112
-rw-r--r--gtk/gtkmodule.c1
-rw-r--r--gtk/gtkobject-support.c16
-rw-r--r--gtk/pygtk-private.h3
-rw-r--r--gtk/pygtk.h12
9 files changed, 30 insertions, 146 deletions
diff --git a/ChangeLog b/ChangeLog
index 2756bce3..ec976155 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2001-06-24 James Henstridge <james@daa.com.au>
+ * gtk/gtk-types.c: removed all traces of GdkVisual.
+
+ * gtk/gdk.defs (Visual): add boxed type for visual.
+
* gtk/gtk-types.c: remove all traces of GtkAccelGroup from this
file -- GtkAccelGroup is now generated code.
diff --git a/codegen/argtypes.py b/codegen/argtypes.py
index 68315f7e..13293a40 100644
--- a/codegen/argtypes.py
+++ b/codegen/argtypes.py
@@ -587,8 +587,6 @@ matcher.register_custom_boxed('GdkColor', 'PyGdkColor_Type',
'PyGdkColor_Get', 'PyGdkColor_New')
matcher.register_custom_boxed('GdkEvent', 'PyGdkEvent_Type',
'PyGdkEvent_Get', 'PyGdkEvent_New')
-matcher.register_custom_boxed('GdkVisual', 'PyGdkVisual_Type',
- 'PyGdkVisual_Get', 'PyGdkVisual_New')
matcher.register_custom_boxed('GtkSelectionData', 'PyGtkSelectionData_Type',
'PyGtkSelectionData_Get',
'PyGtkSelectionData_New')
diff --git a/codegen/codegen.py b/codegen/codegen.py
index 94e65d90..cec3a3b6 100644
--- a/codegen/codegen.py
+++ b/codegen/codegen.py
@@ -536,6 +536,7 @@ def write_boxed_constructor(objname, funcobj, fp=sys.stdout):
def write_boxed_getattr(parser, boxedobj, fp=sys.stdout):
typecode = argtypes._enum_name(boxedobj.c_name)
+ uline = argtypes._to_upper_str(boxedobj.c_name)[1:]
attrchecks = ''
for ftype, fname in boxedobj.fields:
try:
diff --git a/gtk/gdk.defs b/gtk/gdk.defs
index 8de261b4..353d15e7 100644
--- a/gtk/gdk.defs
+++ b/gtk/gdk.defs
@@ -70,6 +70,31 @@
(c-name GdkPixbufAnimationIter)
)
+
+;; Boxed types ...
+
+(boxed Visual
+ (in-module Gdk)
+ (c-name GdkVisual)
+ (copy-func gdk_visual_ref)
+ (release-func gdk_visual_unref)
+ (field (type-and-name GdkVisualType type))
+ (field (type-and-name gint depth))
+ (field (type-and-name GdkByteOrder byte_order))
+ (field (type-and-name gint colormap_size))
+ (field (type-and-name gint bits_per_rgb))
+ (field (type-and-name guint32 red_mask))
+ (field (type-and-name gint red_shift))
+ (field (type-and-name gint red_prec))
+ (field (type-and-name guint32 green_mask))
+ (field (type-and-name gint green_shift))
+ (field (type-and-name gint green_prec))
+ (field (type-and-name guint32 blue_mask))
+ (field (type-and-name gint blue_shift))
+ (field (type-and-name gint blue_prec))
+)
+
+
;; Enumerations and flags ...
(enum ColorContextMode
diff --git a/gtk/gtk-types.c b/gtk/gtk-types.c
index 29f4283e..65bc2d99 100644
--- a/gtk/gtk-types.c
+++ b/gtk/gtk-types.c
@@ -86,20 +86,6 @@ PyGdkGC_New(GdkGC *gc)
}
#endif
-PyObject *
-PyGdkVisual_New(GdkVisual *visual)
-{
- PyGdkVisual_Object *self;
-
- self = (PyGdkVisual_Object *)PyObject_NEW(PyGdkVisual_Object,
- &PyGdkVisual_Type);
- if (self == NULL)
- return NULL;
- self->obj = visual;
- gdk_visual_ref(self->obj);
- return (PyObject *)self;
-}
-
#if 0
PyObject *
PyGdkColormap_New(GdkColormap *cmap)
@@ -1835,89 +1821,8 @@ PyTypeObject PyGdkGC_Type = {
0L,0L,0L,0L,
NULL
};
-#endif
static void
-pygdk_visual_dealloc(PyGdkVisual_Object *self)
-{
- gdk_visual_unref(self->obj);
- PyMem_DEL(self);
-}
-
-static struct memberlist pygdk_visual_members[] = {
- { "type", T_INT, offsetof(GdkVisual, type), READONLY },
- { "depth", T_INT, offsetof(GdkVisual, depth), READONLY },
- { "byte_order", T_INT, offsetof(GdkVisual, byte_order), READONLY },
- { "colormap_size", T_INT, offsetof(GdkVisual, colormap_size), READONLY },
- { "bits_per_rgb", T_INT, offsetof(GdkVisual, bits_per_rgb), READONLY },
- { "red_mask", T_INT, offsetof(GdkVisual, red_mask), READONLY },
- { "red_shift", T_INT, offsetof(GdkVisual, red_shift), READONLY },
- { "red_prec", T_INT, offsetof(GdkVisual, red_prec), READONLY },
- { "green_mask", T_INT, offsetof(GdkVisual, green_mask), READONLY },
- { "green_shift", T_INT, offsetof(GdkVisual, green_shift), READONLY },
- { "green_prec", T_INT, offsetof(GdkVisual, green_prec), READONLY },
- { "blue_mask", T_INT, offsetof(GdkVisual, blue_mask), READONLY },
- { "blue_shift", T_INT, offsetof(GdkVisual, blue_shift), READONLY },
- { "blue_prec", T_INT, offsetof(GdkVisual, blue_prec), READONLY },
- { NULL, 0, 0, 0 }
-};
-
-static PyObject *
-pygdk_visual_getattr(PyGdkVisual_Object *self, char *attr)
-{
- /* handle non int attributes first */
- if (!strcmp(attr, "type"))
- return PyInt_FromLong(self->obj->type);
- else if (!strcmp(attr, "byte_order"))
- return PyInt_FromLong(self->obj->byte_order);
- else if (!strcmp(attr, "red_mask"))
- return PyInt_FromLong(self->obj->red_mask);
- else if (!strcmp(attr, "green_mask"))
- return PyInt_FromLong(self->obj->green_mask);
- else if (!strcmp(attr, "blue_mask"))
- return PyInt_FromLong(self->obj->blue_mask);
- /* rest are all ints, so PyMember_Get should have not problems */
- return PyMember_Get((char *)self->obj, pygdk_visual_members, attr);
-}
-
-static int
-pygdk_visual_compare(PyGdkVisual_Object *self, PyGdkVisual_Object *v)
-{
- if (self->obj == v->obj) return 0;
- if (self->obj > v->obj) return -1;
- return 1;
-}
-
-static long
-pygdk_visual_hash(PyGdkVisual_Object *self)
-{
- return (long)self->obj;
-}
-
-PyTypeObject PyGdkVisual_Type = {
- PyObject_HEAD_INIT(NULL)
- 0,
- "GdkVisual",
- sizeof(PyGdkVisual_Object),
- 0,
- (destructor)pygdk_visual_dealloc,
- (printfunc)0,
- (getattrfunc)pygdk_visual_getattr,
- (setattrfunc)0,
- (cmpfunc)pygdk_visual_compare,
- (reprfunc)0,
- 0,
- 0,
- 0,
- (hashfunc)pygdk_visual_hash,
- (ternaryfunc)0,
- (reprfunc)0,
- 0L,0L,0L,0L,
- NULL
-};
-
-#if 0
-static void
PyGdkColormap_Dealloc(PyGdkColormap_Object *self)
{
gdk_colormap_unref(self->obj);
@@ -3587,20 +3492,6 @@ PyGdkEvent_to_value(GValue *value, PyObject *object)
return -1;
}
static PyObject *
-PyGdkVisual_from_value(const GValue *value)
-{
- return PyGdkVisual_New(g_value_get_boxed(value));
-}
-static int
-PyGdkVisual_to_value(GValue *value, PyObject *object)
-{
- if (PyGdkVisual_Check(object)) {
- g_value_set_boxed(value, PyGdkVisual_Get(object));
- return 0;
- }
- return -1;
-}
-static PyObject *
PyGtkSelectionData_from_value(const GValue *value)
{
return PyGtkSelectionData_New(g_value_get_boxed(value));
@@ -3685,9 +3576,6 @@ _pygtk_register_boxed_types(PyObject *moddict)
#if 0
register_tp(GdkWindow);
register_tp(GdkGC);
-#endif
- register_tp2(GdkVisual, GDK_TYPE_VISUAL);
-#if 0
register_tp(GdkColormap);
register_tp(GdkDragContext);
#endif
diff --git a/gtk/gtkmodule.c b/gtk/gtkmodule.c
index 9c22318f..32becd1c 100644
--- a/gtk/gtkmodule.c
+++ b/gtk/gtkmodule.c
@@ -37,7 +37,6 @@ static struct _PyGtk_FunctionStruct functions = {
&PyGdkFont_Type, PyGdkFont_New,
&PyGdkColor_Type, PyGdkColor_New,
&PyGdkEvent_Type, PyGdkEvent_New,
- &PyGdkVisual_Type, PyGdkVisual_New,
&PyGtkSelectionData_Type, PyGtkSelectionData_New,
&PyGdkAtom_Type, PyGdkAtom_New,
&PyGdkCursor_Type, PyGdkCursor_New,
diff --git a/gtk/gtkobject-support.c b/gtk/gtkobject-support.c
index ba96678b..63e95cfc 100644
--- a/gtk/gtkobject-support.c
+++ b/gtk/gtkobject-support.c
@@ -231,13 +231,6 @@ pygtk_arg_from_pyobject(GtkArg *arg, PyObject *obj)
GTK_VALUE_BOXED(*arg) = NULL;
else
return -1;
- } else if (arg->type == GDK_TYPE_VISUAL) {
- if (PyGdkVisual_Check(obj))
- GTK_VALUE_BOXED(*arg) = PyGdkVisual_Get(obj);
- else if (obj == Py_None)
- GTK_VALUE_BOXED(*arg) = NULL;
- else
- return -1;
} else if (arg->type == GTK_TYPE_SELECTION_DATA) {
if (PyGtkSelectionData_Check(obj))
GTK_VALUE_BOXED(*arg) = PyGtkSelectionData_Get(obj);
@@ -316,8 +309,6 @@ pygtk_arg_as_pyobject(GtkArg *arg)
return PyGdkFont_New(GTK_VALUE_BOXED(*arg));
else if (arg->type == GDK_TYPE_COLOR)
return PyGdkColor_New(GTK_VALUE_BOXED(*arg));
- else if (arg->type == GDK_TYPE_VISUAL)
- return PyGdkVisual_New(GTK_VALUE_BOXED(*arg));
else if (arg->type == GTK_TYPE_SELECTION_DATA)
return PyGtkSelectionData_New(GTK_VALUE_BOXED(*arg));
else {
@@ -459,11 +450,6 @@ pygtk_ret_from_pyobject(GtkArg *ret, PyObject *py_ret)
*GTK_RETLOC_BOXED(*ret) = PyGdkColor_Get(py_ret);
else
*GTK_RETLOC_BOXED(*ret) = NULL;
- } else if (ret->type == GDK_TYPE_VISUAL) {
- if (PyGdkVisual_Check(py_ret))
- *GTK_RETLOC_BOXED(*ret) = PyGdkVisual_Get(py_ret);
- else
- *GTK_RETLOC_BOXED(*ret) = NULL;
} else if (ret->type == GTK_TYPE_SELECTION_DATA) {
if (PyGtkSelectionData_Check(py_ret))
*GTK_RETLOC_BOXED(*ret) = PyGtkSelectionData_Get(py_ret);
@@ -539,8 +525,6 @@ pygtk_ret_as_pyobject(GtkArg *arg)
return PyGdkFont_New(*GTK_RETLOC_BOXED(*arg));
else if (arg->type == GDK_TYPE_COLOR)
return PyGdkColor_New(*GTK_RETLOC_BOXED(*arg));
- else if (arg->type == GDK_TYPE_VISUAL)
- return PyGdkVisual_New(*GTK_RETLOC_BOXED(*arg));
else if (arg->type == GTK_TYPE_SELECTION_DATA)
return PyGtkSelectionData_New(*GTK_RETLOC_BOXED(*arg));
else {
diff --git a/gtk/pygtk-private.h b/gtk/pygtk-private.h
index 2d8c7f41..19a807fd 100644
--- a/gtk/pygtk-private.h
+++ b/gtk/pygtk-private.h
@@ -18,7 +18,6 @@ extern PyExtensionClass PyGtkAccelGroup_Type;
extern PyTypeObject PyGdkFont_Type;
extern PyTypeObject PyGdkColor_Type;
extern PyTypeObject PyGdkEvent_Type;
-extern PyTypeObject PyGdkVisual_Type;
extern PyTypeObject PyGtkSelectionData_Type;
extern PyTypeObject PyGdkAtom_Type;
extern PyTypeObject PyGdkCursor_Type;
@@ -32,7 +31,6 @@ extern PyTypeObject PyGtkTreeIter_Type;
#define PyGdkFont_Check(v) ((v)->ob_type == &PyGdkFont_Type)
#define PyGdkColor_Check(v) ((v)->ob_type == &PyGdkColor_Type)
#define PyGdkEvent_Check(v) ((v)->ob_type == &PyGdkEvent_Type)
-#define PyGdkVisual_Check(v) ((v)->ob_type == &PyGdkVisual_Type)
#define PyGtkSelectionData_Check(v) ((v)->ob_type == &PyGtkSelectionData_Type)
#define PyGdkAtom_Check(v) ((v)->ob_type == &PyGdkAtom_Type)
#define PyGdkCursor_Check(v) ((v)->ob_type == &PyGdkCursor_Type)
@@ -46,7 +44,6 @@ extern PyTypeObject PyGtkTreeIter_Type;
PyObject *PyGdkFont_New(GdkFont *font);
PyObject *PyGdkColor_New(GdkColor *colour);
PyObject *PyGdkEvent_New(GdkEvent *event);
-PyObject *PyGdkVisual_New(GdkVisual *visual);
PyObject *PyGtkSelectionData_New(GtkSelectionData *data);
PyObject *PyGdkAtom_New(GdkAtom atom);
PyObject *PyGdkCursor_New(GdkCursor *cursor);
diff --git a/gtk/pygtk.h b/gtk/pygtk.h
index b985a5f6..01bca62c 100644
--- a/gtk/pygtk.h
+++ b/gtk/pygtk.h
@@ -38,9 +38,6 @@ struct _PyGtk_FunctionStruct {
PyTypeObject *gdkEvent_type;
PyObject *(* gdkEvent_new)(GdkEvent *event);
- PyTypeObject *gdkVisual_type;
- PyObject *(* gdkVisual_new)(GdkVisual *visual);
-
PyTypeObject *gtkSelectionData_type;
PyObject *(* gtkSelectionData_new)(GtkSelectionData *data);
@@ -82,11 +79,6 @@ typedef struct {
typedef struct {
PyObject_HEAD
- GdkVisual *obj;
-} PyGdkVisual_Object;
-
-typedef struct {
- PyObject_HEAD
GtkSelectionData *obj;
} PyGtkSelectionData_Object;
@@ -125,7 +117,6 @@ typedef struct {
#define PyGdkFont_Get(v) (((PyGdkFont_Object *)(v))->obj)
#define PyGdkColor_Get(v) (&((PyGdkColor_Object *)(v))->obj)
#define PyGdkEvent_Get(v) (((PyGdkEvent_Object *)(v))->obj)
-#define PyGdkVisual_Get(v) (((PyGdkVisual_Object *)(v))->obj)
#define PyGtkSelectionData_Get(v) (((PyGtkSelectionData_Object *)(v))->obj)
#define PyGdkAtom_Get(v) (((PyGdkAtom_Object *)(v))->atom)
#define PyGdkCursor_Get(v) (((PyGdkCursor_Object *)(v))->obj)
@@ -151,7 +142,6 @@ struct _PyGtk_FunctionStruct *_PyGtk_API;
#define PyGdkFont_Type *(_PyGtk_API->gdkFont_type)
#define PyGdkColor_Type *(_PyGtk_API->gdkColor_type)
#define PyGdkEvent_Type *(_PyGtk_API->gdkEvent_type)
-#define PyGdkVisual_Type *(_PyGtk_API->gdkVisual_type)
#define PyGtkSelectionData_Type *(_PyGtk_API->gtkSelectionData_type)
#define PyGdkAtom_Type *(_PyGtk_API->gdkAtom_type)
#define PyGdkCursor_Type *(_PyGtk_API->gdkCursor_type)
@@ -164,7 +154,6 @@ struct _PyGtk_FunctionStruct *_PyGtk_API;
#define PyGdkFont_Check(v) ((v)->ob_type == _PyGtk_API->gdkFont_type)
#define PyGdkColor_Check(v) ((v)->ob_type == _PyGtk_API->gdkColor_type)
#define PyGdkEvent_Check(v) ((v)->ob_type == _PyGtk_API->gdkEvent_type)
-#define PyGdkVisual_Check(v) ((v)->ob_type == _PyGtk_API->gdkVisual_type)
#define PyGtkSelectionData_Check(v) ((v)->ob_type == _PyGtk_API->gtkSelectionData_type)
#define PyGdkAtom_Check(v) ((v)->ob_type == _PyGtk_API->gdkAtom_type)
#define PyGdkCursor_Check(v) ((v)->ob_type == _PyGtk_API->gdkCursor_type)
@@ -177,7 +166,6 @@ struct _PyGtk_FunctionStruct *_PyGtk_API;
#define PyGdkFont_New (_PyGtk_API->gdkFont_new)
#define PyGdkColor_New (_PyGtk_API->gdkColor_new)
#define PyGdkEvent_New (_PyGtk_API->gdkEvent_new)
-#define PyGdkVisual_New (_PyGtk_API->gdkVisual_new)
#define PyGtkSelectionData_New (_PyGtk_API->gtkSelectionData_new)
#define PyGdkAtom_New (_PyGtk_API->gdkAtom_new)
#define PyGdkCursor_New (_PyGtk_API->gdkCursor_new)