cleanup osx code
This commit is contained in:
@@ -162,7 +162,6 @@
|
||||
{
|
||||
airdrop_service = [NSSharingService sharingServiceNamed:NSSharingServiceNameSendViaAirDrop];
|
||||
airdrop_service.delegate = self;
|
||||
gl_ready = false;
|
||||
cursor_visible = CGCursorIsVisible();
|
||||
cursor_inside = false;
|
||||
cursor_ignore = false;
|
||||
@@ -197,26 +196,10 @@
|
||||
GLint swapInt = 1;
|
||||
[[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
|
||||
|
||||
cgl = [[self openGLContext] CGLContextObj];
|
||||
glctx = [self openGLContext];
|
||||
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
[self.window setTitle:[NSString stringWithFormat:@"%s - %s", g_window_title, glGetString(GL_RENDERER)]];
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
gl_ready = true;
|
||||
|
||||
App::I->render_thread_start();
|
||||
App::I->render_sync();
|
||||
|
||||
if ([file2open length] > 0)
|
||||
{
|
||||
std::string s = [file2open UTF8String];
|
||||
App::I->render_task([=]
|
||||
{
|
||||
LOG("open file %s", s.c_str());
|
||||
App::I->open_document(s);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- (void)terminateGL
|
||||
@@ -452,14 +435,14 @@
|
||||
- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename
|
||||
{
|
||||
LOG("open file %s", [filename UTF8String]);
|
||||
if (view && view->gl_ready)
|
||||
if (App::I)
|
||||
{
|
||||
std::string path = [filename UTF8String];
|
||||
App::I->ui_task_async([=]
|
||||
{
|
||||
App::I->open_document([filename UTF8String]);
|
||||
App::I->open_document(path);
|
||||
});
|
||||
}
|
||||
file2open = filename;
|
||||
return YES;
|
||||
}
|
||||
- (void)applicationWillTerminate:(NSNotification *)notification
|
||||
@@ -484,7 +467,6 @@
|
||||
NSRect r = NSMakeRect(0, 0, App::I->width, App::I->height);
|
||||
|
||||
view = [[View alloc] initWithFrame:r];
|
||||
view->file2open = file2open;
|
||||
controller = [[Controller alloc] initWithWindow:window];
|
||||
App::I->osx_view = view;
|
||||
|
||||
@@ -512,7 +494,7 @@
|
||||
[appMenu addItem:quitMenuItem];
|
||||
[appMenuItem setSubmenu:appMenu];
|
||||
|
||||
NSLog(@"app launched");
|
||||
LOG("app launched");
|
||||
App::I->ui_thread_start();
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -13,13 +13,10 @@
|
||||
{
|
||||
@public Window* wnd;
|
||||
NSOpenGLContext* glctx;
|
||||
_CGLContextObject* cgl;
|
||||
bool gl_ready;
|
||||
bool cursor_visible;
|
||||
bool cursor_inside;
|
||||
bool cursor_ignore;
|
||||
NSTrackingArea* trackingArea;
|
||||
@public NSString* file2open;
|
||||
}
|
||||
- (void)close;
|
||||
- (void)terminateGL;
|
||||
|
||||
Reference in New Issue
Block a user