Rémi Bernon : server: Remove tid from set_key_state request.
Alexandre Julliard
julliard at winehq.org
Fri Apr 2 16:10:12 CDT 2021
Module: wine
Branch: master
Commit: 6444e4fadefb90bea8075b2e883c06cdb03454b9
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6444e4fadefb90bea8075b2e883c06cdb03454b9
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Fri Apr 2 10:08:00 2021 +0200
server: Remove tid from set_key_state request.
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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/input.c | 1 -
dlls/winex11.drv/keyboard.c | 1 -
include/wine/server_protocol.h | 4 +---
server/protocol.def | 3 +--
server/queue.c | 18 +++---------------
server/request.h | 5 ++---
server/trace.c | 3 +--
7 files changed, 8 insertions(+), 27 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/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 642841fceeb..9756e9cb8b7 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -3846,10 +3846,8 @@ struct get_key_state_reply
struct set_key_state_request
{
struct request_header __header;
- thread_id_t tid;
int async;
/* VARARG(keystate,bytes); */
- char __pad_20[4];
};
struct set_key_state_reply
{
@@ -6226,7 +6224,7 @@ union generic_reply
/* ### protocol_version begin ### */
-#define SERVER_PROTOCOL_VERSION 689
+#define SERVER_PROTOCOL_VERSION 690
/* ### protocol_version end ### */
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 );
- }
}
diff --git a/server/request.h b/server/request.h
index a389a4eb6f7..6777f90b067 100644
--- a/server/request.h
+++ b/server/request.h
@@ -1724,9 +1724,8 @@ C_ASSERT( FIELD_OFFSET(struct get_key_state_request, key) == 16 );
C_ASSERT( sizeof(struct get_key_state_request) == 24 );
C_ASSERT( FIELD_OFFSET(struct get_key_state_reply, state) == 8 );
C_ASSERT( sizeof(struct get_key_state_reply) == 16 );
-C_ASSERT( FIELD_OFFSET(struct set_key_state_request, tid) == 12 );
-C_ASSERT( FIELD_OFFSET(struct set_key_state_request, async) == 16 );
-C_ASSERT( sizeof(struct set_key_state_request) == 24 );
+C_ASSERT( FIELD_OFFSET(struct set_key_state_request, async) == 12 );
+C_ASSERT( sizeof(struct set_key_state_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct set_foreground_window_request, handle) == 12 );
C_ASSERT( sizeof(struct set_foreground_window_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct set_foreground_window_reply, previous) == 8 );
diff --git a/server/trace.c b/server/trace.c
index ee11cfc9c3c..44bc8d8ee6f 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -3413,8 +3413,7 @@ static void dump_get_key_state_reply( const struct get_key_state_reply *req )
static void dump_set_key_state_request( const struct set_key_state_request *req )
{
- fprintf( stderr, " tid=%04x", req->tid );
- fprintf( stderr, ", async=%d", req->async );
+ fprintf( stderr, " async=%d", req->async );
dump_varargs_bytes( ", keystate=", cur_size );
}
More information about the wine-cvs
mailing list