mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-13 08:44:12 +03:00
Use Atom+sharedApplication to init CEF
This commit is contained in:
parent
bf87f467ef
commit
7ca50efa30
File diff suppressed because it is too large
Load Diff
@ -13,12 +13,16 @@
|
||||
// Provide the CefAppProtocol implementation required by CEF.
|
||||
@implementation Atom
|
||||
|
||||
+ (void)load {
|
||||
+ (id)sharedApplication {
|
||||
id atomApp = [super sharedApplication];
|
||||
|
||||
CefSettings settings;
|
||||
AppGetSettings(settings);
|
||||
|
||||
CefRefPtr<CefApp> app;
|
||||
CefInitialize(settings, app);
|
||||
|
||||
return atomApp;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
|
@ -4,17 +4,19 @@
|
||||
#include "include/cef_app.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
|
||||
Class principalClass = NSClassFromString([infoDictionary objectForKey:@"NSPrincipalClass"]);
|
||||
NSApplication *application = [principalClass sharedApplication];
|
||||
|
||||
NSString *mainNibName = [infoDictionary objectForKey:@"NSMainNibFile"];
|
||||
NSNib *mainNib = [[NSNib alloc] initWithNibNamed:mainNibName bundle:[NSBundle mainBundle]];
|
||||
[mainNib instantiateNibWithOwner:application topLevelObjects:nil];
|
||||
@autoreleasepool {
|
||||
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
|
||||
Class principalClass = NSClassFromString([infoDictionary objectForKey:@"NSPrincipalClass"]);
|
||||
NSApplication *application = [principalClass sharedApplication];
|
||||
|
||||
// Run the application message loop.
|
||||
CefRunMessageLoop();
|
||||
|
||||
// Don't put anything below this line because it won't be executed.
|
||||
return 0;
|
||||
NSString *mainNibName = [infoDictionary objectForKey:@"NSMainNibFile"];
|
||||
NSNib *mainNib = [[NSNib alloc] initWithNibNamed:mainNibName bundle:[NSBundle mainBundle]];
|
||||
[mainNib instantiateNibWithOwner:application topLevelObjects:nil];
|
||||
|
||||
// Run the application message loop.
|
||||
CefRunMessageLoop();
|
||||
|
||||
// Don't put anything below this line because it won't be executed.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user