SDL  2.0
mac_support.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void init_apple_message_system ()
 
void check_apple_events ()
 

Function Documentation

◆ check_apple_events()

void check_apple_events ( )

Definition at line 122 of file mac_support.cpp.

References HandleEvent(), NULL, and TRUE.

Referenced by MainWindow::onMacTimeout().

123 {
124  RgnHandle cursorRgn = NULL;
125  Boolean gotEvent=TRUE;
126  EventRecord event;
127 
128  while (gotEvent) {
129  gotEvent = WaitNextEvent(everyEvent, &event, 0L/*timeout*/, cursorRgn);
130  if (gotEvent) {
131  HandleEvent(&event);
132  }
133  }
134 }
struct _cl_event * event
#define TRUE
Definition: edid-parse.c:33
#define NULL
Definition: begin_code.h:164
static void HandleEvent(EventRecord *event)
Definition: mac_support.cpp:66

◆ init_apple_message_system()

void init_apple_message_system ( )

Definition at line 96 of file mac_support.cpp.

References AEHandler(), d, HandleQuitMessage(), HandleReopenMessage(), and NULL.

Referenced by MainWindow::create().

97 {
98  OSErr err;
99  static const EventTypeSpec appleEvents[] =
100  {
101  { kEventClassAppleEvent, kEventAppleEvent }
102  };
103 
104  /* Install the handler for Apple Events */
105  InstallApplicationEventHandler(NewEventHandlerUPP(AEHandler),
106  GetEventTypeCount(appleEvents), appleEvents, 0, NULL);
107 
108  /* Install handlers for the individual Apple Events that come
109  from the Dock icon: the Reopen (click), and the Quit messages. */
110  err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
111  NewAEEventHandlerUPP(HandleQuitMessage), 0, false);
112  err = AEInstallEventHandler(kCoreEventClass, kAEReopenApplication,
113  NewAEEventHandlerUPP(HandleReopenMessage), 0, false);
114 #if 0
115  // Left as an example of a wild card match.
116  err = AEInstallEventHandler(kCoreEventClass, typeWildCard,
117  NewAEEventHandlerUPP(HandleWildMessage), 0, false);
118 #endif
119 }
static pascal OSErr HandleQuitMessage(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon)
Definition: mac_support.cpp:17
OSStatus AEHandler(EventHandlerCallRef inCaller, EventRef inEvent, void *inRefcon)
Definition: mac_support.cpp:40
static pascal OSErr HandleReopenMessage(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon)
Definition: mac_support.cpp:25
#define NULL
Definition: begin_code.h:164