server: Store the global cursor position in the server.
diff --git a/server/protocol.def b/server/protocol.def
index 728898f..be644b5 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3290,9 +3290,14 @@
     unsigned int   flags;         /* flags for fields to set (see below) */
     user_handle_t  handle;        /* handle to the cursor */
     int            show_count;    /* show count increment/decrement */
+    int            x;             /* cursor position */
+    int            y;
 @REPLY
     user_handle_t  prev_handle;   /* previous handle */
     int            prev_count;    /* previous show count */
+    int            new_x;         /* new position */
+    int            new_y;
 @END
 #define SET_CURSOR_HANDLE 0x01
 #define SET_CURSOR_COUNT  0x02
+#define SET_CURSOR_POS    0x04
diff --git a/server/queue.c b/server/queue.c
index 7a25517..20e0fc0 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -1237,8 +1237,9 @@
 
 /* find the window that should receive a given hardware message */
 static user_handle_t find_hardware_message_window( struct thread_input *input, struct message *msg,
-                                                   struct hardware_msg_data *data, unsigned int *msg_code )
+                                                   unsigned int *msg_code )
 {
+    struct hardware_msg_data *data = msg->data;
     user_handle_t win = 0;
 
     *msg_code = msg->msg;
@@ -1264,15 +1265,23 @@
 }
 
 /* queue a hardware message into a given thread input */
-static void queue_hardware_message( struct thread_input *input, struct message *msg,
-                                    struct hardware_msg_data *data )
+static void queue_hardware_message( struct desktop *desktop, struct thread_input *input,
+                                    struct message *msg )
 {
     user_handle_t win;
     struct thread *thread;
     unsigned int msg_code;
+    struct hardware_msg_data *data = msg->data;
 
+    if (msg->msg == WM_MOUSEMOVE)
+    {
+        desktop->cursor_x = data->x;
+        desktop->cursor_y = data->y;
+    }
+    data->x = desktop->cursor_x;
+    data->y = desktop->cursor_y;
     last_input_time = get_tick_count();
-    win = find_hardware_message_window( input, msg, data, &msg_code );
+    win = find_hardware_message_window( input, msg, &msg_code );
     if (!win || !(thread = get_window_thread(win)))
     {
         if (input) update_input_key_state( input, msg );
@@ -1361,7 +1370,7 @@
         struct hardware_msg_data *data = msg->data;
 
         ptr = list_next( &input->msg_list, ptr );
-        win = find_hardware_message_window( input, msg, data, &msg_code );
+        win = find_hardware_message_window( input, msg, &msg_code );
         if (!win || !(win_thread = get_window_thread( win )))
         {
             /* no window at all, remove it */
@@ -1748,7 +1757,7 @@
         msg->result    = NULL;
         msg->data      = data;
         msg->data_size = sizeof(*data);
-        queue_hardware_message( input, msg, data );
+        queue_hardware_message( desktop, input, msg );
     }
     else free( data );
 
@@ -2286,10 +2295,17 @@
         }
         input->cursor = req->handle;
     }
-
     if (req->flags & SET_CURSOR_COUNT)
     {
         queue->cursor_count += req->show_count;
         input->cursor_count += req->show_count;
     }
+    if (req->flags & SET_CURSOR_POS)
+    {
+        input->desktop->cursor_x = req->x;
+        input->desktop->cursor_y = req->y;
+    }
+
+    reply->new_x    = input->desktop->cursor_x;
+    reply->new_y    = input->desktop->cursor_y;
 }
diff --git a/server/request.h b/server/request.h
index ae45ab8..f1894c0 100644
--- a/server/request.h
+++ b/server/request.h
@@ -2100,10 +2100,14 @@
 C_ASSERT( FIELD_OFFSET(struct set_cursor_request, flags) == 12 );
 C_ASSERT( FIELD_OFFSET(struct set_cursor_request, handle) == 16 );
 C_ASSERT( FIELD_OFFSET(struct set_cursor_request, show_count) == 20 );
-C_ASSERT( sizeof(struct set_cursor_request) == 24 );
+C_ASSERT( FIELD_OFFSET(struct set_cursor_request, x) == 24 );
+C_ASSERT( FIELD_OFFSET(struct set_cursor_request, y) == 28 );
+C_ASSERT( sizeof(struct set_cursor_request) == 32 );
 C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, prev_handle) == 8 );
 C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, prev_count) == 12 );
-C_ASSERT( sizeof(struct set_cursor_reply) == 16 );
+C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, new_x) == 16 );
+C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, new_y) == 20 );
+C_ASSERT( sizeof(struct set_cursor_reply) == 24 );
 
 #endif  /* WANT_REQUEST_HANDLERS */
 
diff --git a/server/trace.c b/server/trace.c
index e01a3f1..5305cac 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -3871,12 +3871,16 @@
     fprintf( stderr, " flags=%08x", req->flags );
     fprintf( stderr, ", handle=%08x", req->handle );
     fprintf( stderr, ", show_count=%d", req->show_count );
+    fprintf( stderr, ", x=%d", req->x );
+    fprintf( stderr, ", y=%d", req->y );
 }
 
 static void dump_set_cursor_reply( const struct set_cursor_reply *req )
 {
     fprintf( stderr, " prev_handle=%08x", req->prev_handle );
     fprintf( stderr, ", prev_count=%d", req->prev_count );
+    fprintf( stderr, ", new_x=%d", req->new_x );
+    fprintf( stderr, ", new_y=%d", req->new_y );
 }
 
 static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
diff --git a/server/user.h b/server/user.h
index 708692a..4d39e40 100644
--- a/server/user.h
+++ b/server/user.h
@@ -63,6 +63,8 @@
     struct timeout_user *close_timeout;    /* timeout before closing the desktop */
     struct thread_input *foreground_input; /* thread input of foreground thread */
     unsigned int         users;            /* processes and threads using this desktop */
+    int                  cursor_x;         /* cursor position */
+    int                  cursor_y;
 };
 
 /* user handles functions */
diff --git a/server/winstation.c b/server/winstation.c
index b05efac..3d1ac3c 100644
--- a/server/winstation.c
+++ b/server/winstation.c
@@ -232,6 +232,8 @@
             desktop->close_timeout = NULL;
             desktop->foreground_input = NULL;
             desktop->users = 0;
+            desktop->cursor_x = 0;
+            desktop->cursor_y = 0;
             list_add_tail( &winstation->desktops, &desktop->entry );
         }
     }