Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
native jGNE/native jGNE.c
#define OLDROUTINELOCATIONS 0 |
#define OLDROUTINENAMES 0 |
#define SystemSevenOrLater 1 |
#ifndef __FONTS__ |
# include <Fonts.h> |
#endif |
#ifndef __DIALOGS__ |
# include <Dialogs.h> |
#endif |
#ifndef __LOWMEM__ |
# include <LowMem.h> |
#endif |
static pascal OSErr InitMac (void) |
{ |
MaxApplZone ( ); |
InitGraf (&(qd.thePort)); |
InitFonts ( ); |
InitWindows ( ); |
InitMenus ( ); |
TEInit ( ); |
InitDialogs (nil); |
return noErr; |
} |
static GetNextEventFilterUPP gGetNextEventFilterUPP; |
static Boolean gFilterDone; |
static void myGetNextEventFilter (EventRecord *event, Boolean *result) |
{ |
// |
// IMPORTANT NOTE: It's not possible to declare a 68K jGNEFilter |
// this way! Examine one of the jGNE Helper projects for an example |
// of a 68K jGNEFilter. I hope to produce a "fat" filter some time |
// in the near future. |
// |
if (gGetNextEventFilterUPP) |
CallGetNextEventFilterProc (gGetNextEventFilterUPP,event,result); |
if (*result && event->what == mouseDown) |
{ |
event->what = nullEvent; |
*result = false; |
gFilterDone = true; |
} |
} |
void main (void) |
{ |
if (!InitMac ( )) |
{ |
GetNextEventFilterUPP myFilterUPP = NewGetNextEventFilterProc (myGetNextEventFilter); |
if (myFilterUPP) |
{ |
gGetNextEventFilterUPP = LMGetGNEFilter ( ); |
LMSetGNEFilter (myFilterUPP); |
do |
{ |
EventRecord event; |
WaitNextEvent (everyEvent,&event,1,nil); |
} |
while (!gFilterDone); |
if (LMGetGNEFilter ( ) != myFilterUPP) |
DebugStr ("\pSomeone else has gotten into the jGNE filter chain!"); |
else |
LMSetGNEFilter (gGetNextEventFilterUPP); |
DisposeRoutineDescriptor (myFilterUPP); |
} |
} |
} |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14