winex11: Update only the key state on KeymapNotify without sending fake key events.
diff --git a/server/protocol.def b/server/protocol.def
index 73f2d8e..80c0cd3 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -2706,6 +2706,7 @@
 /* Set queue keyboard state for a given 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 2cd82b4..4fd32ed 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -2724,6 +2724,11 @@
     {
         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 c1cca4c..5b45cf9 100644
--- a/server/request.h
+++ b/server/request.h
@@ -1756,7 +1756,8 @@
 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( sizeof(struct set_key_state_request) == 16 );
+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_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 b8dc316..cfef963 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -3162,6 +3162,7 @@
 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 );
     dump_varargs_bytes( ", keystate=", cur_size );
 }