mirror of
				https://github.com/cookiengineer/audacity
				synced 2025-10-31 14:13:50 +01:00 
			
		
		
		
	Fix black screen after closing fullscreen window -- REBUILD WXWIDGETS
Works by un-full-screening before closing. Patching wxWidgets was needed to make that work correctly after full-screening by clicking on the green circle in the title bar, but that fix is not needed for full screen after command+/
This commit is contained in:
		| @@ -42,6 +42,7 @@ http://forum.audacityteam.org/viewtopic.php?p=303835#p303835 . | ||||
|    patch -p0 -i <path to Audacity source>/mac/wxMac_additions/focusrings.patch . | ||||
|    patch -p0 -i <path to Audacity source>/mac/wxMac_additions/wxMac-3.0.2-wxaccessible.patch . | ||||
|    patch -p0 -i <path to Audacity source>/mac/wxMac_additions/tooldock-quit.patch . | ||||
|    patch -p0 -i <path to Audacity source>/mac/wxMac_additions/fullscreen.patch . | ||||
|  | ||||
| 10) And finally build/install wxWidgets: | ||||
|  | ||||
|   | ||||
							
								
								
									
										108
									
								
								mac/wxMac_additions/fullscreen.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										108
									
								
								mac/wxMac_additions/fullscreen.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,108 @@ | ||||
| From 85106af5ce61eef45d2f416908a4ff7b64728124 Mon Sep 17 00:00:00 2001 | ||||
| From: Paul Licameli <paul.licameli@audacityteam.org> | ||||
| Date: Wed, 7 Dec 2016 09:31:28 -0500 | ||||
| Subject: [PATCH] Correctly track the full-screen state on OSX 10.7 and later | ||||
|  | ||||
| --- | ||||
|  include/wx/osx/cocoa/private.h |  3 +++ | ||||
|  src/osx/cocoa/nonownedwnd.mm   | 32 +++++++++++++++++++++++++++++++- | ||||
|  2 files changed, 34 insertions(+), 1 deletion(-) | ||||
|  | ||||
| diff --git a/include/wx/osx/cocoa/private.h b/include/wx/osx/cocoa/private.h | ||||
| index ed731f7..0743ae9 100644 | ||||
| --- include/wx/osx/cocoa/private.h | ||||
| +++ include/wx/osx/cocoa/private.h | ||||
| @@ -239,6 +239,8 @@ public : | ||||
|   | ||||
|      virtual bool ShowFullScreen(bool show, long style); | ||||
|   | ||||
| +    bool NotifyFullScreen( bool fullScreen ) { m_isFullScreen = fullScreen; } | ||||
| + | ||||
|      virtual void ShowWithoutActivating(); | ||||
|   | ||||
|      virtual void RequestUserAttention(int flags); | ||||
| @@ -264,6 +266,7 @@ protected : | ||||
|      CGWindowLevel   m_macWindowLevel; | ||||
|      WXWindow        m_macWindow; | ||||
|      void *          m_macFullScreenData ; | ||||
| +    bool            m_isFullScreen; | ||||
|      DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowCocoaImpl) | ||||
|  }; | ||||
|   | ||||
| diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm | ||||
| index 9e79c6a..338bcf6 100644 | ||||
| --- src/osx/cocoa/nonownedwnd.mm | ||||
| +++ src/osx/cocoa/nonownedwnd.mm | ||||
| @@ -302,6 +302,10 @@ static NSResponder* s_nextFirstResponder = NULL; | ||||
|  - (void)windowDidMove:(NSNotification *)notification; | ||||
|  - (BOOL)windowShouldClose:(id)window; | ||||
|  - (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame; | ||||
| +// - (void)windowWillEnterFullScreen:(NSNotification *)notification; | ||||
| +- (void)windowDidEnterFullScreen:(NSNotification *)notification; | ||||
| +// - (void)windowWillExitFullScreen:(NSNotification *)notification; | ||||
| +- (void)windowDidExitFullScreen:(NSNotification *)notification; | ||||
|   | ||||
|  @end | ||||
|   | ||||
| @@ -534,6 +538,20 @@ extern int wxOSXGetIdFromSelector(SEL action ); | ||||
|      return true; | ||||
|  } | ||||
|   | ||||
| +- (void)windowDidEnterFullScreen:(NSNotification *)notification | ||||
| +{ | ||||
| +   NSWindow* window = (NSWindow*) [notification object]; | ||||
| +   wxNonOwnedWindowCocoaImpl* windowimpl = [window WX_implementation]; | ||||
| +   windowimpl->NotifyFullScreen(true); | ||||
| +} | ||||
| + | ||||
| +- (void)windowDidExitFullScreen:(NSNotification *)notification | ||||
| +{ | ||||
| +   NSWindow* window = (NSWindow*) [notification object]; | ||||
| +   wxNonOwnedWindowCocoaImpl* windowimpl = [window WX_implementation]; | ||||
| +   windowimpl->NotifyFullScreen(false); | ||||
| +} | ||||
| + | ||||
|  @end | ||||
|   | ||||
|  IMPLEMENT_DYNAMIC_CLASS( wxNonOwnedWindowCocoaImpl , wxNonOwnedWindowImpl ) | ||||
| @@ -543,12 +561,14 @@ wxNonOwnedWindowCocoaImpl::wxNonOwnedWindowCocoaImpl( wxNonOwnedWindow* nonowned | ||||
|  { | ||||
|      m_macWindow = NULL; | ||||
|      m_macFullScreenData = NULL; | ||||
| +    m_isFullScreen = false; | ||||
|  } | ||||
|   | ||||
|  wxNonOwnedWindowCocoaImpl::wxNonOwnedWindowCocoaImpl() | ||||
|  { | ||||
|      m_macWindow = NULL; | ||||
|      m_macFullScreenData = NULL; | ||||
| +    m_isFullScreen = false; | ||||
|  } | ||||
|   | ||||
|  wxNonOwnedWindowCocoaImpl::~wxNonOwnedWindowCocoaImpl() | ||||
| @@ -924,11 +944,21 @@ typedef struct | ||||
|   | ||||
|  bool wxNonOwnedWindowCocoaImpl::IsFullScreen() const | ||||
|  { | ||||
| -    return m_macFullScreenData != NULL ; | ||||
| +    if ( [ m_macWindow respondsToSelector:@selector(toggleFullScreen:) ] ) | ||||
| +       return m_isFullScreen; | ||||
| +   else | ||||
| +      return m_macFullScreenData != NULL ; | ||||
|  } | ||||
|   | ||||
|  bool wxNonOwnedWindowCocoaImpl::ShowFullScreen(bool show, long WXUNUSED(style)) | ||||
|  { | ||||
| +    if ( [ m_macWindow respondsToSelector:@selector(toggleFullScreen:) ] ) | ||||
| +    { | ||||
| +       if ( show != m_isFullScreen ) | ||||
| +          m_isFullScreen = show, [m_macWindow toggleFullScreen: nil]; | ||||
| +       return true; | ||||
| +    } | ||||
| + | ||||
|      if ( show ) | ||||
|      { | ||||
|          FullScreenData *data = (FullScreenData *)m_macFullScreenData ; | ||||
| --  | ||||
| 2.3.2 (Apple Git-55) | ||||
|  | ||||
| @@ -2414,6 +2414,11 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event) | ||||
|       return; | ||||
|    } | ||||
|  | ||||
|    // TODO: consider postponing these steps until after the possible veto | ||||
|    // below:  closing the two analysis dialogs, and stopping audio streams. | ||||
|    // Streams can be for play, recording, or monitoring.  But maybe it still | ||||
|    // makes sense to stop any recording before putting up the dialog. | ||||
|  | ||||
|    if (mFreqWindow) { | ||||
|       mFreqWindow->Destroy(); | ||||
|       mFreqWindow = NULL; | ||||
| @@ -2473,6 +2478,18 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event) | ||||
|       } | ||||
|    } | ||||
|  | ||||
| #ifdef __WXMAC__ | ||||
|    // Fix bug apparently introduced into 2.1.2 because of wxWidgets 3: | ||||
|    // closing a project that was made full-screen (as by clicking the green dot | ||||
|    // or command+/; not merely "maximized" as by clicking the title bar or | ||||
|    // Zoom in the Window menu) leaves the screen black. | ||||
|    // Fix it by un-full-screening. | ||||
|    // (But is there a different way to do this? What do other applications do? | ||||
|    //  I don't see full screen windows of Safari shrinking, but I do see | ||||
|    //  momentary blackness.) | ||||
|    ShowFullScreen(false); | ||||
| #endif | ||||
|  | ||||
|    ModuleManager::Get().Dispatch(ProjectClosing); | ||||
|  | ||||
|    // Stop the timer since there's no need to update anything anymore | ||||
|   | ||||
		Reference in New Issue
	
	Block a user