From c41e05baac96c0e26d8a593dd477fe4c292be115 Mon Sep 17 00:00:00 2001 From: Yee Cheng Chin Date: Wed, 5 Oct 2022 18:44:02 -0700 Subject: [PATCH] Fix warning: zoomAll / makeWindowsPerform Fix the deprecation warning on makeWindowsPerform. While we could simply replace it with the more updated form, one thing I noticed was that zoomAll: simply wasn't getting called. It appears that NSApplication has a native handler of it and would call zoom: on each window by itself, and as such there's no point in making our own zoomAll: method at all. I couldn't find out if this was the case in old macOS versions, and so just ifdef out the zoomAll function in newer versions of macOS which also fixes the deprecation warning. --- src/MacVim/MMAppController.h | 2 ++ src/MacVim/MMAppController.m | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/MacVim/MMAppController.h b/src/MacVim/MMAppController.h index 9786457080..f043fd1e4f 100644 --- a/src/MacVim/MMAppController.h +++ b/src/MacVim/MMAppController.h @@ -73,7 +73,9 @@ - (IBAction)showVimHelp:(id)sender withCmd:(NSString *)cmd; - (IBAction)showVimHelp:(id)sender; - (IBAction)checkForUpdates:(id)sender; +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_13 - (IBAction)zoomAll:(id)sender; +#endif - (IBAction)stayInFront:(id)sender; - (IBAction)stayInBack:(id)sender; - (IBAction)stayLevelNormal:(id)sender; diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index dd668ad05d..10bddcba3b 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -1315,11 +1315,19 @@ fsEventCallback(ConstFSEventStreamRef streamRef, #endif } +// Note that the zoomAll method does not appear to be called in modern macOS versions +// as NSApplication just handles it and directly calls each window's zoom:. It's +// difficult to trace through history to see when that happened as it's not really +// documented, so we are leaving this method around in case on older macOS +// versions it's useful. +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_13 - (IBAction)zoomAll:(id)sender { + // TODO ychin: check on 10.13 etc. This was depreacated post 10.14. ASLogDebug(@"Zoom all windows"); [NSApp makeWindowsPerform:@selector(performZoom:) inOrder:YES]; } +#endif - (IBAction)stayInFront:(id)sender {