Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
This supersedes 203899-203901 in a sense that they will conflict with the patches. The previous series was anyway not doing much and I intend to resend the surface patches later, making all user32 tests pass with null driver progressively.
As a starting point, this series makes all the user32 input tests pass with null graphics driver.
dlls/user32/driver.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c index 7ac77141696..8060baa5df1 100644 --- a/dlls/user32/driver.c +++ b/dlls/user32/driver.c @@ -35,6 +35,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(user); WINE_DECLARE_DEBUG_CHANNEL(winediag); +WINE_DECLARE_DEBUG_CHANNEL(keyboard);
static USER_DRIVER null_driver, lazy_load_driver;
@@ -187,9 +188,12 @@ void USER_unload_driver(void) * These are fallbacks for entry points that are not implemented in the real driver. */
+static HKL nulldrv_keyboard_layout = (HKL)MAKELONG(MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT)); + static HKL CDECL nulldrv_ActivateKeyboardLayout( HKL layout, UINT flags ) { - return 0; + TRACE_(keyboard)( "layout %p, flags %x.\n", layout, flags ); + return nulldrv_keyboard_layout; }
static void CDECL nulldrv_Beep(void) @@ -260,17 +264,24 @@ static INT CDECL nulldrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
static HKL CDECL nulldrv_GetKeyboardLayout( DWORD thread_id ) { - return 0; + TRACE_(keyboard)( "thread_id %u.\n", thread_id ); + return nulldrv_keyboard_layout; }
static BOOL CDECL nulldrv_GetKeyboardLayoutName( LPWSTR name ) { - return FALSE; + DWORD layout; + TRACE_(keyboard)( "name %p.\n", name ); + layout = HandleToUlong( nulldrv_keyboard_layout ); + if (HIWORD(layout) == LOWORD(layout)) layout = LOWORD(layout); + swprintf( name, KL_NAMELENGTH, L"%08x", layout ); + return TRUE; }
static HKL CDECL nulldrv_LoadKeyboardLayout( LPCWSTR name, UINT flags ) { - return 0; + TRACE_(keyboard)( "name %s, flags %x.\n", debugstr_w(name), flags ); + return nulldrv_keyboard_layout; }
static UINT CDECL nulldrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/user32/driver.c | 79 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c index 8060baa5df1..65b9388a79a 100644 --- a/dlls/user32/driver.c +++ b/dlls/user32/driver.c @@ -297,7 +297,84 @@ static BOOL CDECL nulldrv_RegisterHotKey( HWND hwnd, UINT modifiers, UINT vk ) static INT CDECL nulldrv_ToUnicodeEx( UINT virt, UINT scan, const BYTE *state, LPWSTR str, int size, UINT flags, HKL layout ) { - return 0; + WCHAR buffer[2]; + BOOL shift = state[VK_SHIFT] & 0x80; + BOOL ctrl = state[VK_CONTROL] & 0x80; + BOOL numlock = state[VK_NUMLOCK] & 0x01; + INT len; + + TRACE_(keyboard)( "virt %u, scan %u, state %p, str %p, size %d, flags %x, layout %p.\n", + virt, scan, state, str, size, flags, layout ); + + buffer[0] = buffer[1] = 0; + + if (scan & 0x8000) return 0; /* key up */ + + if (!ctrl) + { + switch (virt) + { + case VK_BACK: buffer[0] = '\b'; break; + case VK_OEM_1: buffer[0] = shift ? ':' : ';'; break; + case VK_OEM_2: buffer[0] = shift ? '?' : '/'; break; + case VK_OEM_3: buffer[0] = shift ? '~' : '`'; break; + case VK_OEM_4: buffer[0] = shift ? '{' : '['; break; + case VK_OEM_5: buffer[0] = shift ? '|' : '\'; break; + case VK_OEM_6: buffer[0] = shift ? '}' : ']'; break; + case VK_OEM_7: buffer[0] = shift ? '"' : '''; break; + case VK_OEM_COMMA: buffer[0] = shift ? '<' : ','; break; + case VK_OEM_MINUS: buffer[0] = shift ? '_' : '-'; break; + case VK_OEM_PERIOD: buffer[0] = shift ? '>' : '.'; break; + case VK_OEM_PLUS: buffer[0] = shift ? '+' : '='; break; + case VK_RETURN: buffer[0] = '\r'; break; + case VK_SPACE: buffer[0] = ' '; break; + case VK_TAB: buffer[0] = '\t'; break; + case VK_MULTIPLY: buffer[0] = '*'; break; + case VK_ADD: buffer[0] = '+'; break; + case VK_SUBTRACT: buffer[0] = '-'; break; + case VK_DIVIDE: buffer[0] = '/'; break; + default: + if (virt >= '0' && virt <= '9') + { + buffer[0] = shift ? ")!@#$%^&*("[virt - '0'] : virt; + break; + } + if (virt >= 'A' && virt <= 'Z') + { + buffer[0] = shift || (state[VK_CAPITAL] & 0x01) ? virt : virt + 'a' - 'A'; + break; + } + if (virt >= VK_NUMPAD0 && virt <= VK_NUMPAD9 && numlock && !shift) + { + buffer[0] = '0' + virt - VK_NUMPAD0; + break; + } + if (virt == VK_DECIMAL && numlock && !shift) + { + buffer[0] = '.'; + break; + } + break; + } + } + else /* Control codes */ + { + switch (virt) + { + case VK_OEM_4: buffer[0] = 0x1b; break; + case VK_OEM_5: buffer[0] = 0x1c; break; + case VK_OEM_6: buffer[0] = 0x1d; break; + case VK_SUBTRACT: buffer[0] = 0x1e; break; + default: + if (virt >= 'A' && virt <= 'Z') buffer[0] = virt - 'A' + 1; + break; + } + } + + len = wcslen( buffer ); + wcsncpy( str, buffer, size ); + TRACE_(keyboard)( "ret %d, str %s.\n", len, debugstr_wn(str, len) ); + return len; }
static BOOL CDECL nulldrv_UnloadKeyboardLayout( HKL layout )
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=88964
Your paranoid android.
=== debiant2 (64 bit WoW report) ===
user32: clipboard.c:760: Test failed: 2: gle 5 clipboard.c:765: Test failed: 2.0: got 0000 instead of 000d clipboard.c:805: Test failed: 2: gle 1418 clipboard.c:815: Test failed: 2: count 4 clipboard.c:818: Test failed: 2: gle 1418 clipboard.c:853: Test failed: 2.0: formats 00000000 have been rendered clipboard.c:858: Test failed: 2.0: formats 00000000 have been rendered clipboard.c:853: Test failed: 2.2: formats 00000000 have been rendered clipboard.c:858: Test failed: 2.2: formats 00000000 have been rendered clipboard.c:853: Test failed: 2.3: formats 00000000 have been rendered clipboard.c:858: Test failed: 2.3: formats 00000000 have been rendered
Rémi Bernon rbernon@codeweavers.com writes:
Signed-off-by: Rémi Bernon rbernon@codeweavers.com
dlls/user32/driver.c | 79 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-)
It should be moved instead of copied, but even better, that sort of thing should be done in the generic code, to make fallbacks available to all drivers.
The goal shouldn't be to add a lot of code to the null driver, because that would mean that a lot of code is needed in all drivers. On the contrary, ideally the null driver would remain empty, and the user32 code would provide the necessary functionality, while letting the drivers override only the parts that need special handling.
On 4/23/21 3:40 PM, Alexandre Julliard wrote:
Rémi Bernon rbernon@codeweavers.com writes:
Signed-off-by: Rémi Bernon rbernon@codeweavers.com
dlls/user32/driver.c | 79 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-)
It should be moved instead of copied, but even better, that sort of thing should be done in the generic code, to make fallbacks available to all drivers.
The goal shouldn't be to add a lot of code to the null driver, because that would mean that a lot of code is needed in all drivers. On the contrary, ideally the null driver would remain empty, and the user32 code would provide the necessary functionality, while letting the drivers override only the parts that need special handling.
I can only agree. It's however sometimes a bit hard to tell what was a driver specific behavior from what wasn't.
For instance, I don't know if the Android keyboard implementation is only implementing a simple en-US keyboard or if it has something specific that need to be kept.
I guess that answers it and I'll move the code instead.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/user32/driver.c | 197 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 195 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c index 65b9388a79a..40bbc25c7bc 100644 --- a/dlls/user32/driver.c +++ b/dlls/user32/driver.c @@ -257,9 +257,142 @@ static UINT CDECL nulldrv_GetKeyboardLayoutList( INT size, HKL *layouts ) return count; }
+static const WCHAR *nulldrv_scancode_name[] = +{ + 0, L"Esc", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9", L"0", L"-", L"=", L"Backspace", L"Tab", + L"Q", L"W", L"E", L"R", L"T", L"Y", L"U", L"I", L"O", L"P", L"[", L"]", L"Enter", L"Ctrl", L"A", L"S", + L"D", L"F", L"G", L"H", L"J", L"K", L"L", L";", L"'", L"`", L"Shift", L"\", L"Z", L"X", L"C", L"V", + L"B", L"N", L"M", L",", L".", L"/", L"Right Shift", L"Num *", L"Alt", L"Space", L"Caps Lock", L"F1", L"F2", L"F3", L"F4", L"F5", + L"F6", L"F7", L"F8", L"F9", L"F10", L"Pause", L"Scroll Lock", L"Num 7", L"Num 8", L"Num 9", L"Num -", L"Num 4", L"Num 5", L"Num 6", L"Num +", L"Num 1", + L"Num 2", L"Num 3", L"Num 0", L"Num Del", L"Sys Req", 0, L"\", L"F11", L"F12", 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L"F13", L"F14", L"F15", L"F16", + L"F17", L"F18", L"F19", L"F20", L"F21", L"F22", L"F23", L"F24", 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* extended */ + 0, L"\x1b", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9", L"0", L"-", L"=", L"\x08", L"\t", + L"Q", L"W", L"E", L"R", L"T", L"Y", L"U", L"I", L"O", L"P", L"[", L"]", L"Num Enter", L"Right Ctrl", L"A", L"S", + L"D", L"F", L"G", L"H", L"J", L"K", L"L", L";", L"'", L"`", 0, L"\", L"Z", L"X", L"C", L"V", + L"B", L"N", L"M", L",", L".", L"Num /", 0, L"Prnt Scrn", L"Right Alt", L" ", 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, L"Num Lock", L"Break", L"Home", L"Up", L"Page Up", L"-", L"Left", 0, L"Right", L"+", L"End", + L"Down", L"Page Down", L"Insert", L"Delete", L"<00>", 0, L"Help", 0, 0, 0, 0, L"Left Windows", L"Right Windows", L"Application", 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L"\t", 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const UINT nulldrv_vkey_to_char[] = +{ + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x08, 0x09, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, + ' ', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 0x00, 0x00, 0x00, 0x00, 0x00, + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '+', 0x00, '-', '.', '/', + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ';', '=', ',', '-', '.', '/', + '`', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, '[', '\', ']', ''', 0x00, + 0x00, 0x00, '\', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +static const UINT nulldrv_scancode_to_vkey[] = +{ + 0x00, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0xbd, 0xbb, 0x08, 0x09, + 0x51, 0x57, 0x45, 0x52, 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0xdb, 0xdd, 0x0d, 0xa2, 0x41, 0x53, + 0x44, 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0xba, 0xde, 0xc0, 0xa0, 0xdc, 0x5a, 0x58, 0x43, 0x56, + 0x42, 0x4e, 0x4d, 0xbc, 0xbe, 0xbf, 0xa1, 0x6a, 0xa4, 0x20, 0x14, 0x70, 0x71, 0x72, 0x73, 0x74, + 0x75, 0x76, 0x77, 0x78, 0x79, 0x90, 0x91, 0x24, 0x26, 0x21, 0x6d, 0x25, 0x0c, 0x27, 0x6b, 0x23, + 0x28, 0x22, 0x2d, 0x2e, 0x2c, 0x00, 0xe2, 0x7a, 0x7b, 0x0c, 0xee, 0xf1, 0xea, 0xf9, 0xf5, 0xf3, + 0x00, 0x00, 0xfb, 0x2f, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0xed, + 0x00, 0xe9, 0x00, 0xc1, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x09, 0x00, 0xc2, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0xe000 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x0d, 0xa3, 0x00, 0x00, + 0xad, 0xb7, 0xb3, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0x00, + 0xaf, 0x00, 0xac, 0x00, 0x00, 0x6f, 0x00, 0x2c, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x24, 0x26, 0x21, 0x00, 0x25, 0x00, 0x27, 0x00, 0x23, + 0x28, 0x22, 0x2d, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x5c, 0x5d, 0x00, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xab, 0xa8, 0xa9, 0xa7, 0xa6, 0xb6, 0xb4, 0xb5, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0xe100 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + static INT CDECL nulldrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size ) { - return 0; + INT code = ((lparam >> 16) & 0x1ff), vkey; + + TRACE_(keyboard)( "lparam %d, buffer %p, size %d.\n", lparam, buffer, size ); + + if (lparam & 0x2000000) + { + switch ((vkey = nulldrv_scancode_to_vkey[code])) + { + case VK_RSHIFT: vkey = VK_SHIFT; break; + case VK_RCONTROL: vkey = VK_CONTROL; break; + case VK_RMENU: vkey = VK_MENU; break; + } + if (vkey != nulldrv_scancode_to_vkey[code]) + { + for (code = 0; code < ARRAY_SIZE(nulldrv_scancode_to_vkey); ++code) + if (nulldrv_scancode_to_vkey[code] == vkey) break; + } + } + + if (code >= ARRAY_SIZE(nulldrv_scancode_name) || !nulldrv_scancode_name[code]) return 0; + wcsncpy( buffer, nulldrv_scancode_name[code], size ); + buffer[size - 1] = 0; + return min( wcslen( nulldrv_scancode_name[code] ), size - 1 ); }
static HKL CDECL nulldrv_GetKeyboardLayout( DWORD thread_id ) @@ -286,7 +419,67 @@ static HKL CDECL nulldrv_LoadKeyboardLayout( LPCWSTR name, UINT flags )
static UINT CDECL nulldrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout ) { - return 0; + UINT ret; + + TRACE_(keyboard)( "code %u, type %u, layout %p.\n", code, type, layout ); + + switch (type) + { + case MAPVK_VK_TO_VSC_EX: + case MAPVK_VK_TO_VSC: + switch (code) + { + case VK_SHIFT: code = VK_LSHIFT; break; + case VK_CONTROL: code = VK_LCONTROL; break; + case VK_MENU: code = VK_LMENU; break; + case VK_NUMPAD0: code = VK_INSERT; break; + case VK_NUMPAD1: code = VK_END; break; + case VK_NUMPAD2: code = VK_DOWN; break; + case VK_NUMPAD3: code = VK_NEXT; break; + case VK_NUMPAD4: code = VK_LEFT; break; + case VK_NUMPAD5: code = VK_CLEAR; break; + case VK_NUMPAD6: code = VK_RIGHT; break; + case VK_NUMPAD7: code = VK_HOME; break; + case VK_NUMPAD8: code = VK_UP; break; + case VK_NUMPAD9: code = VK_PRIOR; break; + case VK_DECIMAL: code = VK_DELETE; break; + } + for (ret = 0; ret < ARRAY_SIZE( nulldrv_scancode_to_vkey ); ++ret) + if (nulldrv_scancode_to_vkey[ret] == code) break; + if (ret >= ARRAY_SIZE( nulldrv_scancode_to_vkey )) return 0; + if (type == MAPVK_VK_TO_VSC) + { + if (ret >= 0x200) ret = 0; + else ret &= 0xff; + } + else if (ret >= 0x100) ret = 0xe000 | (ret - 0x100); + break; + case MAPVK_VSC_TO_VK: + case MAPVK_VSC_TO_VK_EX: + if (code & 0xe000) code = ((code + 0x100) & 0x3ff); + if (code >= ARRAY_SIZE( nulldrv_scancode_to_vkey )) return 0; + ret = nulldrv_scancode_to_vkey[code]; + if (type == MAPVK_VSC_TO_VK) + { + switch (ret) + { + case VK_LSHIFT: case VK_RSHIFT: ret = VK_SHIFT; break; + case VK_LCONTROL: case VK_RCONTROL: ret = VK_CONTROL; break; + case VK_LMENU: case VK_RMENU: ret = VK_MENU; break; + } + } + break; + case MAPVK_VK_TO_CHAR: + if (code >= ARRAY_SIZE( nulldrv_vkey_to_char )) return 0; + ret = nulldrv_vkey_to_char[code]; + break; + default: + FIXME_(keyboard)( "unknown type %d\n", type ); + return 0; + } + + TRACE_(keyboard)( "returning 0x%04x\n", ret ); + return ret; }
static BOOL CDECL nulldrv_RegisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=88965
Your paranoid android.
=== debiant2 (64 bit WoW report) ===
user32: win.c:10096: Test failed: Expected foreground window 0, got 0000000000CF00CC win.c:10102: Test failed: Expected foreground window 00000000000E013E, got 0000000000CF00CC
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/user32/driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c index 40bbc25c7bc..d8bb7a423e7 100644 --- a/dlls/user32/driver.c +++ b/dlls/user32/driver.c @@ -491,6 +491,7 @@ static INT CDECL nulldrv_ToUnicodeEx( UINT virt, UINT scan, const BYTE *state, L int size, UINT flags, HKL layout ) { WCHAR buffer[2]; + BOOL alt = state[VK_MENU] & 0x80; BOOL shift = state[VK_SHIFT] & 0x80; BOOL ctrl = state[VK_CONTROL] & 0x80; BOOL numlock = state[VK_NUMLOCK] & 0x01; @@ -550,7 +551,7 @@ static INT CDECL nulldrv_ToUnicodeEx( UINT virt, UINT scan, const BYTE *state, L break; } } - else /* Control codes */ + else if (!alt) /* Control codes */ { switch (virt) {
As shown by user32 input and msg tests.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/user32/driver.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c index d8bb7a423e7..ca790f30a63 100644 --- a/dlls/user32/driver.c +++ b/dlls/user32/driver.c @@ -504,7 +504,8 @@ static INT CDECL nulldrv_ToUnicodeEx( UINT virt, UINT scan, const BYTE *state, L
if (scan & 0x8000) return 0; /* key up */
- if (!ctrl) + if (virt == VK_ESCAPE) buffer[0] = VK_ESCAPE; + else if (!ctrl) { switch (virt) { @@ -559,6 +560,8 @@ static INT CDECL nulldrv_ToUnicodeEx( UINT virt, UINT scan, const BYTE *state, L case VK_OEM_5: buffer[0] = 0x1c; break; case VK_OEM_6: buffer[0] = 0x1d; break; case VK_SUBTRACT: buffer[0] = 0x1e; break; + case VK_RETURN: buffer[0] = shift ? 0 : '\n'; break; + case VK_SPACE: buffer[0] = ' '; break; default: if (virt >= 'A' && virt <= 'Z') buffer[0] = virt - 'A' + 1; break;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=88967
Your paranoid android.
=== debiant2 (32 bit Chinese:China report) ===
user32: menu.c:2337: Test failed: test 25
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/user32/driver.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c index ca790f30a63..4a68abaede4 100644 --- a/dlls/user32/driver.c +++ b/dlls/user32/driver.c @@ -36,6 +36,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(user); WINE_DECLARE_DEBUG_CHANNEL(winediag); WINE_DECLARE_DEBUG_CHANNEL(keyboard); +WINE_DECLARE_DEBUG_CHANNEL(cursor);
static USER_DRIVER null_driver, lazy_load_driver;
@@ -605,17 +606,20 @@ static void CDECL nulldrv_SetCursor( HCURSOR cursor )
static BOOL CDECL nulldrv_GetCursorPos( LPPOINT pt ) { - return FALSE; + TRACE_(cursor)( "pt %p.\n", pt ); + return TRUE; }
static BOOL CDECL nulldrv_SetCursorPos( INT x, INT y ) { - return FALSE; + TRACE_(cursor)( "x %d, y %d.\n", x, y ); + return TRUE; }
static BOOL CDECL nulldrv_ClipCursor( LPCRECT clip ) { - return FALSE; + TRACE_(cursor)( "clip %s.\n", wine_dbgstr_rect(clip) ); + return TRUE; }
static void CDECL nulldrv_UpdateClipboard(void)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=88968
Your paranoid android.
=== debiant2 (32 bit Chinese:China report) ===
user32: clipboard.c:760: Test failed: 2: gle 5 clipboard.c:765: Test failed: 2.0: got 0000 instead of 000d clipboard.c:805: Test failed: 2: gle 1418 clipboard.c:815: Test failed: 2: count 4 clipboard.c:818: Test failed: 2: gle 1418 clipboard.c:833: Test failed: 2: gle 5 clipboard.c:838: Test failed: 2.0: got 0000 instead of 000d clipboard.c:868: Test failed: 2: gle 1418 clipboard.c:717: Test failed: 3: gle 5 clipboard.c:719: Test failed: 3: gle 1418 clipboard.c:746: Test failed: 3: count 4 clipboard.c:749: Test failed: 3: gle 1418 clipboard.c:755: Test failed: 3: 000e not available clipboard.c:755: Test failed: 3: 0003 not available clipboard.c:757: Test failed: 3: count 4 instead of 2 clipboard.c:765: Test failed: 3.0: got 000d instead of 000e
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=88963
Your paranoid android.
=== debiant2 (64 bit WoW report) ===
user32: win.c:10102: Test failed: Expected foreground window 00000000000E013E, got 0000000000CF00CC