Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Functions | Variables
main_mac.mm File Reference
import <Cocoa/Cocoa.h>
#include "tools/sk_app/Application.h"
#include "tools/sk_app/mac/Window_mac.h"

Go to the source code of this file.

Classes

class  AppDelegate
 

Functions

int main (int argc, char *argv[])
 

Variables

 __pad0__
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 45 of file main_mac.mm.

45 {
46#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
47 // we only run on systems that support at least Core Profile 3.2
48 return EXIT_FAILURE;
49#endif
50
51 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
52 [NSApplication sharedApplication];
53
54 [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
55
56 //Create the application menu.
57 NSMenu* menuBar=[[NSMenu alloc] initWithTitle:@"AMainMenu"];
58 [NSApp setMainMenu:menuBar];
59
60 NSMenuItem* item;
61 NSMenu* subMenu;
62
63 item=[[NSMenuItem alloc] initWithTitle:@"Apple" action:nil keyEquivalent:@""];
64 [menuBar addItem:item];
65 subMenu=[[NSMenu alloc] initWithTitle:@"Apple"];
66 [menuBar setSubmenu:subMenu forItem:item];
67 [item release];
68 item=[[NSMenuItem alloc] initWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@"q"];
69 [subMenu addItem:item];
70 [item release];
71 [subMenu release];
72
73 // Set AppDelegate to catch certain global events
74 AppDelegate* appDelegate = [[AppDelegate alloc] init];
75 [NSApp setDelegate:appDelegate];
76
77 Application* app = Application::Create(argc, argv, nullptr);
78
79 // This will run until the application finishes launching, then lets us take over
80 [NSApp run];
81
82 // Now we process the events
83 while (![appDelegate done]) {
84 NSEvent* event;
85 do {
86 event = [NSApp nextEventMatchingMask:NSAnyEventMask
87 untilDate:[NSDate distantPast]
88 inMode:NSDefaultRunLoopMode
89 dequeue:YES];
90 [NSApp sendEvent:event];
91 } while (event != nil);
92
93 [pool drain];
94 pool = [[NSAutoreleasePool alloc] init];
95
96 // Rather than depending on a Mac event to drive this, we treat our window
97 // invalidation flag as a separate event stream. Window::onPaint() will clear
98 // the invalidation flag, effectively removing it from the stream.
100
101 app->onIdle();
102 }
103
104 delete app;
105
106 [NSApp setDelegate:nil];
107 [appDelegate release];
108
109 [menuBar release];
110 [pool release];
111
112 return EXIT_SUCCESS;
113}
AutoreleasePool pool
static void done(const char *config, const char *src, const char *srcOptions, const char *name)
Definition DM.cpp:263
static void PaintWindows()
FlKeyEvent * event
Definition run.py:1
init(device_serial, adb_binary)
Definition _adb_path.py:12

Variable Documentation

◆ __pad0__

__pad0__

Definition at line 15 of file main_mac.mm.