mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
Added HandleEvent method to macos, so python programs can hand back
events they don't want to handle to stdio
This commit is contained in:
parent
8828fcf738
commit
a76382a6ac
3 changed files with 39 additions and 13 deletions
|
@ -266,6 +266,28 @@ PyMac_SetYield(long fgi, long fgy, long bgi, long bgy)
|
|||
yield_bg = bgy;
|
||||
}
|
||||
|
||||
/*
|
||||
** Handle an event, either one found in the mainloop eventhandler or
|
||||
** one passed back from the python program.
|
||||
*/
|
||||
void
|
||||
PyMac_HandleEvent(evp)
|
||||
EventRecord *evp;
|
||||
{
|
||||
WindowPtr wp;
|
||||
|
||||
#ifdef __MWERKS__
|
||||
/* If SIOUX wants it we're done */
|
||||
(void)SIOUXHandleOneEvent(evp);
|
||||
#else
|
||||
/* Other compilers are just unlucky: we only weed out clicks in other applications */
|
||||
if ( evp->what == mouseDown ) {
|
||||
if ( FindWindow(evp->where, &wp) == inSysWindow )
|
||||
SystemClick(evp, wp);
|
||||
}
|
||||
#endif /* !__MWERKS__ */
|
||||
}
|
||||
|
||||
/*
|
||||
** Yield the CPU to other tasks.
|
||||
*/
|
||||
|
@ -273,7 +295,6 @@ static
|
|||
PyMac_DoYield()
|
||||
{
|
||||
EventRecord ev;
|
||||
WindowPtr wp;
|
||||
long yield;
|
||||
static int no_waitnextevent = -1;
|
||||
int gotone;
|
||||
|
@ -306,17 +327,7 @@ PyMac_DoYield()
|
|||
/* Get out quickly if nothing interesting is happening */
|
||||
if ( !gotone || ev.what == nullEvent )
|
||||
break;
|
||||
|
||||
#ifdef __MWERKS__
|
||||
/* If SIOUX wants it we're done too */
|
||||
(void)SIOUXHandleOneEvent(&ev);
|
||||
#else
|
||||
/* Other compilers are just unlucky: we only weed out clicks in other applications */
|
||||
if ( ev.what == mouseDown ) {
|
||||
if ( FindWindow(ev.where, &wp) == inSysWindow )
|
||||
SystemClick(&ev, wp);
|
||||
}
|
||||
#endif /* !__MWERKS__ */
|
||||
PyMac_HandleEvent(&ev);
|
||||
}
|
||||
lastyield = TickCount();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue