Alexandre Julliard : server: Optionally return the global key state when queueing a hardware message.
Alexandre Julliard
julliard at winehq.org
Thu Dec 15 12:47:20 CST 2011
Module: wine
Branch: master
Commit: 5a30e31806b8b2c2917670aaf9e2c5038bc625c6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5a30e31806b8b2c2917670aaf9e2c5038bc625c6
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Dec 15 14:29:46 2011 +0100
server: Optionally return the global key state when queueing a hardware message.
---
include/wine/server_protocol.h | 3 ++-
server/protocol.def | 1 +
server/queue.c | 12 ++++++++++--
server/trace.c | 1 +
4 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index ab239f3..5880b47 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -2796,6 +2796,7 @@ struct send_hardware_message_reply
{
struct reply_header __header;
int wait;
+ /* VARARG(keystate,bytes); */
char __pad_12[4];
};
#define SEND_HWMSG_INJECTED 0x01
@@ -5639,6 +5640,6 @@ union generic_reply
struct set_suspend_context_reply set_suspend_context_reply;
};
-#define SERVER_PROTOCOL_VERSION 428
+#define SERVER_PROTOCOL_VERSION 429
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/protocol.def b/server/protocol.def
index a59bb6e..91a59b2 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -2032,6 +2032,7 @@ enum message_type
unsigned int flags; /* flags (see below) */
@REPLY
int wait; /* do we need to wait for a reply? */
+ VARARG(keystate,bytes); /* global state array for all the keys */
@END
#define SEND_HWMSG_INJECTED 0x01
diff --git a/server/queue.c b/server/queue.c
index 7de6d88..20d3e41 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -2189,13 +2189,20 @@ DECL_HANDLER(send_hardware_message)
struct thread *thread = NULL;
struct desktop *desktop;
struct msg_queue *sender = get_current_queue();
+ data_size_t size = min( 256, get_reply_max_size() );
+
+ if (!(desktop = get_thread_desktop( current, 0 ))) return;
if (req->win)
{
if (!(thread = get_window_thread( req->win ))) return;
- desktop = (struct desktop *)grab_object( thread->queue->input->desktop );
+ if (desktop != thread->queue->input->desktop)
+ {
+ /* don't allow queuing events to a different desktop */
+ release_object( desktop );
+ return;
+ }
}
- else if (!(desktop = get_thread_desktop( current, 0 ))) return;
switch (req->input.type)
{
@@ -2212,6 +2219,7 @@ DECL_HANDLER(send_hardware_message)
set_error( STATUS_INVALID_PARAMETER );
}
if (thread) release_object( thread );
+ set_reply_data( desktop->keystate, size );
release_object( desktop );
}
diff --git a/server/trace.c b/server/trace.c
index e463229..4a50232 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -2452,6 +2452,7 @@ static void dump_send_hardware_message_request( const struct send_hardware_messa
static void dump_send_hardware_message_reply( const struct send_hardware_message_reply *req )
{
fprintf( stderr, " wait=%d", req->wait );
+ dump_varargs_bytes( ", keystate=", cur_size );
}
static void dump_get_message_request( const struct get_message_request *req )
More information about the wine-cvs
mailing list