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.
This commit is contained in:
parent
c636b59bcf
commit
573102ee88
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue