[PATCH] comctl32/button: Keep control style

Nikolay Sivov nsivov at codeweavers.com
Sun Apr 1 03:33:38 CDT 2018


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/comctl32/button.c       | 8 +++++++-
 dlls/comctl32/tests/button.c | 2 ++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c
index 7d48fe7956..1e339ef19c 100644
--- a/dlls/comctl32/button.c
+++ b/dlls/comctl32/button.c
@@ -91,6 +91,7 @@ typedef struct _BUTTON_INFO
 {
     HWND        hwnd;
     HWND        parent;
+    LONG        style;
     LONG        state;
     HFONT       font;
     WCHAR      *note;
@@ -340,11 +341,16 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
         break;
 
     case WM_NCCREATE:
+    {
+        CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam;
+
         infoPtr = heap_alloc_zero( sizeof(*infoPtr) );
         SetWindowLongPtrW( hWnd, 0, (LONG_PTR)infoPtr );
         infoPtr->hwnd = hWnd;
-        infoPtr->parent = GetParent(hWnd);
+        infoPtr->parent = cs->hwndParent;
+        infoPtr->style = cs->style;
         return DefWindowProcW(hWnd, uMsg, wParam, lParam);
+    }
 
     case WM_NCDESTROY:
         SetWindowLongPtrW( hWnd, 0, 0 );
diff --git a/dlls/comctl32/tests/button.c b/dlls/comctl32/tests/button.c
index 0aacfa5888..7bd73de7cb 100644
--- a/dlls/comctl32/tests/button.c
+++ b/dlls/comctl32/tests/button.c
@@ -1004,6 +1004,7 @@ static void test_button_data(void)
     {
         HWND self;
         HWND parent;
+        LONG style;
     };
     unsigned int i;
     HWND parent;
@@ -1027,6 +1028,7 @@ static void test_button_data(void)
         {
             ok(desc->self == hwnd, "Unexpected 'self' field.\n");
             ok(desc->parent == parent, "Unexpected 'parent' field.\n");
+            ok(desc->style == (WS_CHILD | BS_NOTIFY | styles[i]), "Unexpected 'style' field.\n");
         }
 
         DestroyWindow(hwnd);
-- 
2.16.2




More information about the wine-devel mailing list