Merge from HEAD: r14248
Correctly draw the titlebar as active or inactive during the processing of WM_NCACTIVATE message.
Modified: branches/ros-branch-0_2_6/reactos/lib/user32/windows/defwnd.c
Modified: branches/ros-branch-0_2_6/reactos/lib/user32/windows/nonclient.c
Modified: branches/ros-branch-0_2_6/reactos/lib/user32/windows/window.c

Modified: branches/ros-branch-0_2_6/reactos/lib/user32/windows/defwnd.c
--- branches/ros-branch-0_2_6/reactos/lib/user32/windows/defwnd.c	2005-03-23 17:22:41 UTC (rev 14289)
+++ branches/ros-branch-0_2_6/reactos/lib/user32/windows/defwnd.c	2005-03-23 17:23:02 UTC (rev 14290)
@@ -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: branches/ros-branch-0_2_6/reactos/lib/user32/windows/nonclient.c
--- branches/ros-branch-0_2_6/reactos/lib/user32/windows/nonclient.c	2005-03-23 17:22:41 UTC (rev 14289)
+++ branches/ros-branch-0_2_6/reactos/lib/user32/windows/nonclient.c	2005-03-23 17:23:02 UTC (rev 14290)
@@ -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: branches/ros-branch-0_2_6/reactos/lib/user32/windows/window.c
--- branches/ros-branch-0_2_6/reactos/lib/user32/windows/window.c	2005-03-23 17:22:41 UTC (rev 14289)
+++ branches/ros-branch-0_2_6/reactos/lib/user32/windows/window.c	2005-03-23 17:23:02 UTC (rev 14290)
@@ -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;
   }