Module: wine Branch: master Commit: 2f0b111243609c9501c130e341871cd6dedfb515 URL: http://source.winehq.org/git/wine.git/?a=commit;h=2f0b111243609c9501c130e341...
Author: Lei Zhang thestig@google.com Date: Wed Apr 23 17:58:30 2008 -0700
user32: Handle VK_RETURN WM_KEYDOWN events better in edit controls.
Elias Benali wrote the initial version of this patch.
---
dlls/user32/edit.c | 8 ++++++-- dlls/user32/tests/edit.c | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index 7748b70..4c0342b 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -4602,8 +4602,12 @@ static LRESULT EDIT_WM_KeyDown(EDITSTATE *es, INT key) /* If the edit doesn't want the return send a message to the default object */ if(!(es->style & ES_MULTILINE) || !(es->style & ES_WANTRETURN)) { - HWND hwndParent = GetParent(es->hwndSelf); - DWORD dw = SendMessageW( hwndParent, DM_GETDEFID, 0, 0 ); + HWND hwndParent; + DWORD dw; + + if (!EDIT_IsInsideDialog(es)) return 1; + hwndParent = GetParent(es->hwndSelf); + dw = SendMessageW( hwndParent, DM_GETDEFID, 0, 0 ); if (HIWORD(dw) == DC_HASDEFID) { SendMessageW( hwndParent, WM_COMMAND, diff --git a/dlls/user32/tests/edit.c b/dlls/user32/tests/edit.c index b34e6e0..9f40416 100644 --- a/dlls/user32/tests/edit.c +++ b/dlls/user32/tests/edit.c @@ -1932,8 +1932,8 @@ static void test_child_edit_wmkeydown(void) hwParent = GetParent(hwEdit); SetWindowLong(hwParent, GWL_WNDPROC, (LONG)child_edit_wmkeydown_proc); r = SendMessage(hwEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001); - todo_wine ok(1 == r, "expected 1, got %d\n", r); - todo_wine ok(0 == child_edit_wmkeydown_num_messages, "expected 0, got %d\n", child_edit_wmkeydown_num_messages); + ok(1 == r, "expected 1, got %d\n", r); + ok(0 == child_edit_wmkeydown_num_messages, "expected 0, got %d\n", child_edit_wmkeydown_num_messages); destroy_child_editcontrol(hwEdit); }