diff --git a/macosx/Controller.mm b/macosx/Controller.mm index f3baa5d70..b6b83c123 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -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; diff --git a/macosx/Toolbar.h b/macosx/Toolbar.h index 20e9d847f..e6d2ad618 100644 --- a/macosx/Toolbar.h +++ b/macosx/Toolbar.h @@ -6,4 +6,6 @@ @interface Toolbar : NSToolbar +@property(readonly) BOOL isRunningCustomizationPalette; + @end diff --git a/macosx/Toolbar.mm b/macosx/Toolbar.mm index 06efd4e86..5685001f2 100644 --- a/macosx/Toolbar.mm +++ b/macosx/Toolbar.mm @@ -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