Reset helper when makeTouchBar is called
This commit is contained in:
parent
ca29ec0101
commit
14ef5c5957
2 changed files with 8 additions and 13 deletions
|
@ -352,9 +352,8 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
- (void)setShell:(atom::NativeWindowMac*)shell;
|
- (void)setShell:(atom::NativeWindowMac*)shell;
|
||||||
- (void)setEnableLargerThanScreen:(bool)enable;
|
- (void)setEnableLargerThanScreen:(bool)enable;
|
||||||
- (void)enableWindowButtonsOffset;
|
- (void)enableWindowButtonsOffset;
|
||||||
- (void)reloadTouchBar;
|
|
||||||
- (void)refreshTouchBarItem:(mate::Arguments*)args;
|
|
||||||
- (void)resetTouchBar;
|
- (void)resetTouchBar;
|
||||||
|
- (void)refreshTouchBarItem:(mate::Arguments*)args;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface AtomNSWindow () <NSTouchBarDelegate>
|
@interface AtomNSWindow () <NSTouchBarDelegate>
|
||||||
|
@ -365,7 +364,6 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
|
|
||||||
- (void)setShell:(atom::NativeWindowMac*)shell {
|
- (void)setShell:(atom::NativeWindowMac*)shell {
|
||||||
shell_ = shell;
|
shell_ = shell;
|
||||||
touch_bar_.reset([[AtomTouchBar alloc] initWithDelegate:self window:shell]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setEnableLargerThanScreen:(bool)enable {
|
- (void)setEnableLargerThanScreen:(bool)enable {
|
||||||
|
@ -376,16 +374,12 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
self.touchBar = nil;
|
self.touchBar = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)reloadTouchBar {
|
|
||||||
[touch_bar_ clear];
|
|
||||||
self.touchBar = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)refreshTouchBarItem:(mate::Arguments*)args {
|
- (void)refreshTouchBarItem:(mate::Arguments*)args {
|
||||||
[touch_bar_ refreshTouchBarItem:args];
|
[touch_bar_ refreshTouchBarItem:args];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSTouchBar*)makeTouchBar {
|
- (NSTouchBar*)makeTouchBar {
|
||||||
|
touch_bar_.reset([[AtomTouchBar alloc] initWithDelegate:self window:shell_]);
|
||||||
return [touch_bar_ makeTouchBarFromItemOptions:shell_->GetTouchBarItems()];
|
return [touch_bar_ makeTouchBarFromItemOptions:shell_->GetTouchBarItems()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1377,6 +1371,7 @@ void NativeWindowMac::SetVibrancy(const std::string& type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::DestroyTouchBar() {
|
void NativeWindowMac::DestroyTouchBar() {
|
||||||
|
touch_bar_items_.clear();
|
||||||
[window_ resetTouchBar];
|
[window_ resetTouchBar];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1384,7 +1379,7 @@ void NativeWindowMac::SetTouchBar(mate::Arguments* args) {
|
||||||
std::vector<mate::PersistentDictionary> items;
|
std::vector<mate::PersistentDictionary> items;
|
||||||
if (args->GetNext(&items)) {
|
if (args->GetNext(&items)) {
|
||||||
touch_bar_items_ = items;
|
touch_bar_items_ = items;
|
||||||
[window_ reloadTouchBar];
|
[window_ resetTouchBar];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue