mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
Mac version now looks ahead in event queue instead of eating events.
Much better!
This commit is contained in:
parent
d9bf55d0d0
commit
875eb7d9c2
1 changed files with 35 additions and 10 deletions
|
|
@ -27,26 +27,52 @@ intrcheck()
|
||||||
|
|
||||||
#ifdef THINK_C
|
#ifdef THINK_C
|
||||||
|
|
||||||
|
/* This is for THINK C 4.0.
|
||||||
|
For 3.0, you may have to remove the signal stuff. */
|
||||||
|
|
||||||
#include <MacHeaders>
|
#include <MacHeaders>
|
||||||
|
#include <signal.h>
|
||||||
|
#include "sigtype.h"
|
||||||
|
|
||||||
|
static int interrupted;
|
||||||
|
|
||||||
|
static SIGTYPE
|
||||||
|
intcatcher(sig)
|
||||||
|
int sig;
|
||||||
|
{
|
||||||
|
interrupted = 1;
|
||||||
|
signal(SIGINT, intcatcher);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
initintr()
|
initintr()
|
||||||
{
|
{
|
||||||
|
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
|
||||||
|
signal(SIGINT, intcatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
intrcheck()
|
intrcheck()
|
||||||
{
|
{
|
||||||
/* Static to make it faster only */
|
register EvQElPtr q;
|
||||||
static EventRecord e;
|
|
||||||
|
|
||||||
/* XXX This fails if the user first types ahead and then
|
/* This is like THINK C 4.0's <console.h>.
|
||||||
decides to interrupt -- repeating Command-. until the
|
I'm not sure why FlushEvents must be called from asm{}. */
|
||||||
event queue overflows may work though. */
|
for (q = (EvQElPtr)EventQueue.qHead; q; q = (EvQElPtr)q->qLink) {
|
||||||
if (EventAvail(keyDownMask|autoKeyMask, &e) &&
|
if (q->evtQWhat == keyDown &&
|
||||||
(e.modifiers & cmdKey) &&
|
(char)q->evtQMessage == '.' &&
|
||||||
(e.message & charCodeMask) == '.') {
|
(q->evtQModifiers & cmdKey) != 0) {
|
||||||
(void) GetNextEvent(keyDownMask|autoKeyMask, &e);
|
|
||||||
|
asm {
|
||||||
|
moveq #keyDownMask,d0
|
||||||
|
_FlushEvents
|
||||||
|
}
|
||||||
|
interrupted = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (interrupted) {
|
||||||
|
interrupted = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -63,7 +89,6 @@ intrcheck()
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#include "sigtype.h"
|
#include "sigtype.h"
|
||||||
|
|
||||||
static int interrupted;
|
static int interrupted;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue