mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
Set touch bar default button directly instead of changing its keyEquivalent
This commit is contained in:
1 parent
7ae0e71b02
commit
d95f420360
6 files changed
+14
-12
No files matched your search
Vendored
+3
-3
@@ -110,10 +110,10 @@
|
||||
- (NSTouchBar *)makeTouchBar
|
||||
{
|
||||
self.touchBarProvider = [[SUTouchBarProvider alloc] initWithIdentifier:self.className];
|
||||
[self.touchBarProvider addButtonWithButton:self.skipButton];
|
||||
[self.touchBarProvider addButtonWithButton:self.skipButton isDefault:NO];
|
||||
[self.touchBarProvider addSpace];
|
||||
[self.touchBarProvider addButtonWithButton:self.laterButton];
|
||||
[self.touchBarProvider addButtonWithButton:self.installButton].keyEquivalent = @"\r";
|
||||
[self.touchBarProvider addButtonWithButton:self.laterButton isDefault:NO];
|
||||
[self.touchBarProvider addButtonWithButton:self.installButton isDefault:YES];
|
||||
[self.touchBarProvider addSpace];
|
||||
[self.touchBarProvider addSpace];
|
||||
return self.touchBarProvider.touchBar;
|
||||
|
||||
Vendored
+1
-1
@@ -135,7 +135,7 @@
|
||||
- (NSTouchBar *)makeTouchBar
|
||||
{
|
||||
self.touchBarProvider = [[SUTouchBarProvider alloc] initWithIdentifier:self.className];
|
||||
self.touchBarButton = [self.touchBarProvider addButtonWithButton:self.actionButton];
|
||||
self.touchBarButton = [self.touchBarProvider addButtonWithButton:self.actionButton isDefault:[self.actionButton.keyEquivalent isEqualToString:@"\r"]];
|
||||
return self.touchBarProvider.touchBar;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -15,7 +15,7 @@
|
||||
@property (strong, readonly) NSTouchBar *touchBar;
|
||||
|
||||
-(instancetype)initWithIdentifier:(NSString *)identifier;
|
||||
-(NSButton *)addButtonWithButton:(NSButton *)button;
|
||||
-(NSButton *)addButtonWithButton:(NSButton *)button isDefault:(BOOL)isDefault;
|
||||
-(void)addSpace;
|
||||
|
||||
@end
|
||||
Vendored
+4
-2
@@ -46,14 +46,16 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(NSButton *)addButtonWithButton:(NSButton *)button
|
||||
-(NSButton *)addButtonWithButton:(NSButton *)button isDefault:(BOOL)isDefault
|
||||
{
|
||||
NSString *itemId = [self.indentifier stringByAppendingFormat:@".button-%lu", self.touchBarItems.count];
|
||||
NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:itemId];
|
||||
|
||||
NSButton *buttonCopy = [NSButton buttonWithTitle:button.title target:button.target action:button.action];
|
||||
buttonCopy.keyEquivalent = button.keyEquivalent;
|
||||
buttonCopy.tag = button.tag;
|
||||
if (isDefault) {
|
||||
buttonCopy.keyEquivalent = @"\r";
|
||||
}
|
||||
|
||||
[buttonCopy bind:@"title" toObject:button withKeyPath:@"title" options:nil];
|
||||
[buttonCopy bind:@"enabled" toObject:button withKeyPath:@"enabled" options:nil];
|
||||
|
||||
Vendored
+3
-3
@@ -327,10 +327,10 @@
|
||||
- (NSTouchBar *)makeTouchBar
|
||||
{
|
||||
self.touchBarProvider = [[SUTouchBarProvider alloc] initWithIdentifier:self.className];
|
||||
[self.touchBarProvider addButtonWithButton:self.skipButton];
|
||||
[self.touchBarProvider addButtonWithButton:self.skipButton isDefault:NO];
|
||||
[self.touchBarProvider addSpace];
|
||||
[self.touchBarProvider addButtonWithButton:self.laterButton];
|
||||
[self.touchBarProvider addButtonWithButton:self.installButton].keyEquivalent = @"\r";
|
||||
[self.touchBarProvider addButtonWithButton:self.laterButton isDefault:NO];
|
||||
[self.touchBarProvider addButtonWithButton:self.installButton isDefault:YES];
|
||||
[self.touchBarProvider addSpace];
|
||||
[self.touchBarProvider addSpace];
|
||||
return self.touchBarProvider.touchBar;
|
||||
|
||||
Vendored
+2
-2
@@ -170,8 +170,8 @@
|
||||
- (NSTouchBar *)makeTouchBar
|
||||
{
|
||||
self.touchBarProvider = [[SUTouchBarProvider alloc] initWithIdentifier:self.className];
|
||||
[self.touchBarProvider addButtonWithButton:self.cancelButton];
|
||||
[self.touchBarProvider addButtonWithButton:self.checkButton].keyEquivalent = @"\r";
|
||||
[self.touchBarProvider addButtonWithButton:self.cancelButton isDefault:NO];
|
||||
[self.touchBarProvider addButtonWithButton:self.checkButton isDefault:YES];
|
||||
return self.touchBarProvider.touchBar;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user