Article View: comp.sys.mac
Article #23275MultiFinder suppend/resume question
From: Bill Stackhouse
Date: Mon, 04 Jan 1988 14:58
Date: Mon, 04 Jan 1988 14:58
94 lines
3708 bytes
3708 bytes
I am have a program that I would like to run in the background of MultiFinder.
I have built an off screen bitmap so that I can continue some of the
processing. When I receive a suppend event, the routine Msuppend is called
and then Mresume is called of course for the resume event. The idea is to
copy what is in the window at the time of the suppend and then restore on
the resume. Sounds simple. In fact when I simulate it under Finder it seems
to work just fine. When under MultiFinder though, only the lower 2/3Us of the
window is refreshed. There doesn't seem to be any relationship between the
part of the screen that is not refreshed and other windows on the screen.
There is only one window that belongs to this program. Can anyone point
out what is wrong ??
Thanks.
Bill Stackhouse
Cambridge Ma.
bills@cca.cca.com
PROCEDURE Msuppend;
BEGIN
NowSuppended := true;
WITH theWindow^ DO
BEGIN
OldScreen := Portbits;
CopyBits(PortBits, OffScreen, PortRect,
OffScreen.bounds, srcCopy, NIL);
END;
SetPortBits(OffScreen);
END; {Msuppend}
PROCEDURE Mresume;
BEGIN
NowSuppended := false;
SetPort(theWindow);
SetPortBits(OldScreen);
WITH theWindow^ DO
CopyBits(OffScreen, PortBits, OffScreen.bounds,
PortRect, srcCopy, visRgn);
END; {Mresume}
{----------- open window fragment -------------}
theWindow := GetNewWindow(1000, NIL, WindowPtr(-1));
SetPort(theWindow);
OldScreen := theWindow^.PortBits;
bRect := theWindow^.PortRect;
WITH theWindow^.PortRect DO
BEGIN
OffsetRect(bRect, -left, -top);
OffRowBytes := (((right - left - 1) DIV 16) + 1) * 2;
OffSize := (bottom - top) * OffRowBytes;
END;
WITH OffScreen DO
BEGIN
baseAddr := QDPtr(NewPtr(OffSize));
rowbytes := OffRowBytes;
bounds := bRect;
END;
NowSuppended := false;
{------- event code fragment --------------}
IF WaitNextEventPresent THEN
result := WaitNextEvent(EveryEvent, theEvent, 0, NIL)
ELSE
result := GetNextEvent(EveryEvent, theEvent);
IF result THEN
CASE theEvent.what OF
UpdateEvt :
BEGIN
BeginUpdate(WindowPtr(theEvent.message));
EndUpdate(WindowPtr(theEvent.message));
END;
app4Evt :
CASE BitAnd(theEvent.message, $FF000000) OF
$01000000 :
IF BitAnd(theEvent.message, $00000001) = 0 THEN
Msuppend
ELSE
Mresume;
$FA000000 :
;
END;
OTHERWISE
END;
--
Bill Stackhouse
Cambridge, MA.
bills@cca.cca.com
Technical Details
Message-ID:
<22899@cca.CCA.COM>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-lcc!lll-tis!ames!sri-spam!rutgers!husc6!cca!billsShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-lcc!lll-tis!ames!sri-spam!rutgers!husc6!cca!bills From: bills@cca.CCA.COM (Bill Stackhouse) Newsgroups: comp.sys.mac Subject: MultiFinder suppend/resume question Message-ID: <22899@cca.CCA.COM> Date: 4 Jan 88 14:58:24 GMT Distribution: na Organization: Computer Corp. of America, Cambridge, MA Lines: 93