Flesh out apple events, add an update event stub. Hopefully this will make the window behave better in multitasking systems.

This commit is contained in:
Thomas Cherryhomes 2019-01-29 20:25:42 -06:00
parent 227f948745
commit df05c53db3

View File

@ -39,6 +39,31 @@ RGBColor current_foreground;
RGBColor current_background;
int windowWidth;
int windowHeight;
static AEEventHandlerUPP oappUPP, odocUPP, pdocUPP, quitUPP;
extern unsigned char running;
/* Apple Event Handler callbacks */
static pascal OSErr AEOpenApplication(const AppleEvent *theAE, AppleEvent *reply, UInt32 refCon)
{
return noErr;
}
static pascal OSErr AEOpenDocuments(const AppleEvent *theAE, AppleEvent *reply, UInt32 refCon)
{
return errAEEventNotHandled;
}
static pascal OSErr AEPrintDocuments(const AppleEvent *theAE, AppleEvent *reply, UInt32 refCon)
{
return errAEEventNotHandled;
}
static pascal OSErr AEQuitApplication(const AppleEvent *theAE, AppleEvent *reply, UInt32 refCon)
{
running=false;
return noErr;
}
/**
* screen_init() - Set up the screen
@ -50,7 +75,20 @@ void screen_init(void)
InitWindows();
InitMenus();
InitPalettes();
TEInit();
InitDialogs(NULL);
InitCursor();
/* Attach Apple Event handler callbacks */
oappUPP = NewAEEventHandlerUPP(AEOpenApplication);
AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, oappUPP, 0L, false);
odocUPP = NewAEEventHandlerUPP(AEOpenDocuments);
AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, odocUPP, 0L, false);
pdocUPP = NewAEEventHandlerUPP(AEPrintDocuments);
AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, pdocUPP, 0L, false);
quitUPP = NewAEEventHandlerUPP(AEQuitApplication);
AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, quitUPP, 0L, false);
current_foreground.red=255;
current_foreground.green=255;
current_foreground.blue=255;
@ -190,7 +228,10 @@ void screen_main(void)
keyboard_main(&theEvent);
break;
case updateEvt:
/* To be implemented, somehow... */
BeginUpdate((WindowPtr)theEvent.message);
EndUpdate((WindowPtr)theEvent.message);
case kHighLevelEvent:
AEProcessAppleEvent(&theEvent);
break;
}
}