Alexandre Julliard : server: Return the current cursor when queuing a hardware message.

Alexandre Julliard julliard at winehq.org
Wed Apr 21 10:40:18 CDT 2010


Module: wine
Branch: master
Commit: cd28e2be7c79644e02babb509247a453e0153390
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=cd28e2be7c79644e02babb509247a453e0153390

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Apr 20 20:51:45 2010 +0200

server: Return the current cursor when queuing a hardware message.

---

 include/wine/server_protocol.h |    4 +++-
 server/protocol.def            |    3 +++
 server/queue.c                 |   28 ++++++++++++++++------------
 server/request.h               |    3 +++
 server/trace.c                 |    8 +++++++-
 5 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 83c55db..24790a5 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -2751,6 +2751,8 @@ struct send_hardware_message_request
 struct send_hardware_message_reply
 {
     struct reply_header __header;
+    user_handle_t   cursor;
+    int             count;
 };
 
 
@@ -5481,6 +5483,6 @@ union generic_reply
     struct set_cursor_reply set_cursor_reply;
 };
 
-#define SERVER_PROTOCOL_VERSION 399
+#define SERVER_PROTOCOL_VERSION 400
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
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 @@ enum message_type
     int             x;         /* x position */
     int             y;         /* y position */
     unsigned int    time;      /* message time */
+ at 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 @@ static user_handle_t find_hardware_message_window( struct thread_input *input, s
 }
 
 /* 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_message)
 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 @@ DECL_HANDLER(send_hardware_message)
         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, x) == 48 );
 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 @@ static void dump_send_hardware_message_request( const struct send_hardware_messa
     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 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
     (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,




More information about the wine-cvs mailing list