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>
This commit is contained in:
parent
ee7c17c16d
commit
626870abe2
@ -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 );
|
||||
|
@ -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 );
|
||||
|
@ -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);
|
||||
|
@ -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 );
|
||||
|
@ -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 ### */
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user