Correctly draw the titlebar as active or inactive during the processing of WM_NCACTIVATE message.
Modified: trunk/reactos/lib/user32/windows/defwnd.c
Modified: trunk/reactos/lib/user32/windows/nonclient.c
Modified: trunk/reactos/lib/user32/windows/window.c

Modified: trunk/reactos/lib/user32/windows/defwnd.c
--- trunk/reactos/lib/user32/windows/defwnd.c	2005-03-21 01:34:02 UTC (rev 14247)
+++ trunk/reactos/lib/user32/windows/defwnd.c	2005-03-21 01:59:21 UTC (rev 14248)
@@ -31,7 +31,7 @@
 #define WM_QUERYDROPOBJECT  0x022B
 #endif
 
-LRESULT DefWndNCPaint(HWND hWnd, HRGN hRgn);
+LRESULT DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active);
 LRESULT DefWndNCCalcSize(HWND hWnd, BOOL CalcSizeStruct, RECT *Rect);
 LRESULT DefWndNCActivate(HWND hWnd, WPARAM wParam);
 LRESULT DefWndNCHitTest(HWND hWnd, POINT Point);
@@ -949,7 +949,7 @@
     {
 	case WM_NCPAINT:
 	{
-            return DefWndNCPaint(hWnd, (HRGN)wParam);
+            return DefWndNCPaint(hWnd, (HRGN)wParam, -1);
         }
 
         case WM_NCCALCSIZE:
@@ -1472,7 +1472,7 @@
             
             if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
             {
-                DefWndNCPaint(hWnd, (HRGN)1);
+                DefWndNCPaint(hWnd, (HRGN)1, -1);
             }
             return TRUE;
         }
@@ -1532,7 +1532,7 @@
             
             if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
             {
-                DefWndNCPaint(hWnd, (HRGN)1);
+                DefWndNCPaint(hWnd, (HRGN)1, -1);
             }
             return (1);
         }

Modified: trunk/reactos/lib/user32/windows/nonclient.c
--- trunk/reactos/lib/user32/windows/nonclient.c	2005-03-21 01:34:02 UTC (rev 14247)
+++ trunk/reactos/lib/user32/windows/nonclient.c	2005-03-21 01:59:21 UTC (rev 14248)
@@ -288,10 +288,9 @@
  * - Correct drawing of size-box
  */
 LRESULT
-DefWndNCPaint(HWND hWnd, HRGN hRgn)
+DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active)
 {
    HDC hDC;
-   BOOL Active;
    DWORD Style, ExStyle;
    HWND Parent;
    RECT ClientRect, WindowRect, CurrentRect, TempRect;
@@ -309,16 +308,19 @@
    
    Parent = GetParent(hWnd);
    ExStyle = GetWindowLongW(hWnd, GWL_EXSTYLE);
-   if (ExStyle & WS_EX_MDICHILD)
+   if (Active == -1)
    {
-      Active = IsChild(GetForegroundWindow(), hWnd);
-      if (Active)
-         Active = (hWnd == (HWND)SendMessageW(Parent, WM_MDIGETACTIVE, 0, 0));
+      if (ExStyle & WS_EX_MDICHILD)
+      {
+         Active = IsChild(GetForegroundWindow(), hWnd);
+         if (Active)
+            Active = (hWnd == (HWND)SendMessageW(Parent, WM_MDIGETACTIVE, 0, 0));
+      }
+      else
+      {
+         Active = (GetForegroundWindow() == hWnd);
+      }
    }
-   else
-   {
-      Active = (GetForegroundWindow() == hWnd);
-   }
    GetWindowRect(hWnd, &WindowRect);
    GetClientRect(hWnd, &ClientRect);
 
@@ -660,7 +662,7 @@
 LRESULT
 DefWndNCActivate(HWND hWnd, WPARAM wParam)
 {
-   DefWndNCPaint(hWnd, (HRGN)1);
+   DefWndNCPaint(hWnd, (HRGN)1, wParam);
    return TRUE;
 }
 

Modified: trunk/reactos/lib/user32/windows/window.c
--- trunk/reactos/lib/user32/windows/window.c	2005-03-21 01:34:02 UTC (rev 14247)
+++ trunk/reactos/lib/user32/windows/window.c	2005-03-21 01:59:21 UTC (rev 14248)
@@ -22,7 +22,7 @@
 
 BOOL ControlsInitialized = FALSE;
 
-LRESULT DefWndNCPaint(HWND hWnd, HRGN hRgn);
+LRESULT DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active);
 
 /* FUNCTIONS *****************************************************************/
 
@@ -1236,7 +1236,7 @@
     
     if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
     {
-      DefWndNCPaint(hWnd, (HRGN)1);
+      DefWndNCPaint(hWnd, (HRGN)1, -1);
     }
     return TRUE;
   }
@@ -1270,7 +1270,7 @@
     
     if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
     {
-      DefWndNCPaint(hWnd, (HRGN)1);
+      DefWndNCPaint(hWnd, (HRGN)1, -1);
     }
     return TRUE;
   }