Commit 9581c61c authored by Jack Jansen's avatar Jack Jansen

Handle systemclicks ourselves, in stead of passing them to Sioux. This

fixes (or masks?) a bug with Python becoming unreactive during
time.sleep() if you have already switched applications before.
parent 92767f65
...@@ -92,7 +92,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -92,7 +92,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
** handle them). Note that we don't know who has windows open, so ** handle them). Note that we don't know who has windows open, so
** even handing updates off to SIOUX under MW isn't going to work. ** even handing updates off to SIOUX under MW isn't going to work.
*/ */
#define MAINLOOP_EVENTMASK (mDownMask|keyDownMask|osMask) #define MAINLOOP_EVENTMASK (mDownMask|keyDownMask|osMask|activMask)
#include <signal.h> #include <signal.h>
...@@ -476,6 +476,14 @@ void ...@@ -476,6 +476,14 @@ void
PyMac_HandleEventIntern(evp) PyMac_HandleEventIntern(evp)
EventRecord *evp; EventRecord *evp;
{ {
if ( evp->what == mouseDown ) {
WindowPtr wp;
if ( FindWindow(evp->where, &wp) == inSysWindow ) {
SystemClick(evp, wp);
return;
}
}
#ifdef __MWERKS__ #ifdef __MWERKS__
{ {
int siouxdidit; int siouxdidit;
...@@ -486,15 +494,7 @@ PyMac_HandleEventIntern(evp) ...@@ -486,15 +494,7 @@ PyMac_HandleEventIntern(evp)
return; return;
} }
#else #else
/* Other compilers are just unlucky: we only weed out clicks in other applications */ /* Other compilers are just unlucky... */
if ( evp->what == mouseDown ) {
WindowPtr wp;
if ( FindWindow(evp->where, &wp) == inSysWindow ) {
SystemClick(evp, wp);
return;
}
}
#endif /* !__MWERKS__ */ #endif /* !__MWERKS__ */
} }
...@@ -557,6 +557,11 @@ PyMac_DoYield(int maxsleep, int maycallpython) ...@@ -557,6 +557,11 @@ PyMac_DoYield(int maxsleep, int maycallpython)
} else { } else {
latest_time_ready = LMGetTicks() + maxsleep; latest_time_ready = LMGetTicks() + maxsleep;
while ( maxsleep >= 0 ) { while ( maxsleep >= 0 ) {
/* XXXX Hack by Jack.
** In time.sleep() you can click to another application
** once only. If you come back to Python you cannot get away
** again.
**/
gotone = WaitNextEvent(schedparams.process_events, &ev, maxsleep, NULL); gotone = WaitNextEvent(schedparams.process_events, &ev, maxsleep, NULL);
/* Get out quickly if nothing interesting is happening */ /* Get out quickly if nothing interesting is happening */
if ( !gotone || ev.what == nullEvent ) if ( !gotone || ev.what == nullEvent )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment