; ; File: ToolboxEventMgrPatches.a ; ; Contains: linked patches for the Toolbox Event Manager ; ; Copyright: © 1990, 1992 by Apple Computer, Inc., all rights reserved. ; ; Change History (most recent first): ; ; <3> 3/27/92 JSM Moved this file to ToolboxEventMgr folder, keeping all the old ; revisions, to reflect current Reality structure. ; <2> 3/3/92 PN Roll in DoSysErrorUpdates ; <12> 4/2/91 DFH dba, #86111: Added using32BitHeaps to the FixCheckActivate ; patch, so that apps (like MacWrite 5.0) that depend on the ; undocumented sys-vs-user-window event modifier will work, at ; least in 24-bit mode. ; <11> 1/14/91 DC rlc - Honor ScrDmpEnb on all machines. Currently implemented on ; the Plus. Fix Patches to SE and II. Add Patches for Portable and ; IIci. ; <10> 12/20/90 DFH (dba) Changed GetNextEvent and EventAvail to look for highlevel ; events (with a higher priority than updates). ; <9> 11/20/90 JSM Add come-from patches on _GetResource inside ; GetNextEvent() for the Plus (to disable FKEYs from GNE) and the ; II and SE (to disable FKEYs from the keypad). Moved here from ; Patch[PlusSEII]ROM.a. ; <8> 11/4/90 dba save the port around the call to PaintBehind ; <7> 10/23/90 dba (with csd) fix patch to OSEventAvail; it does the wrong things ; with the stack ; <6> 9/22/90 dba Ed Tecot meant well when he told us to do a PaintOne(RootLayer), ; but he really meant PaintBehind(RootLayer). ; <5> 8/1/90 dba put in a hack to make the old DSWndUpdate thing work ; <4> 7/2/90 stb Font fix ; <3> 6/24/90 DTY Added come-from patch to _GetMouse, which sets the current port ; to the Window Manager port before calling _GetMouse. This keeps ; the journal driver happy. ; <2> 4/26/90 dba add patch to GetNextEvent and EventAvail on the IIci to fix a ; 32-bit deactivation bug ; <1> 4/20/90 dba first checked in ; ; NOTE: These patches must be loaded *after* the Layer Mgr. since they call GetRootLayer. ; load 'StandardEqu.d' include 'LinkedPatchMacros.a' include 'LayerEqu.a' include 'GestaltEqu.a' include 'MFPrivate.a' AfterGetMouseInGetNextEvent ROMBind (Plus,$11136),(SE,$B724),(II,$F2E6),(Portable,$10224),(IIci,$15C04) AfterOSEventAvailInCheckActivate ROMBind (IIci,$15C28) AfterSystemUserWindowInCheckActivate ROMBind (IIci,$15C4A) AfterGetResourceInTryFKey ROMBind (Plus,$110F8),(SE,$B6B8),(II,$F27A),(Portable,$101B8),(IIci,$15B98) ; <9> <11> DoneGNE ROMBind (Plus,$1112C) ; <9> TrySysEvent ROMBind (SE,$B6EA),(II,$F2AC) ; <9> AfterOSEventAvailInGetNextEvent ROMBind (Plus,$1108A),(SE,$B656),(II,$F218),(Portable,$10144),(IIci,$15B2A) AfterGetOSEventInGetNextEvent ROMBind (Plus,$1108E),(SE,$B65A),(II,$F21C),(Portable,$10148),(IIci,$15B2E) ;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ ; GetNextEvent Ñ update windows when a disk switch dialog or other system error trashed the screen ; There is some code (in all of our ROMs) that causes an update when a disk switch dialog has ; appeared, but there was not enough room on the stack to save the bits behind the dialog. ; There is a bug in this code (the high bit of the top coordinate was set, so we always painted ; too much). Also, I needed the same mechanism to erase the space under the Òforced quitÓ system ; error dialog. In order to fix the bug and add a new feature, I introduced a new global (off of ; ExpandMem) to contain a rectangle that needs to be updated. Anyone (in system software) can union ; a rectangle into this global (even when the Memory Manager cannot be used) and the next ; GetNextEvent call will take care of the updating. Patches to the file systemÕs disk switch ; dialog code in FileSystemPatches.a cause it to union with this rectangle, so that it participates ; in this scheme. ; *** This does not take care of the case when the bits are scrolled or otherwise moved before ; GetNextEvent is called, but neither did the old code, and I donÕt have any ideas. DoSysErrorUpdates patchproc _GetNextEvent,(Plus,SE,II,Portable,IIci) import ClearSysErrorUpdateRect BSET #7,DSWndUpdate ; check if someone is trying to use the old update mechanism bnz.s @noUpdateNeeded move.l DSAlertRect+4,-(sp) move.l DSAlertRect,-(sp) bclr #7,(sp) ; clear the bit that is sometimes set here move.l sp,-(sp) ; copy of DSAlertRect without the high bit move.l ExpandMem,a0 pea ExpandMemRec.SysErrorUpdateRect(a0) move.l (sp),-(sp) _UnionRect add #8,sp ; get rid of the rectangle on the stack @noUpdateNeeded TST.B WWExist ; does a window world exist? BNE.S @noWindowMgr ; no, one less world to worry about subq #2,sp ; make room for result move.l ExpandMem,a0 pea ExpandMemRec.SysErrorUpdateRect(a0) _EmptyRect tst.b (sp)+ ; is it empty? bnz.s @rectIsEmpty subq #4,sp ; make room for saved port move.l sp,-(sp) _GetPort SUBQ #4,SP ; get a region for PaintBehind _NewRgn MOVE.L (SP),-(sp) ; and set region to the deep squid window move.l ExpandMem,a0 pea ExpandMemRec.SysErrorUpdateRect(a0) _RectRgn subq #4,sp ; make room for root layer _GetRootLayer MOVE.L 4(sp),-(SP) ; clobber the whole region, from WindowList down! _PaintBehind _DisposRgn ; and then throw away the clobbered region _SetPort ; restore the port jsr ClearSysErrorUpdateRect ; no more rectangle @rectIsEmpty @noWindowMgr if forROM then import GetNextEvent jmp GetNextEvent else jmpOld endif endproc ClearSysErrorUpdateRect installproc (Plus,SE,II,Portable,IIci) ; Empty out the sysErrorUpdateRect, and make the coordinates such that UnionRect with any ; rectangle will return that rectangle. UnionRect will do this if top and left are maximum ; and bottom and right are minimum. move.l ExpandMem,a0 move.l #$7FFF7FFF,ExpandMemRec.SysErrorUpdateRect+topLeft(a0) ; highest numbers move.l #$80008000,ExpandMemRec.SysErrorUpdateRect+botRight(a0) ; lowest numbers rts endproc end