Bug 1173725 - part 1: force top border to be visible on windows 10 and don't cut out caption buttons, r=jimm

--HG--
extra : commitid : JFN92Gfp4xt
extra : rebase_source : e131e3c13d1936aa9f44587535ae5e9ac19cdd1f
This commit is contained in:
Gijs Kruitbosch 2015-07-10 12:07:03 +01:00
parent a10ae2709a
commit 34c0ac27ca

View File

@ -3735,14 +3735,24 @@ void
nsWindow::UpdateThemeGeometries(const nsTArray<ThemeGeometry>& 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;