Module: wine Branch: master Commit: 626870abe2e800cc9407d05d5c00500a4ad97b3a URL: https://source.winehq.org/git/wine.git/?a=commit;h=626870abe2e800cc9407d05d5...
Author: Rémi Bernon rbernon@codeweavers.com Date: Fri Apr 2 10:07:59 2021 +0200
server: Remove tid from get_key_state request.
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 Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/user32/input.c | 4 +--- dlls/wineandroid.drv/keyboard.c | 2 +- dlls/winemac.drv/keyboard.c | 2 +- dlls/winex11.drv/keyboard.c | 2 +- include/wine/server_protocol.h | 4 ++-- server/protocol.def | 4 ++-- server/queue.c | 14 +++++--------- server/request.h | 2 +- server/trace.c | 2 +- 9 files changed, 15 insertions(+), 21 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/include/wine/server_protocol.h b/include/wine/server_protocol.h index 36506bd258d..642841fceeb 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -3830,7 +3830,7 @@ struct get_last_input_time_reply struct get_key_state_request { struct request_header __header; - thread_id_t tid; + int async; int key; char __pad_20[4]; }; @@ -6226,7 +6226,7 @@ union generic_reply
/* ### protocol_version begin ### */
-#define SERVER_PROTOCOL_VERSION 688 +#define SERVER_PROTOCOL_VERSION 689
/* ### protocol_version end ### */
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; diff --git a/server/request.h b/server/request.h index d0baa089b4e..a389a4eb6f7 100644 --- a/server/request.h +++ b/server/request.h @@ -1719,7 +1719,7 @@ C_ASSERT( sizeof(struct get_thread_input_reply) == 64 ); C_ASSERT( sizeof(struct get_last_input_time_request) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_last_input_time_reply, time) == 8 ); C_ASSERT( sizeof(struct get_last_input_time_reply) == 16 ); -C_ASSERT( FIELD_OFFSET(struct get_key_state_request, tid) == 12 ); +C_ASSERT( FIELD_OFFSET(struct get_key_state_request, async) == 12 ); 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 ); diff --git a/server/trace.c b/server/trace.c index b45dfc286b7..ee11cfc9c3c 100644 --- a/server/trace.c +++ b/server/trace.c @@ -3401,7 +3401,7 @@ static void dump_get_last_input_time_reply( const struct get_last_input_time_rep
static void dump_get_key_state_request( const struct get_key_state_request *req ) { - fprintf( stderr, " tid=%04x", req->tid ); + fprintf( stderr, " async=%d", req->async ); fprintf( stderr, ", key=%d", req->key ); }