Skip to content
Snippets Groups Projects
Commit 28a9c07a authored by George Nachman's avatar George Nachman
Browse files

Avoid makingn touchbar API calls on devices that don't support it

parent d0a9015a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -7043,6 +7043,9 @@ ITERM_WEAKLY_REFERENCEABLE
}
 
- (NSTouchBar *)makeGenericTouchBar {
if (!IsTouchBarAvailable()) {
return nil;
}
NSTouchBar *touchBar = [[[NSTouchBar alloc] init] autorelease];
touchBar.delegate = self;
touchBar.defaultItemIdentifiers = @[ iTermTouchBarIdentifierManPage,
Loading
Loading
@@ -7080,6 +7083,9 @@ ITERM_WEAKLY_REFERENCEABLE
}
 
- (NSTouchBar *)amendTouchBar:(NSTouchBar *)touchBar {
if (!IsTouchBarAvailable()) {
return nil;
}
touchBar.customizationIdentifier = @"regular";
if (self.anyFullScreen) {
NSMutableArray *temp = [[touchBar.defaultItemIdentifiers mutableCopy] autorelease];
Loading
Loading
@@ -7095,10 +7101,12 @@ ITERM_WEAKLY_REFERENCEABLE
}
 
- (void)currentSessionWordAtCursorDidBecome:(NSString *)word {
NSTouchBarItem *item = [self.touchBar itemForIdentifier:iTermTouchBarIdentifierManPage];
if (item) {
iTermTouchBarButton *button = (iTermTouchBarButton *)item.view;
[self updateManPageButton:button word:word];
if (IsTouchBarAvailable() && [self respondsToSelector:@selector(touchBar)]) {
NSTouchBarItem *item = [self.touchBar itemForIdentifier:iTermTouchBarIdentifierManPage];
if (item) {
iTermTouchBarButton *button = (iTermTouchBarButton *)item.view;
[self updateManPageButton:button word:word];
}
}
}
 
Loading
Loading
@@ -7119,6 +7127,9 @@ ITERM_WEAKLY_REFERENCEABLE
}
 
- (NSTouchBarItem *)colorPresetsScrollViewTouchBarItem {
if (!IsTouchBarAvailable()) {
return nil;
}
NSScrollView *scrollView = [[[NSScrollView alloc] init] autorelease];
NSCustomTouchBarItem *item = [[[NSCustomTouchBarItem alloc] initWithIdentifier:iTermTouchBarIdentifierColorPresetScrollview] autorelease];
item.view = scrollView;
Loading
Loading
@@ -7746,7 +7757,6 @@ ITERM_WEAKLY_REFERENCEABLE
- (__kindof NSScrubberItemView *)scrubber:(NSScrubber *)scrubber viewForItemAtIndex:(NSInteger)index {
NSScrubberTextItemView *itemView = [scrubber makeItemWithIdentifier:iTermTabBarItemTouchBarIdentifier owner:nil];
itemView.textField.stringValue = [self scrubberLabelAtIndex:index];
// [itemView.textField sizeToFit];
return itemView;
}
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment