Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27238 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31899 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35907 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385 Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
This series should be no-op and just adds some tests and does some refactoring in preparation for the actual bug fixes.
dlls/user32/tests/input.c | 128 +++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 65 deletions(-)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 9d75daa0bd5..9540566867f 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -3739,15 +3739,48 @@ struct get_key_state_thread_params int index; };
+#define check_get_keyboard_state(i, c, x, todo) check_get_keyboard_state_(i, c, x, todo, __LINE__) +static void check_get_keyboard_state_(int i, int c, int x, int todo, int line) +{ + unsigned char keystate[256]; + BOOL ret; + + memset(keystate, 0, sizeof(keystate)); + ret = GetKeyboardState(keystate); + ok_(__FILE__, line)(ret, "GetKeyboardState failed, %u\n", GetLastError()); + todo_wine_if(todo) ok_(__FILE__, line)(!(keystate['X'] & 0x80) == !x, "%d: expected that X keystate is %s\n", i, x ? "set" : "unset"); + ok_(__FILE__, line)(!(keystate['C'] & 0x80) == !c, "%d: expected that C keystate is %s\n", i, c ? "set" : "unset"); + + /* calling it twice shouldn't change */ + memset(keystate, 0, sizeof(keystate)); + ret = GetKeyboardState(keystate); + ok_(__FILE__, line)(ret, "GetKeyboardState failed, %u\n", GetLastError()); + todo_wine_if(todo) ok_(__FILE__, line)(!(keystate['X'] & 0x80) == !x, "%d: expected that X keystate is %s\n", i, x ? "set" : "unset"); + ok_(__FILE__, line)(!(keystate['C'] & 0x80) == !c, "%d: expected that C keystate is %s\n", i, c ? "set" : "unset"); +} + +#define check_get_key_state(i, c, x, todo) check_get_key_state_(i, c, x, todo, __LINE__) +static void check_get_key_state_(int i, int c, int x, int todo, int line) +{ + SHORT state; + + state = GetKeyState('X'); + todo_wine_if(todo) ok_(__FILE__, line)(!(state & 0x8000) == !x, "%d: expected that X highest bit is %s, got %#x\n", i, x ? "set" : "unset", state); + ok_(__FILE__, line)(!(state & 0x007e), "%d: expected that X undefined bits are unset, got %#x\n", i, state); + + state = GetKeyState('C'); + ok_(__FILE__, line)(!(state & 0x8000) == !c, "%d: expected that C highest bit is %s, got %#x\n", i, c ? "set" : "unset", state); + ok_(__FILE__, line)(!(state & 0x007e), "%d: expected that C undefined bits are unset, got %#x\n", i, state); +} + static DWORD WINAPI get_key_state_thread(void *arg) { struct get_key_state_thread_params *params = arg; struct get_key_state_test_desc* test; HANDLE *semaphores = params->semaphores; DWORD result; - BYTE keystate[256]; BOOL has_queue; - BOOL ret; + BOOL expect_x; MSG msg; int i = params->index;
@@ -3770,67 +3803,21 @@ static DWORD WINAPI get_key_state_thread(void *arg) result = WaitForSingleObject(semaphores[1], 1000); ok(result == WAIT_OBJECT_0, "%d: WaitForSingleObject returned %u\n", i, result);
- memset(keystate, 0, sizeof(keystate)); - ret = GetKeyboardState(keystate); - ok(ret, "GetKeyboardState failed, %u\n", GetLastError()); - result = keystate['X']; - todo_wine_if(!has_queue) - ok(!result, "%d: expected that keystate is not set, got %#x\n", i, result); - - result = keystate['C']; - ok(!result, "%d: expected that C keystate is not set, got %#x\n", i, result); + if (!has_queue) expect_x = FALSE; + else expect_x = TRUE;
- result = GetKeyState('X'); - if (!has_queue) todo_wine ok(!(result & 0x8000), "%d: expected that highest bit is unset, got %#x\n", i, result); - else todo_wine ok((result & 0x8000), "%d: expected that highest bit is set, got %#x\n", i, result); - ok(!(result & 0x007e), "%d: expected that undefined bits are unset, got %#x\n", i, result); - - result = GetKeyState('C'); - ok(!(result & 0x8000), "%d: expected that C highest bit is unset, got %#x\n", i, result); - ok(!(result & 0x007e), "%d: expected that C undefined bits are unset, got %#x\n", i, result); - - memset(keystate, 0, sizeof(keystate)); - ret = GetKeyboardState(keystate); - ok(ret, "GetKeyboardState failed, %u\n", GetLastError()); - result = keystate['X']; - if (!has_queue) todo_wine ok(!result, "%d: expected that keystate is unset, got %#x\n", i, result); - else todo_wine ok(result, "%d: expected that keystate is set, got %#x\n", i, result); - - result = keystate['C']; - ok(!result, "%d: expected that C keystate is not set, got %#x\n", i, result); + check_get_keyboard_state(i, FALSE, FALSE, /* todo */ !has_queue); + check_get_key_state(i, FALSE, expect_x, /* todo */ TRUE); + check_get_keyboard_state(i, FALSE, expect_x, /* todo */ TRUE);
/* key released */ ReleaseSemaphore(semaphores[0], 1, NULL); result = WaitForSingleObject(semaphores[1], 1000); ok(result == WAIT_OBJECT_0, "%d: WaitForSingleObject returned %u\n", i, result);
- memset(keystate, 0, sizeof(keystate)); - ret = GetKeyboardState(keystate); - ok(ret, "GetKeyboardState failed, %u\n", GetLastError()); - result = keystate['X']; - if (!has_queue) ok(!result, "%d: expected that keystate is unset, got %#x\n", i, result); - else todo_wine ok(result, "%d: expected that keystate is set, got %#x\n", i, result); - - result = keystate['C']; - ok(!result, "%d: expected that C keystate is not set, got %#x\n", i, result); - - result = GetKeyState('X'); - ok(!(result & 0x8000), "%d: expected that highest bit is unset, got %#x\n", i, result); - ok(!(result & 0x007e), "%d: expected that undefined bits are unset, got %#x\n", i, result); - - result = GetKeyState('C'); - ok(!(result & 0x8000), "%d: expected that C highest bit is unset, got %#x\n", i, result); - ok(!(result & 0x007e), "%d: expected that C undefined bits are unset, got %#x\n", i, result); - - memset(keystate, 0, sizeof(keystate)); - ret = GetKeyboardState(keystate); - ok(ret, "GetKeyboardState failed, %u\n", GetLastError()); - result = keystate['X']; - if (!has_queue) ok(!result || broken(result) /* w2008 */, "%d: expected that keystate is unset, got %#x\n", i, result); - else todo_wine ok(result || broken(!result) /* w2008 */, "%d: expected that keystate is set, got %#x\n", i, result); - - result = keystate['C']; - ok(!result, "%d: expected that C keystate is not set, got %#x\n", i, result); + check_get_keyboard_state(i, FALSE, expect_x, /* todo */ has_queue); + check_get_key_state(i, FALSE, FALSE, /* todo */ FALSE); + check_get_keyboard_state(i, FALSE, FALSE, /* todo */ FALSE);
return 0; } @@ -3841,6 +3828,7 @@ static void test_GetKeyState(void) HANDLE thread; DWORD result; BYTE keystate[256]; + BOOL expect_x; HWND hwnd; MSG msg; int i; @@ -3888,13 +3876,19 @@ static void test_GetKeyState(void) keybd_event('X', 0, 0, 0); keystate['C'] = 0xff; SetKeyboardState(keystate); + + check_get_keyboard_state(i, TRUE, FALSE, /* todo */ FALSE); + check_get_key_state(i, TRUE, FALSE, /* todo */ FALSE); + check_get_keyboard_state(i, TRUE, FALSE, /* todo */ FALSE); + if (test->peek_message_main) while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
- result = GetKeyState('C'); - ok((result & 0x8000), "%d: expected that highest bit is set, got %#x\n", i, result); - result = GetKeyState('X'); - if (test->peek_message_main) ok((result & 0x8000), "%d: expected that highest bit is set, got %#x\n", i, result); - else ok(!(result & 0x8000), "%d: expected that highest bit is unset, got %#x\n", i, result); + if (test->peek_message_main) expect_x = TRUE; + else expect_x = FALSE; + + check_get_keyboard_state(i, TRUE, expect_x, /* todo */ FALSE); + check_get_key_state(i, TRUE, expect_x, /* todo */ FALSE); + check_get_keyboard_state(i, TRUE, expect_x, /* todo */ FALSE);
ReleaseSemaphore(params.semaphores[1], 1, NULL);
@@ -3905,12 +3899,16 @@ static void test_GetKeyState(void) keybd_event('X', 0, KEYEVENTF_KEYUP, 0); keystate['C'] = 0x00; SetKeyboardState(keystate); + + check_get_keyboard_state(i, FALSE, FALSE, /* todo */ FALSE); + check_get_key_state(i, FALSE, FALSE, /* todo */ FALSE); + check_get_keyboard_state(i, FALSE, FALSE, /* todo */ FALSE); + if (test->peek_message_main) while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
- result = GetKeyState('C'); - ok(!(result & 0x8000), "%d: expected that highest bit is unset, got %#x\n", i, result); - result = GetKeyState('X'); - ok(!(result & 0x8000), "%d: expected that highest bit is unset, got %#x\n", i, result); + check_get_keyboard_state(i, FALSE, FALSE, /* todo */ FALSE); + check_get_key_state(i, FALSE, FALSE, /* todo */ FALSE); + check_get_keyboard_state(i, FALSE, FALSE, /* todo */ FALSE);
ReleaseSemaphore(params.semaphores[1], 1, NULL);
As it changes the results on the second and later iterations.
This shows for instance that without a thread message queue, the first key press is always missed but then the thread input will follow desktop async keystate updates.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27238 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31899 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35907 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/user32/tests/input.c | 148 ++++++++++++++++++++------------------ 1 file changed, 77 insertions(+), 71 deletions(-)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 9540566867f..80548e0ed3c 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -3739,8 +3739,8 @@ struct get_key_state_thread_params int index; };
-#define check_get_keyboard_state(i, c, x, todo) check_get_keyboard_state_(i, c, x, todo, __LINE__) -static void check_get_keyboard_state_(int i, int c, int x, int todo, int line) +#define check_get_keyboard_state(i, j, c, x, todo) check_get_keyboard_state_(i, j, c, x, todo, __LINE__) +static void check_get_keyboard_state_(int i, int j, int c, int x, int todo, int line) { unsigned char keystate[256]; BOOL ret; @@ -3748,29 +3748,29 @@ static void check_get_keyboard_state_(int i, int c, int x, int todo, int line) memset(keystate, 0, sizeof(keystate)); ret = GetKeyboardState(keystate); ok_(__FILE__, line)(ret, "GetKeyboardState failed, %u\n", GetLastError()); - todo_wine_if(todo) ok_(__FILE__, line)(!(keystate['X'] & 0x80) == !x, "%d: expected that X keystate is %s\n", i, x ? "set" : "unset"); - ok_(__FILE__, line)(!(keystate['C'] & 0x80) == !c, "%d: expected that C keystate is %s\n", i, c ? "set" : "unset"); + todo_wine_if(todo) ok_(__FILE__, line)(!(keystate['X'] & 0x80) == !x, "%d:%d: expected that X keystate is %s\n", i, j, x ? "set" : "unset"); + ok_(__FILE__, line)(!(keystate['C'] & 0x80) == !c, "%d:%d: expected that C keystate is %s\n", i, j, c ? "set" : "unset");
/* calling it twice shouldn't change */ memset(keystate, 0, sizeof(keystate)); ret = GetKeyboardState(keystate); ok_(__FILE__, line)(ret, "GetKeyboardState failed, %u\n", GetLastError()); - todo_wine_if(todo) ok_(__FILE__, line)(!(keystate['X'] & 0x80) == !x, "%d: expected that X keystate is %s\n", i, x ? "set" : "unset"); - ok_(__FILE__, line)(!(keystate['C'] & 0x80) == !c, "%d: expected that C keystate is %s\n", i, c ? "set" : "unset"); + todo_wine_if(todo) ok_(__FILE__, line)(!(keystate['X'] & 0x80) == !x, "%d:%d: expected that X keystate is %s\n", i, j, x ? "set" : "unset"); + ok_(__FILE__, line)(!(keystate['C'] & 0x80) == !c, "%d:%d: expected that C keystate is %s\n", i, j, c ? "set" : "unset"); }
-#define check_get_key_state(i, c, x, todo) check_get_key_state_(i, c, x, todo, __LINE__) -static void check_get_key_state_(int i, int c, int x, int todo, int line) +#define check_get_key_state(i, j, c, x, todo) check_get_key_state_(i, j, c, x, todo, __LINE__) +static void check_get_key_state_(int i, int j, int c, int x, int todo, int line) { SHORT state;
state = GetKeyState('X'); - todo_wine_if(todo) ok_(__FILE__, line)(!(state & 0x8000) == !x, "%d: expected that X highest bit is %s, got %#x\n", i, x ? "set" : "unset", state); - ok_(__FILE__, line)(!(state & 0x007e), "%d: expected that X undefined bits are unset, got %#x\n", i, state); + todo_wine_if(todo) ok_(__FILE__, line)(!(state & 0x8000) == !x, "%d:%d: expected that X highest bit is %s, got %#x\n", i, j, x ? "set" : "unset", state); + ok_(__FILE__, line)(!(state & 0x007e), "%d:%d: expected that X undefined bits are unset, got %#x\n", i, j, state);
state = GetKeyState('C'); - ok_(__FILE__, line)(!(state & 0x8000) == !c, "%d: expected that C highest bit is %s, got %#x\n", i, c ? "set" : "unset", state); - ok_(__FILE__, line)(!(state & 0x007e), "%d: expected that C undefined bits are unset, got %#x\n", i, state); + ok_(__FILE__, line)(!(state & 0x8000) == !c, "%d:%d: expected that C highest bit is %s, got %#x\n", i, j, c ? "set" : "unset", state); + ok_(__FILE__, line)(!(state & 0x007e), "%d:%d: expected that C undefined bits are unset, got %#x\n", i, j, state); }
static DWORD WINAPI get_key_state_thread(void *arg) @@ -3782,7 +3782,7 @@ static DWORD WINAPI get_key_state_thread(void *arg) BOOL has_queue; BOOL expect_x; MSG msg; - int i = params->index; + int i = params->index, j;
test = get_key_state_tests + i; has_queue = test->peek_message; @@ -3793,31 +3793,34 @@ static DWORD WINAPI get_key_state_thread(void *arg) ok(!is_keyboard_message(msg.message), "%d: PeekMessageA got keyboard message.\n", i); }
- /* initialization */ - ReleaseSemaphore(semaphores[0], 1, NULL); - result = WaitForSingleObject(semaphores[1], 1000); - ok(result == WAIT_OBJECT_0, "%d: WaitForSingleObject returned %u\n", i, result); + for (j = 0; j < 4; ++j) + { + /* initialization */ + ReleaseSemaphore(semaphores[0], 1, NULL); + result = WaitForSingleObject(semaphores[1], 1000); + ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %u\n", i, j, result);
- /* key pressed */ - ReleaseSemaphore(semaphores[0], 1, NULL); - result = WaitForSingleObject(semaphores[1], 1000); - ok(result == WAIT_OBJECT_0, "%d: WaitForSingleObject returned %u\n", i, result); + /* key pressed */ + ReleaseSemaphore(semaphores[0], 1, NULL); + result = WaitForSingleObject(semaphores[1], 1000); + ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %u\n", i, j, result);
- if (!has_queue) expect_x = FALSE; - else expect_x = TRUE; + if (!has_queue && j == 0) expect_x = FALSE; + else expect_x = TRUE;
- check_get_keyboard_state(i, FALSE, FALSE, /* todo */ !has_queue); - check_get_key_state(i, FALSE, expect_x, /* todo */ TRUE); - check_get_keyboard_state(i, FALSE, expect_x, /* todo */ TRUE); + check_get_keyboard_state(i, j, FALSE, FALSE, /* todo */ !has_queue); + check_get_key_state(i, j, FALSE, expect_x, /* todo */ has_queue || j == 0); + check_get_keyboard_state(i, j, FALSE, expect_x, /* todo */ has_queue || j == 0);
- /* key released */ - ReleaseSemaphore(semaphores[0], 1, NULL); - result = WaitForSingleObject(semaphores[1], 1000); - ok(result == WAIT_OBJECT_0, "%d: WaitForSingleObject returned %u\n", i, result); + /* key released */ + ReleaseSemaphore(semaphores[0], 1, NULL); + result = WaitForSingleObject(semaphores[1], 1000); + ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %u\n", i, j, result);
- check_get_keyboard_state(i, FALSE, expect_x, /* todo */ has_queue); - check_get_key_state(i, FALSE, FALSE, /* todo */ FALSE); - check_get_keyboard_state(i, FALSE, FALSE, /* todo */ FALSE); + check_get_keyboard_state(i, j, FALSE, expect_x, /* todo */ has_queue || j > 0); + check_get_key_state(i, j, FALSE, FALSE, /* todo */ FALSE); + check_get_keyboard_state(i, j, FALSE, FALSE, /* todo */ FALSE); + }
return 0; } @@ -3831,7 +3834,7 @@ static void test_GetKeyState(void) BOOL expect_x; HWND hwnd; MSG msg; - int i; + int i, j;
BOOL us_kbd = (GetKeyboardLayout(0) == (HKL)(ULONG_PTR)0x04090409); if (!us_kbd) @@ -3859,58 +3862,61 @@ static void test_GetKeyState(void) thread = CreateThread(NULL, 0, get_key_state_thread, ¶ms, 0, NULL); ok(thread != NULL, "CreateThread failed %u\n", GetLastError());
- /* initialization */ - result = WaitForSingleObject(params.semaphores[0], 1000); - ok(result == WAIT_OBJECT_0, "%d: WaitForSingleObject returned %u\n", i, result); + for (j = 0; j < 4; ++j) + { + /* initialization */ + result = WaitForSingleObject(params.semaphores[0], 1000); + ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %u\n", i, j, result);
- SetForegroundWindow(hwnd); - SetFocus(hwnd); - empty_message_queue(); + SetForegroundWindow(hwnd); + SetFocus(hwnd); + empty_message_queue();
- ReleaseSemaphore(params.semaphores[1], 1, NULL); + ReleaseSemaphore(params.semaphores[1], 1, NULL);
- /* key pressed */ - result = WaitForSingleObject(params.semaphores[0], 1000); - ok(result == WAIT_OBJECT_0, "%d: WaitForSingleObject returned %u\n", i, result); + /* key pressed */ + result = WaitForSingleObject(params.semaphores[0], 1000); + ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %u\n", i, j, result);
- keybd_event('X', 0, 0, 0); - keystate['C'] = 0xff; - SetKeyboardState(keystate); + keybd_event('X', 0, 0, 0); + keystate['C'] = 0xff; + SetKeyboardState(keystate);
- check_get_keyboard_state(i, TRUE, FALSE, /* todo */ FALSE); - check_get_key_state(i, TRUE, FALSE, /* todo */ FALSE); - check_get_keyboard_state(i, TRUE, FALSE, /* todo */ FALSE); + check_get_keyboard_state(i, j, TRUE, FALSE, /* todo */ FALSE); + check_get_key_state(i, j, TRUE, FALSE, /* todo */ FALSE); + check_get_keyboard_state(i, j, TRUE, FALSE, /* todo */ FALSE);
- if (test->peek_message_main) while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); + if (test->peek_message_main) while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
- if (test->peek_message_main) expect_x = TRUE; - else expect_x = FALSE; + if (test->peek_message_main) expect_x = TRUE; + else expect_x = FALSE;
- check_get_keyboard_state(i, TRUE, expect_x, /* todo */ FALSE); - check_get_key_state(i, TRUE, expect_x, /* todo */ FALSE); - check_get_keyboard_state(i, TRUE, expect_x, /* todo */ FALSE); + check_get_keyboard_state(i, j, TRUE, expect_x, /* todo */ FALSE); + check_get_key_state(i, j, TRUE, expect_x, /* todo */ FALSE); + check_get_keyboard_state(i, j, TRUE, expect_x, /* todo */ FALSE);
- ReleaseSemaphore(params.semaphores[1], 1, NULL); + ReleaseSemaphore(params.semaphores[1], 1, NULL);
- /* key released */ - result = WaitForSingleObject(params.semaphores[0], 1000); - ok(result == WAIT_OBJECT_0, "%d: WaitForSingleObject returned %u\n", i, result); + /* key released */ + result = WaitForSingleObject(params.semaphores[0], 1000); + ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %u\n", i, j, result);
- keybd_event('X', 0, KEYEVENTF_KEYUP, 0); - keystate['C'] = 0x00; - SetKeyboardState(keystate); + keybd_event('X', 0, KEYEVENTF_KEYUP, 0); + keystate['C'] = 0x00; + SetKeyboardState(keystate);
- check_get_keyboard_state(i, FALSE, FALSE, /* todo */ FALSE); - check_get_key_state(i, FALSE, FALSE, /* todo */ FALSE); - check_get_keyboard_state(i, FALSE, FALSE, /* todo */ FALSE); + check_get_keyboard_state(i, j, FALSE, FALSE, /* todo */ FALSE); + check_get_key_state(i, j, FALSE, FALSE, /* todo */ FALSE); + check_get_keyboard_state(i, j, FALSE, FALSE, /* todo */ FALSE);
- if (test->peek_message_main) while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); + if (test->peek_message_main) while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
- check_get_keyboard_state(i, FALSE, FALSE, /* todo */ FALSE); - check_get_key_state(i, FALSE, FALSE, /* todo */ FALSE); - check_get_keyboard_state(i, FALSE, FALSE, /* todo */ FALSE); + check_get_keyboard_state(i, j, FALSE, FALSE, /* todo */ FALSE); + check_get_key_state(i, j, FALSE, FALSE, /* todo */ FALSE); + check_get_keyboard_state(i, j, FALSE, FALSE, /* todo */ FALSE);
- ReleaseSemaphore(params.semaphores[1], 1, NULL); + ReleaseSemaphore(params.semaphores[1], 1, NULL); + }
result = WaitForSingleObject(thread, 1000); ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
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=88135
Your paranoid android.
=== w1064v1809 (64 bit report) ===
user32: input.c:2747: Test failed: 0: expected WM_MOUSEMOVE message input.c:2747: Test failed: 1: expected WM_MOUSEMOVE message input.c:2747: Test failed: 2: expected WM_MOUSEMOVE message
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27238 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31899 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35907 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/user32/tests/input.c | 120 +++++++++++++++++++++++++------------- 1 file changed, 81 insertions(+), 39 deletions(-)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 80548e0ed3c..63163b7ed01 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -3719,18 +3719,40 @@ struct get_key_state_test_desc { BOOL peek_message; BOOL peek_message_main; + BOOL set_keyboard_state_main; + BOOL set_keyboard_state; };
struct get_key_state_test_desc get_key_state_tests[] = { /* 0: not peeking in thread, no msg queue: GetKeyState / GetKeyboardState miss key press */ - {FALSE, TRUE}, + {FALSE, TRUE, FALSE, FALSE}, /* 1: peeking on thread init, not in main: GetKeyState / GetKeyboardState catch key press */ /* - GetKeyboardState misses key press if called before GetKeyState */ /* - GetKeyboardState catches key press, if called after GetKeyState */ - { TRUE, FALSE}, + { TRUE, FALSE, FALSE, FALSE}, /* 2: peeking on thread init, and in main: GetKeyState / GetKeyboardState catch key press */ - { TRUE, TRUE}, + { TRUE, TRUE, FALSE, FALSE}, + + /* same tests but with SetKeyboardState called in main thread */ + /* 3: not peeking in thread, no msg queue: GetKeyState / GetKeyboardState miss key press */ + {FALSE, TRUE, TRUE, FALSE}, + /* 4: peeking on thread init, not in main: GetKeyState / GetKeyboardState catch key press */ + /* - GetKeyboardState misses key press if called before GetKeyState */ + /* - GetKeyboardState catches key press, if called after GetKeyState */ + { TRUE, FALSE, TRUE, FALSE}, + /* 5: peeking on thread init, and in main: GetKeyState / GetKeyboardState catch key press */ + { TRUE, TRUE, TRUE, FALSE}, + + /* same tests but with SetKeyboardState called in other thread */ + /* 6: not peeking in thread, no msg queue: GetKeyState / GetKeyboardState miss key press */ + {FALSE, TRUE, TRUE, TRUE}, + /* 7: peeking on thread init, not in main: GetKeyState / GetKeyboardState catch key press */ + /* - GetKeyboardState misses key press if called before GetKeyState */ + /* - GetKeyboardState catches key press, if called after GetKeyState */ + { TRUE, FALSE, TRUE, TRUE}, + /* 8: peeking on thread init, and in main: GetKeyState / GetKeyboardState catch key press */ + { TRUE, TRUE, TRUE, TRUE}, };
struct get_key_state_thread_params @@ -3739,8 +3761,8 @@ struct get_key_state_thread_params int index; };
-#define check_get_keyboard_state(i, j, c, x, todo) check_get_keyboard_state_(i, j, c, x, todo, __LINE__) -static void check_get_keyboard_state_(int i, int j, int c, int x, int todo, int line) +#define check_get_keyboard_state(i, j, c, x, todo_c, todo_x) check_get_keyboard_state_(i, j, c, x, todo_c, todo_x, __LINE__) +static void check_get_keyboard_state_(int i, int j, int c, int x, int todo_c, int todo_x, int line) { unsigned char keystate[256]; BOOL ret; @@ -3748,28 +3770,28 @@ static void check_get_keyboard_state_(int i, int j, int c, int x, int todo, int memset(keystate, 0, sizeof(keystate)); ret = GetKeyboardState(keystate); ok_(__FILE__, line)(ret, "GetKeyboardState failed, %u\n", GetLastError()); - todo_wine_if(todo) ok_(__FILE__, line)(!(keystate['X'] & 0x80) == !x, "%d:%d: expected that X keystate is %s\n", i, j, x ? "set" : "unset"); - ok_(__FILE__, line)(!(keystate['C'] & 0x80) == !c, "%d:%d: expected that C keystate is %s\n", i, j, c ? "set" : "unset"); + todo_wine_if(todo_x) ok_(__FILE__, line)(!(keystate['X'] & 0x80) == !x, "%d:%d: expected that X keystate is %s\n", i, j, x ? "set" : "unset"); + todo_wine_if(todo_c) ok_(__FILE__, line)(!(keystate['C'] & 0x80) == !c, "%d:%d: expected that C keystate is %s\n", i, j, c ? "set" : "unset");
/* calling it twice shouldn't change */ memset(keystate, 0, sizeof(keystate)); ret = GetKeyboardState(keystate); ok_(__FILE__, line)(ret, "GetKeyboardState failed, %u\n", GetLastError()); - todo_wine_if(todo) ok_(__FILE__, line)(!(keystate['X'] & 0x80) == !x, "%d:%d: expected that X keystate is %s\n", i, j, x ? "set" : "unset"); - ok_(__FILE__, line)(!(keystate['C'] & 0x80) == !c, "%d:%d: expected that C keystate is %s\n", i, j, c ? "set" : "unset"); + todo_wine_if(todo_x) ok_(__FILE__, line)(!(keystate['X'] & 0x80) == !x, "%d:%d: expected that X keystate is %s\n", i, j, x ? "set" : "unset"); + todo_wine_if(todo_c) ok_(__FILE__, line)(!(keystate['C'] & 0x80) == !c, "%d:%d: expected that C keystate is %s\n", i, j, c ? "set" : "unset"); }
-#define check_get_key_state(i, j, c, x, todo) check_get_key_state_(i, j, c, x, todo, __LINE__) -static void check_get_key_state_(int i, int j, int c, int x, int todo, int line) +#define check_get_key_state(i, j, c, x, todo_c, todo_x) check_get_key_state_(i, j, c, x, todo_c, todo_x, __LINE__) +static void check_get_key_state_(int i, int j, int c, int x, int todo_c, int todo_x, int line) { SHORT state;
state = GetKeyState('X'); - todo_wine_if(todo) ok_(__FILE__, line)(!(state & 0x8000) == !x, "%d:%d: expected that X highest bit is %s, got %#x\n", i, j, x ? "set" : "unset", state); + todo_wine_if(todo_x) ok_(__FILE__, line)(!(state & 0x8000) == !x, "%d:%d: expected that X highest bit is %s, got %#x\n", i, j, x ? "set" : "unset", state); ok_(__FILE__, line)(!(state & 0x007e), "%d:%d: expected that X undefined bits are unset, got %#x\n", i, j, state);
state = GetKeyState('C'); - ok_(__FILE__, line)(!(state & 0x8000) == !c, "%d:%d: expected that C highest bit is %s, got %#x\n", i, j, c ? "set" : "unset", state); + todo_wine_if(todo_c) ok_(__FILE__, line)(!(state & 0x8000) == !c, "%d:%d: expected that C highest bit is %s, got %#x\n", i, j, c ? "set" : "unset", state); ok_(__FILE__, line)(!(state & 0x007e), "%d:%d: expected that C undefined bits are unset, got %#x\n", i, j, state); }
@@ -3779,8 +3801,9 @@ static DWORD WINAPI get_key_state_thread(void *arg) struct get_key_state_test_desc* test; HANDLE *semaphores = params->semaphores; DWORD result; + BYTE keystate[256]; BOOL has_queue; - BOOL expect_x; + BOOL expect_x, expect_c; MSG msg; int i = params->index, j;
@@ -3800,26 +3823,36 @@ static DWORD WINAPI get_key_state_thread(void *arg) result = WaitForSingleObject(semaphores[1], 1000); ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %u\n", i, j, result);
+ if (test->set_keyboard_state) + { + keystate['C'] = 0xff; + SetKeyboardState(keystate); + } + /* key pressed */ ReleaseSemaphore(semaphores[0], 1, NULL); result = WaitForSingleObject(semaphores[1], 1000); ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %u\n", i, j, result);
- if (!has_queue && j == 0) expect_x = FALSE; + if (test->set_keyboard_state) expect_x = TRUE; + else if (!has_queue && j == 0) expect_x = FALSE; else expect_x = TRUE;
- check_get_keyboard_state(i, j, FALSE, FALSE, /* todo */ !has_queue); - check_get_key_state(i, j, FALSE, expect_x, /* todo */ has_queue || j == 0); - check_get_keyboard_state(i, j, FALSE, expect_x, /* todo */ has_queue || j == 0); + if (test->set_keyboard_state) expect_c = TRUE; + else expect_c = FALSE; + + check_get_keyboard_state(i, j, expect_c, FALSE, /* todo */ i == 6, !has_queue); + check_get_key_state(i, j, expect_c, expect_x, /* todo */ i == 6, i != 6 && (has_queue || j == 0)); + check_get_keyboard_state(i, j, expect_c, expect_x, /* todo */ i == 6, i != 6 && (has_queue || j == 0));
/* key released */ ReleaseSemaphore(semaphores[0], 1, NULL); result = WaitForSingleObject(semaphores[1], 1000); - ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %u\n", i, j, result); + ok(result == WAIT_OBJECT_0, "%d: WaitForSingleObject returned %u\n", i, result);
- check_get_keyboard_state(i, j, FALSE, expect_x, /* todo */ has_queue || j > 0); - check_get_key_state(i, j, FALSE, FALSE, /* todo */ FALSE); - check_get_keyboard_state(i, j, FALSE, FALSE, /* todo */ FALSE); + check_get_keyboard_state(i, j, expect_c, expect_x, /* todo */ i == 6, has_queue || i == 6 || j > 0); + check_get_key_state(i, j, expect_c, FALSE, /* todo */ i == 6, FALSE); + check_get_keyboard_state(i, j, expect_c, FALSE, /* todo */ i == 6, FALSE); }
return 0; @@ -3831,7 +3864,7 @@ static void test_GetKeyState(void) HANDLE thread; DWORD result; BYTE keystate[256]; - BOOL expect_x; + BOOL expect_x, expect_c; HWND hwnd; MSG msg; int i, j; @@ -3879,21 +3912,26 @@ static void test_GetKeyState(void) ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %u\n", i, j, result);
keybd_event('X', 0, 0, 0); - keystate['C'] = 0xff; - SetKeyboardState(keystate); + if (test->set_keyboard_state_main) + { + expect_c = TRUE; + keystate['C'] = 0xff; + SetKeyboardState(keystate); + } + else expect_c = FALSE;
- check_get_keyboard_state(i, j, TRUE, FALSE, /* todo */ FALSE); - check_get_key_state(i, j, TRUE, FALSE, /* todo */ FALSE); - check_get_keyboard_state(i, j, TRUE, FALSE, /* todo */ FALSE); + check_get_keyboard_state(i, j, expect_c, FALSE, /* todo */ FALSE, FALSE); + check_get_key_state(i, j, expect_c, FALSE, /* todo */ FALSE, FALSE); + check_get_keyboard_state(i, j, expect_c, FALSE, /* todo */ FALSE, FALSE);
if (test->peek_message_main) while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
if (test->peek_message_main) expect_x = TRUE; else expect_x = FALSE;
- check_get_keyboard_state(i, j, TRUE, expect_x, /* todo */ FALSE); - check_get_key_state(i, j, TRUE, expect_x, /* todo */ FALSE); - check_get_keyboard_state(i, j, TRUE, expect_x, /* todo */ FALSE); + check_get_keyboard_state(i, j, expect_c, expect_x, /* todo */ FALSE, FALSE); + check_get_key_state(i, j, expect_c, expect_x, /* todo */ FALSE, FALSE); + check_get_keyboard_state(i, j, expect_c, expect_x, /* todo */ FALSE, FALSE);
ReleaseSemaphore(params.semaphores[1], 1, NULL);
@@ -3902,18 +3940,22 @@ static void test_GetKeyState(void) ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %u\n", i, j, result);
keybd_event('X', 0, KEYEVENTF_KEYUP, 0); - keystate['C'] = 0x00; - SetKeyboardState(keystate); + if (test->set_keyboard_state_main) + { + expect_x = FALSE; + keystate['C'] = 0x00; + SetKeyboardState(keystate); + }
- check_get_keyboard_state(i, j, FALSE, FALSE, /* todo */ FALSE); - check_get_key_state(i, j, FALSE, FALSE, /* todo */ FALSE); - check_get_keyboard_state(i, j, FALSE, FALSE, /* todo */ FALSE); + check_get_keyboard_state(i, j, FALSE, expect_x, /* todo */ FALSE, FALSE); + check_get_key_state(i, j, FALSE, expect_x, /* todo */ FALSE, FALSE); + check_get_keyboard_state(i, j, FALSE, expect_x, /* todo */ FALSE, FALSE);
if (test->peek_message_main) while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
- check_get_keyboard_state(i, j, FALSE, FALSE, /* todo */ FALSE); - check_get_key_state(i, j, FALSE, FALSE, /* todo */ FALSE); - check_get_keyboard_state(i, j, FALSE, FALSE, /* todo */ FALSE); + check_get_keyboard_state(i, j, FALSE, FALSE, /* todo */ FALSE, FALSE); + check_get_key_state(i, j, FALSE, FALSE, /* todo */ FALSE, FALSE); + check_get_keyboard_state(i, j, FALSE, FALSE, /* todo */ FALSE, FALSE);
ReleaseSemaphore(params.semaphores[1], 1, NULL); }
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=88136
Your paranoid android.
=== w1064v1809 (32 bit report) ===
user32: input.c:2747: Test failed: 0: expected WM_MOUSEMOVE message input.c:2747: Test failed: 1: expected WM_MOUSEMOVE message input.c:2747: Test failed: 2: expected WM_MOUSEMOVE message
And replace it with an async param if we want the global async keystate.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27238 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31899 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35907 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/user32/input.c | 4 +--- dlls/wineandroid.drv/keyboard.c | 2 +- dlls/winemac.drv/keyboard.c | 2 +- dlls/winex11.drv/keyboard.c | 2 +- server/protocol.def | 4 ++-- server/queue.c | 14 +++++--------- 6 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/dlls/user32/input.c b/dlls/user32/input.c index e06f8b4413e..46dff3a89d4 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -413,7 +413,7 @@ SHORT WINAPI DECLSPEC_HOTPATCH GetAsyncKeyState( INT key ) ret = 0; SERVER_START_REQ( get_key_state ) { - req->tid = 0; + req->async = 1; req->key = key; if (key_state_info) { @@ -550,7 +550,6 @@ SHORT WINAPI DECLSPEC_HOTPATCH GetKeyState(INT vkey)
SERVER_START_REQ( get_key_state ) { - req->tid = GetCurrentThreadId(); req->key = vkey; if (!wine_server_call( req )) retval = (signed char)(reply->state & 0x81); } @@ -573,7 +572,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetKeyboardState( LPBYTE state ) memset( state, 0, 256 ); SERVER_START_REQ( get_key_state ) { - req->tid = GetCurrentThreadId(); req->key = -1; wine_server_set_reply( req, state, 256 ); ret = !wine_server_call_err( req ); diff --git a/dlls/wineandroid.drv/keyboard.c b/dlls/wineandroid.drv/keyboard.c index a0f3257f74b..1c8a1e4f68f 100644 --- a/dlls/wineandroid.drv/keyboard.c +++ b/dlls/wineandroid.drv/keyboard.c @@ -660,7 +660,7 @@ static BOOL get_async_key_state( BYTE state[256] )
SERVER_START_REQ( get_key_state ) { - req->tid = 0; + req->async = 1; req->key = -1; wine_server_set_reply( req, state, 256 ); ret = !wine_server_call( req ); diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index 45770b3125b..1b74300e93a 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -942,7 +942,7 @@ static BOOL get_async_key_state(BYTE state[256])
SERVER_START_REQ(get_key_state) { - req->tid = 0; + req->async = 1; req->key = -1; wine_server_set_reply(req, state, 256); ret = !wine_server_call(req); diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index 48da12c0292..517522727fe 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1161,7 +1161,7 @@ static BOOL get_async_key_state( BYTE state[256] )
SERVER_START_REQ( get_key_state ) { - req->tid = 0; + req->async = 1; req->key = -1; wine_server_set_reply( req, state, 256 ); ret = !wine_server_call( req ); diff --git a/server/protocol.def b/server/protocol.def index be524f92868..c468c5b7151 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2749,9 +2749,9 @@ enum coords_relative @END
-/* Retrieve queue keyboard state for a given thread */ +/* Retrieve queue keyboard state for current thread or global async state */ @REQ(get_key_state) - thread_id_t tid; /* id of thread */ + int async; /* whether to query the async state */ int key; /* optional key code or -1 */ @REPLY unsigned char state; /* state of specified key */ diff --git a/server/queue.c b/server/queue.c index e47980a4aa8..13a3641cfb8 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2964,14 +2964,13 @@ DECL_HANDLER(get_thread_input) }
-/* retrieve queue keyboard state for a given thread */ +/* retrieve queue keyboard state for current thread or global async state */ DECL_HANDLER(get_key_state) { - struct thread *thread; struct desktop *desktop; data_size_t size = min( 256, get_reply_max_size() );
- if (!req->tid) /* get global async key state */ + if (req->async) /* get global async key state */ { if (!(desktop = get_thread_desktop( current, 0 ))) return; if (req->key >= 0) @@ -2985,15 +2984,12 @@ DECL_HANDLER(get_key_state) else { unsigned char *keystate; - if (!(thread = get_thread_from_id( req->tid ))) return; - if (thread->queue) + if (current->queue) { - if (req->key >= 0) reply->state = thread->queue->input->keystate[req->key & 0xff]; - set_reply_data( thread->queue->input->keystate, size ); - release_object( thread ); + if (req->key >= 0) reply->state = current->queue->input->keystate[req->key & 0xff]; + set_reply_data( current->queue->input->keystate, size ); return; } - release_object( thread );
/* fallback to desktop keystate */ if (!(desktop = get_thread_desktop( current, 0 ))) return;
As it is always set to GetCurrentThreadId().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27238 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31899 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35907 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/user32/input.c | 1 - dlls/winex11.drv/keyboard.c | 1 - server/protocol.def | 3 +-- server/queue.c | 18 +++--------------- 4 files changed, 4 insertions(+), 19 deletions(-)
diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 46dff3a89d4..8992c463c48 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -591,7 +591,6 @@ BOOL WINAPI SetKeyboardState( LPBYTE state )
SERVER_START_REQ( set_key_state ) { - req->tid = GetCurrentThreadId(); wine_server_add_data( req, state, 256 ); ret = !wine_server_call_err( req ); } diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index 517522727fe..35a801fc895 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1177,7 +1177,6 @@ static void set_async_key_state( const BYTE state[256] ) { SERVER_START_REQ( set_key_state ) { - req->tid = GetCurrentThreadId(); req->async = 1; wine_server_add_data( req, state, 256 ); wine_server_call( req ); diff --git a/server/protocol.def b/server/protocol.def index c468c5b7151..617818f622d 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2758,9 +2758,8 @@ enum coords_relative VARARG(keystate,bytes); /* state array for all the keys */ @END
-/* Set queue keyboard state for a given thread */ +/* Set queue keyboard state for current thread */ @REQ(set_key_state) - thread_id_t tid; /* id of thread */ int async; /* whether to change the async state too */ VARARG(keystate,bytes); /* state array for all the keys */ @END diff --git a/server/queue.c b/server/queue.c index 13a3641cfb8..e1f4f208fc8 100644 --- a/server/queue.c +++ b/server/queue.c @@ -3004,30 +3004,18 @@ DECL_HANDLER(get_key_state) }
-/* set queue keyboard state for a given thread */ +/* set queue keyboard state for current thread */ DECL_HANDLER(set_key_state) { - struct thread *thread; struct desktop *desktop; data_size_t size = min( 256, get_req_data_size() );
- if (!req->tid) /* set global async key state */ + if (current->queue) memcpy( current->queue->input->keystate, get_req_data(), size ); + if (req->async && (desktop = get_thread_desktop( current, 0 ))) { - if (!(desktop = get_thread_desktop( current, 0 ))) return; memcpy( desktop->keystate, get_req_data(), size ); release_object( desktop ); } - else - { - if (!(thread = get_thread_from_id( req->tid ))) return; - if (thread->queue) memcpy( thread->queue->input->keystate, get_req_data(), size ); - if (req->async && (desktop = get_thread_desktop( thread, 0 ))) - { - memcpy( desktop->keystate, get_req_data(), size ); - release_object( desktop ); - } - release_object( thread ); - } }
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=88138
Your paranoid android.
=== debiant2 (64 bit WoW report) ===
user32: win.c:10102: Test failed: Expected foreground window 00000000000E013E, got 0000000000CF00CC
When current thread doesn't have a message queue. It's going to be removed later anyway.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27238 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31899 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35907 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- server/queue.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/server/queue.c b/server/queue.c index e1f4f208fc8..b026c03e13d 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2981,16 +2981,9 @@ DECL_HANDLER(get_key_state) set_reply_data( desktop->keystate, size ); release_object( desktop ); } - else + else if (!current->queue) { unsigned char *keystate; - if (current->queue) - { - if (req->key >= 0) reply->state = current->queue->input->keystate[req->key & 0xff]; - set_reply_data( current->queue->input->keystate, size ); - return; - } - /* fallback to desktop keystate */ if (!(desktop = get_thread_desktop( current, 0 ))) return; if (req->key >= 0) reply->state = desktop->keystate[req->key & 0xff] & ~0x40; @@ -3001,6 +2994,12 @@ DECL_HANDLER(get_key_state) } release_object( desktop ); } + else + { + unsigned char *keystate = current->queue->input->keystate; + if (req->key >= 0) reply->state = keystate[req->key & 0xff]; + set_reply_data( keystate, size ); + } }
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=88134
Your paranoid android.
=== w1064 (32 bit report) ===
user32: input.c:1302: Test failed: Wrong set pos: (99,100)
=== w10pro64 (32 bit report) ===
user32: input.c:1292: Test failed: GetCursorPos: (99,100)