Dmitry Timoshkov : user: Do not force repainting on WM_WINDOWPOSCHANGED in combobox.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 28 05:09:16 CDT 2006


Module: wine
Branch: master
Commit: a20d0336274a8f361021ed48160701781cfe2f40
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=a20d0336274a8f361021ed48160701781cfe2f40

Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date:   Sun Aug 27 17:54:05 2006 +0900

user: Do not force repainting on WM_WINDOWPOSCHANGED in combobox.

- do not force repainting on WM_WINDOWPOSCHANGED in combobox, it
  breaks Z-order based painting.
- do nothing in the combobox WM_ERASEBKGND handler do all painting in
  WM_PAINT like Windows does.

---

 dlls/user/combo.c |   47 ++++++++++++-----------------------------------
 1 files changed, 12 insertions(+), 35 deletions(-)

diff --git a/dlls/user/combo.c b/dlls/user/combo.c
index b8a815a..27c2923 100644
--- a/dlls/user/combo.c
+++ b/dlls/user/combo.c
@@ -912,34 +912,6 @@ static HBRUSH COMBO_PrepareColors(
   return hBkgBrush;
 }
 
-/***********************************************************************
- *           COMBO_EraseBackground
- */
-static LRESULT COMBO_EraseBackground(
-  HWND        hwnd,
-  LPHEADCOMBO lphc,
-  HDC         hParamDC)
-{
-  HBRUSH  hBkgBrush;
-  HDC 	  hDC;
-
-  if(lphc->wState & CBF_EDIT)
-      return TRUE;
-
-  hDC = (hParamDC) ? hParamDC
-		   : GetDC(hwnd);
-  /*
-   * Retrieve the background brush
-   */
-  hBkgBrush = COMBO_PrepareColors(lphc, hDC);
-
-  FillRect(hDC, &lphc->textRect, hBkgBrush);
-
-  if (!hParamDC)
-    ReleaseDC(hwnd, hDC);
-
-  return TRUE;
-}
 
 /***********************************************************************
  *           COMBO_Paint
@@ -965,6 +937,8 @@ static LRESULT COMBO_Paint(LPHEADCOMBO l
       hBkgBrush = COMBO_PrepareColors(lphc, hDC);
 
       hPrevBrush = SelectObject( hDC, hBkgBrush );
+      if (!(lphc->wState & CBF_EDIT))
+        FillRect(hDC, &lphc->textRect, hBkgBrush);
 
       /*
        * In non 3.1 look, there is a sunken border on the combobox
@@ -1606,7 +1580,7 @@ static void CBResetPos(
 /***********************************************************************
  *           COMBO_Size
  */
-static void COMBO_Size( LPHEADCOMBO lphc )
+static void COMBO_Size( LPHEADCOMBO lphc, BOOL bRedraw )
   {
   CBCalcPlacement(lphc->self,
 		  lphc,
@@ -1614,7 +1588,7 @@ static void COMBO_Size( LPHEADCOMBO lphc
 		  &lphc->buttonRect,
 		  &lphc->droppedRect);
 
-  CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE );
+  CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, bRedraw );
 }
 
 
@@ -1907,15 +1881,15 @@ static LRESULT ComboWndProc_common( HWND
 	}
 
         case WM_PRINTCLIENT:
-	        if (lParam & PRF_ERASEBKGND)
-		  COMBO_EraseBackground(hwnd, lphc, (HDC)wParam);
-
 		/* Fallthrough */
      	case WM_PAINT:
 		/* wParam may contain a valid HDC! */
 		return  COMBO_Paint(lphc, (HDC)wParam);
+
 	case WM_ERASEBKGND:
-		return  COMBO_EraseBackground(hwnd, lphc, (HDC)wParam);
+                /* do all painting in WM_PAINT like Windows does */
+                return 1;
+
 	case WM_GETDLGCODE:
 	{
 		LRESULT result = DLGC_WANTARROWS | DLGC_WANTCHARS;
@@ -1936,10 +1910,13 @@ static LRESULT ComboWndProc_common( HWND
          * get a WM_SIZE. Since we still want to update the Listbox, we have to
          * do it here.
          */
+        /* we should not force repainting on WM_WINDOWPOSCHANGED, it breaks
+         * Z-order based painting.
+         */
         /* fall through */
 	case WM_SIZE:
 	        if( lphc->hWndLBox &&
-		  !(lphc->wState & CBF_NORESIZE) ) COMBO_Size( lphc );
+		  !(lphc->wState & CBF_NORESIZE) ) COMBO_Size( lphc, message == WM_SIZE );
 		return  TRUE;
 	case WM_SETFONT:
 		COMBO_Font( lphc, (HFONT)wParam, (BOOL)lParam );




More information about the wine-cvs mailing list