[Wine-patches] [eter-2.0.0] user32: IsDialogMessage should allow control ids other than IDOK when processing WM_KEYDOWN (eterbug #7882).
Dmitry Timoshkov
dmitry на baikal.ru
Ср Мар 28 10:01:31 MSK 2012
---
dlls/user32/dialog.c | 2 +-
dlls/user32/tests/dialog.c | 34 ++++++++++++++++++++++++++--------
2 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c
index e78ccbb..57952f6 100644
--- a/dlls/user32/dialog.c
+++ b/dlls/user32/dialog.c
@@ -1279,7 +1279,7 @@ BOOL WINAPI IsDialogMessageW( HWND hwndDlg, LPMSG msg )
else if (DC_HASDEFID == HIWORD(dw = SendMessageW (hwndDlg, DM_GETDEFID, 0, 0)))
{
HWND hwndDef = DIALOG_IdToHwnd(hwndDlg, LOWORD(dw));
- if (hwndDef ? IsWindowEnabled(hwndDef) : LOWORD(dw)==IDOK)
+ if (!hwndDef || IsWindowEnabled(hwndDef))
SendMessageW( hwndDlg, WM_COMMAND, MAKEWPARAM( LOWORD(dw), BN_CLICKED ), (LPARAM)hwndDef);
}
else
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
index 404aeee..6bd34b3 100644
--- a/dlls/user32/tests/dialog.c
+++ b/dlls/user32/tests/dialog.c
@@ -1065,20 +1065,38 @@ static INT_PTR CALLBACK TestDefButtonDlgProc (HWND hDlg, UINT uiMsg,
static INT_PTR CALLBACK TestReturnKeyDlgProc (HWND hDlg, UINT uiMsg,
WPARAM wParam, LPARAM lParam)
{
- static int received_idok = 0;
+ static int received_idok;
+
switch (uiMsg)
{
case WM_INITDIALOG:
- {
- MSG msg = {hDlg, WM_KEYDOWN, VK_RETURN, 0x011c0001};
- IsDialogMessage(hDlg, &msg);
- }
- ok(received_idok, "WM_COMMAND not received\n");
+ {
+ MSG msg = {hDlg, WM_KEYDOWN, VK_RETURN, 0x011c0001};
+
+ received_idok = -1;
+ IsDialogMessage(hDlg, &msg);
+ ok(received_idok == 0xdead, "WM_COMMAND/0xdead not received\n");
+
+ received_idok = -2;
+ IsDialogMessage(hDlg, &msg);
+ ok(received_idok == IDOK, "WM_COMMAND/IDOK not received\n");
+
EndDialog(hDlg, 0);
return TRUE;
+ }
+
+ case DM_GETDEFID:
+ if (received_idok == -1)
+ {
+ HWND hwnd = GetDlgItem(hDlg, 0xdead);
+ ok(!hwnd, "dialog item with ID 0xdead should not exist\n");
+ SetWindowLong(hDlg, DWLP_MSGRESULT, MAKELRESULT(0xdead, DC_HASDEFID));
+ return TRUE;
+ }
+ return FALSE;
+
case WM_COMMAND:
- ok(wParam==IDOK, "Expected IDOK\n");
- received_idok = 1;
+ received_idok = wParam;
return TRUE;
}
return FALSE;
--
1.7.9.4
Подробная информация о списке рассылки Wine-patches