Make REBAR_StyleChanged respect wParam

Igor Tarasov tarasov.igor at gmail.com
Thu Feb 26 20:30:03 CST 2009


MSDN states that WM_STYLECHANGED needs 2 params: wParam, which specifies
whether the window styles or extended window styles have changed, and lParam,
holding styles.
http://msdn.microsoft.com/en-us/library/ms632648(VS.85).aspx

But REBAR_StyleChanged operates only with lParam, thus ignoring
wParam. This results in dwStyle being overwritten by extended styles
if applcation update these. There is no extended styles support at all
in rebar.c, and even no dwExStyle property in REBAR_Info structure, so
the patch only helps avoiding overwriting styles, and throws a FIXME
if extended styles are being updated.

This partly fixes bug 12553: http://bugs.winehq.org/show_bug.cgi?id=12553
-------------- next part --------------
diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c
index 89ac420..8de7fd6 100644
--- a/dlls/comctl32/rebar.c
+++ b/dlls/comctl32/rebar.c
@@ -3469,19 +3469,22 @@ REBAR_Size (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-REBAR_StyleChanged (REBAR_INFO *infoPtr, LPARAM lParam)
+REBAR_StyleChanged (REBAR_INFO *infoPtr, INT nType, const STYLESTRUCT *lpStyle)
 {
-    STYLESTRUCT *ss = (STYLESTRUCT *)lParam;
 
     TRACE("current style=%08x, styleOld=%08x, style being set to=%08x\n",
-	  infoPtr->dwStyle, ss->styleOld, ss->styleNew);
-    infoPtr->orgStyle = infoPtr->dwStyle = ss->styleNew;
-    if (GetWindowTheme (infoPtr->hwndSelf))
-        infoPtr->dwStyle &= ~WS_BORDER;
-    /* maybe it should be COMMON_STYLES like in toolbar */
-    if ((ss->styleNew ^ ss->styleOld) & CCS_VERT)
-        REBAR_Layout(infoPtr);
-
+	  infoPtr->dwStyle, lpStyle->styleOld, lpStyle->styleNew);
+    if (nType == GWL_STYLE)
+    {
+        infoPtr->orgStyle = infoPtr->dwStyle = lpStyle->styleNew;
+        if (GetWindowTheme (infoPtr->hwndSelf))
+            infoPtr->dwStyle &= ~WS_BORDER;
+        /* maybe it should be COMMON_STYLES like in toolbar */
+        if ((lpStyle->styleNew ^ lpStyle->styleOld) & CCS_VERT)
+            REBAR_Layout(infoPtr);
+    } else if (nType == GWL_EXSTYLE) {
+        FIXME("GWL_EXSTYLE not implemented\n");
+    }
     return FALSE;
 }
 
@@ -3715,7 +3718,7 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 	    return REBAR_Size (infoPtr, wParam, lParam);
 
         case WM_STYLECHANGED:
-	    return REBAR_StyleChanged (infoPtr, lParam);
+	    return REBAR_StyleChanged (infoPtr, (INT)wParam, (LPSTYLESTRUCT)lParam);
 
         case WM_THEMECHANGED:
             return theme_changed (infoPtr);


More information about the wine-patches mailing list