From 573102ee8856ee142269316b44b4a939d83e5050 Mon Sep 17 00:00:00 2001 From: Dylan Smith Date: Thu, 8 Jan 2009 00:44:11 -0500 Subject: [PATCH] richedit: Fixed implementation of WM_GETDLGCODE message. This fixes inconsistencies shown in the tests I added for the WM_GETDLGCODE. The tests covered different cases handled by the current implementation in order to show that the native implementation is simpler for all these cases. --- dlls/riched20/editor.c | 18 +++--------------- dlls/riched20/tests/editor.c | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 28 deletions(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 107dcea60e6..5bfc0aa6a0d 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -2956,21 +2956,9 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, return ME_StreamOut(editor, wParam, (EDITSTREAM *)lParam); case WM_GETDLGCODE: { - UINT code = DLGC_WANTCHARS|DLGC_WANTARROWS; - if(lParam && (((LPMSG)lParam)->message == WM_KEYDOWN)) - { - int vk = (int)((LPMSG)lParam)->wParam; - /* if style says we want return key */ - if((vk == VK_RETURN) && (GetWindowLongW(editor->hWnd, GWL_STYLE) & ES_WANTRETURN)) - { - code |= DLGC_WANTMESSAGE; - } - /* we always handle ctrl-tab */ - if((vk == VK_TAB) && (GetKeyState(VK_CONTROL) & 0x8000)) - { - code |= DLGC_WANTMESSAGE; - } - } + UINT code = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL; + if (GetWindowLongW(editor->hWnd, GWL_STYLE) & ES_MULTILINE) + code |= DLGC_WANTMESSAGE; return code; } case EM_EMPTYUNDOBUFFER: diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index d9c5d7846d7..11930ad4b21 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -6025,7 +6025,7 @@ static void test_WM_GETDLGCODE(void) msg.hwnd = hwnd; res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, 0); expected = expected | DLGC_WANTMESSAGE; - todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", + ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", res, expected); DestroyWindow(hwnd); @@ -6043,7 +6043,7 @@ static void test_WM_GETDLGCODE(void) msg.hwnd = hwnd; res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg); expected = expected | DLGC_WANTMESSAGE; - todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", + ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", res, expected); DestroyWindow(hwnd); @@ -6054,7 +6054,7 @@ static void test_WM_GETDLGCODE(void) msg.hwnd = hwnd; res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg); expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL|DLGC_WANTMESSAGE; - todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", + ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", res, expected); DestroyWindow(hwnd); @@ -6065,7 +6065,7 @@ static void test_WM_GETDLGCODE(void) msg.hwnd = hwnd; res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg); expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL; - todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", + ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", res, expected); DestroyWindow(hwnd); @@ -6076,7 +6076,7 @@ static void test_WM_GETDLGCODE(void) msg.hwnd = hwnd; res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg); expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL; - todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", + ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", res, expected); DestroyWindow(hwnd); @@ -6090,7 +6090,7 @@ static void test_WM_GETDLGCODE(void) msg.hwnd = hwnd; res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg); expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL|DLGC_WANTMESSAGE; - todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", + ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", res, expected); DestroyWindow(hwnd); @@ -6101,7 +6101,7 @@ static void test_WM_GETDLGCODE(void) msg.hwnd = hwnd; res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg); expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL; - todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", + ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", res, expected); DestroyWindow(hwnd); @@ -6114,7 +6114,7 @@ static void test_WM_GETDLGCODE(void) msg.hwnd = hwnd; res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg); expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL|DLGC_WANTMESSAGE; - todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", + ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", res, expected); DestroyWindow(hwnd); @@ -6125,7 +6125,7 @@ static void test_WM_GETDLGCODE(void) msg.hwnd = hwnd; res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg); expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL; - todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", + ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", res, expected); DestroyWindow(hwnd); @@ -6141,7 +6141,7 @@ static void test_WM_GETDLGCODE(void) msg.hwnd = hwnd; res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg); expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL|DLGC_WANTMESSAGE; - todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", + ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", res, expected); DestroyWindow(hwnd); @@ -6152,7 +6152,7 @@ static void test_WM_GETDLGCODE(void) msg.hwnd = hwnd; res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg); expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL; - todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", + ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", res, expected); DestroyWindow(hwnd); @@ -6165,7 +6165,7 @@ static void test_WM_GETDLGCODE(void) msg.hwnd = hwnd; res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg); expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL|DLGC_WANTMESSAGE; - todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", + ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", res, expected); DestroyWindow(hwnd); @@ -6176,7 +6176,7 @@ static void test_WM_GETDLGCODE(void) msg.hwnd = hwnd; res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg); expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL; - todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", + ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", res, expected); DestroyWindow(hwnd); }