From 0f208ced60e900936586d7d12396ab9a5e7fefe6 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Fri, 12 Jul 2019 22:02:45 +0200 Subject: [PATCH] cleanup osx code --- PanoPainter-OSX/main.cpp | 26 ++++---------------------- PanoPainter-OSX/main.h | 3 --- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/PanoPainter-OSX/main.cpp b/PanoPainter-OSX/main.cpp index 08253e3..1985470 100644 --- a/PanoPainter-OSX/main.cpp +++ b/PanoPainter-OSX/main.cpp @@ -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 diff --git a/PanoPainter-OSX/main.h b/PanoPainter-OSX/main.h index 756208a..2986dec 100644 --- a/PanoPainter-OSX/main.h +++ b/PanoPainter-OSX/main.h @@ -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;