server: Get rid of the global cursor structure.

Based on a patch by Huw Davies.
This commit is contained in:
Rémi Bernon 2024-02-19 22:27:55 +01:00 committed by Alexandre Julliard
parent 496f663157
commit 472ce7fd1d
3 changed files with 10 additions and 14 deletions

View file

@ -440,7 +440,7 @@ static struct thread_input *get_desktop_cursor_thread_input( struct desktop *des
struct thread_input *input = NULL;
struct thread *thread;
if ((thread = get_window_thread( desktop->cursor.win )))
if ((thread = get_window_thread( desktop->cursor_win )))
{
if (thread->queue) input = thread->queue->input;
release_object( thread );
@ -451,9 +451,9 @@ static struct thread_input *get_desktop_cursor_thread_input( struct desktop *des
static int update_desktop_cursor_window( struct desktop *desktop, user_handle_t win )
{
int updated = win != desktop->cursor.win;
int updated = win != desktop->cursor_win;
struct thread_input *input;
desktop->cursor.win = win;
desktop->cursor_win = win;
if (updated && (input = get_desktop_cursor_thread_input( desktop )))
{
@ -495,7 +495,7 @@ static void update_desktop_cursor_handle( struct desktop *desktop, struct thread
{
if (input == get_desktop_cursor_thread_input( desktop ))
{
user_handle_t win = desktop->cursor.win;
user_handle_t win = desktop->cursor_win;
/* when clipping send the message to the foreground window as well, as some driver have an artificial overlay window */
if (is_cursor_clipped( desktop )) queue_cursor_message( desktop, 0, WM_WINE_SETCURSOR, win, handle );
queue_cursor_message( desktop, win, WM_WINE_SETCURSOR, win, handle );
@ -560,8 +560,8 @@ void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect, unsig
}
SHARED_WRITE_END;
old_flags = desktop->cursor.clip_flags;
desktop->cursor.clip_flags = flags;
old_flags = desktop->clip_flags;
desktop->clip_flags = flags;
/* warp the mouse to be inside the clip rect */
x = max( min( desktop_shm->cursor.x, new_rect.right - 1 ), new_rect.left );

View file

@ -54,12 +54,6 @@ struct winstation
struct namespace *desktop_names; /* namespace for desktops of this winstation */
};
struct global_cursor
{
unsigned int clip_flags; /* last cursor clip flags */
user_handle_t win; /* window that contains the cursor */
};
struct key_repeat
{
int enable; /* enable auto-repeat */
@ -86,9 +80,10 @@ 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 */
struct global_cursor cursor; /* global cursor information */
unsigned char keystate[256]; /* asynchronous key state */
struct key_repeat key_repeat; /* key auto-repeat */
unsigned int clip_flags; /* last cursor clip flags */
user_handle_t cursor_win; /* window that contains the cursor */
const desktop_shm_t *shared; /* desktop session shared memory */
};

View file

@ -292,7 +292,8 @@ static struct desktop *create_desktop( const struct unicode_str *name, unsigned
desktop->foreground_input = NULL;
desktop->users = 0;
list_init( &desktop->threads );
memset( &desktop->cursor, 0, sizeof(desktop->cursor) );
desktop->clip_flags = 0;
desktop->cursor_win = 0;
memset( desktop->keystate, 0, sizeof(desktop->keystate) );
memset( &desktop->key_repeat, 0, sizeof(desktop->key_repeat) );
list_add_tail( &winstation->desktops, &desktop->entry );