Use SetTouchBar withe empty vector instead of DestroyTouchBar
This commit is contained in:
parent
d5dbe3676e
commit
51f1c5a557
8 changed files with 11 additions and 25 deletions
|
@ -845,10 +845,6 @@ void Window::SetVibrancy(mate::Arguments* args) {
|
|||
window_->SetVibrancy(type);
|
||||
}
|
||||
|
||||
void Window::DestroyTouchBar() {
|
||||
window_->DestroyTouchBar();
|
||||
}
|
||||
|
||||
void Window::SetTouchBar(const std::vector<mate::PersistentDictionary>& items) {
|
||||
window_->SetTouchBar(items);
|
||||
}
|
||||
|
@ -977,8 +973,7 @@ void Window::BuildPrototype(v8::Isolate* isolate,
|
|||
.SetMethod("setAutoHideCursor", &Window::SetAutoHideCursor)
|
||||
#endif
|
||||
.SetMethod("setVibrancy", &Window::SetVibrancy)
|
||||
.SetMethod("_destroyTouchBar", &Window::DestroyTouchBar)
|
||||
.SetMethod("_setTouchBar", &Window::SetTouchBar)
|
||||
.SetMethod("_setTouchBarItems", &Window::SetTouchBar)
|
||||
.SetMethod("_refreshTouchBarItem", &Window::RefreshTouchBarItem)
|
||||
#if defined(OS_WIN)
|
||||
.SetMethod("hookWindowMessage", &Window::HookWindowMessage)
|
||||
|
|
|
@ -206,7 +206,6 @@ class Window : public mate::TrackableObject<Window>,
|
|||
void SetAutoHideCursor(bool auto_hide);
|
||||
|
||||
void SetVibrancy(mate::Arguments* args);
|
||||
void DestroyTouchBar();
|
||||
void SetTouchBar(const std::vector<mate::PersistentDictionary>& items);
|
||||
void RefreshTouchBarItem(const std::string& item_id);
|
||||
|
||||
|
|
|
@ -340,9 +340,6 @@ void NativeWindow::SetAutoHideCursor(bool auto_hide) {
|
|||
void NativeWindow::SetVibrancy(const std::string& filename) {
|
||||
}
|
||||
|
||||
void NativeWindow::DestroyTouchBar() {
|
||||
}
|
||||
|
||||
void NativeWindow::SetTouchBar(
|
||||
const std::vector<mate::PersistentDictionary>& items) {
|
||||
}
|
||||
|
|
|
@ -171,7 +171,6 @@ class NativeWindow : public base::SupportsUserData,
|
|||
virtual void SetVibrancy(const std::string& type);
|
||||
|
||||
// Touchbar API
|
||||
virtual void DestroyTouchBar();
|
||||
virtual void SetTouchBar(
|
||||
const std::vector<mate::PersistentDictionary>& items);
|
||||
virtual void RefreshTouchBarItem(const std::string& item_id);
|
||||
|
|
|
@ -100,7 +100,6 @@ class NativeWindowMac : public NativeWindow,
|
|||
void SetAutoHideCursor(bool auto_hide) override;
|
||||
|
||||
void SetVibrancy(const std::string& type) override;
|
||||
void DestroyTouchBar() override;
|
||||
void SetTouchBar(
|
||||
const std::vector<mate::PersistentDictionary>& items) override;
|
||||
void RefreshTouchBarItem(const std::string& item_id) override;
|
||||
|
|
|
@ -1372,11 +1372,6 @@ void NativeWindowMac::SetVibrancy(const std::string& type) {
|
|||
[effect_view setMaterial:vibrancyType];
|
||||
}
|
||||
|
||||
void NativeWindowMac::DestroyTouchBar() {
|
||||
touch_bar_items_.clear();
|
||||
[window_ resetTouchBar];
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetTouchBar(
|
||||
const std::vector<mate::PersistentDictionary>& items) {
|
||||
touch_bar_items_ = items;
|
||||
|
|
|
@ -199,20 +199,20 @@ Object.assign(BrowserWindow.prototype, {
|
|||
|
||||
// TouchBar API
|
||||
setTouchBar (touchBar) {
|
||||
// This property is set from within TouchBar
|
||||
if (this._touchBar != null) {
|
||||
this._touchBar._removeFromWindow(this)
|
||||
}
|
||||
|
||||
if (touchBar == null) {
|
||||
if (this._touchBar != null) {
|
||||
this._touchBar._removeFromWindow(this)
|
||||
}
|
||||
this._destroyTouchBar()
|
||||
this._setTouchBarItems([])
|
||||
return
|
||||
}
|
||||
|
||||
if (Array.isArray(touchBar)) {
|
||||
touchBar = new TouchBar(touchBar)
|
||||
}
|
||||
|
||||
this._touchBar = touchBar
|
||||
this._touchBar._addToWindow(this)
|
||||
touchBar._addToWindow(this)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ class TouchBar extends EventEmitter {
|
|||
// Already added to window
|
||||
if (this.windowListeners.hasOwnProperty(id)) return
|
||||
|
||||
window._touchBar = this
|
||||
|
||||
const changeListener = (itemID) => {
|
||||
window._refreshTouchBarItem(itemID)
|
||||
}
|
||||
|
@ -61,7 +63,7 @@ class TouchBar extends EventEmitter {
|
|||
window.once('closed', removeListeners)
|
||||
this.windowListeners[id] = removeListeners
|
||||
|
||||
window._setTouchBar(this.ordereredItems)
|
||||
window._setTouchBarItems(this.ordereredItems)
|
||||
}
|
||||
|
||||
// Called by BrowserWindow.setTouchBar
|
||||
|
|
Loading…
Reference in a new issue