[Win32k]
[reactos.git] / reactos / win32ss / user / ntuser / nonclient.c
index dd2dafd..6fa7dab 100644 (file)
@@ -497,7 +497,7 @@ DefWndDoSizeMove(PWND pwnd, WORD wParam)
                        // Only the windows that overlap will be redrawn.
                        if (RECTL_bIntersectRect( &rect, &pwnd->rcWindow, &pwndTemp->rcWindow ))
                        {
-                          co_UserRedrawWindow( pwndTemp, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN);
+                          co_UserRedrawWindow( pwndTemp, NULL, NULL, RDW_UPDATENOW | RDW_NOCHILDREN);
                        }
                     }
                  }
@@ -890,7 +890,7 @@ VOID UserDrawCaptionBar(
 
    if (!(Flags & DC_NOVISIBLE) && !IntIsWindowVisible(pWnd)) return;
 
-   TRACE("UserDrawCaptionBar: pWnd %p, hDc %p, Flags 0x%x.\n", pWnd, hDC, Flags);
+   ERR("UserDrawCaptionBar: pWnd %p, hDc %p, Flags 0x%x.\n", pWnd, hDC, Flags);
 
    Style = pWnd->style;
    ExStyle = pWnd->ExStyle;
@@ -930,6 +930,8 @@ VOID UserDrawCaptionBar(
    {
       TempRect = CurrentRect;
 
+      Flags |= DC_TEXT|DC_BUTTONS; // Icon will be checked if not already set.
+
       if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
       {
          Flags |= DC_GRADIENT;
@@ -1039,8 +1041,11 @@ NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
       {
          Active = (gpqForeground == pWnd->head.pti->MessageQueue);
       }
-      Flags = DC_NC;
+      Flags = DC_NC; // Redraw everything!
    }
+   else
+      Flags |= DC_NC;
+
 
    IntGetWindowRect(pWnd, &WindowRect);
 
@@ -1091,11 +1096,12 @@ NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
 
       if (Active)
       {
-         if (!(pWnd->state & WNDS_ACTIVEFRAME))
+         if (pWnd->state & WNDS_ACTIVEFRAME)
+            Flags |= DC_ACTIVE;
+         else
          {
             ERR("Wnd is active and not set active!\n");
          }
-         Flags |= DC_ACTIVE;
       }
 
       TempRect = CurrentRect;
@@ -1112,14 +1118,6 @@ NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
          CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
       }
 
-      if (!(Flags & DC_ICON)               &&
-           (Style & WS_SYSMENU)            &&
-          !(Flags & DC_SMALLCAP)           &&
-          !(ExStyle & WS_EX_DLGMODALFRAME) && 
-          !(ExStyle & WS_EX_TOOLWINDOW) )
-      {
-         pIcon = NC_IconForWindow(pWnd); // Force redraw of caption with icon if DC_ICON not flaged....
-      }
       UserDrawCaption(pWnd, hDC, &TempRect, NULL, pIcon ? UserHMGetHandle(pIcon) : NULL, NULL, Flags);
 
       /* Draw buttons */
@@ -1409,7 +1407,7 @@ LRESULT NC_HandleNCActivate( PWND Wnd, WPARAM wParam, LPARAM lParam )
    }
    else
    {
-      Wnd->state &= ~(WNDS_ACTIVEFRAME|WNDS_HASCAPTION);
+      Wnd->state &= ~WNDS_ACTIVEFRAME;
       wParam = DC_CAPTION;
    }
 
@@ -1506,8 +1504,7 @@ NC_DoButton(PWND pWnd, WPARAM wParam, LPARAM lParam)
 
    for (;;)
    {
-      if (co_IntGetPeekMessage(&Msg, 0, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE, TRUE) <= 0)
-         break;
+      if (!co_IntGetPeekMessage(&Msg, 0, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE, TRUE)) break;
       if (IntCallMsgFilter( &Msg, MSGF_MAX )) continue;
 
       if (Msg.message == WM_LBUTTONUP)