@@ -1705,64 +1705,6 @@ void nsWindow::Show(bool aState) {
1705
1705
// top level windows:
1706
1706
syncInvalidate = true ;
1707
1707
1708
- // Cloak (or uncloak) the window.
1709
- //
1710
- // (DWMWA_CLOAK is effectively orthogonal to any cloaking done by the
1711
- // shell to implement virtual desktops; we don't have to worry about
1712
- // accidentally forcing something on another desktop to become visible.)
1713
- constexpr static const auto CloakWindow = [](HWND hwnd, BOOL state) {
1714
- ::DwmSetWindowAttribute (hwnd, DWMWA_CLOAK, &state, sizeof (state));
1715
- };
1716
-
1717
- // Clear the window using a theme-appropriate color.
1718
- constexpr static const auto ClearWindow = [](HWND hwnd) {
1719
- // default background color from current theme
1720
- auto const bgcolor = LookAndFeel::Color (
1721
- StyleSystemColor::Window, PreferenceSheet::ColorSchemeForChrome (),
1722
- LookAndFeel::UseStandins::No, NS_RGB(0 , 0 , 0 ));
1723
-
1724
- HBRUSH brush = ::CreateSolidBrush (NSRGB_2_COLOREF(bgcolor));
1725
- if (NS_WARN_IF(!brush)) {
1726
- // GDI object cap hit, possibly?
1727
- return ;
1728
- }
1729
- auto const _releaseBrush =
1730
- MakeScopeExit ([&] { ::DeleteObject (brush); });
1731
-
1732
- HDC hdc = ::GetWindowDC (hwnd);
1733
- MOZ_ASSERT (hdc);
1734
- auto const _cleanupDC =
1735
- MakeScopeExit ([&] { ::ReleaseDC (hwnd, hdc); });
1736
-
1737
- RECT rect;
1738
- ::GetWindowRect (hwnd, &rect); // includes non-client area
1739
-
1740
- // Convert from screen- to client-coordinates, accounting for the
1741
- // desktop (or, in theory, us) possibly being WS_EX_LAYOUTRTL...
1742
- ::MapWindowPoints (HWND_DESKTOP, hwnd, (LPPOINT)&rect, 2);
1743
- // ... then convert from client- to window- coordinates, with no
1744
- // separate RTL-handling needed.
1745
- ::OffsetRect (&rect, -rect.left, -rect.top);
1746
-
1747
- ::FillRect (hdc, &rect, brush);
1748
- };
1749
-
1750
- if (!mHasBeenShown ) {
1751
- // On creation, the window's content is not specified; in practice,
1752
- // it's observed to usually be full of bright white, regardless of any
1753
- // window-class options. DWM will happily render that unspecified
1754
- // content to the screen before we get a chance to process a
1755
- // WM_ERASEBKGND event (or, indeed, anything else). To avoid dark-mode
1756
- // users being assaulted with a bright white flash, we need to draw
1757
- // something on top of that at least once before showing the window.
1758
- //
1759
- // Unfortunately, there's a bit of a catch-22 here: until the window
1760
- // has been set "visible" at least once, it doesn't have a backing
1761
- // surface, so we can't draw anything to it! To work around this, we
1762
- // cloak the window before "showing" it.
1763
- CloakWindow (mWnd , TRUE );
1764
- }
1765
-
1766
1708
// Set the cursor before showing the window to avoid the default wait
1767
1709
// cursor.
1768
1710
SetCursor (Cursor{eCursor_standard});
@@ -1789,16 +1731,6 @@ void nsWindow::Show(bool aState) {
1789
1731
}
1790
1732
break ;
1791
1733
}
1792
-
1793
- if (!mHasBeenShown ) {
1794
- // Now that ::ShowWindow() has been called once, the window surface
1795
- // actually exists, so we can draw to it. Fill it with the theme's
1796
- // background color before uncloaking it to complete the Show().
1797
- ClearWindow (mWnd );
1798
- CloakWindow (mWnd , FALSE );
1799
- mHasBeenShown = false ;
1800
- }
1801
-
1802
1734
} else {
1803
1735
DWORD flags = SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW;
1804
1736
if (wasVisible) {
@@ -5701,7 +5633,7 @@ bool nsWindow::ProcessMessageInternal(UINT msg, WPARAM& wParam, LPARAM& lParam,
5701
5633
} break ;
5702
5634
5703
5635
// Say we've dealt with erasing the background. (This is actually handled in
5704
- // WM_PAINT or at window-creation time, as necessary.)
5636
+ // WM_PAINT, where necessary.)
5705
5637
case WM_ERASEBKGND: {
5706
5638
*aRetValue = 1 ;
5707
5639
result = true ;
0 commit comments