https://git.reactos.org/?p=reactos.git;a=commitdiff;h=db10ce0f9f1e23e9de8ef…
commit db10ce0f9f1e23e9de8ef867cacd0758bd5e0f23
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed Dec 13 07:04:52 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Dec 13 07:04:52 2023 +0900
[USER32] Skip STATIC controls on arrow keys (#6142)
- Skip DLGC_STATIC controls on array keys.
- Avoid infinite loop by using hwndFirst variable.
CORE-6127
---
win32ss/user/user32/windows/dialog.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/win32ss/user/user32/windows/dialog.c b/win32ss/user/user32/windows/dialog.c
index 359cfd150c6..842aeb5b0a3 100644
--- a/win32ss/user/user32/windows/dialog.c
+++ b/win32ss/user/user32/windows/dialog.c
@@ -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 );