Article View: comp.sys.amiga.tech
Article #12246How to peek at queued Intution msgs?
From: Ross Cunniff
Date: Fri, 14 Apr 1989 20:04
Date: Fri, 14 Apr 1989 20:04
49 lines
1788 bytes
1788 bytes
What is the best way to look for a SPECIFIC message
on a window's UserPort? For example, say I have an
application that has the standard event loop:
EventLoop()
{
while( !Done ) {
Wait( 1 << MyWindow->UserPort.mp_SigBit );
while( Msg = GetMsg( MyWindow->UserPort ) ) {
if( Class = WHATEVER )
DoSomeLongAndComplicatedThing();
else
DoSomethingElse();
ReplyMsg( Msg );
}
}
}
Further, assume DoSomeLongAndComplicatedThing() wants
to allow the user to abort the action by, say, pressing
the ESC key or something. Now, I can have the simple-
minded approach:
CheckForEscapeKey()
{
while( Msg = GetMsg( MyWindow->UserPort ) ) {
if( (Msg->Class == VANILLAKEY) && Msg->Code == '\033' ) {
/* Aha! */
ReplyMsg( Msg );
return 1;
}
ReplyMsg( Msg );
}
return 0;
}
However, this eats ALL pending events that happen before the abort,
including potentially important ones such as NEWSIZE.
The question is, therefore: is there a supported way of peeking at the
UserPort queue and finding a specific IDCMP message without deleting
all messages before it? Or am I stuck doing significantly smarter
processing in CheckForEscapeKey() in order not to miss the *REALLY*
important messages?
Ross Cunniff
Hewlett-Packard Colorado Languages Lab
...{ucbvax,hplabs}!hpfcla!cunniff
cunniff%hpfcrt@hplabs.HP.COM
Technical Details
Message-ID:
<11640015@hpfcdc.HP.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!ucsd!sdcsvax!ucsdhub!hp-sdd!hplabs!hpfcdc!cunniffShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!ucsd!sdcsvax!ucsdhub!hp-sdd!hplabs!hpfcdc!cunniff From: cunniff@hpfcdc.HP.COM (Ross Cunniff) Newsgroups: comp.sys.amiga.tech Subject: How to peek at queued Intution msgs? Message-ID: <11640015@hpfcdc.HP.COM> Date: 14 Apr 89 20:04:36 GMT Organization: HP Ft. Collins, Co. Lines: 49