André Hentschel : user32: Fix for finding nested default buttons.
Alexandre Julliard
julliard at winehq.org
Thu Jul 28 13:55:47 CDT 2011
Module: wine
Branch: master
Commit: a3551214144c2b973a5a048e81e265a7aeec0363
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a3551214144c2b973a5a048e81e265a7aeec0363
Author: André Hentschel <nerv at dawncrow.de>
Date: Tue Jul 26 20:39:28 2011 +0200
user32: Fix for finding nested default buttons.
---
dlls/comctl32/tests/propsheet.c | 1 -
dlls/user32/dialog.c | 34 +++++++++++++++++++++++++++++++++-
dlls/user32/tests/dialog.c | 2 +-
3 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/dlls/comctl32/tests/propsheet.c b/dlls/comctl32/tests/propsheet.c
index f6b4c7d..89c548f 100644
--- a/dlls/comctl32/tests/propsheet.c
+++ b/dlls/comctl32/tests/propsheet.c
@@ -502,7 +502,6 @@ static void test_custom_default_button(void)
}
}
- todo_wine
ok(add_button_has_been_pressed, "The Add button has not been pressed!\n");
DestroyWindow(hdlg);
diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c
index 2aa89d9..1e47374 100644
--- a/dlls/user32/dialog.c
+++ b/dlls/user32/dialog.c
@@ -1120,6 +1120,38 @@ static void DIALOG_FixChildrenOnChangeFocus (HWND hwndDlg, HWND hwndNext)
}
/***********************************************************************
+ * DIALOG_IdToHwnd
+ *
+ * A recursive version of GetDlgItem
+ *
+ * RETURNS
+ * The HWND for a Child ID.
+ */
+static HWND DIALOG_IdToHwnd( HWND hwndDlg, INT id )
+{
+ int i;
+ HWND *list = WIN_ListChildren( hwndDlg );
+ HWND ret = 0;
+
+ if (!list) return 0;
+
+ for (i = 0; list[i]; i++)
+ {
+ if (GetWindowLongPtrW( list[i], GWLP_ID ) == id)
+ {
+ ret = list[i];
+ break;
+ }
+
+ /* Recurse into every child */
+ if ((ret = DIALOG_IdToHwnd( list[i], id ))) break;
+ }
+
+ HeapFree( GetProcessHeap(), 0, list );
+ return ret;
+}
+
+/***********************************************************************
* IsDialogMessageW (USER32.@)
*/
BOOL WINAPI IsDialogMessageW( HWND hwndDlg, LPMSG msg )
@@ -1227,7 +1259,7 @@ BOOL WINAPI IsDialogMessageW( HWND hwndDlg, LPMSG msg )
}
else if (DC_HASDEFID == HIWORD(dw = SendMessageW (hwndDlg, DM_GETDEFID, 0, 0)))
{
- HWND hwndDef = GetDlgItem(hwndDlg, LOWORD(dw));
+ HWND hwndDef = DIALOG_IdToHwnd(hwndDlg, LOWORD(dw));
if (hwndDef ? IsWindowEnabled(hwndDef) : LOWORD(dw)==IDOK)
SendMessageW( hwndDlg, WM_COMMAND, MAKEWPARAM( LOWORD(dw), BN_CLICKED ), (LPARAM)hwndDef);
}
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
index 1a1cd75..8e4ffb5 100644
--- a/dlls/user32/tests/dialog.c
+++ b/dlls/user32/tests/dialog.c
@@ -709,7 +709,7 @@ static void test_WM_NEXTDLGCTL(void)
g_bReceivedCommand = FALSE;
FormEnterMsg (&msg, child3);
ok(IsDialogMessage (g_hwndTestDlg, &msg), "Did not handle the ENTER\n");
- todo_wine ok(g_bReceivedCommand, "Did not trigger the default Button action\n");
+ ok(g_bReceivedCommand, "Did not trigger the default Button action\n");
DestroyWindow(child3);
DestroyWindow(child2);
More information about the wine-cvs
mailing list