mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-03 08:28:38 +00:00
Fixed opening customizable toolbar while having multiple windows (closes https://github.com/zen-browser/desktop/issues/3819)
This commit is contained in:
@@ -61,7 +61,7 @@ ac_add_options --enable-alsa
|
||||
ac_add_options --enable-pulseaudio
|
||||
|
||||
if test "$ZEN_RELEASE"; then
|
||||
#ac_add_options --enable-clang-plugin
|
||||
ac_add_options --enable-clang-plugin
|
||||
|
||||
# Disable DMD and ELF hacks, enable linker lld
|
||||
ac_add_options --disable-dmd
|
||||
|
@@ -117,6 +117,8 @@ var gZenUIManager = {
|
||||
|
||||
var gZenVerticalTabsManager = {
|
||||
init() {
|
||||
this._multiWindowFeature = new ZenMultiWindowFeature();
|
||||
|
||||
ChromeUtils.defineLazyGetter(this, 'isWindowsStyledButtons', () => {
|
||||
return !(window.AppConstants.platform === 'macosx' || window.matchMedia('(-moz-gtk-csd-reversed-placement)').matches
|
||||
|| Services.prefs.getBoolPref('zen.view.experimental-force-window-controls-left'));
|
||||
@@ -138,7 +140,7 @@ var gZenVerticalTabsManager = {
|
||||
this.initRightSideOrderContextMenu();
|
||||
|
||||
window.addEventListener('customizationstarting', this._preCustomize.bind(this));
|
||||
window.addEventListener('aftercustomization', updateEvent);
|
||||
window.addEventListener('aftercustomization', this._postCustomize.bind(this));
|
||||
|
||||
window.addEventListener('DOMContentLoaded', updateEvent, { once: true });
|
||||
|
||||
@@ -209,12 +211,22 @@ var gZenVerticalTabsManager = {
|
||||
return this.__actualWindowButtons;
|
||||
},
|
||||
|
||||
_preCustomize() {
|
||||
this._updateEvent({ forceMultipleToolbar: true });
|
||||
async _preCustomize() {
|
||||
await this._multiWindowFeature.foreachWindowAsActive(async (browser) => {
|
||||
browser.gZenVerticalTabsManager._updateEvent({ forceMultipleToolbar: true, dontRebuildAreas: true });
|
||||
});
|
||||
this.rebuildAreas();
|
||||
this.navigatorToolbox.setAttribute('zen-sidebar-expanded', 'true');
|
||||
document.documentElement.setAttribute('zen-sidebar-expanded', 'true'); // force expanded sidebar
|
||||
},
|
||||
|
||||
_postCustomize() {
|
||||
// No need to use `await` here, because the customization is already done
|
||||
this._multiWindowFeature.foreachWindowAsActive(async (browser) => {
|
||||
browser.gZenVerticalTabsManager._updateEvent({ dontRebuildAreas: true });
|
||||
});
|
||||
},
|
||||
|
||||
initializePreferences(updateEvent) {
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
this,
|
||||
@@ -261,7 +273,7 @@ var gZenVerticalTabsManager = {
|
||||
);
|
||||
},
|
||||
|
||||
_updateEvent({ forceMultipleToolbar = false } = {}) {
|
||||
_updateEvent({ forceMultipleToolbar = false, dontRebuildAreas = false } = {}) {
|
||||
if (this._isUpdating) {
|
||||
return;
|
||||
}
|
||||
@@ -314,16 +326,8 @@ var gZenVerticalTabsManager = {
|
||||
!isCompactMode
|
||||
) {
|
||||
this.navigatorToolbox.prepend(topButtons);
|
||||
// browser.prepend(this.navigatorToolbox);
|
||||
} else {
|
||||
// customizationTarget.prepend(topButtons);
|
||||
// tabboxWrapper.prepend(this.navigatorToolbox);
|
||||
}
|
||||
|
||||
//if (!isVerticalTabs) {
|
||||
// document.getElementById("urlbar-container").after(document.getElementById('navigator-toolbox'));
|
||||
//}
|
||||
|
||||
let windowButtons = this.actualWindowButtons;
|
||||
let doNotChangeWindowButtons = !isCompactMode && isRightSide && this.isWindowsStyledButtons;
|
||||
const navBar = document.getElementById('nav-bar');
|
||||
@@ -365,8 +369,10 @@ var gZenVerticalTabsManager = {
|
||||
document.documentElement.removeAttribute("zen-single-toolbar");
|
||||
navBar.appendChild(document.getElementById('PanelUI-button'));
|
||||
this._toolbarOriginalParent.prepend(navBar);
|
||||
if (!dontRebuildAreas) {
|
||||
this.rebuildAreas();
|
||||
}
|
||||
}
|
||||
|
||||
if (isCompactMode) {
|
||||
titlebar.prepend(topButtons);
|
||||
|
@@ -437,7 +437,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (-moz-bool-pref: 'zen.workspaces.show-workspace-indicator') or (not (-moz-bool-pref: 'zen.workspaces.enabled')) {
|
||||
@media (not (-moz-bool-pref: 'zen.workspaces.show-workspace-indicator')) or (not (-moz-bool-pref: 'zen.workspaces.enabled')) {
|
||||
#zen-current-workspace-indicator {
|
||||
display: none !important;
|
||||
}
|
||||
|
@@ -22,12 +22,16 @@ class ZenMultiWindowFeature {
|
||||
return Services.wm.getMostRecentWindow('navigator:browser');
|
||||
}
|
||||
|
||||
isActiveWindow() {
|
||||
static get isActiveWindow() {
|
||||
return ZenMultiWindowFeature.currentBrowser === window;
|
||||
}
|
||||
|
||||
windowIsActive(browser) {
|
||||
return browser === ZenMultiWindowFeature.currentBrowser;
|
||||
}
|
||||
|
||||
async foreachWindowAsActive(callback) {
|
||||
if (!this.isActiveWindow()) {
|
||||
if (!ZenMultiWindowFeature.isActiveWindow) {
|
||||
return;
|
||||
}
|
||||
for (const browser of ZenMultiWindowFeature.browsers) {
|
||||
|
Reference in New Issue
Block a user