mirror of
https://github.com/transmission/transmission
synced 2025-02-06 22:42:33 +00:00
fix: CoreAutoLayout hang during runCustomizationPalette on macOS 13.2 (#4709)
This commit is contained in:
parent
0c582c6d7e
commit
3fb1f8bcd7
3 changed files with 26 additions and 2 deletions
|
@ -4225,7 +4225,7 @@ void onTorrentCompletenessChanged(tr_torrent* tor, tr_completeness status, bool
|
|||
return [self toolbarButtonWithIdentifier:ident forToolbarButtonClass:[ButtonToolbarItem class]];
|
||||
}
|
||||
|
||||
- (id)toolbarButtonWithIdentifier:(NSString*)ident forToolbarButtonClass:(Class)klass
|
||||
- (__kindof ButtonToolbarItem*)toolbarButtonWithIdentifier:(NSString*)ident forToolbarButtonClass:(Class)klass
|
||||
{
|
||||
ButtonToolbarItem* item = [[klass alloc] initWithItemIdentifier:ident];
|
||||
|
||||
|
@ -4344,6 +4344,12 @@ void onTorrentCompletenessChanged(tr_torrent* tor, tr_completeness status, bool
|
|||
forSegment:TOOLBAR_RESUME_TAG];
|
||||
[segmentedControl setToolTip:NSLocalizedString(@"Resume all transfers", "All toolbar item -> tooltip")
|
||||
forSegment:TOOLBAR_RESUME_TAG];
|
||||
if ([toolbar isKindOfClass:Toolbar.class] && ((Toolbar*)toolbar).isRunningCustomizationPalette)
|
||||
{
|
||||
// On macOS 13.2, the palette autolayout will hang unless the segmentedControl width is longer than the groupItem paletteLabel (matters especially in Russian and French).
|
||||
[segmentedControl setWidth:64 forSegment:TOOLBAR_PAUSE_TAG];
|
||||
[segmentedControl setWidth:64 forSegment:TOOLBAR_RESUME_TAG];
|
||||
}
|
||||
|
||||
groupItem.label = NSLocalizedString(@"Apply All", "All toolbar item -> label");
|
||||
groupItem.paletteLabel = NSLocalizedString(@"Pause / Resume All", "All toolbar item -> palette label");
|
||||
|
@ -4394,8 +4400,13 @@ void onTorrentCompletenessChanged(tr_torrent* tor, tr_completeness status, bool
|
|||
forSegment:TOOLBAR_RESUME_TAG];
|
||||
[segmentedControl setToolTip:NSLocalizedString(@"Resume selected transfers", "Selected toolbar item -> tooltip")
|
||||
forSegment:TOOLBAR_RESUME_TAG];
|
||||
if ([toolbar isKindOfClass:Toolbar.class] && ((Toolbar*)toolbar).isRunningCustomizationPalette)
|
||||
{
|
||||
// On macOS 13.2, the palette autolayout will hang unless the segmentedControl width is longer than the groupItem paletteLabel (matters especially in Russian and French).
|
||||
[segmentedControl setWidth:64 forSegment:TOOLBAR_PAUSE_TAG];
|
||||
[segmentedControl setWidth:64 forSegment:TOOLBAR_RESUME_TAG];
|
||||
}
|
||||
|
||||
groupItem.view = segmentedControl;
|
||||
groupItem.label = NSLocalizedString(@"Apply Selected", "Selected toolbar item -> label");
|
||||
groupItem.paletteLabel = NSLocalizedString(@"Pause / Resume Selected", "Selected toolbar item -> palette label");
|
||||
groupItem.visibilityPriority = NSToolbarItemVisibilityPriorityHigh;
|
||||
|
|
|
@ -6,4 +6,6 @@
|
|||
|
||||
@interface Toolbar : NSToolbar
|
||||
|
||||
@property(readonly) BOOL isRunningCustomizationPalette;
|
||||
|
||||
@end
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
#import "Toolbar.h"
|
||||
|
||||
@interface Toolbar ()
|
||||
@property(nonatomic) BOOL isRunningCustomizationPalette;
|
||||
@end
|
||||
|
||||
@implementation Toolbar
|
||||
|
||||
- (void)setVisible:(BOOL)visible
|
||||
|
@ -15,4 +19,11 @@
|
|||
super.visible = visible;
|
||||
}
|
||||
|
||||
- (void)runCustomizationPalette:(nullable id)sender
|
||||
{
|
||||
_isRunningCustomizationPalette = YES;
|
||||
[super runCustomizationPalette:sender];
|
||||
_isRunningCustomizationPalette = NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue