diff options
| author | Johan Dahlin <zilch@src.gnome.org> | 2003-01-24 01:54:55 +0000 |
|---|---|---|
| committer | Johan Dahlin <zilch@src.gnome.org> | 2003-01-24 01:54:55 +0000 |
| commit | 2db3e47ca60967f488ecac5de12766ac89616856 (patch) | |
| tree | 93d2ce02e5b62fa75e1b808e265e310ebfd7ce88 | |
| parent | b4dad8b9d2222cd045bf74f19cb57507e3e696d9 (diff) | |
| download | pygtk-2db3e47ca60967f488ecac5de12766ac89616856.tar.gz | |
Added a timeout that calls python_do_pending_calls every 100 ms.
* gtk/gtkmodule.c (init_gtk): Added a timeout that calls
python_do_pending_calls every 100 ms.
(python_do_pending_calls): Call PyErr_CheckSignals, so Ctrl-C
works as expected inside of gtk_main(). Fixes #72333
| -rw-r--r-- | ChangeLog | 7 | ||||
| -rw-r--r-- | gtk/gtkmodule.c | 15 |
2 files changed, 21 insertions, 1 deletions
@@ -1,3 +1,10 @@ +2003-01-23 Johan Dahlin <jdahlin@async.com.br> + + * gtk/gtkmodule.c (init_gtk): Added a timeout that calls + python_do_pending_calls every 100 ms. + (python_do_pending_calls): Call PyErr_CheckSignals, so Ctrl-C + works as expected inside of gtk_main(). Fixes #72333 + 2003-01-21 Johan Dahlin <jdahlin@async.com.br> * dsextras.py (Template.generate): Import codegen here instead, diff --git a/gtk/gtkmodule.c b/gtk/gtkmodule.c index 1c3e33ef..ba77dda3 100644 --- a/gtk/gtkmodule.c +++ b/gtk/gtkmodule.c @@ -9,6 +9,7 @@ /* include this first, before NO_IMPORT_PYGOBJECT is defined */ #include <pygobject.h> #include "pygtk-private.h" +#include <pyerrors.h> void _pygtk_register_boxed_types(PyObject *moddict); void pygtk_register_classes(PyObject *d); @@ -34,6 +35,17 @@ sink_gtkobject(GObject *object) } } +static gboolean +python_do_pending_calls(gpointer data) +{ + if (PyErr_CheckSignals() == -1) { + PyErr_SetNone(PyExc_KeyboardInterrupt); + gtk_main_quit(); + } + + return TRUE; +} + DL_EXPORT(void) init_gtk(void) { @@ -153,5 +165,6 @@ init_gtk(void) if (PyErr_Occurred()) Py_FatalError("can't initialise module _gtk"); - + + gtk_timeout_add(100, python_do_pending_calls, NULL); } |
