Index: trunk/src/comctl32/progress.c
===================================================================
--- trunk/src/comctl32/progress.c	(revision 105)
+++ trunk/src/comctl32/progress.c	(revision 106)
@@ -1,4 +1,4 @@
-/* $Id: progress.c,v 1.2 1999-06-10 16:22:01 achimha Exp $ */
-/*		
+/* $Id: progress.c,v 1.3 1999-06-12 20:44:06 cbratschi Exp $ */
+/*
  * Progress control
  *
@@ -6,4 +6,5 @@
  * Copyright 1998, 1999 Eric Kohl
  * Copyright 1999 Achim Hasenmueller
+ * Copyright 1999 Christoph Bratschi
  *
  */
@@ -23,6 +24,6 @@
 //#define UNKNOWN_PARAM(msg, wParam, lParam) WARN(progress, \
 //        "Unknown parameter(s) for message " #msg     \
-//	"(%04x): wp=%04x lp=%08lx\n", msg, wParam, lParam); 
-#define UNKNOWN_PARAM(msg, wParam, lParam) 
+//      "(%04x): wp=%04x lp=%08lx\n", msg, wParam, lParam);
+#define UNKNOWN_PARAM(msg, wParam, lParam)
 
 #define PROGRESS_GetInfoPtr(hwnd) ((PROGRESS_INFO *)GetWindowLongA(hwnd, 0))
@@ -34,5 +35,5 @@
  */
 static void
-PROGRESS_Draw (HWND hwnd, HDC hdc)
+PROGRESS_Draw (HWND hwnd, HDC hdc, INT lastVal, BOOL inUpdate)
 {
   PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd);
@@ -43,5 +44,5 @@
 
 //  TRACE(progress, "refresh pos=%d min=%d, max=%d\n",
-//	       infoPtr->CurVal, infoPtr->MinVal, infoPtr->MaxVal);
+//             infoPtr->CurVal, infoPtr->MinVal, infoPtr->MaxVal);
 
   /* get the required bar brush */
@@ -71,8 +72,8 @@
   if (dwStyle & PBS_VERTICAL)
   {
-    rightBar = rect.bottom - 
+    rightBar = rect.bottom -
       MulDiv(infoPtr->CurVal-infoPtr->MinVal,
-	       rect.bottom - rect.top,
-	       infoPtr->MaxVal-infoPtr->MinVal);
+               rect.bottom - rect.top,
+               infoPtr->MaxVal-infoPtr->MinVal);
     ledWidth = MulDiv ((rect.right - rect.left), 2, 3);
     rightMost = rect.top;
@@ -80,8 +81,8 @@
   else
   {
-    rightBar = rect.left + 
+    rightBar = rect.left +
       MulDiv(infoPtr->CurVal-infoPtr->MinVal,
-	       rect.right - rect.left,
-	       infoPtr->MaxVal-infoPtr->MinVal);
+               rect.right - rect.left,
+               infoPtr->MaxVal-infoPtr->MinVal);
     ledWidth = MulDiv ((rect.bottom - rect.top), 2, 3);
     rightMost = rect.right;
@@ -101,5 +102,5 @@
     if (dwStyle & PBS_VERTICAL)
   {
-      while(rect.bottom > rightBar) { 
+      while(rect.bottom > rightBar) {
         rect.top = rect.bottom-ledWidth;
         if (rect.top < rightMost)
@@ -110,5 +111,5 @@
     }
     else {
-      while(rect.left < rightBar) { 
+      while(rect.left < rightBar) {
         rect.right = rect.left+ledWidth;
         if (rect.right > rightMost)
@@ -130,4 +131,21 @@
 
 /***********************************************************************
+ * PROGRESS_Update (prototype, todo)
+ * Updates only the changed pixels -> faster, no flickering
+ */
+static void PROGRESS_Update(HWND hwnd,INT lastVal)
+{
+  PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd);
+  HDC hdc;
+
+  if (lastVal != infoPtr->CurVal) //Only update if really necessary
+  {
+   hdc = GetDC(hwnd);
+   PROGRESS_Draw(hwnd,hdc,lastVal,TRUE);
+   ReleaseDC(hwnd,hdc);
+  }
+}
+
+/***********************************************************************
  * PROGRESS_Refresh
  * Draw the progress bar. The background need not be erased.
@@ -139,5 +157,5 @@
 
     hdc = GetDC (hwnd);
-    PROGRESS_Draw (hwnd, hdc);
+    PROGRESS_Draw (hwnd, hdc, 0, FALSE);
     ReleaseDC (hwnd, hdc);
 }
@@ -155,5 +173,5 @@
 
     hdc = BeginPaint (hwnd, &ps);
-    PROGRESS_Draw (hwnd, hdc);
+    PROGRESS_Draw (hwnd, hdc, 0, FALSE);
     EndPaint (hwnd, &ps);
 }
@@ -166,5 +184,5 @@
 static void PROGRESS_CoercePos(HWND hwnd)
 {
-    PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd); 
+    PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd);
 
   if(infoPtr->CurVal < infoPtr->MinVal)
@@ -182,10 +200,10 @@
 PROGRESS_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
-    PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd); 
+    PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd);
   HFONT hOldFont = infoPtr->hFont;
 
   infoPtr->hFont = (HFONT)wParam;
   if (LOWORD(lParam))
-	PROGRESS_Refresh (hwnd);
+        PROGRESS_Refresh (hwnd);
   return hOldFont;
 }
@@ -195,8 +213,8 @@
  *           ProgressWindowProc
  */
-LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message, 
+LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
                                   WPARAM wParam, LPARAM lParam)
 {
-    PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd); 
+    PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd);
   UINT temp;
 
@@ -204,21 +222,21 @@
     {
     case WM_NCCREATE:
-	    {
-		DWORD dwExStyle;
-		dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
-		SetWindowLongA(hwnd, GWL_EXSTYLE, dwExStyle | WS_EX_STATICEDGE);
-	    }
+            {
+                DWORD dwExStyle;
+                dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
+                SetWindowLongA(hwnd, GWL_EXSTYLE, dwExStyle | WS_EX_STATICEDGE);
+            }
       return TRUE;
 
     case WM_CREATE:
       /* allocate memory for info struct */
-      infoPtr = 
-	(PROGRESS_INFO *)COMCTL32_Alloc (sizeof(PROGRESS_INFO));
+      infoPtr =
+        (PROGRESS_INFO *)COMCTL32_Alloc (sizeof(PROGRESS_INFO));
       SetWindowLongA(hwnd, 0, (DWORD)infoPtr);
 
       /* initialize the info struct */
-      infoPtr->MinVal=0; 
+      infoPtr->MinVal=0;
       infoPtr->MaxVal=100;
-      infoPtr->CurVal=0; 
+      infoPtr->CurVal=0;
       infoPtr->Step=10;
       infoPtr->ColorBar=CLR_DEFAULT;
@@ -227,5 +245,5 @@
 //      TRACE(progress, "Progress Ctrl creation, hwnd=%04x\n", hwnd);
       break;
-    
+
     case WM_DESTROY:
 //      TRACE (progress, "Progress Ctrl destruction, hwnd=%04x\n", hwnd);
@@ -235,7 +253,7 @@
     case WM_ERASEBKGND:
       /* pretend to erase it here, but we will do it in the paint
-	 function to avoid flicker */
+         function to avoid flicker */
       return 1;
-	
+
     case WM_GETFONT:
       return (LRESULT)infoPtr->hFont;
@@ -247,13 +265,13 @@
       PROGRESS_Paint (hwnd);
       break;
-    
+
     case PBM_DELTAPOS:
       if(lParam)
-	UNKNOWN_PARAM(PBM_DELTAPOS, wParam, lParam);
+        UNKNOWN_PARAM(PBM_DELTAPOS, wParam, lParam);
       temp = infoPtr->CurVal;
       if(wParam != 0){
-	infoPtr->CurVal += (UINT16)wParam;
-	PROGRESS_CoercePos (hwnd);
-	PROGRESS_Refresh (hwnd);
+        infoPtr->CurVal += (INT)wParam; //CB: negative values allowed, was UINT16
+        PROGRESS_CoercePos (hwnd);
+        PROGRESS_Update (hwnd,temp);
       }
       return temp;
@@ -261,24 +279,24 @@
     case PBM_SETPOS:
       if (lParam)
-	UNKNOWN_PARAM(PBM_SETPOS, wParam, lParam);
+        UNKNOWN_PARAM(PBM_SETPOS, wParam, lParam);
       temp = infoPtr->CurVal;
       if(temp != wParam){
-	infoPtr->CurVal = (UINT16)wParam;
-	PROGRESS_CoercePos(hwnd);
-	PROGRESS_Refresh (hwnd);
-      }
-      return temp;          
-      
+        infoPtr->CurVal = (UINT16)wParam;
+        PROGRESS_CoercePos(hwnd);
+        PROGRESS_Update (hwnd,temp);
+      }
+      return temp;
+
     case PBM_SETRANGE:
       if (wParam)
-	UNKNOWN_PARAM(PBM_SETRANGE, wParam, lParam);
+        UNKNOWN_PARAM(PBM_SETRANGE, wParam, lParam);
       temp = MAKELONG(infoPtr->MinVal, infoPtr->MaxVal);
       if(temp != lParam){
-	infoPtr->MinVal = LOWORD(lParam); 
-	infoPtr->MaxVal = HIWORD(lParam);
-	if(infoPtr->MaxVal <= infoPtr->MinVal)
-	  infoPtr->MaxVal = infoPtr->MinVal+1;
-	PROGRESS_CoercePos(hwnd);
-	PROGRESS_Refresh (hwnd);
+        infoPtr->MinVal = LOWORD(lParam);
+        infoPtr->MaxVal = HIWORD(lParam);
+        if(infoPtr->MaxVal <= infoPtr->MinVal)
+          infoPtr->MaxVal = infoPtr->MinVal+1;
+        PROGRESS_CoercePos(hwnd);
+        PROGRESS_Refresh (hwnd);
       }
       return temp;
@@ -286,18 +304,18 @@
     case PBM_SETSTEP:
       if (lParam)
-	UNKNOWN_PARAM(PBM_SETSTEP, wParam, lParam);
-      temp = infoPtr->Step;   
-      infoPtr->Step = (UINT16)wParam;   
+        UNKNOWN_PARAM(PBM_SETSTEP, wParam, lParam);
+      temp = infoPtr->Step;
+      infoPtr->Step = (UINT16)wParam;
       return temp;
 
     case PBM_STEPIT:
       if (wParam || lParam)
-	UNKNOWN_PARAM(PBM_STEPIT, wParam, lParam);
-      temp = infoPtr->CurVal;   
+        UNKNOWN_PARAM(PBM_STEPIT, wParam, lParam);
+      temp = infoPtr->CurVal;
       infoPtr->CurVal += infoPtr->Step;
       if(infoPtr->CurVal > infoPtr->MaxVal)
-	infoPtr->CurVal = infoPtr->MinVal;
+        infoPtr->CurVal = infoPtr->MinVal;
       if(temp != infoPtr->CurVal)
-	PROGRESS_Refresh (hwnd);
+        PROGRESS_Update (hwnd,temp);
       return temp;
 
@@ -306,13 +324,13 @@
       if((infoPtr->MinVal != (INT)wParam) ||
          (infoPtr->MaxVal != (INT)lParam)) {
-	infoPtr->MinVal = (INT)wParam;
-	infoPtr->MaxVal = (INT)lParam;
-	if(infoPtr->MaxVal <= infoPtr->MinVal)
-	  infoPtr->MaxVal = infoPtr->MinVal+1;
-	PROGRESS_CoercePos(hwnd);
-	PROGRESS_Refresh (hwnd);
-      }
-      return temp;
-    
+        infoPtr->MinVal = (INT)wParam;
+        infoPtr->MaxVal = (INT)lParam;
+        if(infoPtr->MaxVal <= infoPtr->MinVal)
+          infoPtr->MaxVal = infoPtr->MinVal+1;
+        PROGRESS_CoercePos(hwnd);
+        PROGRESS_Refresh (hwnd);
+      }
+      return temp;
+
     case PBM_GETRANGE:
       if (lParam){
@@ -324,11 +342,11 @@
     case PBM_GETPOS:
       if (wParam || lParam)
-	UNKNOWN_PARAM(PBM_STEPIT, wParam, lParam);
+        UNKNOWN_PARAM(PBM_STEPIT, wParam, lParam);
       return (infoPtr->CurVal);
 
     case PBM_SETBARCOLOR:
       if (wParam)
-	UNKNOWN_PARAM(PBM_SETBARCOLOR, wParam, lParam);
-      infoPtr->ColorBar = (COLORREF)lParam;     
+        UNKNOWN_PARAM(PBM_SETBARCOLOR, wParam, lParam);
+      infoPtr->ColorBar = (COLORREF)lParam;
       PROGRESS_Refresh (hwnd);
       break;
@@ -336,15 +354,15 @@
     case PBM_SETBKCOLOR:
       if (wParam)
-	UNKNOWN_PARAM(PBM_SETBKCOLOR, wParam, lParam);
+        UNKNOWN_PARAM(PBM_SETBKCOLOR, wParam, lParam);
       infoPtr->ColorBk = (COLORREF)lParam;
       PROGRESS_Refresh (hwnd);
       break;
 
-    default: 
-//      if (message >= WM_USER) 
-//	ERR(progress, "unknown msg %04x wp=%04x lp=%08lx\n", 
-//		    message, wParam, lParam );
-      return DefWindowProcA( hwnd, message, wParam, lParam ); 
-    } 
+    default:
+//      if (message >= WM_USER)
+//      ERR(progress, "unknown msg %04x wp=%04x lp=%08lx\n",
+//                  message, wParam, lParam );
+      return DefWindowProcA( hwnd, message, wParam, lParam );
+    }
 
     return 0;
@@ -387,5 +405,5 @@
 {
     if (GlobalFindAtomA(PROGRESS_CLASSA))
-	UnregisterClassA(PROGRESS_CLASSA, (HINSTANCE)NULL);
-}
-
+        UnregisterClassA(PROGRESS_CLASSA, (HINSTANCE)NULL);
+}
+
Index: trunk/src/user32/user32.cpp
===================================================================
--- trunk/src/user32/user32.cpp	(revision 105)
+++ trunk/src/user32/user32.cpp	(revision 106)
@@ -1,3 +1,3 @@
-/* $Id: user32.cpp,v 1.6 1999-06-09 20:53:30 phaller Exp $ */
+/* $Id: user32.cpp,v 1.7 1999-06-12 20:44:07 cbratschi Exp $ */
 
 /*
@@ -565,4 +565,13 @@
   if (y      < 0) y       = 0;
 #endif
+
+// 6-12-99 CB: WS_CLIPCHILDREN not set -> controls not redrawn
+// Problems with group boxes
+
+#ifndef WS_CLIPCHILDREN
+  #define WS_CLIPCHILDREN            0x20000000L
+#endif
+
+  dwStyle |= WS_CLIPCHILDREN;
 
 //SvL: Breaks applications
@@ -1289,5 +1298,4 @@
 //******************************************************************************
 // Not implemented by Open32 (5-31-99 Christoph Bratschi)
-// Quick and dirty implementation
 //******************************************************************************
 BOOL WIN32API CheckRadioButton( HWND arg1, UINT arg2, UINT arg3, UINT  arg4)
