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 <zzhang@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2020-05-06 16:47:58 +08:00 committed by Alexandre Julliard
parent 01fbe20617
commit 463482a829
2 changed files with 9 additions and 4 deletions

View File

@ -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 );

View File

@ -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);
}