1: Only update the screen when there's nothing else to do. This means that
it's a lot harder for a fast typist to outrun PuTTY.
2: Only sleep for at most 100ms at a time. This is a kludge to work around
the WakeUpProcess caused by incoming data can happen before the
WaitNextEvent it's meant to interrupt, leading to PuTTY sleeping forever
because it doesn't know there's network data pending.
git-svn-id: svn://svn.tartarus.org/sgt/putty@2901
cda61777-01e9-0310-a592-
d414129be87e
-/* $Id: mac.c,v 1.52 2003/02/27 23:34:59 ben Exp $ */
+/* $Id: mac.c,v 1.53 2003/03/01 15:12:03 ben Exp $ */
/*
* Copyright (c) 1999, 2003 Ben Harris
* All rights reserved.
/*
* Copyright (c) 1999, 2003 Ben Harris
* All rights reserved.
static int cold = 1;
static int borednow = FALSE;
struct mac_gestalts mac_gestalts;
static int cold = 1;
static int borednow = FALSE;
struct mac_gestalts mac_gestalts;
static void mac_startup(void);
static void mac_eventloop(void);
static void mac_startup(void);
static void mac_eventloop(void);
RgnHandle cursrgn;
cursrgn = NewRgn();
RgnHandle cursrgn;
cursrgn = NewRgn();
for (;;) {
mac_adjustcursor(cursrgn);
for (;;) {
mac_adjustcursor(cursrgn);
- gotevent = WaitNextEvent(everyEvent, &event, LONG_MAX, cursrgn);
+ gotevent = WaitNextEvent(everyEvent, &event, sleeptime, cursrgn);
+ /*
+ * XXX For now, limit sleep time to 1/10 s to work around
+ * wake-before-sleep race in MacTCP code.
+ */
+ sleeptime = 6;
mac_adjustcursor(cursrgn);
mac_adjustcursor(cursrgn);
+ if (gotevent) {
+ /* Ensure we get a null event when the real ones run out. */
+ sleeptime = 0;
- if (borednow)
- cleanup_exit(0);
+ if (borednow)
+ cleanup_exit(0);
+ }
+ if (!gotevent)
+ mac_pollterm();
};
extern struct mac_gestalts mac_gestalts;
};
extern struct mac_gestalts mac_gestalts;
+extern UInt32 sleeptime;
#if TARGET_RT_MAC_CFM
/* All systems that can use CFM have Color QuickDraw */
#if TARGET_RT_MAC_CFM
/* All systems that can use CFM have Color QuickDraw */