summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1997-09-08 13:23:19 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1997-09-08 13:23:19 (GMT)
commit2e871e4f0947798a87757290412730b9ab245ac4 (patch)
tree142b6373ff005af4bce33cbea46ea040d21f256f /Mac
parent5b3c9717c47283a121a610d0f6a5222063ae0382 (diff)
downloadcpython-2e871e4f0947798a87757290412730b9ab245ac4.zip
cpython-2e871e4f0947798a87757290412730b9ab245ac4.tar.gz
cpython-2e871e4f0947798a87757290412730b9ab245ac4.tar.bz2
Added SysBeep
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Modules/macosmodule.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/Mac/Modules/macosmodule.c b/Mac/Modules/macosmodule.c
index d187ac3..1717d39 100644
--- a/Mac/Modules/macosmodule.c
+++ b/Mac/Modules/macosmodule.c
@@ -482,13 +482,13 @@ MacOS_EnableAppswitch(PyObject *self, PyObject *args)
if ( schp.process_events )
old = 1;
else if ( schp.check_interrupt )
- old = -1;
- else
old = 0;
+ else
+ old = -1;
if ( new > 0 ) {
schp.process_events = mDownMask|keyDownMask|osMask;
schp.check_interrupt = 1;
- } else if ( new < 0 ) {
+ } else if ( new == 0 ) {
schp.process_events = 0;
schp.check_interrupt = 1;
} else {
@@ -555,16 +555,14 @@ MacOS_splash(PyObject *self, PyObject *args)
{
int resid = -1;
static DialogPtr curdialog = NULL;
+ DialogPtr olddialog;
WindowRef theWindow;
CGrafPtr thePort;
short xpos, ypos, width, height, swidth, sheight;
if (!PyArg_ParseTuple(args, "|i", &resid))
return NULL;
- if (curdialog) {
- DisposeDialog(curdialog);
- curdialog = NULL;
- }
+ olddialog = curdialog;
if ( resid != -1 ) {
curdialog = GetNewDialog(resid, NULL, (WindowPtr)-1);
@@ -582,6 +580,8 @@ MacOS_splash(PyObject *self, PyObject *args)
DrawDialog(curdialog);
}
}
+ if (olddialog)
+ DisposeDialog(olddialog);
Py_INCREF(Py_None);
return Py_None;
}
@@ -601,6 +601,20 @@ MacOS_DebugStr(PyObject *self, PyObject *args)
return Py_None;
}
+static char SysBeep_doc[] = "BEEEEEP!!!";
+
+static PyObject *
+MacOS_SysBeep(PyObject *self, PyObject *args)
+{
+ int duration = 6;
+
+ if (!PyArg_ParseTuple(args, "|i", &duration))
+ return NULL;
+ SysBeep(duration);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
static char GetTicks_doc[] = "Return number of ticks since bootup";
static PyObject *
@@ -685,6 +699,7 @@ static PyMethodDef MacOS_Methods[] = {
{"splash", MacOS_splash, 1, splash_doc},
{"DebugStr", MacOS_DebugStr, 1, DebugStr_doc},
{"GetTicks", MacOS_GetTicks, 1, GetTicks_doc},
+ {"SysBeep", MacOS_SysBeep, 1, SysBeep_doc},
{NULL, NULL} /* Sentinel */
};