server: Return the current cursor when queuing a hardware message.
diff --git a/server/protocol.def b/server/protocol.def
index 4aaff10..5015e97 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -1992,6 +1992,9 @@
int x; /* x position */
int y; /* y position */
unsigned int time; /* message time */
+@REPLY
+ user_handle_t cursor; /* current cursor for the target thread input */
+ int count; /* current cursor count */
@END
diff --git a/server/queue.c b/server/queue.c
index c49c3e1..4a06a73 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -1262,12 +1262,11 @@
}
/* queue a hardware message into a given thread input */
-static void queue_hardware_message( struct msg_queue *queue, struct message *msg,
+static void queue_hardware_message( struct thread_input *input, struct message *msg,
struct hardware_msg_data *data )
{
user_handle_t win;
struct thread *thread;
- struct thread_input *input = queue ? queue->input : foreground_input;
unsigned int msg_code;
last_input_time = get_tick_count();
@@ -1704,20 +1703,20 @@
DECL_HANDLER(send_hardware_message)
{
struct message *msg;
- struct msg_queue *recv_queue = NULL;
struct thread *thread = NULL;
struct hardware_msg_data *data;
+ struct thread_input *input = foreground_input;
if (req->id)
{
if (!(thread = get_thread_from_id( req->id ))) return;
- }
-
- if (thread && !(recv_queue = thread->queue))
- {
- set_error( STATUS_INVALID_PARAMETER );
- release_object( thread );
- return;
+ if (!thread->queue)
+ {
+ set_error( STATUS_INVALID_PARAMETER );
+ release_object( thread );
+ return;
+ }
+ input = thread->queue->input;
}
if (!(data = mem_alloc( sizeof(*data) )))
@@ -1741,11 +1740,16 @@
msg->result = NULL;
msg->data = data;
msg->data_size = sizeof(*data);
- queue_hardware_message( recv_queue, msg, data );
+ queue_hardware_message( input, msg, data );
}
else free( data );
- if (thread) release_object( thread );
+ if (thread)
+ {
+ reply->cursor = input->cursor;
+ reply->count = input->cursor_count;
+ release_object( thread );
+ }
}
/* post a quit message to the current queue */
diff --git a/server/request.h b/server/request.h
index eb710b9..604d115 100644
--- a/server/request.h
+++ b/server/request.h
@@ -1381,6 +1381,9 @@
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, y) == 52 );
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, time) == 56 );
C_ASSERT( sizeof(struct send_hardware_message_request) == 64 );
+C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, cursor) == 8 );
+C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, count) == 12 );
+C_ASSERT( sizeof(struct send_hardware_message_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_message_request, flags) == 12 );
C_ASSERT( FIELD_OFFSET(struct get_message_request, get_win) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_message_request, get_first) == 20 );
diff --git a/server/trace.c b/server/trace.c
index 7958781..c97bd70 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -2427,6 +2427,12 @@
fprintf( stderr, ", time=%08x", req->time );
}
+static void dump_send_hardware_message_reply( const struct send_hardware_message_reply *req )
+{
+ fprintf( stderr, " cursor=%08x", req->cursor );
+ fprintf( stderr, ", count=%d", req->count );
+}
+
static void dump_get_message_request( const struct get_message_request *req )
{
fprintf( stderr, " flags=%08x", req->flags );
@@ -4190,7 +4196,7 @@
(dump_func)dump_get_process_idle_event_reply,
NULL,
NULL,
- NULL,
+ (dump_func)dump_send_hardware_message_reply,
(dump_func)dump_get_message_reply,
NULL,
NULL,