From 163f6c2544331afc7e4303ecf1fe97ebdb10fc8d Mon Sep 17 00:00:00 2001 From: SweetPPro Date: Sun, 5 Jun 2022 15:49:31 +0200 Subject: [PATCH] more FullScreen fixes, and some toolbar animation fixes (#3195) * Update Controller.mm fix fullscreen behaviour as described here https://github.com/transmission/transmission/issues/1906 * more FullScreen fixes, and some toolbar animation fixes https://github.com/transmission/transmission/issues/1906, https://github.com/transmission/transmission/issues/1903 --- macosx/Controller.mm | 11 +++++----- macosx/MainWindow.h | 11 ++++++++++ macosx/Mainwindow.mm | 37 +++++++++++++++++++++++++++++++++ macosx/da.lproj/MainMenu.xib | 2 +- macosx/de.lproj/MainMenu.xib | 2 +- macosx/en.lproj/MainMenu.xib | 6 ++++-- macosx/es.lproj/MainMenu.xib | 2 +- macosx/fr.lproj/MainMenu.xib | 2 +- macosx/it.lproj/MainMenu.xib | 2 +- macosx/nl.lproj/MainMenu.xib | 2 +- macosx/pt_PT.lproj/MainMenu.xib | 2 +- macosx/ru.lproj/MainMenu.xib | 2 +- macosx/tr.lproj/MainMenu.xib | 2 +- 13 files changed, 67 insertions(+), 16 deletions(-) create mode 100644 macosx/MainWindow.h create mode 100644 macosx/Mainwindow.mm diff --git a/macosx/Controller.mm b/macosx/Controller.mm index d955599f8..80d9578bc 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -54,6 +54,7 @@ #import "NSStringAdditions.h" #import "ExpandedPathToPathTransformer.h" #import "ExpandedPathToIconTransformer.h" +#import "MainWindow.h" #define TOOLBAR_CREATE @"Toolbar Create" #define TOOLBAR_OPEN_FILE @"Toolbar Open" @@ -230,7 +231,7 @@ static void removeKeRangerRansomware() @interface Controller () -@property(nonatomic) IBOutlet NSWindow* fWindow; +@property(nonatomic) IBOutlet MainWindow* fWindow; @property(nonatomic) IBOutlet TorrentTableView* fTableView; @property(nonatomic) IBOutlet NSMenuItem* fOpenIgnoreDownloadFolder; @@ -4252,7 +4253,7 @@ static void removeKeRangerRansomware() if (@available(macOS 11.0, *)) { - // not needed + button.bordered = NO; } else { @@ -4351,7 +4352,7 @@ static void removeKeRangerRansomware() if (@available(macOS 11.0, *)) { - // not needed + segmentedCell.bezeled = NO; } else { @@ -4402,7 +4403,7 @@ static void removeKeRangerRansomware() if (@available(macOS 11.0, *)) { - // not needed + segmentedCell.bezeled = NO; } else { @@ -5188,7 +5189,7 @@ static void removeKeRangerRansomware() - (void)setWindowSizeToFit { - if ([self.fDefaults boolForKey:@"AutoSize"]) + if ([self.fDefaults boolForKey:@"AutoSize"] && self.fWindow.isFullScreen == NO) { NSScrollView* scrollView = self.fTableView.enclosingScrollView; diff --git a/macosx/MainWindow.h b/macosx/MainWindow.h new file mode 100644 index 000000000..7c70b4abd --- /dev/null +++ b/macosx/MainWindow.h @@ -0,0 +1,11 @@ +// This file Copyright © 2008-2022 Transmission authors and contributors. +// It may be used under the MIT (SPDX: MIT) license. +// License text can be found in the licenses/ folder. + +#import + +@interface MainWindow : NSWindow + +- (BOOL)isFullScreen; + +@end diff --git a/macosx/Mainwindow.mm b/macosx/Mainwindow.mm new file mode 100644 index 000000000..0574d9ece --- /dev/null +++ b/macosx/Mainwindow.mm @@ -0,0 +1,37 @@ +// This file Copyright © 2008-2022 Transmission authors and contributors. +// It may be used under the MIT (SPDX: MIT) license. +// License text can be found in the licenses/ folder. + +#import "MainWindow.h" + +#define BIG_SUR_TOOLBARHEIGHT 28.0 + +@implementation MainWindow + +- (void)toggleToolbarShown:(id)sender +{ + NSRect frame = self.frame; + + //fix window sizing when toggling toolbar + if (@available(macOS 10.11, *)) + { + if (self.toolbar.isVisible == YES) + { + frame.size.height += BIG_SUR_TOOLBARHEIGHT; + } + else + { + frame.size.height -= BIG_SUR_TOOLBARHEIGHT; + } + } + [self setFrame:frame display:YES animate:NO]; + + [super toggleToolbarShown:sender]; +} + +- (BOOL)isFullScreen +{ + return (self.styleMask & NSFullScreenWindowMask); +} + +@end diff --git a/macosx/da.lproj/MainMenu.xib b/macosx/da.lproj/MainMenu.xib index 672c2cdaf..e76369880 100644 --- a/macosx/da.lproj/MainMenu.xib +++ b/macosx/da.lproj/MainMenu.xib @@ -13,7 +13,7 @@ - + diff --git a/macosx/de.lproj/MainMenu.xib b/macosx/de.lproj/MainMenu.xib index cf9c3aca8..89e3f1952 100644 --- a/macosx/de.lproj/MainMenu.xib +++ b/macosx/de.lproj/MainMenu.xib @@ -13,7 +13,7 @@ - + diff --git a/macosx/en.lproj/MainMenu.xib b/macosx/en.lproj/MainMenu.xib index 83d91d2d2..e3472cba9 100644 --- a/macosx/en.lproj/MainMenu.xib +++ b/macosx/en.lproj/MainMenu.xib @@ -13,7 +13,7 @@ - + @@ -171,7 +171,7 @@ - + @@ -698,6 +698,7 @@ CA + @@ -828,6 +829,7 @@ CA + diff --git a/macosx/es.lproj/MainMenu.xib b/macosx/es.lproj/MainMenu.xib index 00cb0fdec..d01a23643 100644 --- a/macosx/es.lproj/MainMenu.xib +++ b/macosx/es.lproj/MainMenu.xib @@ -13,7 +13,7 @@ - + diff --git a/macosx/fr.lproj/MainMenu.xib b/macosx/fr.lproj/MainMenu.xib index 43989c674..76d7c0b44 100644 --- a/macosx/fr.lproj/MainMenu.xib +++ b/macosx/fr.lproj/MainMenu.xib @@ -13,7 +13,7 @@ - + diff --git a/macosx/it.lproj/MainMenu.xib b/macosx/it.lproj/MainMenu.xib index c57b1acea..176dc2be8 100644 --- a/macosx/it.lproj/MainMenu.xib +++ b/macosx/it.lproj/MainMenu.xib @@ -13,7 +13,7 @@ - + diff --git a/macosx/nl.lproj/MainMenu.xib b/macosx/nl.lproj/MainMenu.xib index 7a2091201..ce77122f7 100644 --- a/macosx/nl.lproj/MainMenu.xib +++ b/macosx/nl.lproj/MainMenu.xib @@ -13,7 +13,7 @@ - + diff --git a/macosx/pt_PT.lproj/MainMenu.xib b/macosx/pt_PT.lproj/MainMenu.xib index 81b9d218b..f900cc7bf 100644 --- a/macosx/pt_PT.lproj/MainMenu.xib +++ b/macosx/pt_PT.lproj/MainMenu.xib @@ -13,7 +13,7 @@ - + diff --git a/macosx/ru.lproj/MainMenu.xib b/macosx/ru.lproj/MainMenu.xib index b9e1d2e6f..fe3e92ef4 100644 --- a/macosx/ru.lproj/MainMenu.xib +++ b/macosx/ru.lproj/MainMenu.xib @@ -13,7 +13,7 @@ - + diff --git a/macosx/tr.lproj/MainMenu.xib b/macosx/tr.lproj/MainMenu.xib index a3b32f45a..a5eb65b2d 100644 --- a/macosx/tr.lproj/MainMenu.xib +++ b/macosx/tr.lproj/MainMenu.xib @@ -13,7 +13,7 @@ - +