diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index b762e8da5286..baf19cfe5590 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -3735,14 +3735,24 @@ void nsWindow::UpdateThemeGeometries(const nsTArray& aThemeGeometries) { nsIntRegion clearRegion; - for (size_t i = 0; i < aThemeGeometries.Length(); i++) { - if (aThemeGeometries[i].mType == nsNativeThemeWin::eThemeGeometryTypeWindowButtons && - nsUXThemeData::CheckForCompositor()) - { - nsIntRect bounds = aThemeGeometries[i].mRect; - clearRegion = nsIntRect(bounds.X(), bounds.Y(), bounds.Width(), bounds.Height() - 2.0); - clearRegion.Or(clearRegion, nsIntRect(bounds.X() + 1.0, bounds.YMost() - 2.0, bounds.Width() - 1.0, 1.0)); - clearRegion.Or(clearRegion, nsIntRect(bounds.X() + 2.0, bounds.YMost() - 1.0, bounds.Width() - 3.0, 1.0)); + if (!HasGlass() || !nsUXThemeData::CheckForCompositor()) { + return; + } + // On Win10, force show the top border: + if (IsWin10OrLater() && mCustomNonClient && mSizeMode == nsSizeMode_Normal) { + RECT rect; + ::GetWindowRect(mWnd, &rect); + clearRegion.Or(clearRegion, nsIntRect(0, 0, rect.right - rect.left, 1.0)); + } + if (!IsWin10OrLater()) { + for (size_t i = 0; i < aThemeGeometries.Length(); i++) { + if (aThemeGeometries[i].mType == nsNativeThemeWin::eThemeGeometryTypeWindowButtons) + { + nsIntRect bounds = aThemeGeometries[i].mRect; + clearRegion.Or(clearRegion, nsIntRect(bounds.X(), bounds.Y(), bounds.Width(), bounds.Height() - 2.0)); + clearRegion.Or(clearRegion, nsIntRect(bounds.X() + 1.0, bounds.YMost() - 2.0, bounds.Width() - 1.0, 1.0)); + clearRegion.Or(clearRegion, nsIntRect(bounds.X() + 2.0, bounds.YMost() - 1.0, bounds.Width() - 3.0, 1.0)); + } } } @@ -4699,6 +4709,9 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam, LRESULT dwmHitResult; if (mCustomNonClient && nsUXThemeData::CheckForCompositor() && + /* We don't do this for win10 glass with a custom titlebar, + * in order to avoid the caption buttons breaking. */ + !(IsWin10OrLater() && HasGlass()) && WinUtils::dwmDwmDefWindowProcPtr(mWnd, msg, wParam, lParam, &dwmHitResult)) { *aRetValue = dwmHitResult; return true;