Bug 607251 - Aero broken with Basic/Aero theme and minimize/un-minimize. r=jimm
authorBrian R. Bondy <netzen@gmail.com>
Fri, 07 Oct 2011 21:52:09 -0400
changeset 78373 ba387863cf06
parent 78372 b9bae20fb35c
child 78374 c664f85010b0
push id2513
push userbbondy@mozilla.com
push dateSat, 08 Oct 2011 01:53:56 +0000
treeherdermozilla-inbound@ba387863cf06 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs607251
milestone10.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 607251 - Aero broken with Basic/Aero theme and minimize/un-minimize. r=jimm
widget/src/windows/nsWindow.cpp
widget/src/windows/nsWindow.h
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -2646,42 +2646,56 @@ NS_IMETHODIMP nsWindow::HideWindowChrome
   ::SetWindowLongPtrW(hwnd, GWL_STYLE, style);
   ::SetWindowLongPtrW(hwnd, GWL_EXSTYLE, exStyle);
 
   return NS_OK;
 }
 
 /**************************************************************
  *
- * SECTION: nsIWidget::Invalidate
+ * SECTION: nsWindow::Invalidate
  *
  * Invalidate an area of the client for painting.
  *
  **************************************************************/
 
 // Invalidate this component visible area
-NS_METHOD nsWindow::Invalidate(bool aIsSynchronous)
-{
-  if (mWnd)
-  {
+NS_METHOD nsWindow::Invalidate(bool aIsSynchronous, 
+                               bool aEraseBackground, 
+                               bool aUpdateNCArea,
+                               bool aIncludeChildren)
+{
+  if (!mWnd) {
+    return NS_OK;
+  }
+
 #ifdef WIDGET_DEBUG_OUTPUT
-    debug_DumpInvalidate(stdout,
-                         this,
-                         nsnull,
-                         aIsSynchronous,
-                         nsCAutoString("noname"),
-                         (PRInt32) mWnd);
+  debug_DumpInvalidate(stdout,
+                       this,
+                       nsnull,
+                       aIsSynchronous,
+                       nsCAutoString("noname"),
+                       (PRInt32) mWnd);
 #endif // WIDGET_DEBUG_OUTPUT
 
-    VERIFY(::InvalidateRect(mWnd, NULL, FALSE));
-
-    if (aIsSynchronous) {
-      VERIFY(::UpdateWindow(mWnd));
-    }
-  }
+  DWORD flags = RDW_INVALIDATE;
+  if (aEraseBackground) {
+    flags |= RDW_ERASE;
+  }
+  if (aIsSynchronous) {
+    flags |= RDW_UPDATENOW;
+  }
+  if (aUpdateNCArea) {
+    flags |= RDW_FRAME;
+  }
+  if (aIncludeChildren) {
+    flags |= RDW_ALLCHILDREN;
+  }
+
+  VERIFY(::RedrawWindow(mWnd, NULL, NULL, flags));
   return NS_OK;
 }
 
 // Invalidate this component visible area
 NS_METHOD nsWindow::Invalidate(const nsIntRect & aRect, bool aIsSynchronous)
 {
   if (mWnd)
   {
@@ -4682,17 +4696,17 @@ bool nsWindow::ProcessMessage(UINT msg, 
       UpdateNonClientMargins();
       nsUXThemeData::InitTitlebarInfo();
       nsUXThemeData::UpdateNativeThemeInfo();
 
       DispatchStandardEvent(NS_THEMECHANGED);
 
       // Invalidate the window so that the repaint will
       // pick up the new theme.
-      Invalidate(false);
+      Invalidate(true, true, true, true);
     }
     break;
 
     case WM_FONTCHANGE:
     {
       nsresult rv;
       bool didChange = false;
 
@@ -5361,17 +5375,17 @@ bool nsWindow::ProcessMessage(UINT msg, 
     // should use same state as here for consistency painting.
     nsUXThemeData::CheckForCompositor(true);
 
     UpdateNonClientMargins();
     RemovePropW(mWnd, kManageWindowInfoProperty);
     BroadcastMsg(mWnd, WM_DWMCOMPOSITIONCHANGED);
     DispatchStandardEvent(NS_THEMECHANGED);
     UpdateGlass();
-    Invalidate(false);
+    Invalidate(true, true, true, true);
     break;
 #endif
 
   case WM_UPDATEUISTATE:
   {
     // If the UI state has changed, fire an event so the UI updates the
     // keyboard cues based on the system setting and how the window was
     // opened. For example, a dialog opened via a keyboard press on a button
--- a/widget/src/windows/nsWindow.h
+++ b/widget/src/windows/nsWindow.h
@@ -140,17 +140,20 @@ public:
   virtual nsIntPoint      GetClientOffset();
   NS_IMETHOD              SetBackgroundColor(const nscolor &aColor);
   NS_IMETHOD              SetCursor(imgIContainer* aCursor,
                                     PRUint32 aHotspotX, PRUint32 aHotspotY);
   NS_IMETHOD              SetCursor(nsCursor aCursor);
   virtual nsresult        ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
   NS_IMETHOD              MakeFullScreen(bool aFullScreen);
   NS_IMETHOD              HideWindowChrome(bool aShouldHide);
-  NS_IMETHOD              Invalidate(bool aIsSynchronous);
+  NS_IMETHOD              Invalidate(bool aIsSynchronous, 
+                                     bool aEraseBackground = false,
+                                     bool aUpdateNCArea = false,
+                                     bool aIncludeChildren = false);
   NS_IMETHOD              Invalidate(const nsIntRect & aRect, bool aIsSynchronous);
   NS_IMETHOD              Update();
   virtual void*           GetNativeData(PRUint32 aDataType);
   virtual void            FreeNativeData(void * data, PRUint32 aDataType);
   NS_IMETHOD              SetTitle(const nsAString& aTitle);
   NS_IMETHOD              SetIcon(const nsAString& aIconSpec);
   virtual nsIntPoint      WidgetToScreenOffset();
   virtual nsIntSize       ClientToWindowSize(const nsIntSize& aClientSize);