mirror of
https://github.com/zen-browser/desktop.git
synced 2026-01-24 21:56:10 +00:00
chore: Apply patches to fix double click on the sidebar, p=#11456
This commit is contained in:
90
src/firefox-patches/147_windows_border_fix_1.patch
Normal file
90
src/firefox-patches/147_windows_border_fix_1.patch
Normal file
@@ -0,0 +1,90 @@
|
||||
From 433cc8224790300fdabe76bd225b644c1812da34 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= <emilio@crisal.io>
|
||||
Date: Thu, 27 Nov 2025 15:28:12 +0000
|
||||
Subject: [PATCH] Bug 1993474 - Ensure our WNDPROC has precedence over
|
||||
WinAppSDK's. r=gstoll,win-reviewers
|
||||
|
||||
See the comment for reasoning. WM_NCCALCSIZE wasn't getting called, and
|
||||
we rely on that to get the right client area on things like maximized
|
||||
windows.
|
||||
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D274281
|
||||
---
|
||||
widget/windows/nsWindow.cpp | 32 ++++++++++++++++++++++----------
|
||||
widget/windows/nsWindow.h | 2 ++
|
||||
2 files changed, 24 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp
|
||||
index 0b98d157097da..b357df236cfcd 100644
|
||||
--- a/widget/windows/nsWindow.cpp
|
||||
+++ b/widget/windows/nsWindow.cpp
|
||||
@@ -1520,12 +1520,31 @@ DWORD nsWindow::WindowExStyle() {
|
||||
*
|
||||
**************************************************************/
|
||||
|
||||
+bool nsWindow::ShouldAssociateWithWinAppSDK() const {
|
||||
+ // We currently don't need any SDK functionality for for PiP windows,
|
||||
+ // and using the SDK on these windows causes them to go under the
|
||||
+ // taskbar (bug 1995838).
|
||||
+ //
|
||||
+ // TODO(emilio): That might not be true anymore after bug 1993474,
|
||||
+ // consider re-testing and removing that special-case.
|
||||
+ return IsTopLevelWidget() && !mIsPIPWindow;
|
||||
+}
|
||||
+
|
||||
bool nsWindow::AssociateWithNativeWindow() {
|
||||
if (!mWnd || !IsWindow(mWnd)) {
|
||||
NS_ERROR("Invalid window handle");
|
||||
return false;
|
||||
}
|
||||
|
||||
+ if (ShouldAssociateWithWinAppSDK()) {
|
||||
+ // Make sure to call this here to associate our window with the
|
||||
+ // Windows App SDK _before_ setting our WNDPROC, if needed.
|
||||
+ // This is important because the SDKs WNDPROC might handle messages like
|
||||
+ // WM_NCCALCSIZE without calling into us, and that can cause sizing issues,
|
||||
+ // see bug 1993474.
|
||||
+ WindowsUIUtils::SetIsTitlebarCollapsed(mWnd, mCustomNonClient);
|
||||
+ }
|
||||
+
|
||||
// Connect the this pointer to the native window handle.
|
||||
// This should be done before SetWindowLongPtrW, because nsWindow::WindowProc
|
||||
// uses WinUtils::GetNSWindowPtr internally.
|
||||
@@ -1552,12 +1571,7 @@ void nsWindow::DissociateFromNativeWindow() {
|
||||
DebugOnly<WNDPROC> wndProcBeforeDissociate =
|
||||
reinterpret_cast<WNDPROC>(::SetWindowLongPtrW(
|
||||
mWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(*mPrevWndProc)));
|
||||
- // If we've used the Windows App SDK to remove the minimize/maximize/close
|
||||
- // entries from the titlebar, then the Windows App SDK sets its own WNDPROC
|
||||
- // own the window, so this assertion would fail. But we only do this if
|
||||
- // Mica is available.
|
||||
- NS_ASSERTION(WinUtils::MicaAvailable() ||
|
||||
- wndProcBeforeDissociate == nsWindow::WindowProc,
|
||||
+ NS_ASSERTION(wndProcBeforeDissociate == nsWindow::WindowProc,
|
||||
"Unstacked an unexpected native window procedure");
|
||||
|
||||
WinUtils::SetNSWindowPtr(mWnd, nullptr);
|
||||
@@ -2835,9 +2849,7 @@ void nsWindow::SetCustomTitlebar(bool aCustomTitlebar) {
|
||||
mCustomNonClientMetrics = {};
|
||||
ResetLayout();
|
||||
}
|
||||
- // Not needed for PiP windows, and using the Windows App SDK on
|
||||
- // these windows causes them to go under the taskbar (bug 1995838)
|
||||
- if (!mPIPWindow) {
|
||||
+ if (ShouldAssociateWithWinAppSDK()) {
|
||||
WindowsUIUtils::SetIsTitlebarCollapsed(mWnd, mCustomNonClient);
|
||||
}
|
||||
}
|
||||
diff --git a/widget/windows/nsWindow.h b/widget/windows/nsWindow.h
|
||||
index 20f016757dfee..2756b248368a3 100644
|
||||
--- a/widget/windows/nsWindow.h
|
||||
+++ b/widget/windows/nsWindow.h
|
||||
@@ -335,6 +335,8 @@ class nsWindow final : public nsIWidget {
|
||||
|
||||
bool IsRTL() const { return mIsRTL; }
|
||||
|
||||
+ bool ShouldAssociateWithWinAppSDK() const;
|
||||
+
|
||||
/**
|
||||
* AssociateDefaultIMC() associates or disassociates the default IMC for
|
||||
* the window.
|
||||
57
src/firefox-patches/147_windows_border_fix_2.patch
Normal file
57
src/firefox-patches/147_windows_border_fix_2.patch
Normal file
@@ -0,0 +1,57 @@
|
||||
From 418e274c76f9e6b2d1149048cb399f1f6d709553 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= <emilio@crisal.io>
|
||||
Date: Thu, 27 Nov 2025 15:31:40 +0000
|
||||
Subject: [PATCH] Bug 1993474 - Remove redundant nsWindow::mPIPWindow.
|
||||
r=win-reviewers,gstoll
|
||||
|
||||
nsIWidget already has a member for this.
|
||||
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D274282
|
||||
---
|
||||
widget/windows/nsWindow.cpp | 4 +---
|
||||
widget/windows/nsWindow.h | 3 ---
|
||||
2 files changed, 1 insertion(+), 6 deletions(-)
|
||||
|
||||
diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp
|
||||
index b357df236cfc..19f5980a106f 100644
|
||||
--- a/widget/windows/nsWindow.cpp
|
||||
+++ b/widget/windows/nsWindow.cpp
|
||||
@@ -817,7 +817,6 @@ static bool IsCloaked(HWND hwnd) {
|
||||
nsWindow::nsWindow()
|
||||
: nsBaseWidget(BorderStyle::Default),
|
||||
mFrameState(std::in_place, this),
|
||||
- mPIPWindow(false),
|
||||
mMicaBackdrop(false),
|
||||
mLastPaintEndTime(TimeStamp::Now()),
|
||||
mCachedHitTestTime(TimeStamp::Now()),
|
||||
@@ -1028,7 +1027,6 @@ nsresult nsWindow::Create(nsIWidget* aParent, const LayoutDeviceIntRect& aRect,
|
||||
aParent ? (HWND)aParent->GetNativeData(NS_NATIVE_WINDOW) : nullptr;
|
||||
|
||||
mIsRTL = aInitData->mRTL;
|
||||
- mPIPWindow = aInitData->mPIPWindow;
|
||||
mOpeningAnimationSuppressed = aInitData->mIsAnimationSuppressed;
|
||||
mAlwaysOnTop = aInitData->mAlwaysOnTop;
|
||||
mIsAlert = aInitData->mIsAlert;
|
||||
@@ -2807,7 +2805,7 @@ bool nsWindow::UpdateNonClientMargins(bool aReflowWindow) {
|
||||
// frame sizes for left, right and bottom since Windows will automagically
|
||||
// position the edges "offscreen" for maximized windows.
|
||||
metrics.mOffset.top = metrics.mCaptionHeight;
|
||||
- } else if (mPIPWindow &&
|
||||
+ } else if (mIsPIPWindow &&
|
||||
!StaticPrefs::widget_windows_pip_decorations_enabled()) {
|
||||
metrics.mOffset = metrics.DefaultMargins();
|
||||
} else {
|
||||
diff --git a/widget/windows/nsWindow.h b/widget/windows/nsWindow.h
|
||||
index 2756b248368a..9e6b4d41d721 100644
|
||||
--- a/widget/windows/nsWindow.h
|
||||
+++ b/widget/windows/nsWindow.h
|
||||
@@ -852,9 +852,6 @@ class nsWindow final : public nsIWidget {
|
||||
// Whether we're in the process of sending a WM_SETTEXT ourselves
|
||||
bool mSendingSetText = false;
|
||||
|
||||
- // Whether we're a PIP window.
|
||||
- bool mPIPWindow : 1;
|
||||
-
|
||||
// Whether we are asked to render a mica backdrop.
|
||||
bool mMicaBackdrop : 1;
|
||||
|
||||
Reference in New Issue
Block a user