On 18-May-99 Alex Robinson wrote:
> Chris,
>
> Remember that on OS version 2 and 1 the automatic power off is normally
> done under interrupt and not with autoOffChr.
>
> You might keep the time/date display up to date by asking for events
> every 30 seconds or so. OS V 3 allows you to put that timeout in the
> call to EvtGetEvent(). Older OS's, I've observed, require -1 for the
> timeout and your own logic to filter nilEvent's.
I do update every 30 seconds or so, but I'm in the habit of turning on and
looking at the screen immediately. I'm not sure of the difference you
mention in EvtGetEvent(). I've been putting a 30*sysTicksPerSecond as the
argument and only looking for the nilEvent. That appears to work fine on OS2
& OS3. I don't have an OS1 device however.
I still get an autoOffChr though on OS2 because that's what I use in xcopilot
to test with. This is a breakpoint right after:
EvtGetEvent(&e, eventTimeout);
if (! SysHandleEvent(&e))
if (! MenuHandleEvent(NULL, &e, &err))
if (! ApplicationHandleEvent(&e))
FrmDispatchEvent(&e);
I let xcopilot go to sleep by itself, and then I pressed the on button.
Inspecting 'e' following the above code shows that the autoOffChr was the
last event received.
gdb) p e.eType
$7 = keyDownEvent
(gdb) p e.data.keyDown
$8 = {chr = 276, keyCode = 0, modifiers = 8}
>From Chars.h:
#define autoOffChr 0x0114
Likewise if I inspect 'e' after a hardPowerChr turned the unit off, I will
see the hardPowerChr as the last 'e' before the SysHandlEvent() took control.
/* Chris Faherty <[EMAIL PROTECTED]>, finger for PGP */