Skip to content

Commit

Permalink
bug 981569. Don't ever remove our custom "is the window active" prope…
Browse files Browse the repository at this point in the history
…rty. When switching from custom non-client margins to default non-client margins, send a `WM_NCACTIVATE` message so that `DefWindowProc` knows the correct active/inactive state of the window. r=blassey
  • Loading branch information
TimAbraldes committed Apr 15, 2014
1 parent 169120e commit 309198c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions widget/windows/nsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2248,10 +2248,16 @@ nsWindow::SetNonClientMargins(nsIntMargin &margins)
margins.right == -1 && margins.bottom == -1) {
mCustomNonClient = false;
mNonClientMargins = margins;
RemovePropW(mWnd, kManageWindowInfoProperty);
// Force a reflow of content based on the new client
// dimensions.
ResetLayout();

int windowStatus =
reinterpret_cast<LONG_PTR>(GetPropW(mWnd, kManageWindowInfoProperty));
if (windowStatus) {
::SendMessageW(mWnd, WM_NCACTIVATE, 1 != windowStatus, 0);
}

return NS_OK;
}

Expand Down Expand Up @@ -4671,6 +4677,7 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
* WM_NCACTIVATE paints nc areas. Avoid this and re-route painting
* through WM_NCPAINT via InvalidateNonClientRegion.
*/
UpdateGetWindowInfoCaptionStatus(FALSE != wParam);

if (!mCustomNonClient)
break;
Expand All @@ -4683,15 +4690,13 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
// going active
*aRetValue = FALSE; // ignored
result = true;
UpdateGetWindowInfoCaptionStatus(true);
// invalidate to trigger a paint
InvalidateNonClientRegion();
break;
} else {
// going inactive
*aRetValue = TRUE; // go ahead and deactive
result = true;
UpdateGetWindowInfoCaptionStatus(false);
// invalidate to trigger a paint
InvalidateNonClientRegion();
break;
Expand Down Expand Up @@ -5205,7 +5210,6 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
nsUXThemeData::CheckForCompositor(true);

UpdateNonClientMargins();
RemovePropW(mWnd, kManageWindowInfoProperty);
BroadcastMsg(mWnd, WM_DWMCOMPOSITIONCHANGED);
NotifyThemeChanged();
UpdateGlass();
Expand Down

0 comments on commit 309198c

Please sign in to comment.