server: Move the last cursor time to the desktop session object.

Based on a patch by Huw Davies.
This commit is contained in:
Rémi Bernon 2024-02-19 22:17:27 +01:00 committed by Alexandre Julliard
parent 728049d6fa
commit 5488d99b3e
5 changed files with 15 additions and 8 deletions

View file

@ -887,6 +887,7 @@ struct shared_cursor
{
int x;
int y;
unsigned int last_change;
};
typedef volatile struct
@ -6566,7 +6567,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 812
#define SERVER_PROTOCOL_VERSION 813
/* ### protocol_version end ### */

View file

@ -903,6 +903,7 @@ struct shared_cursor
{
int x; /* cursor position */
int y;
unsigned int last_change; /* time of last position change */
};
typedef volatile struct

View file

@ -469,6 +469,7 @@ static int update_desktop_cursor_pos( struct desktop *desktop, user_handle_t win
{
const desktop_shm_t *desktop_shm = desktop->shared;
int updated;
unsigned int time = get_tick_count();
x = max( min( x, desktop->cursor.clip.right - 1 ), desktop->cursor.clip.left );
y = max( min( y, desktop->cursor.clip.bottom - 1 ), desktop->cursor.clip.top );
@ -478,11 +479,10 @@ static int update_desktop_cursor_pos( struct desktop *desktop, user_handle_t win
updated = shared->cursor.x != x || shared->cursor.y != y;
shared->cursor.x = x;
shared->cursor.y = y;
shared->cursor.last_change = time;
}
SHARED_WRITE_END;
desktop->cursor.last_change = get_tick_count();
if (!win || !is_window_visible( win ) || is_window_transparent( win ))
win = shallow_window_from_point( desktop, x, y );
if (update_desktop_cursor_window( desktop, win )) updated = 1;
@ -1998,7 +1998,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
struct rawinput_message raw_msg;
struct message *msg;
struct thread *foreground;
unsigned int i, time, flags;
unsigned int i, time = get_tick_count(), flags;
struct hw_msg_source source = { IMDT_MOUSE, origin };
lparam_t wparam = input->mouse.data << 16;
int wait = 0, x, y;
@ -2020,10 +2020,15 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
WM_MOUSEHWHEEL /* 0x1000 = MOUSEEVENTF_HWHEEL */
};
desktop->cursor.last_change = get_tick_count();
SHARED_WRITE_BEGIN( desktop_shm, desktop_shm_t )
{
shared->cursor.last_change = time;
}
SHARED_WRITE_END;
flags = input->mouse.flags;
time = input->mouse.time;
if (!time) time = desktop->cursor.last_change;
if (!time) time = desktop_shm->cursor.last_change;
if (flags & MOUSEEVENTF_MOVE)
{
@ -3741,7 +3746,7 @@ DECL_HANDLER(set_cursor)
reply->new_x = desktop_shm->cursor.x;
reply->new_y = desktop_shm->cursor.y;
reply->new_clip = desktop->cursor.clip;
reply->last_change = desktop->cursor.last_change;
reply->last_change = desktop_shm->cursor.last_change;
}
/* Get the history of the 64 last cursor positions */

View file

@ -58,7 +58,6 @@ struct global_cursor
{
rectangle_t clip; /* cursor clip rectangle */
unsigned int clip_flags; /* last cursor clip flags */
unsigned int last_change; /* time of last position change */
user_handle_t win; /* window that contains the cursor */
};

View file

@ -309,6 +309,7 @@ static struct desktop *create_desktop( const struct unicode_str *name, unsigned
{
shared->cursor.x = 0;
shared->cursor.y = 0;
shared->cursor.last_change = 0;
}
SHARED_WRITE_END;
}