user32: Move the auto radio button group logic from BM_SETCHECK to WM_LBUTTONUP handler.

This patch also changes the logic to get the control style with WM_GETDLGCODE
instead of GetWindowLong to make the message test pass.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2018-11-25 20:58:00 +03:00 committed by Alexandre Julliard
parent 2d9e3236ea
commit 96d0af52eb
1 changed files with 4 additions and 7 deletions

View File

@ -309,7 +309,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
SendMessageW( hWnd, BM_SETCHECK, !(state & BST_CHECKED), 0 ); SendMessageW( hWnd, BM_SETCHECK, !(state & BST_CHECKED), 0 );
break; break;
case BS_AUTORADIOBUTTON: case BS_AUTORADIOBUTTON:
SendMessageW( hWnd, BM_SETCHECK, TRUE, 0 ); BUTTON_CheckAutoRadioButton( hWnd );
break; break;
case BS_AUTO3STATE: case BS_AUTO3STATE:
SendMessageW( hWnd, BM_SETCHECK, SendMessageW( hWnd, BM_SETCHECK,
@ -475,8 +475,6 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
set_button_state( hWnd, (state & ~3) | wParam ); set_button_state( hWnd, (state & ~3) | wParam );
paint_button( hWnd, btn_type, ODA_SELECT ); paint_button( hWnd, btn_type, ODA_SELECT );
} }
if ((btn_type == BS_AUTORADIOBUTTON) && (wParam == BST_CHECKED) && (style & WS_CHILD))
BUTTON_CheckAutoRadioButton( hWnd );
break; break;
case BM_GETSTATE: case BM_GETSTATE:
@ -961,13 +959,12 @@ static void BUTTON_CheckAutoRadioButton( HWND hwnd )
parent = GetParent(hwnd); parent = GetParent(hwnd);
/* make sure that starting control is not disabled or invisible */ /* make sure that starting control is not disabled or invisible */
start = sibling = GetNextDlgGroupItem( parent, hwnd, TRUE ); start = sibling = hwnd;
do do
{ {
if (!sibling) break; if (!sibling) break;
if ((hwnd != sibling) && if (SendMessageW( sibling, WM_GETDLGCODE, 0, 0 ) == (DLGC_BUTTON | DLGC_RADIOBUTTON))
((GetWindowLongW( sibling, GWL_STYLE) & BS_TYPEMASK) == BS_AUTORADIOBUTTON)) SendMessageW( sibling, BM_SETCHECK, sibling == hwnd ? BST_CHECKED : BST_UNCHECKED, 0 );
SendMessageW( sibling, BM_SETCHECK, BST_UNCHECKED, 0 );
sibling = GetNextDlgGroupItem( parent, sibling, FALSE ); sibling = GetNextDlgGroupItem( parent, sibling, FALSE );
} while (sibling != start); } while (sibling != start);
} }