This commit is contained in:
mr. m
2025-11-19 19:14:50 +01:00
6 changed files with 43 additions and 134 deletions

View File

@@ -57,3 +57,6 @@
- name: zen.view.show-clear-tabs-button
value: true
- name: zen.view.draggable-sidebar
value: true

View File

@@ -0,0 +1,15 @@
diff --git a/browser/components/urlbar/UrlbarResult.sys.mjs b/browser/components/urlbar/UrlbarResult.sys.mjs
index 0882c0a01d17184cadb56aa1236ca97adf7f866b..4a5842eda6280205b96f9aee9b6f3b49fac7077c 100644
--- a/browser/components/urlbar/UrlbarResult.sys.mjs
+++ b/browser/components/urlbar/UrlbarResult.sys.mjs
@@ -172,6 +172,10 @@ export class UrlbarResult {
return this.#heuristic;
}
+ set heuristic(value) {
+ this.#heuristic = value;
+ }
+
get hideRowLabel() {
return this.#hideRowLabel;
}

View File

@@ -1,107 +0,0 @@
diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp
index 2a17159215d107f6e4b09cf3a63ab0fff2c2ee70..15dffb83dbac8c6aa9b3dfa388b66874d5b05a7e 100644
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -2848,6 +2848,25 @@ void nsWindow::SetCustomTitlebar(bool aCustomTitlebar) {
mCustomNonClient = aCustomTitlebar;
+ // Because of bug 1993474, we want to properly set the WS_BORDER style
+ // when the titlebar is turned on or off.
+ //
+ // The documentation for window styles says that most styles can't be
+ // modified after the window is created. Testing shows that WS_BORDER
+ // seems to be OK, but make sure this is the only style we try to change
+ // here.
+ const LONG_PTR actualStyle = ::GetWindowLongPtrW(mWnd, GWL_STYLE);
+ LONG_PTR newStyle = actualStyle;
+ if (mCustomNonClient) {
+ newStyle &= ~WS_BORDER;
+ } else {
+ newStyle |= WS_BORDER;
+ }
+ if (newStyle != actualStyle) {
+ VERIFY_WINDOW_STYLE(newStyle);
+ ::SetWindowLongPtrW(mWnd, GWL_STYLE, newStyle);
+ }
+
// Force a reflow of content based on the new client dimensions.
if (mCustomNonClient) {
UpdateNonClientMargins();
@@ -8792,9 +8811,10 @@ void nsWindow::FrameState::CheckInvariant() const {
mPreFullscreenSizeMode < nsSizeMode_Invalid);
MOZ_ASSERT(mWindow);
- // We should never observe fullscreen sizemode unless fullscreen is enabled
- MOZ_ASSERT_IF(mSizeMode == nsSizeMode_Fullscreen, mFullscreenMode);
- MOZ_ASSERT_IF(!mFullscreenMode, mSizeMode != nsSizeMode_Fullscreen);
+ // Unfortunately this can happen now with the hack fix in
+ // SetSizeModeInternal()
+ // MOZ_ASSERT_IF(mSizeMode == nsSizeMode_Fullscreen, mFullscreenMode);
+ // MOZ_ASSERT_IF(!mFullscreenMode, mSizeMode != nsSizeMode_Fullscreen);
// Something went wrong if we somehow saved fullscreen mode when we are
// changing into fullscreen mode
@@ -8902,6 +8922,62 @@ void nsWindow::FrameState::SetSizeModeInternal(nsSizeMode aMode,
mSizeMode == nsSizeMode_Fullscreen || aMode == nsSizeMode_Fullscreen;
const bool maximized = aMode == nsSizeMode_Maximized;
const bool fullscreen = aMode == nsSizeMode_Fullscreen;
+ const bool wasMaximized = mSizeMode == nsSizeMode_Maximized;
+ const bool wasFullscreen = mSizeMode == nsSizeMode_Fullscreen;
+
+ // Maximizing a window without the WS_BORDER style set will make Windows
+ // display it over the taskbar, even if we tell it not to. So if we're
+ // becoming maximized, make sure WS_BORDER is set, then clear it after a
+ // short time if necessary (to avoid issues like bug 1993474). Conversely,
+ // for becoming fullscreen make sure WS_BORDER is cleared. Yes, this is a
+ // hack.
+ if ((maximized && !wasMaximized) || (fullscreen && !wasFullscreen)) {
+ const LONG_PTR actualStyle = ::GetWindowLongPtrW(mWindow->mWnd, GWL_STYLE);
+ LONG_PTR newStyle = actualStyle;
+ if (maximized) {
+ newStyle |= WS_BORDER;
+ } else {
+ newStyle &= ~WS_BORDER;
+ }
+ if (newStyle != actualStyle) {
+ VERIFY_WINDOW_STYLE(newStyle);
+ MOZ_LOG(
+ gWindowsLog, LogLevel::Info,
+ ("window style is %d, temporarily fixing up WS_BORDER", mSizeMode));
+ ::SetWindowLongPtrW(mWindow->mWnd, GWL_STYLE, newStyle);
+ ::SetWindowPos(mWindow->mWnd, nullptr, 0, 0, 0, 0,
+ SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE |
+ SWP_NOACTIVATE | SWP_NOOWNERZORDER);
+ }
+ NS_DispatchToMainThread(NS_NewRunnableFunction(
+ "nsWindow::FrameState::SetSizeModeInternal",
+ [expectedMode = aMode, window = RefPtr(this->mWindow)]() {
+ // Make sure we're still in the same state (i.e. the user hasn't
+ // un-maximized or un-fullscreened the window in the meantime)
+ if (window->SizeMode() != expectedMode) {
+ return;
+ }
+ const LONG_PTR actualStyle =
+ ::GetWindowLongPtrW(window->mWnd, GWL_STYLE);
+ LONG_PTR newStyle = actualStyle;
+ if (expectedMode == nsSizeMode_Maximized &&
+ window->mCustomNonClient) {
+ newStyle &= ~WS_BORDER;
+ } else {
+ newStyle |= WS_BORDER;
+ }
+ if (newStyle != actualStyle) {
+ VERIFY_WINDOW_STYLE(newStyle);
+ MOZ_LOG(gWindowsLog, LogLevel::Info,
+ ("window style is %d, after delay restoring WS_BORDER",
+ expectedMode));
+ ::SetWindowLongPtrW(window->mWnd, GWL_STYLE, newStyle);
+ ::SetWindowPos(window->mWnd, nullptr, 0, 0, 0, 0,
+ SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE |
+ SWP_NOACTIVATE | SWP_NOOWNERZORDER);
+ }
+ }));
+ }
mSizeMode = aMode;

View File

@@ -444,29 +444,29 @@ var gZenUIManager = {
gURLBar._zenHandleUrlbarClose = null;
}
const isFocusedBefore = gURLBar.focused;
setTimeout(() => {
// We use this attribute on Tabbrowser::addTab
gURLBar.removeAttribute('zen-newtab');
}, 0);
// Safely restore tab visual state with proper validation
if (
this._lastTab &&
!this._lastTab.closing &&
this._lastTab.ownerGlobal &&
!this._lastTab.ownerGlobal.closed
) {
this._lastTab._visuallySelected = true;
this._lastTab = null;
}
// Safely restore tab visual state with proper validation
if (
this._lastTab &&
!this._lastTab.closing &&
this._lastTab.ownerGlobal &&
!this._lastTab.ownerGlobal.closed &&
!onSwitch
) {
this._lastTab._visuallySelected = true;
this._lastTab = null;
}
// Reset newtab buttons
for (const button of this.newtabButtons) {
button.removeAttribute('in-urlbar');
}
// Reset newtab buttons
for (const button of this.newtabButtons) {
button.removeAttribute('in-urlbar');
}
// Handle search data
if (!onElementPicked) {
// Handle search data
if (onSwitch) {
this.clearUrlbarData();
} else {
@@ -487,12 +487,8 @@ var gZenUIManager = {
}
gURLBar.handleRevert();
} else if (onElementPicked && onSwitch) {
this.clearUrlbarData();
}
if (gURLBar.focused) {
setTimeout(() => {
if (isFocusedBefore) {
setTimeout(() => {
window.dispatchEvent(
new CustomEvent('ZenURLBarClosed', { detail: { onSwitch, onElementPicked } })
@@ -513,8 +509,8 @@ var gZenUIManager = {
}
}
}, 0);
}, 0);
}
}
}, 0);
},
urlbarTrim(aURL) {

View File

@@ -106,7 +106,7 @@
right: calc(-1 * var(--actual-zen-sidebar-width) + var(--zen-element-separation) / 2 + 1px);
}
& .browserSidebarContainer {
& .browserSidebarContainer:not([is-zen-split='true']) {
margin-left: 0 !important;
margin-right: 0 !important;
}

View File

@@ -330,8 +330,10 @@ zen-workspace {
}
}
&[active] .zen-workspace-empty-space {
-moz-window-dragging: drag;
@media -moz-pref('zen.view.draggable-sidebar') {
&[active] .zen-workspace-empty-space {
-moz-window-dragging: drag;
}
}
}