fix: Apply patch from https://bugzilla.mozilla.org/show_bug.cgi?id=1993474, b=no-bug, c=no-component

This commit is contained in:
mr. m
2025-11-15 18:18:56 +01:00
parent a0ce296668
commit 4798821192

View File

@@ -0,0 +1,30 @@
diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp
index 2a17159215d107f6e4b09cf3a63ab0fff2c2ee70..622bb36a184a87a1d755b19ff6c3c50027ae53f5 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();