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;