[USER32] Skip STATIC controls on arrow keys (#6142)

- Skip DLGC_STATIC controls on array keys.
- Avoid infinite loop by using hwndFirst variable.
CORE-6127
This commit is contained in:
Katayama Hirofumi MZ 2023-12-13 07:04:52 +09:00 committed by GitHub
parent be8e4c691d
commit db10ce0f9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2624,7 +2624,17 @@ IsDialogMessageW(
if (!(dlgCode & DLGC_WANTARROWS))
{
BOOL fPrevious = (lpMsg->wParam == VK_LEFT || lpMsg->wParam == VK_UP);
HWND hwndNext = GetNextDlgGroupItem( hDlg, lpMsg->hwnd, fPrevious );
/* Skip STATIC elements when arrow-moving through a list of controls */
HWND hwndNext, hwndFirst = lpMsg->hwnd;
for (hwndNext = GetNextDlgGroupItem(hDlg, hwndFirst, fPrevious);
hwndNext && hwndFirst != hwndNext;
hwndNext = GetNextDlgGroupItem(hDlg, hwndNext, fPrevious))
{
if (!(SendMessageW(hwndNext, WM_GETDLGCODE, 0, 0) & DLGC_STATIC))
break;
}
if (hwndNext && SendMessageW( hwndNext, WM_GETDLGCODE, lpMsg->wParam, (LPARAM)lpMsg ) == (DLGC_BUTTON | DLGC_RADIOBUTTON))
{
SetFocus( hwndNext );