? config.log ? gtkgl_impl.c ? config.status ? config.cache ? gtkmodule_impl.c ? Makefile ? gtkmodule_defs.c ? gtkgl_defs.c ? libglade_impl.c ? libglade_defs.c ? generate/Makefile ? generate/gtk.ignore ? generate/gtkgl.ignore ? generate/libglade.ignore ? pyglade/Makefile Index: GDK.py =================================================================== RCS file: /home/cvs/src/ide/external/pygtk-0.6.5-wing/GDK.py,v retrieving revision 1.1 retrieving revision 1.4 diff -c -r1.1 -r1.4 *** GDK.py 2000/03/13 18:45:37 1.1 --- GDK.py 2001/05/03 18:41:04 1.4 *************** *** 294,299 **** --- 294,316 ---- XTERM = 152 CURSOR_IS_PIXMAP = -1 + # WINGIDE_EXTENSIONS + # GdkWindowClass's + INPUT_OUTPUT = 0 + INPUT_ONLY = 1 + + # GdkWindowType's + WINDOW_ROOT = 0 + WINDOW_TOPLEVEL = 1 + WINDOW_CHILD = 2 + WINDOW_DIALOG = 3 + WINDOW_TEMP = 4 + WINDOW_PIXMAP = 5 + WINDOW_FOREIGN = 6 + + # Time specifier for selection_convert() + CURRENT_TIME = 0L + # END WINGIDE_EXTENSIONS # these are the Key Symbols for GDK # they were created with sed -n 's/#define GDK)\([^ ]*\)/\1 =/p' + #include #ifdef HAVE_NUMPY #include #endif #include + #include + + #ifdef _MSC_VER + #undef WITH_XSTUFF + + /* reduce the strict checking from glibconfig.h */ + #pragma warning(default:4047) + /* see: Python FAQ 3.24 "Initializer not a constant." */ + #if 1 /* set to 0 to get all todos */ + #undef PyObject_HEAD_INIT + #define PyObject_HEAD_INIT(a) \ + 1, NULL, /* must be set by init function */ + #endif + + #define VERSION "0.6.5" /* where does it come from on X ?*/ + #else #define WITH_XSTUFF #ifdef WITH_XSTUFF #include #endif + #endif /* _MSC_VER */ #define _INSIDE_PYGTK_ #include "pygtk.h" + /* Hack to turn off threading support. */ + #ifdef WITH_THREAD + #undef WITH_THREAD + #endif + /* The threading hacks are based on ones supplied by Duncan Grisby * of AT&T Labs Cambridge. Since then they have been modified a bit. */ *************** *** 637,646 **** return PyGtkStyleHelper_New(style, STYLE_GC_ARRAY, style->text_gc); if (!strcmp(attr, "base_gc")) return PyGtkStyleHelper_New(style, STYLE_GC_ARRAY, style->base_gc); ! if (!strcmp(attr, "black_gc")) ! return PyGdkGC_New(style->black_gc); ! if (!strcmp(attr, "white_gc")) ! return PyGdkGC_New(style->white_gc); if (!strcmp(attr, "bg_pixmap")) return PyGtkStyleHelper_New(style, STYLE_PIXMAP_ARRAY, style->bg_pixmap); if (!strcmp(attr, "colormap")) { --- 660,677 ---- return PyGtkStyleHelper_New(style, STYLE_GC_ARRAY, style->text_gc); if (!strcmp(attr, "base_gc")) return PyGtkStyleHelper_New(style, STYLE_GC_ARRAY, style->base_gc); ! if (!strcmp(attr, "black_gc")) { ! if (style->black_gc) ! return PyGdkGC_New(style->black_gc); ! Py_INCREF(Py_None); ! return Py_None; ! } ! if (!strcmp(attr, "white_gc")){ ! if (style->white_gc) ! return PyGdkGC_New(style->white_gc); ! Py_INCREF(Py_None); ! return Py_None; ! } if (!strcmp(attr, "bg_pixmap")) return PyGtkStyleHelper_New(style, STYLE_PIXMAP_ARRAY, style->bg_pixmap); if (!strcmp(attr, "colormap")) { *************** *** 1446,1455 **** PyObject *args) { PyObject *cursor; ! if (!PyArg_ParseTuple(args, "O!:GdkWindow.set_cursor", &PyGdkCursor_Type, ! &cursor)) return NULL; ! gdk_window_set_cursor(self->obj, PyGdkCursor_Get(cursor)); Py_INCREF(Py_None); return Py_None; } --- 1477,1494 ---- PyObject *args) { PyObject *cursor; ! if (!PyArg_ParseTuple(args, "O:GdkWindow.set_cursor", &cursor)) ! return NULL; ! if (PyGdkCursor_Check(cursor)) ! gdk_window_set_cursor(self->obj, PyGdkCursor_Get(cursor)); ! else if (cursor == Py_None) ! gdk_window_set_cursor(self->obj, NULL); ! else { ! PyErr_SetString(PyExc_TypeError, ! "cursor must either be a GdkCursor instance or None"); return NULL; ! } ! Py_INCREF(Py_None); return Py_None; } *************** *** 1643,1648 **** --- 1682,1728 ---- return Py_None; } + #define WINGIDE_EXTENSIONS + #ifdef WINGIDE_EXTENSIONS + static PyObject *PyGdkWindow_Show(PyGdkWindow_Object *self, + PyObject *args) { + if (!PyArg_ParseTuple(args, ":GdkWindow._show")) + return NULL; + gdk_window_show(self->obj); + Py_INCREF(Py_None); + return Py_None; + } + + static PyObject *PyGdkWindow_Hide(PyGdkWindow_Object *self, + PyObject *args) { + if (!PyArg_ParseTuple(args, ":GdkWindow._hide")) + return NULL; + gdk_window_hide(self->obj); + Py_INCREF(Py_None); + return Py_None; + } + + static PyObject *PyGdkWindow_Destroy(PyGdkWindow_Object *self, + PyObject *args) { + if (!PyArg_ParseTuple(args, ":GdkWindow._destroy")) + return NULL; + gdk_window_destroy(self->obj); + Py_INCREF(Py_None); + return Py_None; + } + + static PyObject *PyGdkWindow_SetTransientFor(PyGdkWindow_Object *self, + PyObject *args) { + PyObject *parent; + if (!PyArg_ParseTuple(args, "O:GdkWindow._set_transient_for", &parent)) + return NULL; + + gdk_window_set_transient_for(self->obj, PyGdkWindow_Get(parent)); + Py_INCREF(Py_None); + return Py_None; + } + #endif + static PyObject *PyGdkWindow_InputGetPointer(PyGdkWindow_Object *self, PyObject *args) { guint32 deviceid; *************** *** 1663,1668 **** --- 1743,1754 ---- {"property_change", (PyCFunction)PyGdkWindow_PropertyChange, METH_VARARGS, NULL}, {"property_delete", (PyCFunction)PyGdkWindow_PropertyDelete, METH_VARARGS, NULL}, {"_raise", (PyCFunction)PyGdkWindow_Raise, METH_VARARGS, NULL}, + #ifdef WINGIDE_EXTENSIONS + {"_show", (PyCFunction)PyGdkWindow_Show, METH_VARARGS, NULL}, + {"_hide", (PyCFunction)PyGdkWindow_Hide, METH_VARARGS, NULL}, + {"_destroy", (PyCFunction)PyGdkWindow_Destroy, METH_VARARGS, NULL}, + {"_set_transient_for", (PyCFunction)PyGdkWindow_SetTransientFor, METH_VARARGS, NULL}, + #endif {"lower", (PyCFunction)PyGdkWindow_Lower, METH_VARARGS, NULL}, {"input_get_pointer", (PyCFunction)PyGdkWindow_InputGetPointer, METH_VARARGS, NULL}, {NULL, 0, 0, NULL} *************** *** 1674,1746 **** gint x, y; GdkModifierType p_mask; ! if (!strcmp(key, "__members__")) ! return Py_BuildValue("[sssssssssssss]", "children", "colormap", "depth", ! "height", "parent", "pointer", "pointer_state", ! "toplevel", "type", "width", "x", "xid", "y"); ! if (!strcmp(key, "width")) { ! gdk_window_get_size(win, &x, NULL); ! return PyInt_FromLong(x); ! } ! if (!strcmp(key, "height")) { ! gdk_window_get_size(win, NULL, &y); ! return PyInt_FromLong(y); ! } ! if (!strcmp(key, "x")) { ! gdk_window_get_position(win, &x, NULL); ! return PyInt_FromLong(x); ! } ! if (!strcmp(key, "y")) { ! gdk_window_get_position(win, NULL, &y); ! return PyInt_FromLong(y); ! } ! if (!strcmp(key, "colormap")) ! return PyGdkColormap_New(gdk_window_get_colormap(win)); ! if (!strcmp(key, "pointer")) { ! gdk_window_get_pointer(win, &x, &y, NULL); ! return Py_BuildValue("(ii)", x, y); ! } ! if (!strcmp(key, "pointer_state")) { ! gdk_window_get_pointer(win, NULL, NULL, &p_mask); ! return PyInt_FromLong(p_mask); } ! if (!strcmp(key, "parent")) { GdkWindow *par = gdk_window_get_parent(win); if (par) ! return PyGdkWindow_New(par); Py_INCREF(Py_None); return Py_None; ! } ! if (!strcmp(key, "toplevel")) ! return PyGdkWindow_New(gdk_window_get_toplevel(win)); ! if (!strcmp(key, "children")) { ! GList *children, *tmp; ! PyObject *ret; ! children = gdk_window_get_children(win); ! if ((ret = PyList_New(0)) == NULL) ! return NULL; ! for (tmp = children; tmp != NULL; tmp = tmp->next) { ! PyObject *win = PyGdkWindow_New(tmp->data); ! if (win == NULL) { ! Py_DECREF(ret); ! return NULL; } ! PyList_Append(ret, win); ! Py_DECREF(win); } ! g_list_free(children); ! return ret; ! } ! if (!strcmp(key, "type")) ! return PyInt_FromLong(gdk_window_get_type(win)); ! if (!strcmp(key, "depth")) { ! gdk_window_get_geometry(win, NULL, NULL, NULL, NULL, &x); ! return PyInt_FromLong(x); ! } #ifdef WITH_XSTUFF ! if (!strcmp(key, "xid")) return PyInt_FromLong(GDK_WINDOW_XWINDOW(win)); #endif return Py_FindMethod(PyGdkWindow_methods, (PyObject *)self, key); } --- 1760,1858 ---- gint x, y; GdkModifierType p_mask; ! if (gdk_window_get_type(win) == GDK_WINDOW_PIXMAP) { ! if (!strcmp(key, "__members__")) ! return Py_BuildValue("[ssss]", "depth", "height", "type", "width"); ! if (!strcmp(key, "width")) { ! gdk_window_get_size(win, &x, NULL); ! return PyInt_FromLong(x); ! } ! if (!strcmp(key, "height")) { ! gdk_window_get_size(win, NULL, &y); ! return PyInt_FromLong(y); ! } ! if (!strcmp(key, "type")) ! return PyInt_FromLong(gdk_window_get_type(win)); ! if (!strcmp(key, "depth")) { ! gdk_window_get_geometry(win, NULL, NULL, NULL, NULL, &x); ! return PyInt_FromLong(x); ! } } ! else { ! if (!strcmp(key, "__members__")) ! return Py_BuildValue("[sssssssssssss]", "children", "colormap", "depth", ! "height", "parent", "pointer", "pointer_state", ! "toplevel", "type", "width", "x", "xid", "y"); ! if (!strcmp(key, "width")) { ! gdk_window_get_size(win, &x, NULL); ! return PyInt_FromLong(x); ! } ! if (!strcmp(key, "height")) { ! gdk_window_get_size(win, NULL, &y); ! return PyInt_FromLong(y); ! } ! if (!strcmp(key, "x")) { ! gdk_window_get_position(win, &x, NULL); ! return PyInt_FromLong(x); ! } ! if (!strcmp(key, "y")) { ! gdk_window_get_position(win, NULL, &y); ! return PyInt_FromLong(y); ! } ! if (!strcmp(key, "colormap")) { ! if (gdk_window_get_type(win) == GDK_WINDOW_PIXMAP) { ! Py_INCREF(Py_None); ! return Py_None; ! } ! return PyGdkColormap_New(gdk_window_get_colormap(win)); ! } ! if (!strcmp(key, "pointer")) { ! gdk_window_get_pointer(win, &x, &y, NULL); ! return Py_BuildValue("(ii)", x, y); ! } ! if (!strcmp(key, "pointer_state")) { ! gdk_window_get_pointer(win, NULL, NULL, &p_mask); ! return PyInt_FromLong(p_mask); ! } ! if (!strcmp(key, "parent")) { GdkWindow *par = gdk_window_get_parent(win); if (par) ! return PyGdkWindow_New(par); Py_INCREF(Py_None); return Py_None; ! } ! if (!strcmp(key, "toplevel")) ! return PyGdkWindow_New(gdk_window_get_toplevel(win)); ! if (!strcmp(key, "children")) { ! GList *children, *tmp; ! PyObject *ret; ! ! if ((ret = PyList_New(0)) == NULL) ! return NULL; ! children = gdk_window_get_children(win); ! for (tmp = children; tmp != NULL; tmp = tmp->next) { ! PyObject *win = PyGdkWindow_New(tmp->data); ! if (win == NULL) { ! Py_DECREF(ret); ! return NULL; ! } ! PyList_Append(ret, win); ! Py_DECREF(win); } ! g_list_free(children); ! return ret; } ! if (!strcmp(key, "type")) ! return PyInt_FromLong(gdk_window_get_type(win)); ! if (!strcmp(key, "depth")) { ! gdk_window_get_geometry(win, NULL, NULL, NULL, NULL, &x); ! return PyInt_FromLong(x); ! } #ifdef WITH_XSTUFF ! if (!strcmp(key, "xid")) return PyInt_FromLong(GDK_WINDOW_XWINDOW(win)); #endif + } return Py_FindMethod(PyGdkWindow_methods, (PyObject *)self, key); } *************** *** 1977,1983 **** return NULL; } } ! if (!gdk_color_alloc(self->obj, &color)) { PyErr_SetString(PyExc_RuntimeError, "couldn't allocate color"); return NULL; } --- 2089,2095 ---- return NULL; } } ! if (!gdk_colormap_alloc_color(self->obj, &color, FALSE, TRUE)) { PyErr_SetString(PyExc_RuntimeError, "couldn't allocate color"); return NULL; } *************** *** 3697,3702 **** --- 3809,3824 ---- return Py_None; } + static PyObject *_wrap_gtk_set_locale(PyObject *self, PyObject *args) { + char *locale; + + if (!PyArg_ParseTuple(args, ":gtk_set_locale")) + return NULL; + locale = gtk_set_locale(); + setlocale(LC_NUMERIC, "C"); + return PyString_FromString(locale); + } + static PyObject *_wrap_gtk_main(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, ":gtk_main")) return NULL; *************** *** 4723,4731 **** static PyObject *_wrap_gtk_editable_insert_text(PyObject *self, PyObject *args) { PyGtk_Object *o; char *text; ! int len, pos; ! if (!PyArg_ParseTuple(args, "O!s#:gtk_editable_insert_text", ! &PyGtk_Type, &o, &text, &len)) return NULL; gtk_editable_insert_text(GTK_EDITABLE(PyGtk_Get(o)), text, len, &pos); return PyInt_FromLong(pos); --- 4845,4854 ---- static PyObject *_wrap_gtk_editable_insert_text(PyObject *self, PyObject *args) { PyGtk_Object *o; char *text; ! int len; ! int pos = 0; ! if (!PyArg_ParseTuple(args, "O!s#|i:gtk_editable_insert_text", ! &PyGtk_Type, &o, &text, &len, &pos)) return NULL; gtk_editable_insert_text(GTK_EDITABLE(PyGtk_Get(o)), text, len, &pos); return PyInt_FromLong(pos); *************** *** 4733,4752 **** static void PyGtk_item_factory_cb(PyObject *callback, guint action, GtkWidget *widget) { ! PyObject *ret; PyGTK_BLOCK_THREADS ! ret = PyObject_CallFunction(callback, "iO", action, ! PyGtk_New((GtkObject *)widget)); ! if (ret == NULL) { if (PyGtk_FatalExceptions) gtk_main_quit(); else { PyErr_Print(); PyErr_Clear(); } ! } else ! Py_DECREF(ret); PyGTK_UNBLOCK_THREADS } --- 4856,4879 ---- static void PyGtk_item_factory_cb(PyObject *callback, guint action, GtkWidget *widget) { ! PyObject *ret = NULL; ! PyObject *py_widget = NULL; PyGTK_BLOCK_THREADS ! ! py_widget = PyGtk_New((GtkObject *)widget); ! if ( py_widget != NULL ) ! ret = PyObject_CallFunction(callback, "iO", action, py_widget); ! if (ret == NULL || py_widget == NULL) { if (PyGtk_FatalExceptions) gtk_main_quit(); else { PyErr_Print(); PyErr_Clear(); } ! } ! Py_XDECREF(ret); ! Py_XDECREF(py_widget); PyGTK_UNBLOCK_THREADS } *************** *** 5588,5625 **** } /* gdk_color_alloc analog */ static PyObject *_wrap_gdk_color_alloc(PyObject *self, PyObject *args) { GdkColor gdk_color; GdkColormap *colormap; PyGtkStyle_Object *style; PyGtk_Object *obj; ! if (PyArg_ParseTuple(args, "O!hhh:gdk_color_alloc", &PyGtkStyle_Type, ! &style, &(gdk_color.red), &(gdk_color.green), ! &(gdk_color.blue))) colormap = PyGtkStyle_Get(style)->colormap; else { PyErr_Clear(); ! if (!PyArg_ParseTuple(args, "O!hhh:gdk_color_alloc", &PyGtk_Type, ! &obj, &(gdk_color.red), &(gdk_color.green), ! &(gdk_color.blue))) return NULL; if (GTK_WIDGET_NO_WINDOW(PyGtk_Get(obj))) { PyErr_SetString(PyExc_TypeError, "widget has no window"); return NULL; } colormap = gdk_window_get_colormap(GTK_WIDGET(PyGtk_Get(obj))->window); } ! gdk_color_alloc(colormap, &gdk_color); return PyGdkColor_New(&gdk_color); } static PyObject *_wrap_gdk_color_new(PyObject *self, PyObject *args) { GdkColor gdk_color; ! if (!PyArg_ParseTuple(args, "hhhl:gdk_color_new", ! &(gdk_color.red), &(gdk_color.green), ! &(gdk_color.blue), &(gdk_color.pixel))) ! return NULL; return PyGdkColor_New(&gdk_color); } --- 5715,5768 ---- } /* gdk_color_alloc analog */ static PyObject *_wrap_gdk_color_alloc(PyObject *self, PyObject *args) { + int red, blue, green; GdkColor gdk_color; GdkColormap *colormap; PyGtkStyle_Object *style; PyGtk_Object *obj; ! if (PyArg_ParseTuple(args, "O!iii:gdk_color_alloc", &PyGtkStyle_Type, ! &style, &red, &green, &blue)) colormap = PyGtkStyle_Get(style)->colormap; else { PyErr_Clear(); ! if (!PyArg_ParseTuple(args, "O!iii:gdk_color_alloc", &PyGtk_Type, ! &obj, &red, &green, &blue)) return NULL; if (GTK_WIDGET_NO_WINDOW(PyGtk_Get(obj))) { PyErr_SetString(PyExc_TypeError, "widget has no window"); return NULL; } colormap = gdk_window_get_colormap(GTK_WIDGET(PyGtk_Get(obj))->window); + } + if ( red < 0 || red > 0xFFFF || green < 0 || green > 0xFFFF + || blue < 0 || blue > 0xFFFF ) { + PyErr_SetString(PyExc_OverflowError, "Color index value not in range"); + return NULL; } ! gdk_color.red = red; ! gdk_color.green = green; ! gdk_color.blue = blue; ! gdk_colormap_alloc_color(colormap, &gdk_color, FALSE, TRUE); return PyGdkColor_New(&gdk_color); } static PyObject *_wrap_gdk_color_new(PyObject *self, PyObject *args) { + int red, blue, green; GdkColor gdk_color; + ! if (!PyArg_ParseTuple(args, "iiil:gdk_color_new", &red, &green, &blue, ! &(gdk_color.pixel))) ! return NULL; + if ( red < 0 || red > 0xFFFF || green < 0 || green > 0xFFFF + || blue < 0 || blue > 0xFFFF ) { + PyErr_SetString(PyExc_OverflowError, "Color index value not in range"); + return NULL; + } + gdk_color.red = red; + gdk_color.green = green; + gdk_color.blue = blue; return PyGdkColor_New(&gdk_color); } *************** *** 6387,6392 **** --- 6530,6773 ---- } #endif + static PyObject* _wrap_gdk_keyval_name(PyObject* self, PyObject* args) { + unsigned int keyval; + const char* name; + + if (!PyArg_ParseTuple(args, "i:gdk_keyval_name", &keyval)) + return NULL; + + name = gdk_keyval_name(keyval); + return Py_BuildValue("s", name); + } + + static PyObject* _wrap_gdk_keyval_is_upper(PyObject* self, PyObject* args) { + unsigned int keyval; + int is_upper; + + if (!PyArg_ParseTuple(args, "i:gdk_keyval_is_upper", &keyval)) + return NULL; + + is_upper = gdk_keyval_is_upper(keyval); + if ( is_upper ) { + Py_INCREF(Py_True); + return Py_True; + } + else { + Py_INCREF(Py_False); + return Py_False; + } + } + + static PyObject* _wrap_gdk_keyval_is_lower(PyObject* self, PyObject* args) { + unsigned int keyval; + int is_lower; + + if (!PyArg_ParseTuple(args, "i:gdk_keyval_is_lower", &keyval)) + return NULL; + + is_lower = gdk_keyval_is_lower(keyval); + if ( is_lower ) { + Py_INCREF(Py_True); + return Py_True; + } + else { + Py_INCREF(Py_False); + return Py_False; + } + } + + static PyObject* _wrap_gdk_keyval_to_upper(PyObject* self, PyObject* args) { + unsigned int keyval; + unsigned int upper_val; + + if (!PyArg_ParseTuple(args, "i:gdk_keyval_to_upper", &keyval)) + return NULL; + + upper_val = gdk_keyval_to_upper(keyval); + return Py_BuildValue("i", upper_val); + } + + static PyObject* _wrap_gdk_keyval_to_lower(PyObject* self, PyObject* args) { + unsigned int keyval; + unsigned int lower_val; + + if (!PyArg_ParseTuple(args, "i:gdk_keyval_to_lower", &keyval)) + return NULL; + + lower_val = gdk_keyval_to_lower(keyval); + return Py_BuildValue("i", lower_val); + } + + + #ifdef WINGIDE_EXTENSIONS + static PyObject* _wrap_gdk_window_new(PyObject *self, PyObject *args) { + PyObject *parent; + PyObject *attr_map; + GdkWindow* gdk_parent; + GdkWindow* gdk_win; + PyObject* pygdk_win; + GdkWindowAttr attr; + guint attr_mask = 0; + PyObject *tmp; + + // Parse args + if (!PyArg_ParseTuple(args, "OO!:gdk_window_new", &parent, &PyDict_Type, + &attr_map)) + return NULL; + + if (parent == Py_None) + gdk_parent = NULL; + else if (PyGdkWindow_Check(parent)) + gdk_parent = ((PyGdkWindow_Object *) parent)->obj; + else { + PyErr_SetString(PyExc_TypeError, "window must be a PyGdkWindow or None"); + return NULL; + } + + // Fill in attribs + tmp = PyDict_GetItemString(attr_map, "window_type"); + if (tmp == NULL) { + PyErr_SetString(PyExc_ValueError, "window_type value must be specified"); + return NULL; + } + else { + if (!PyInt_Check(tmp)) { + PyErr_SetString(PyExc_TypeError, "window_type value must be an int"); + return NULL; + } + attr.window_type = PyInt_AsLong(tmp); + } + tmp = PyDict_GetItemString(attr_map, "event_mask"); + if (tmp == NULL) { + PyErr_SetString(PyExc_ValueError, "event_mask value must be specified"); + return NULL; + } + else { + if (!PyInt_Check(tmp)) { + PyErr_SetString(PyExc_TypeError, "event_mask value must be an int"); + return NULL; + } + attr.event_mask = PyInt_AsLong(tmp); + } + tmp = PyDict_GetItemString(attr_map, "width"); + if (tmp == NULL) { + PyErr_SetString(PyExc_ValueError, "width value must be specified"); + return NULL; + } + else { + if (!PyInt_Check(tmp)) { + PyErr_SetString(PyExc_TypeError, "width value must be an int"); + return NULL; + } + attr.width = PyInt_AsLong(tmp); + } + tmp = PyDict_GetItemString(attr_map, "height"); + if (tmp == NULL) { + PyErr_SetString(PyExc_ValueError, "height value must be specified"); + return NULL; + } + else { + if (!PyInt_Check(tmp)) { + PyErr_SetString(PyExc_TypeError, "height value must be an int"); + return NULL; + } + attr.height = PyInt_AsLong(tmp); + } + tmp = PyDict_GetItemString(attr_map, "wclass"); + if (tmp != NULL) { + if (!PyInt_Check(tmp)) { + PyErr_SetString(PyExc_TypeError, "wmclass value must be an int"); + return NULL; + } + attr.wclass = PyInt_AsLong(tmp); + attr_mask |= GDK_WA_WMCLASS; + } + /* + tmp = PyDict_GetItemString(attr_map, "visual"); + if (tmp != NULL) { + if (!PyGtkVisual_Check(tmp)) { + PyErr_SetString(PyExc_TypeError, "visual value must be a PyGtkVisual"); + return NULL; + } + attr.visual = ((PyGtkVisual*)tmp)->obj; + attr_mask |= GDK_WA_VISUAL; + } + */ + tmp = PyDict_GetItemString(attr_map, "colormap"); + if (tmp != NULL) { + if (!PyGdkColormap_Check(tmp)) { + PyErr_SetString(PyExc_TypeError, "colormap value must be a PyGdkColormap"); + return NULL; + } + attr.colormap = ((PyGdkColormap_Object*)tmp)->obj; + attr_mask |= GDK_WA_COLORMAP; + } + tmp = PyDict_GetItemString(attr_map, "override_redirect"); + if (tmp != NULL) { + if (!PyInt_Check(tmp)) { + PyErr_SetString(PyExc_TypeError, "override_redirect value must be an int"); + return NULL; + } + attr.override_redirect = PyInt_AsLong(tmp); + attr_mask |= GDK_WA_NOREDIR; + } + tmp = PyDict_GetItemString(attr_map, "x"); + if (tmp != NULL) { + if (!PyInt_Check(tmp)) { + PyErr_SetString(PyExc_TypeError, "x value must be an int"); + return NULL; + } + attr.x = PyInt_AsLong(tmp); + attr_mask |= GDK_WA_X; + } + tmp = PyDict_GetItemString(attr_map, "y"); + if (tmp != NULL) { + if (!PyInt_Check(tmp)) { + PyErr_SetString(PyExc_TypeError, "y value must be an int"); + return NULL; + } + attr.y = PyInt_AsLong(tmp); + attr_mask |= GDK_WA_Y; + } + + gdk_win = gdk_window_new(gdk_parent, &attr, attr_mask); + pygdk_win = PyGdkWindow_New(gdk_win); + if (pygdk_win == NULL) { + gdk_window_destroy(gdk_win); + return NULL; + } + return pygdk_win; + } + + static PyObject* _wrap_gdk_window_get_root_origin(PyObject *self, PyObject *args) { + PyObject *win; + GdkWindow* gdk_win; + gint x, y; + + // Parse args + if (!PyArg_ParseTuple(args, "O:gdk_window_get_root_origin", &win)) + return NULL; + + // Error checks + if (win == Py_None) { + Py_INCREF(Py_None); + return Py_None; + } + if (!PyGdkWindow_Check(win)) { + Py_INCREF(Py_None); + return Py_None; + } + + // Get value + gdk_win = ((PyGdkWindow_Object *) win)->obj; + gdk_window_get_root_origin(gdk_win, &x, &y); + + // Return Python tuple + return Py_BuildValue("(i,i)", x, y); + } + #endif + static PyMethodDef _gtkmoduleMethods[] = { { "gtk_signal_connect", _wrap_gtk_signal_connect, 1 }, { "gtk_signal_connect_after", _wrap_gtk_signal_connect_after, 1 }, *************** *** 6397,6402 **** --- 6778,6784 ---- { "gtk_signal_handler_unblock_by_data", _wrap_gtk_signal_handler_unblock_by_data, 1 }, { "gtk_signal_emitv_by_name", _wrap_gtk_signal_emitv_by_name, 1 }, { "gtk_init", _wrap_gtk_init, 1 }, + { "gtk_set_locale", _wrap_gtk_set_locale, 1 }, { "gtk_main", _wrap_gtk_main, 1 }, { "gtk_main_iteration", _wrap_gtk_main_iteration, 1 }, { "gtk_events_pending", _wrap_gtk_events_pending, 1 }, *************** *** 6429,6434 **** --- 6811,6820 ---- { "gtk_window_set_icon", _wrap_gtk_window_set_icon, 1 }, { "gtk_window_set_icon_name", _wrap_gtk_window_set_icon_name, 1 }, { "gtk_window_set_geometry_hints", _wrap_gtk_window_set_geometry_hints, 1 }, + #ifdef WINGIDE_EXTENSIONS + { "gdk_window_new", _wrap_gdk_window_new, 1 }, + { "gdk_window_get_root_origin", _wrap_gdk_window_get_root_origin, 1 }, + #endif { "gtk_box_query_child_packing", _wrap_gtk_box_query_child_packing, 1 }, { "gtk_button_box_get_child_size_default", _wrap_gtk_button_box_get_child_size_default, 1 }, { "gtk_button_box_get_child_ipadding_default", _wrap_gtk_button_box_get_child_ipadding_default, 1 }, *************** *** 6527,6532 **** --- 6913,6923 ---- #ifdef HAVE_NUMPY { "gdk_draw_array", _wrap_gdk_draw_array, 1 }, #endif + { "gdk_keyval_name", _wrap_gdk_keyval_name, 1 }, + { "gdk_keyval_is_upper", _wrap_gdk_keyval_is_upper, 1 }, + { "gdk_keyval_is_lower", _wrap_gdk_keyval_is_lower, 1 }, + { "gdk_keyval_to_upper", _wrap_gdk_keyval_to_upper, 1 }, + { "gdk_keyval_to_lower", _wrap_gdk_keyval_to_lower, 1 }, { NULL, NULL } }; *************** *** 6571,6576 **** --- 6962,6986 ---- PyObject *m, *d, *private; m = Py_InitModule("_gtk", _gtkmoduleMethods); d = PyModule_GetDict(m); + + #if defined (_MSC_VER) + /* see: Python FAQ 3.24 "Initializer not a constant." */ + PyGtk_Type.ob_type = &PyType_Type; + PyGtkAccelGroup_Type.ob_type = &PyType_Type; + PyGtkStyleHelper_Type.ob_type = &PyType_Type; + PyGtkStyle_Type.ob_type = &PyType_Type; + PyGdkFont_Type.ob_type = &PyType_Type; + PyGdkColor_Type.ob_type = &PyType_Type; + PyGdkEvent_Type.ob_type = &PyType_Type; + PyGdkWindow_Type.ob_type = &PyType_Type; + PyGdkGC_Type.ob_type = &PyType_Type; + PyGdkColormap_Type.ob_type = &PyType_Type; + PyGdkDragContext_Type.ob_type = &PyType_Type; + PyGtkSelectionData_Type.ob_type = &PyType_Type; + PyGdkAtom_Type.ob_type = &PyType_Type; + PyGdkCursor_Type.ob_type = &PyType_Type; + PyGtkCTreeNode_Type.ob_type = &PyType_Type; + #endif #ifdef HAVE_NUMPY import_array(); Index: makefile.msc =================================================================== RCS file: /home/cvs/src/ide/external/pygtk-0.6.5-wing/makefile.msc,v retrieving revision 1.1 retrieving revision 1.3 diff -c -r1.1 -r1.3 *** makefile.msc 2000/12/15 02:46:09 1.1 --- makefile.msc 2001/03/01 19:12:27 1.3 *************** *** 55,61 **** !ENDIF $(MODULE_PYD) : $(OBJECTS) $(MODULE).def ! $(CC) $(CFLAGS) -LD -Fe$@ $(OBJECTS) $(LDFLAGS) $(EXTRALIBS) $(GTK)\gtk\gtk-$(GTK_VER).lib $(GLIB)\gmodule-$(GLIB_VER).lib $(GLIB)\glib-$(GLIB_VER).lib $(GLIB)\gthread\gthread-$(GLIB_VER).lib $(GTK)\gtk\gtk-$(GTK_VER).lib $(GTK)\gdk\gdk-$(GTK_VER).lib /def:$(MODULE).def # General rule for building $(gimp_OBJECTS) .c.obj: --- 55,61 ---- !ENDIF $(MODULE_PYD) : $(OBJECTS) $(MODULE).def ! $(CC) $(CFLAGS) -LD -Fe$@ $(OBJECTS) $(LDFLAGS) $(EXTRALIBS) $(GTK)\gtk\gtk-$(GTK_VER).lib $(GLIB)\gmodule\gmodule-$(GLIB_VER).lib $(GLIB)\glib-$(GLIB_VER).lib $(GLIB)\gthread\gthread-$(GLIB_VER).lib $(GTK)\gtk\gtk-$(GTK_VER).lib $(GTK)\gdk\gdk-$(GTK_VER).lib /def:$(MODULE).def # General rule for building $(gimp_OBJECTS) .c.obj: *************** *** 65,78 **** $(CC) $(CFLAGS) -E $< >$@ clean: ! del *.exe ! del *.lib ! del *.obj ! del *.exp ! del *.err ! del *.map ! del *.sym ! del *.lk1 ! del *.mk1 ! del *.pdb ! del *.ilk --- 65,78 ---- $(CC) $(CFLAGS) -E $< >$@ clean: ! -del *.exe ! -del *.lib ! -del *.obj ! -del *.exp ! -del *.err ! -del *.map ! -del *.sym ! -del *.lk1 ! -del *.mk1 ! -del *.pdb ! -del *.ilk Index: pygtk.h =================================================================== RCS file: /home/cvs/src/ide/external/pygtk-0.6.5-wing/pygtk.h,v retrieving revision 1.1 retrieving revision 1.5 diff -c -r1.1 -r1.5 *** pygtk.h 2000/03/13 18:45:37 1.1 --- pygtk.h 2000/11/13 23:58:45 1.5 *************** *** 319,325 **** PyObject *module_dict = PyModule_GetDict(pygtk); \ PyObject *cobject = PyDict_GetItemString(module_dict, "_PyGtk_API"); \ if (PyCObject_Check(cobject)) \ ! _PyGtk_API = PyCObject_AsVoidPtr(cobject); \ else { \ Py_FatalError("could not find _PyGtk_API object"); \ return; \ --- 319,325 ---- PyObject *module_dict = PyModule_GetDict(pygtk); \ PyObject *cobject = PyDict_GetItemString(module_dict, "_PyGtk_API"); \ if (PyCObject_Check(cobject)) \ ! _PyGtk_API = (struct _PyGtk_FunctionStruct *) PyCObject_AsVoidPtr(cobject); \ else { \ Py_FatalError("could not find _PyGtk_API object"); \ return; \ Index: setup.pydist =================================================================== RCS file: /home/cvs/src/ide/external/pygtk-0.6.5-wing/setup.pydist,v retrieving revision 1.1 retrieving revision 1.3 diff -c -r1.1 -r1.3 *** setup.pydist 2001/03/27 04:07:40 1.1 --- setup.pydist 2001/03/28 04:42:30 1.3 *************** *** 5,14 **** import sys, os import string from distutils.core import setup, Extension VERSION = '"0.6.5"' if sys.platform == 'win32': ! assert 0, 'unimplemented' else: # Get cflags & link args from scripts -- assumes no arg contains a space --- 5,25 ---- import sys, os import string from distutils.core import setup, Extension + import shutil + import stat VERSION = '"0.6.5"' if sys.platform == 'win32': ! GTK_TOP = '../win32gtk/gtk+' ! include_dirs = ['../win32gtk/glib', '../win32gtk/glib/gmodule', ! '../win32gtk/gtk+', '../win32gtk/gtk+/gdk', ! '../win32gtk/gtk+/gdk/win32',] ! extra_args = [] ! link_args = ['user32.lib', GTK_TOP + '/gtk/gtk-1.3.lib', ! GTK_TOP + '/gdk/gdk-1.3.lib', ! '../win32gtk/glib/glib-1.3.lib'] ! ! #$(EXTRALIBS) $(GTK)\gtk\gtk-$(GTK_VER).lib $(GLIB)\gmodule\gmodule-$(GLIB_VER).lib $(GLIB)\glib-$(GLIB_VER).lib $(GLIB)\gthread\gthread-$(GLIB_VER).lib $(GTK)\gtk\gtk-$(GTK_VER).lib $(GTK)\gdk\gdk-$(GTK_VER).lib] else: # Get cflags & link args from scripts -- assumes no arg contains a space *************** *** 40,42 **** --- 51,67 ---- ) ] ) + + # Copy dlls into place on win32 + if sys.platform == 'win32': + file_list = ['../win32gtk/glib/glib-1.3.dll', + '../win32gtk/glib/gmodule/gmodule-1.3.dll', + '../win32gtk/gtk+/gtk/gtk-1.3.dll', + '../win32gtk/gtk+/gdk/gdk-1.3.dll', + '../win32gtk/intl/gnu-intl.dll', + '../win32gtk/libiconv-1.3/src/iconv-1.3.dll'] + for src_name in file_list: + dst_name = os.path.basename(src_name) + if not os.path.isfile(dst_name) \ + or os.stat(src_name)[stat.ST_MTIME] > os.stat(dst_name)[stat.ST_MTIME]: + shutil.copy2(src_name, dst_name) \ No newline at end of file Index: generate/gtk.defs =================================================================== RCS file: /home/cvs/src/ide/external/pygtk-0.6.5-wing/generate/gtk.defs,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** gtk.defs 2000/03/13 18:45:37 1.1 --- gtk.defs 2001/10/29 16:03:32 1.2 *************** *** 175,184 **** ()) ;gtk_main_iteration - (define-func gtk_set_locale - static_string - ()) - (define-func gtk_quit_add_destroy none ((uint main_level) --- 175,180 ---- Index: generate/gtkbase.defs =================================================================== RCS file: /home/cvs/src/ide/external/pygtk-0.6.5-wing/generate/gtkbase.defs,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** gtkbase.defs 2000/03/13 18:45:37 1.1 --- gtkbase.defs 2001/08/24 20:06:19 1.2 *************** *** 252,257 **** --- 252,261 ---- static_string ((GtkWidget widget))) + (define-func GTK_WIDGET_STATE + GtkStateType + ((GtkWidget widget))) + (define-func gtk_widget_set_state none ((GtkWidget widget)