SDL  2.0
mac_support_cocoa.m File Reference
#include <fx.h>
#import <Cocoa/Cocoa.h>
+ Include dependency graph for mac_support_cocoa.m:

Go to the source code of this file.

Data Structures

class  MyAppDelegate
 

Functions

void init_apple_message_system ()
 
void check_apple_events ()
 

Variables

FXMainWindow * g_main_window
 

Function Documentation

◆ check_apple_events()

void check_apple_events ( )

Definition at line 74 of file mac_support_cocoa.m.

References HandleEvent(), NULL, and TRUE.

75 {
76  NSApplication *app = [NSApplication sharedApplication];
77 
78  NSAutoreleasePool *pool = [NSAutoreleasePool new];
79  while (1) {
80  NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
81  untilDate:nil
82  inMode:NSDefaultRunLoopMode
83  dequeue:YES];
84  if (event == NULL)
85  break;
86  else {
87  //printf("Event happened: Type: %d\n", event->_type);
88  [app sendEvent: event];
89  }
90  }
91  [pool release];
92 }
struct _cl_event * event
#define NULL
Definition: begin_code.h:164

◆ init_apple_message_system()

void init_apple_message_system ( )

Definition at line 58 of file mac_support_cocoa.m.

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

59 {
60  static MyAppDelegate *d = [MyAppDelegate new];
61 
62  [[NSApplication sharedApplication] setDelegate:d];
63 
64  /* Register for Apple Events. */
65  /* This is from
66  http://stackoverflow.com/questions/1768497/application-exit-event */
67  NSAppleEventManager *aem = [NSAppleEventManager sharedAppleEventManager];
68  [aem setEventHandler:d
69  andSelector:@selector(handleQuitEvent:withReplyEvent:)
70  forEventClass:kCoreEventClass andEventID:kAEQuitApplication];
71 }
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d

Variable Documentation

◆ g_main_window

FXMainWindow* g_main_window