Back to index

lightning-sunbird  0.9+nobinonly
Typedefs | Functions
jGNE.h File Reference
#include <Events.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


typedef Boolean(* EventFilterProcPtr )(EventRecord *event)


OSStatus InstallEventFilter (EventFilterProcPtr filter)
OSStatus RemoveEventFilter ()

Typedef Documentation

typedef Boolean(* EventFilterProcPtr)(EventRecord *event)

Definition at line 52 of file jGNE.h.

Function Documentation

Definition at line 74 of file jGNE.cpp.

       if (theEventFilter == NULL) {
              theEventFilter = filter;

              // record the current application's name.
              StringPtr currentAppName = LMGetCurApName();
              ::BlockMoveData(currentAppName, theAppName, 1 + currentAppName[0]);

              // allocate a jump vector in the System heap, so it will be retained after termination.
              if (theGNEFilterJump == NULL) {
                     theGNEFilterJump = (Jump*) NewPtrSys(sizeof(Jump));
                     if (theGNEFilterJump == NULL)
                            return MemError();
                     theGNEFilterJump->jmp = 0x4EF9;
                     theGNEFilterJump->addr = &theGNEFilterDescriptor;
                     // get previous event filter routine.
                     theOldGNEFilterUPP = LMGetGNEFilter();
              } else {
                     // our previously allocated Jump is still installed, use it.
                     theOldGNEFilterUPP = theGNEFilterJump->addr;
                     theGNEFilterJump->addr = &theGNEFilterDescriptor;
              return noErr;
       return paramErr;

Definition at line 106 of file jGNE.cpp.

       if (theEventFilter != NULL) {
              // It's only truly safe to remove our filter, if nobody else installed one after us.
              if (LMGetGNEFilter() == GetNextEventFilterUPP(theGNEFilterJump)) {
                     // can safely restore the old filter.
                     theGNEFilterJump = NULL;
              } else {
                     // modify the jump instruction to point to the previous filter.
                     theGNEFilterJump->addr = theOldGNEFilterUPP;
              theOldGNEFilterUPP = NULL;
              theEventFilter = NULL;
              return noErr;
       return paramErr;