Rebase against 330dc601978922aa1d5864d29d94882d6b1990d1.

This commit is contained in:
Alistair Leslie-Hughes
2022-03-12 11:27:46 +11:00
parent 0e1d830578
commit f077cbe2d3
28 changed files with 467 additions and 458 deletions

View File

@@ -1,4 +1,4 @@
From 4778b1c3d59bd87b067b6266e38ddd9a5d8bae86 Mon Sep 17 00:00:00 2001
From d0142599d03573c50c889a7f9091a9ff2459304b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 1 Apr 2021 23:19:18 +0200
Subject: [PATCH] server: Create message queue and thread input in
@@ -19,10 +19,10 @@ Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385
2 files changed, 28 insertions(+), 27 deletions(-)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 63163b7ed01..c146e4b5cd9 100644
index 6cbf0d6254e..853c0f66df6 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -3761,8 +3761,8 @@ struct get_key_state_thread_params
@@ -3962,8 +3962,8 @@ struct get_key_state_thread_params
int index;
};
@@ -33,9 +33,9 @@ index 63163b7ed01..c146e4b5cd9 100644
{
unsigned char keystate[256];
BOOL ret;
@@ -3771,18 +3771,18 @@ static void check_get_keyboard_state_(int i, int j, int c, int x, int todo_c, in
@@ -3972,18 +3972,18 @@ static void check_get_keyboard_state_(int i, int j, int c, int x, int todo_c, in
ret = GetKeyboardState(keystate);
ok_(__FILE__, line)(ret, "GetKeyboardState failed, %u\n", GetLastError());
ok_(__FILE__, line)(ret, "GetKeyboardState failed, %lu\n", GetLastError());
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");
+ ok_(__FILE__, line)(!(keystate['C'] & 0x80) == !c, "%d:%d: expected that C keystate is %s\n", i, j, c ? "set" : "unset");
@@ -43,7 +43,7 @@ index 63163b7ed01..c146e4b5cd9 100644
/* calling it twice shouldn't change */
memset(keystate, 0, sizeof(keystate));
ret = GetKeyboardState(keystate);
ok_(__FILE__, line)(ret, "GetKeyboardState failed, %u\n", GetLastError());
ok_(__FILE__, line)(ret, "GetKeyboardState failed, %lu\n", GetLastError());
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");
+ ok_(__FILE__, line)(!(keystate['C'] & 0x80) == !c, "%d:%d: expected that C keystate is %s\n", i, j, c ? "set" : "unset");
@@ -56,7 +56,7 @@ index 63163b7ed01..c146e4b5cd9 100644
{
SHORT state;
@@ -3791,7 +3791,7 @@ static void check_get_key_state_(int i, int j, int c, int x, int todo_c, int tod
@@ -3992,7 +3992,7 @@ static void check_get_key_state_(int i, int j, int c, int x, int todo_c, int tod
ok_(__FILE__, line)(!(state & 0x007e), "%d:%d: expected that X undefined bits are unset, got %#x\n", i, j, state);
state = GetKeyState('C');
@@ -65,7 +65,7 @@ index 63163b7ed01..c146e4b5cd9 100644
ok_(__FILE__, line)(!(state & 0x007e), "%d:%d: expected that C undefined bits are unset, got %#x\n", i, j, state);
}
@@ -3808,7 +3808,7 @@ static DWORD WINAPI get_key_state_thread(void *arg)
@@ -4009,7 +4009,7 @@ static DWORD WINAPI get_key_state_thread(void *arg)
int i = params->index, j;
test = get_key_state_tests + i;
@@ -74,7 +74,7 @@ index 63163b7ed01..c146e4b5cd9 100644
if (test->peek_message)
{
@@ -3841,18 +3841,18 @@ static DWORD WINAPI get_key_state_thread(void *arg)
@@ -4042,18 +4042,18 @@ static DWORD WINAPI get_key_state_thread(void *arg)
if (test->set_keyboard_state) expect_c = TRUE;
else expect_c = FALSE;
@@ -88,7 +88,7 @@ index 63163b7ed01..c146e4b5cd9 100644
/* key released */
ReleaseSemaphore(semaphores[0], 1, NULL);
result = WaitForSingleObject(semaphores[1], 1000);
ok(result == WAIT_OBJECT_0, "%d: WaitForSingleObject returned %u\n", i, result);
ok(result == WAIT_OBJECT_0, "%d: WaitForSingleObject returned %lu\n", i, result);
- 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);
@@ -99,7 +99,7 @@ index 63163b7ed01..c146e4b5cd9 100644
}
return 0;
@@ -3920,18 +3920,18 @@ static void test_GetKeyState(void)
@@ -4121,18 +4121,18 @@ static void test_GetKeyState(void)
}
else expect_c = FALSE;
@@ -124,7 +124,7 @@ index 63163b7ed01..c146e4b5cd9 100644
ReleaseSemaphore(params.semaphores[1], 1, NULL);
@@ -3947,15 +3947,15 @@ static void test_GetKeyState(void)
@@ -4148,15 +4148,15 @@ static void test_GetKeyState(void)
SetKeyboardState(keystate);
}
@@ -147,10 +147,10 @@ index 63163b7ed01..c146e4b5cd9 100644
ReleaseSemaphore(params.semaphores[1], 1, NULL);
}
diff --git a/server/queue.c b/server/queue.c
index b026c03e13d..5c9f91a13c5 100644
index 4f69a082b74..561fa825ee7 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -3007,9 +3007,10 @@ DECL_HANDLER(get_key_state)
@@ -3080,9 +3080,10 @@ DECL_HANDLER(get_key_state)
DECL_HANDLER(set_key_state)
{
struct desktop *desktop;
@@ -163,5 +163,5 @@ index b026c03e13d..5c9f91a13c5 100644
{
memcpy( desktop->keystate, get_req_data(), size );
--
2.30.2
2.35.1

View File

@@ -1,4 +1,4 @@
From a6f4d1c57d31c0a8f50afd5af9d50b7e587c84f5 Mon Sep 17 00:00:00 2001
From ffa3222c7cfdd76ec21342e9540b01073d2e4bd7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 1 Apr 2021 23:30:46 +0200
Subject: [PATCH] server: Lock thread input keystate whenever it is modified.
@@ -19,10 +19,10 @@ Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385
2 files changed, 53 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index c146e4b5cd9..246569961be 100644
index 853c0f66df6..848b52d3870 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -3842,15 +3842,15 @@ static DWORD WINAPI get_key_state_thread(void *arg)
@@ -4043,15 +4043,15 @@ static DWORD WINAPI get_key_state_thread(void *arg)
else expect_c = FALSE;
check_get_keyboard_state(i, j, expect_c, FALSE, /* todo */ !has_queue);
@@ -34,7 +34,7 @@ index c146e4b5cd9..246569961be 100644
/* key released */
ReleaseSemaphore(semaphores[0], 1, NULL);
result = WaitForSingleObject(semaphores[1], 1000);
ok(result == WAIT_OBJECT_0, "%d: WaitForSingleObject returned %u\n", i, result);
ok(result == WAIT_OBJECT_0, "%d: WaitForSingleObject returned %lu\n", i, result);
- check_get_keyboard_state(i, j, expect_c, expect_x, /* todo */ has_queue || j > 0);
+ check_get_keyboard_state(i, j, expect_c, expect_x, /* todo */ !has_queue && j > 0);
@@ -42,10 +42,10 @@ index c146e4b5cd9..246569961be 100644
check_get_keyboard_state(i, j, expect_c, FALSE, /* todo */ FALSE);
}
diff --git a/server/queue.c b/server/queue.c
index 5c9f91a13c5..0782c526327 100644
index 561fa825ee7..9e0b9836965 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -114,6 +114,8 @@ struct thread_input
@@ -112,6 +112,8 @@ struct thread_input
int cursor_count; /* cursor show count */
struct list msg_list; /* list of hardware messages */
unsigned char keystate[256]; /* state of each key */
@@ -54,7 +54,7 @@ index 5c9f91a13c5..0782c526327 100644
};
struct msg_queue
@@ -140,6 +142,7 @@ struct msg_queue
@@ -138,6 +140,7 @@ struct msg_queue
struct thread_input *input; /* thread input descriptor */
struct hook_table *hooks; /* hook table */
timeout_t last_get_msg; /* time of last get message call */
@@ -62,7 +62,7 @@ index 5c9f91a13c5..0782c526327 100644
};
struct hotkey
@@ -265,12 +268,14 @@ static struct thread_input *create_thread_input( struct thread *thread )
@@ -263,12 +266,14 @@ static struct thread_input *create_thread_input( struct thread *thread )
list_init( &input->msg_list );
set_caret_window( input, 0 );
memset( input->keystate, 0, sizeof(input->keystate) );
@@ -77,7 +77,7 @@ index 5c9f91a13c5..0782c526327 100644
}
return input;
}
@@ -305,6 +310,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
@@ -303,6 +308,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
queue->input = (struct thread_input *)grab_object( input );
queue->hooks = NULL;
queue->last_get_msg = current_time;
@@ -85,7 +85,7 @@ index 5c9f91a13c5..0782c526327 100644
list_init( &queue->send_result );
list_init( &queue->callback_result );
list_init( &queue->pending_timers );
@@ -326,6 +332,31 @@ void free_msg_queue( struct thread *thread )
@@ -324,6 +330,31 @@ void free_msg_queue( struct thread *thread )
thread->queue = NULL;
}
@@ -117,7 +117,7 @@ index 5c9f91a13c5..0782c526327 100644
/* change the thread input data of a given thread */
static int assign_thread_input( struct thread *thread, struct thread_input *new_input )
{
@@ -339,9 +370,11 @@ static int assign_thread_input( struct thread *thread, struct thread_input *new_
@@ -337,9 +368,11 @@ static int assign_thread_input( struct thread *thread, struct thread_input *new_
if (queue->input)
{
queue->input->cursor_count -= queue->cursor_count;
@@ -129,7 +129,7 @@ index 5c9f91a13c5..0782c526327 100644
new_input->cursor_count += queue->cursor_count;
return 1;
}
@@ -477,6 +510,11 @@ static inline int is_signaled( struct msg_queue *queue )
@@ -476,6 +509,11 @@ static inline int is_signaled( struct msg_queue *queue )
/* set some queue bits */
static inline void set_queue_bits( struct msg_queue *queue, unsigned int bits )
{
@@ -141,7 +141,7 @@ index 5c9f91a13c5..0782c526327 100644
queue->wake_bits |= bits;
queue->changed_bits |= bits;
if (is_signaled( queue )) wake_up( &queue->obj, 0 );
@@ -487,6 +525,11 @@ static inline void clear_queue_bits( struct msg_queue *queue, unsigned int bits
@@ -486,6 +524,11 @@ static inline void clear_queue_bits( struct msg_queue *queue, unsigned int bits
{
queue->wake_bits &= ~bits;
queue->changed_bits &= ~bits;
@@ -153,7 +153,7 @@ index 5c9f91a13c5..0782c526327 100644
}
/* check whether msg is a keyboard message */
@@ -1031,6 +1074,7 @@ static void msg_queue_destroy( struct object *obj )
@@ -1030,6 +1073,7 @@ static void msg_queue_destroy( struct object *obj )
}
if (queue->timeout) remove_timeout_user( queue->timeout );
queue->input->cursor_count -= queue->cursor_count;
@@ -161,7 +161,7 @@ index 5c9f91a13c5..0782c526327 100644
release_object( queue->input );
if (queue->hooks) release_object( queue->hooks );
if (queue->fd) release_object( queue->fd );
@@ -2997,7 +3041,11 @@ DECL_HANDLER(get_key_state)
@@ -3070,7 +3114,11 @@ DECL_HANDLER(get_key_state)
else
{
unsigned char *keystate = current->queue->input->keystate;
@@ -174,7 +174,7 @@ index 5c9f91a13c5..0782c526327 100644
set_reply_data( keystate, size );
}
}
@@ -3011,6 +3059,7 @@ DECL_HANDLER(set_key_state)
@@ -3084,6 +3132,7 @@ DECL_HANDLER(set_key_state)
data_size_t size = min( 256, get_req_data_size() );
memcpy( queue->input->keystate, get_req_data(), size );
@@ -183,5 +183,5 @@ index 5c9f91a13c5..0782c526327 100644
{
memcpy( desktop->keystate, get_req_data(), size );
--
2.30.2
2.35.1

View File

@@ -1,4 +1,4 @@
From a6a449881f6643183316ad867b49bd99f53fa4a4 Mon Sep 17 00:00:00 2001
From b93e17f4dbd548edff543c2607755ba0d7a844d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 1 Apr 2021 23:41:31 +0200
Subject: [PATCH] server: Create message queue and thread input in
@@ -18,10 +18,10 @@ Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385
2 files changed, 28 insertions(+), 40 deletions(-)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 246569961be..561f932b18b 100644
index 848b52d3870..71eaace7d7f 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -3761,8 +3761,8 @@ struct get_key_state_thread_params
@@ -3962,8 +3962,8 @@ struct get_key_state_thread_params
int index;
};
@@ -32,10 +32,10 @@ index 246569961be..561f932b18b 100644
{
unsigned char keystate[256];
BOOL ret;
@@ -3770,24 +3770,24 @@ static void check_get_keyboard_state_(int i, int j, int c, int x, int todo_x, in
@@ -3971,24 +3971,24 @@ static void check_get_keyboard_state_(int i, int j, int c, int x, int todo_x, in
memset(keystate, 0, sizeof(keystate));
ret = GetKeyboardState(keystate);
ok_(__FILE__, line)(ret, "GetKeyboardState failed, %u\n", GetLastError());
ok_(__FILE__, line)(ret, "GetKeyboardState failed, %lu\n", GetLastError());
- 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");
+ 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");
@@ -43,7 +43,7 @@ index 246569961be..561f932b18b 100644
/* calling it twice shouldn't change */
memset(keystate, 0, sizeof(keystate));
ret = GetKeyboardState(keystate);
ok_(__FILE__, line)(ret, "GetKeyboardState failed, %u\n", GetLastError());
ok_(__FILE__, line)(ret, "GetKeyboardState failed, %lu\n", GetLastError());
- 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");
+ 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");
@@ -62,7 +62,7 @@ index 246569961be..561f932b18b 100644
ok_(__FILE__, line)(!(state & 0x007e), "%d:%d: expected that X undefined bits are unset, got %#x\n", i, j, state);
state = GetKeyState('C');
@@ -3841,18 +3841,18 @@ static DWORD WINAPI get_key_state_thread(void *arg)
@@ -4042,18 +4042,18 @@ static DWORD WINAPI get_key_state_thread(void *arg)
if (test->set_keyboard_state) expect_c = TRUE;
else expect_c = FALSE;
@@ -76,7 +76,7 @@ index 246569961be..561f932b18b 100644
/* key released */
ReleaseSemaphore(semaphores[0], 1, NULL);
result = WaitForSingleObject(semaphores[1], 1000);
ok(result == WAIT_OBJECT_0, "%d: WaitForSingleObject returned %u\n", i, result);
ok(result == WAIT_OBJECT_0, "%d: WaitForSingleObject returned %lu\n", i, result);
- check_get_keyboard_state(i, j, expect_c, expect_x, /* todo */ !has_queue && j > 0);
- check_get_key_state(i, j, expect_c, FALSE, /* todo */ FALSE);
@@ -87,7 +87,7 @@ index 246569961be..561f932b18b 100644
}
return 0;
@@ -3920,18 +3920,18 @@ static void test_GetKeyState(void)
@@ -4121,18 +4121,18 @@ static void test_GetKeyState(void)
}
else expect_c = FALSE;
@@ -112,7 +112,7 @@ index 246569961be..561f932b18b 100644
ReleaseSemaphore(params.semaphores[1], 1, NULL);
@@ -3947,15 +3947,15 @@ static void test_GetKeyState(void)
@@ -4148,15 +4148,15 @@ static void test_GetKeyState(void)
SetKeyboardState(keystate);
}
@@ -135,10 +135,10 @@ index 246569961be..561f932b18b 100644
ReleaseSemaphore(params.semaphores[1], 1, NULL);
}
diff --git a/server/queue.c b/server/queue.c
index 0782c526327..fce65e360d4 100644
index 9e0b9836965..d79add56fba 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -3025,25 +3025,13 @@ DECL_HANDLER(get_key_state)
@@ -3098,25 +3098,13 @@ DECL_HANDLER(get_key_state)
set_reply_data( desktop->keystate, size );
release_object( desktop );
}
@@ -168,5 +168,5 @@ index 0782c526327..fce65e360d4 100644
}
set_reply_data( keystate, size );
--
2.30.2
2.35.1