From b0363802d84cc1492c74c966bb065459896aa943 Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 12 Oct 2016 17:56:29 +0000 Subject: [PATCH] OS X: revert "sort out window visibility and focus." This reverts commit 1dba59494911e66e30620d2e6da11093b2e488ec. Turns out the old behavior was more appropriate for OS X. --- src/platform/cocoamain.mm | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/src/platform/cocoamain.mm b/src/platform/cocoamain.mm index 94be0c6e..14e214ba 100644 --- a/src/platform/cocoamain.mm +++ b/src/platform/cocoamain.mm @@ -1010,12 +1010,6 @@ void InitTextWindow() { [TW setFrameAutosaveName:@"TextWindow"]; [TW setFloatingPanel:YES]; [TW setBecomesKeyOnlyIfNeeded:YES]; - [GW addChildWindow:TW ordered:NSWindowAbove]; - - // Without this, graphics window is also hidden when the text window is shown - // (and is its child window). We replicate the standard behavior manually, in - // the application delegate; - [TW setHidesOnDeactivate:NO]; NSScrollView *scrollView = [[NSScrollView alloc] init]; [TW setContentView:scrollView]; @@ -1034,9 +1028,9 @@ void InitTextWindow() { void ShowTextWindow(bool visible) { if(visible) - [GW addChildWindow:TW ordered:NSWindowAbove]; + [TW orderFront:nil]; else - [TW orderOut:GW]; + [TW close]; } void GetTextWindowSize(int *w, int *h) { @@ -1156,8 +1150,6 @@ const void *SolveSpace::LoadResource(const std::string &name, size_t *size) { - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication; - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; - (void)applicationWillTerminate:(NSNotification *)aNotification; -- (void)applicationWillBecomeActive:(NSNotification *)aNotification; -- (void)applicationWillResignActive:(NSNotification *)aNotification; - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename; - (IBAction)preferences:(id)sender; @end @@ -1178,18 +1170,6 @@ const void *SolveSpace::LoadResource(const std::string &name, size_t *size) { SolveSpace::SS.Exit(); } -- (void)applicationWillBecomeActive:(NSNotification *)aNotification { - if(SolveSpace::SS.GW.showTextWindow) { - [GW addChildWindow:TW ordered:NSWindowAbove]; - } -} - -- (void)applicationWillResignActive:(NSNotification *)aNotification { - [TW setAnimationBehavior:NSWindowAnimationBehaviorNone]; - [TW orderOut:nil]; - [TW setAnimationBehavior:NSWindowAnimationBehaviorDefault]; -} - - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { return SolveSpace::SS.OpenFile([filename UTF8String]); }