server: Add fallback to desktop keystate in get_key_state wineserver call.

This commit is contained in:
Sebastian Lackner 2015-07-08 13:31:14 +02:00 committed by Alexandre Julliard
parent 6019da2355
commit 8723d3455e
2 changed files with 13 additions and 1 deletions

View File

@ -2437,7 +2437,6 @@ static DWORD WINAPI get_key_state_thread(void *arg)
ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
result = GetKeyState('X');
todo_wine
ok((result & 0x8000) || broken(!(result & 0x8000)), /* > Win 2003 */
"expected that highest bit is set, got %x\n", result);

View File

@ -2851,13 +2851,26 @@ DECL_HANDLER(get_key_state)
}
else
{
unsigned char *keystate;
if (!(thread = get_thread_from_id( req->tid ))) return;
if (thread->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 );
return;
}
release_object( thread );
/* fallback to desktop keystate */
if (!(desktop = get_thread_desktop( current, 0 ))) return;
if (req->key >= 0) reply->state = desktop->keystate[req->key & 0xff] & ~0x40;
if ((keystate = set_reply_data_size( size )))
{
unsigned int i;
for (i = 0; i < size; i++) keystate[i] = desktop->keystate[i] & ~0x40;
}
release_object( desktop );
}
}