Alexandre Julliard : server: Store the global cursor position in the server .
Alexandre Julliard
julliard at winehq.org
Fri Feb 25 11:19:46 CST 2011
Module: wine
Branch: master
Commit: 183c41b49a3501168da4aad5252eefa85f934261
URL: http://source.winehq.org/git/wine.git/?a=commit;h=183c41b49a3501168da4aad5252eefa85f934261
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Feb 24 17:47:59 2011 +0100
server: Store the global cursor position in the server.
---
dlls/user32/input.c | 17 ++++++++++++++++-
include/wine/server_protocol.h | 7 ++++++-
server/protocol.def | 5 +++++
server/queue.c | 30 +++++++++++++++++++++++-------
server/request.h | 8 ++++++--
server/trace.c | 4 ++++
server/user.h | 2 ++
server/winstation.c | 2 ++
8 files changed, 64 insertions(+), 11 deletions(-)
diff --git a/dlls/user32/input.c b/dlls/user32/input.c
index 162c155..f19b7e4 100644
--- a/dlls/user32/input.c
+++ b/dlls/user32/input.c
@@ -231,7 +231,22 @@ BOOL WINAPI GetCursorInfo( PCURSORINFO pci )
*/
BOOL WINAPI DECLSPEC_HOTPATCH SetCursorPos( INT x, INT y )
{
- return USER_Driver->pSetCursorPos( x, y );
+ BOOL ret;
+
+ SERVER_START_REQ( set_cursor )
+ {
+ req->flags = SET_CURSOR_POS;
+ req->x = x;
+ req->y = y;
+ if ((ret = !wine_server_call( req )))
+ {
+ x = reply->new_x;
+ y = reply->new_y;
+ }
+ }
+ SERVER_END_REQ;
+ if (ret) ret = USER_Driver->pSetCursorPos( x, y );
+ return ret;
}
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 2e940b7..63a6d9d 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -4769,15 +4769,20 @@ struct set_cursor_request
unsigned int flags;
user_handle_t handle;
int show_count;
+ int x;
+ int y;
};
struct set_cursor_reply
{
struct reply_header __header;
user_handle_t prev_handle;
int prev_count;
+ int new_x;
+ int new_y;
};
#define SET_CURSOR_HANDLE 0x01
#define SET_CURSOR_COUNT 0x02
+#define SET_CURSOR_POS 0x04
enum request
@@ -5525,6 +5530,6 @@ union generic_reply
struct set_cursor_reply set_cursor_reply;
};
-#define SERVER_PROTOCOL_VERSION 412
+#define SERVER_PROTOCOL_VERSION 413
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
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 @@ enum coords_relative
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 @@ static void release_hardware_message( struct msg_queue *queue, unsigned int hw_i
/* 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 @@ 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 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 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
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 @@ DECL_HANDLER(send_hardware_message)
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 @@ DECL_HANDLER(set_cursor)
}
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( sizeof(struct free_user_handle_request) == 16 );
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 @@ static void dump_set_cursor_request( const struct set_cursor_request *req )
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 desktop
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 @@ static struct desktop *create_desktop( const struct unicode_str *name, unsigned
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 );
}
}
More information about the wine-cvs
mailing list