Echo typed characters in Wine edit fields
This commit is contained in:
1 parent
d9aa40e16c
commit
a002c4cc1e
7 files changed
+154
-22
No files matched your search
@@ -1,5 +1,7 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef WINE_ACCESS_WINFORMS_FIXTURE
|
||||
static const WCHAR *editClass = L"WindowsForms10.EDIT.app.0.fixture_r7_ad1";
|
||||
@@ -131,6 +133,67 @@ static LRESULT CALLBACK window_proc(HWND window, UINT message, WPARAM wp, LPARAM
|
||||
key(VK_DELETE, FALSE, FALSE);
|
||||
if (GetWindowTextLengthW(editor) != 31) ExitProcess(2);
|
||||
break;
|
||||
case 35:
|
||||
SendMessageW(editor, WM_CHAR, L'!', 1);
|
||||
if (GetWindowTextLengthW(editor) != 31) ExitProcess(2);
|
||||
break;
|
||||
case 36:
|
||||
SendMessageW(editor, EM_SETREADONLY, FALSE, 0);
|
||||
SetWindowTextW(editor, L"");
|
||||
SendMessageW(editor, WM_CHAR, L'z', 1);
|
||||
SendMessageW(editor, WM_CHAR, L'z', 1);
|
||||
SendMessageW(editor, WM_CHAR, L' ', 1);
|
||||
SendMessageW(editor, WM_CHAR, 0x00e9, 1);
|
||||
SendMessageW(editor, WM_CHAR, 0xd83d, 1);
|
||||
SendMessageW(editor, WM_CHAR, 0xde00, 1);
|
||||
SendMessageW(editor, WM_CHAR, VK_RETURN, 1);
|
||||
SendMessageW(editor, WM_CHAR, VK_TAB, 1);
|
||||
{
|
||||
WCHAR text[32];
|
||||
GetWindowTextW(editor, text, 32);
|
||||
if (lstrcmpW(text, L"zz \u00e9\U0001f600\r\n\t")) ExitProcess(2);
|
||||
}
|
||||
break;
|
||||
case 37:
|
||||
// Replacing selected text is still typing, even when length shrinks.
|
||||
SendMessageW(editor, EM_SETSEL, 0, 4);
|
||||
SendMessageW(editor, WM_CHAR, L'q', 1);
|
||||
break;
|
||||
case 38:
|
||||
SetFocus(password);
|
||||
SendMessageW(password, WM_CHAR, L'@', 1);
|
||||
// Background changes must not produce echo for the focused password.
|
||||
SendMessageW(editor, WM_CHAR, L'~', 1);
|
||||
break;
|
||||
case 39:
|
||||
SetFocus(editor);
|
||||
{
|
||||
DWORD length = 1024 * 1024 + 1;
|
||||
WCHAR *large = calloc(length + 1, sizeof(WCHAR));
|
||||
if (!large) ExitProcess(2);
|
||||
for (DWORD i = 0; i < length; ++i) large[i] = L'x';
|
||||
SendMessageW(editor, EM_SETLIMITTEXT, length + 3, 0);
|
||||
SetWindowTextW(editor, large);
|
||||
free(large);
|
||||
SendMessageW(editor, EM_SETSEL, length, length);
|
||||
SendMessageW(editor, WM_CHAR, L'L', 1);
|
||||
SendMessageW(editor, WM_CHAR, 0xd83d, 1);
|
||||
SendMessageW(editor, WM_CHAR, 0xde00, 1);
|
||||
if (GetWindowTextLengthW(editor) != (int)length + 3) {
|
||||
fprintf(stderr, "large typing: length=%d expected=%lu limit=%ld\n",
|
||||
GetWindowTextLengthW(editor), (unsigned long)length + 3,
|
||||
(long)SendMessageW(editor, EM_GETLIMITTEXT, 0, 0));
|
||||
ExitProcess(2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 40:
|
||||
SetWindowTextW(editor, L"full");
|
||||
SendMessageW(editor, EM_SETSEL, 4, 4);
|
||||
SendMessageW(editor, EM_SETLIMITTEXT, 4, 0);
|
||||
SendMessageW(editor, WM_CHAR, L'%', 1);
|
||||
if (GetWindowTextLengthW(editor) != 4) ExitProcess(2);
|
||||
break;
|
||||
default:
|
||||
DestroyWindow(window); break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user