@@ -482,13 +482,13 @@ MacOS_EnableAppswitch(PyObject *self, PyObject *args)
482482 if ( schp .process_events )
483483 old = 1 ;
484484 else if ( schp .check_interrupt )
485- old = -1 ;
486- else
487485 old = 0 ;
486+ else
487+ old = -1 ;
488488 if ( new > 0 ) {
489489 schp .process_events = mDownMask |keyDownMask |osMask ;
490490 schp .check_interrupt = 1 ;
491- } else if ( new < 0 ) {
491+ } else if ( new == 0 ) {
492492 schp .process_events = 0 ;
493493 schp .check_interrupt = 1 ;
494494 } else {
@@ -555,16 +555,14 @@ MacOS_splash(PyObject *self, PyObject *args)
555555{
556556 int resid = -1 ;
557557 static DialogPtr curdialog = NULL ;
558+ DialogPtr olddialog ;
558559 WindowRef theWindow ;
559560 CGrafPtr thePort ;
560561 short xpos , ypos , width , height , swidth , sheight ;
561562
562563 if (!PyArg_ParseTuple (args , "|i" , & resid ))
563564 return NULL ;
564- if (curdialog ) {
565- DisposeDialog (curdialog );
566- curdialog = NULL ;
567- }
565+ olddialog = curdialog ;
568566
569567 if ( resid != -1 ) {
570568 curdialog = GetNewDialog (resid , NULL , (WindowPtr )- 1 );
@@ -582,6 +580,8 @@ MacOS_splash(PyObject *self, PyObject *args)
582580 DrawDialog (curdialog );
583581 }
584582 }
583+ if (olddialog )
584+ DisposeDialog (olddialog );
585585 Py_INCREF (Py_None );
586586 return Py_None ;
587587}
@@ -601,6 +601,20 @@ MacOS_DebugStr(PyObject *self, PyObject *args)
601601 return Py_None ;
602602}
603603
604+ static char SysBeep_doc [] = "BEEEEEP!!!" ;
605+
606+ static PyObject *
607+ MacOS_SysBeep (PyObject * self , PyObject * args )
608+ {
609+ int duration = 6 ;
610+
611+ if (!PyArg_ParseTuple (args , "|i" , & duration ))
612+ return NULL ;
613+ SysBeep (duration );
614+ Py_INCREF (Py_None );
615+ return Py_None ;
616+ }
617+
604618static char GetTicks_doc [] = "Return number of ticks since bootup" ;
605619
606620static PyObject *
@@ -685,6 +699,7 @@ static PyMethodDef MacOS_Methods[] = {
685699 {"splash" , MacOS_splash , 1 , splash_doc },
686700 {"DebugStr" , MacOS_DebugStr , 1 , DebugStr_doc },
687701 {"GetTicks" , MacOS_GetTicks , 1 , GetTicks_doc },
702+ {"SysBeep" , MacOS_SysBeep , 1 , SysBeep_doc },
688703 {NULL , NULL } /* Sentinel */
689704};
690705
0 commit comments