CW: Progress control creation fixes

Dmitry Timoshkov dmitry at baikal.ru
Sun Jan 27 05:12:19 CST 2002


Hello.

This is a part of the big CodeWeavers' patch.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Moved style correcting code to the WM_CREATE handler and added
    clearing of WS_EX_CLIENTEDGE and WS_EX_WINDOWEDGE as in Windows.
    Added SetWindowPos(SWP_FRAMECHANGED) to make changes take effect.

--- cvs/wine/dlls/comctl32/progress.c	Sun Jan 28 03:59:12 2001
+++ wine/dlls/comctl32/progress.c	Sun Jan 27 10:56:14 2002
@@ -71,7 +71,7 @@
   /* draw the background */
   FillRect(hdc, &rect, hbrBk);
 
-  rect.left++; rect.right--; rect.top++; rect.bottom--;
+  InflateRect(&rect, -1, -1);
 
   /* get the window style */
   dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
@@ -212,15 +212,16 @@
       return DefWindowProcA( hwnd, message, wParam, lParam ); 
   switch(message)
     {
-    case WM_NCCREATE:
-	    {
-		DWORD dwExStyle;
-		dwExStyle = GetWindowLongA (hwnd, GWL_EXSTYLE);
-		SetWindowLongA (hwnd, GWL_EXSTYLE, dwExStyle | WS_EX_STATICEDGE);
-	    }
-      return TRUE;
-
     case WM_CREATE:
+    {
+      DWORD dwExStyle = GetWindowLongA (hwnd, GWL_EXSTYLE);
+      dwExStyle &= ~(WS_EX_CLIENTEDGE | WS_EX_WINDOWEDGE);
+      dwExStyle |= WS_EX_STATICEDGE;
+      SetWindowLongA (hwnd, GWL_EXSTYLE, dwExStyle);
+      /* Force recalculation of a non-client area */
+      SetWindowPos(hwnd, 0, 0, 0, 0, 0,
+          SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
+
       /* allocate memory for info struct */
       infoPtr = 
 	(PROGRESS_INFO *)COMCTL32_Alloc (sizeof(PROGRESS_INFO));
@@ -236,6 +237,7 @@
       infoPtr->hFont=(HANDLE)NULL;
       TRACE("Progress Ctrl creation, hwnd=%04x\n", hwnd);
       break;
+    }
     
     case WM_DESTROY:
       TRACE("Progress Ctrl destruction, hwnd=%04x\n", hwnd);






More information about the wine-patches mailing list