[PATCH 0/1] MR5761: comclt32: Allow ctrl-tab and tab hotkeys for propsheets
From: Fabian Maurer <dark.shadow4(a)web.de> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56103 --- dlls/comctl32/propsheet.c | 108 +++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index b530a1a8094..fe8a4c68333 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -2884,6 +2884,59 @@ static void PROPSHEET_CleanUp(HWND hwndDlg) GlobalFree(psInfo); } +/****************************************************************************** + * PROPSHEET_IsDialogMessage + */ +static BOOL PROPSHEET_IsDialogMessage(HWND hwnd, LPMSG lpMsg) +{ + PropSheetInfo* psInfo = GetPropW(hwnd, PropSheetInfoStr); + + TRACE("\n"); + if (!psInfo || (hwnd != lpMsg->hwnd && !IsChild(hwnd, lpMsg->hwnd))) + return FALSE; + + if (lpMsg->message == WM_KEYDOWN && (GetKeyState(VK_CONTROL) & 0x8000)) + { + int new_page = 0; + INT dlgCode = SendMessageW(lpMsg->hwnd, WM_GETDLGCODE, 0, (LPARAM)lpMsg); + + if (!(dlgCode & DLGC_WANTMESSAGE)) + { + switch (lpMsg->wParam) + { + case VK_TAB: + if (GetKeyState(VK_SHIFT) & 0x8000) + new_page = -1; + else + new_page = 1; + break; + + case VK_NEXT: new_page = 1; break; + case VK_PRIOR: new_page = -1; break; + } + } + + if (new_page) + { + if (PROPSHEET_CanSetCurSel(hwnd) != FALSE) + { + new_page += psInfo->active_page; + + if (new_page < 0) + new_page = psInfo->nPages - 1; + else if (new_page >= psInfo->nPages) + new_page = 0; + + PROPSHEET_SetCurSel(hwnd, new_page, 1, 0); + } + + return TRUE; + } + } + + return IsDialogMessageW(hwnd, lpMsg); +} + static INT do_loop(const PropSheetInfo *psInfo) { MSG msg = { 0 }; @@ -2896,7 +2949,7 @@ static INT do_loop(const PropSheetInfo *psInfo) if(ret == -1) break; - if(!IsDialogMessageW(hwnd, &msg)) + if(!PROPSHEET_IsDialogMessage(hwnd, &msg)) { TranslateMessage(&msg); DispatchMessageW(&msg); @@ -3234,59 +3287,6 @@ BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hpsp) return TRUE; } -/****************************************************************************** - * PROPSHEET_IsDialogMessage - */ -static BOOL PROPSHEET_IsDialogMessage(HWND hwnd, LPMSG lpMsg) -{ - PropSheetInfo* psInfo = GetPropW(hwnd, PropSheetInfoStr); - - TRACE("\n"); - if (!psInfo || (hwnd != lpMsg->hwnd && !IsChild(hwnd, lpMsg->hwnd))) - return FALSE; - - if (lpMsg->message == WM_KEYDOWN && (GetKeyState(VK_CONTROL) & 0x8000)) - { - int new_page = 0; - INT dlgCode = SendMessageW(lpMsg->hwnd, WM_GETDLGCODE, 0, (LPARAM)lpMsg); - - if (!(dlgCode & DLGC_WANTMESSAGE)) - { - switch (lpMsg->wParam) - { - case VK_TAB: - if (GetKeyState(VK_SHIFT) & 0x8000) - new_page = -1; - else - new_page = 1; - break; - - case VK_NEXT: new_page = 1; break; - case VK_PRIOR: new_page = -1; break; - } - } - - if (new_page) - { - if (PROPSHEET_CanSetCurSel(hwnd) != FALSE) - { - new_page += psInfo->active_page; - - if (new_page < 0) - new_page = psInfo->nPages - 1; - else if (new_page >= psInfo->nPages) - new_page = 0; - - PROPSHEET_SetCurSel(hwnd, new_page, 1, 0); - } - - return TRUE; - } - } - - return IsDialogMessageW(hwnd, lpMsg); -} - /****************************************************************************** * PROPSHEET_DoCommand */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5761
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/propsheet.c:
if(ret == -1) break;
- if(!IsDialogMessageW(hwnd, &msg)) + if(!PROPSHEET_IsDialogMessage(hwnd, &msg))
The change looks good to fine. It would be better if you could add a test. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5761#note_72282
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/propsheet.c:
GlobalFree(psInfo); }
The patch subject should be about Ctrl+Tab and Ctrl+Shift+Tab hotkeys. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5761#note_72281
On Tue Jun 4 07:55:27 2024 +0000, Zhiyi Zhang wrote:
The change looks good to fine. It would be better if you could add a test. Not quite sure how to do that, the code path only is used for "non modeless" dialogs. How do I run the test code while inside that loop?
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/5761#note_72348
On Tue Jun 4 16:12:04 2024 +0000, Fabian Maurer wrote:
Not quite sure how to do that, the code path only is used for "non modeless" dialogs. How do I run the test code while inside that loop? I guess you could use another thread to wait for the modal dialog to show up and send the keyboard messages. Anyway, I could approve this even without a test. Thanks for looking into this.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/5761#note_72405
On Wed Jun 5 00:58:49 2024 +0000, Zhiyi Zhang wrote:
I guess you could use another thread to wait for the modal dialog to show up and send the keyboard messages. Anyway, I could approve this even without a test. Thanks for looking into this. No problem. Turns out it's a bit more difficult testing this than I thought, but I think I have a properly working approach now. I'll push an update the coming days.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/5761#note_72534
participants (3)
-
Fabian Maurer -
Fabian Maurer (@DarkShadow44) -
Zhiyi Zhang (@zhiyi)