From 463482a8295fad657b7fa22ea145551f63547238 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Wed, 6 May 2020 16:47:58 +0800 Subject: [PATCH] comctl32/button: Do not set BS_PUSHBUTTON and BS_DEFPUSHBUTTON style directly to Split Buttons and Command Links. For Split Buttons and Command Links of common control version 6, setting BS_PUSHBUTTON and BS_DEFPUSHBUTTON style toggles their default bit. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47621 Signed-off-by: Zhiyi Zhang Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/comctl32/button.c | 12 +++++++++--- dlls/comctl32/tests/button.c | 1 - 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c index b615df4a165..4f7a3052b10 100644 --- a/dlls/comctl32/button.c +++ b/dlls/comctl32/button.c @@ -847,8 +847,14 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L break; case BM_SETSTYLE: - btn_type = wParam & BS_TYPEMASK; - style = (style & ~BS_TYPEMASK) | btn_type; + { + DWORD new_btn_type; + + new_btn_type= wParam & BS_TYPEMASK; + if (btn_type >= BS_SPLITBUTTON && new_btn_type <= BS_DEFPUSHBUTTON) + new_btn_type = (btn_type & ~BS_DEFPUSHBUTTON) | new_btn_type; + + style = (style & ~BS_TYPEMASK) | new_btn_type; SetWindowLongW( hWnd, GWL_STYLE, style ); /* Only redraw if lParam flag is set.*/ @@ -856,7 +862,7 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L InvalidateRect( hWnd, NULL, TRUE ); break; - + } case BM_CLICK: SendMessageW( hWnd, WM_LBUTTONDOWN, 0, 0 ); SendMessageW( hWnd, WM_LBUTTONUP, 0, 0 ); diff --git a/dlls/comctl32/tests/button.c b/dlls/comctl32/tests/button.c index 933db6e9825..716850073ff 100644 --- a/dlls/comctl32/tests/button.c +++ b/dlls/comctl32/tests/button.c @@ -2303,7 +2303,6 @@ static void test_style(void) else expected_type = j; - todo_wine_if(i >= BS_SPLITBUTTON && j <= BS_DEFPUSHBUTTON) ok(type == expected_type || broken(type == j), /* XP */ "Original type %#x, expected new type %#x, got %#x.\n", i, expected_type, type); }