Rebase against 192d335facd5ec6ff2b9acec615efff16385a416.

This commit is contained in:
Elizabeth Figura
2025-10-01 16:58:46 -05:00
parent 78a888cd3d
commit 9c06e8eab3
8 changed files with 30 additions and 222 deletions

View File

@@ -1,4 +1,4 @@
From d1f7a457006ab95ec23b0dad5979daa7169fb832 Mon Sep 17 00:00:00 2001
From de5dc4769ee2493fbfc157d5b565c72d56613151 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 15 Mar 2015 01:05:48 +0100
Subject: [PATCH] server: Fix handling of GetMessage after previous PeekMessage
@@ -93,10 +93,10 @@ index c8a12a6f998..618eba3419a 100644
* because both messages are in the same queue. */
diff --git a/server/queue.c b/server/queue.c
index 268c921a914..70d9991e698 100644
index ffb1d441e60..60537685dc2 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -135,6 +135,7 @@ struct msg_queue
@@ -138,6 +138,7 @@ struct msg_queue
struct hook_table *hooks; /* hook table */
int keystate_lock; /* owns an input keystate lock */
queue_shm_t *shared; /* queue in session shared memory */
@@ -104,7 +104,7 @@ index 268c921a914..70d9991e698 100644
};
struct hotkey
@@ -318,6 +319,8 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
@@ -320,6 +321,8 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
queue->input = (struct thread_input *)grab_object( input );
queue->hooks = NULL;
queue->keystate_lock = 0;
@@ -113,7 +113,7 @@ index 268c921a914..70d9991e698 100644
list_init( &queue->send_result );
list_init( &queue->callback_result );
list_init( &queue->pending_timers );
@@ -816,13 +819,21 @@ static inline struct msg_queue *get_current_queue(void)
@@ -827,13 +830,21 @@ static inline struct msg_queue *get_current_queue(void)
}
/* get a (pseudo-)unique id to tag hardware messages */
@@ -136,7 +136,7 @@ index 268c921a914..70d9991e698 100644
/* lookup an already queued mouse message that matches the message, window and type */
static struct message *find_mouse_message( struct thread_input *input, const struct message *msg )
{
@@ -1173,7 +1184,7 @@ static int match_window( user_handle_t win, user_handle_t msg_win )
@@ -1184,7 +1195,7 @@ static int match_window( user_handle_t win, user_handle_t msg_win )
}
/* retrieve a posted message */
@@ -145,7 +145,7 @@ index 268c921a914..70d9991e698 100644
unsigned int first, unsigned int last, unsigned int flags,
struct get_message_reply *reply )
{
@@ -1184,6 +1195,7 @@ static int get_posted_message( struct msg_queue *queue, user_handle_t win,
@@ -1195,6 +1206,7 @@ static int get_posted_message( struct msg_queue *queue, user_handle_t win,
{
if (!match_window( win, msg->win )) continue;
if (!check_msg_filter( msg->msg, first, last )) continue;
@@ -153,7 +153,7 @@ index 268c921a914..70d9991e698 100644
goto found; /* found one */
}
return 0;
@@ -1842,6 +1854,7 @@ found:
@@ -1857,6 +1869,7 @@ found:
msg->msg = WM_HOTKEY;
msg->wparam = hotkey->id;
msg->lparam = ((hotkey->vkey & 0xffff) << 16) | modifiers;
@@ -161,7 +161,7 @@ index 268c921a914..70d9991e698 100644
free( msg->data );
msg->data = NULL;
@@ -2828,7 +2841,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
@@ -2843,7 +2856,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
}
/* now we can return it */
@@ -170,7 +170,7 @@ index 268c921a914..70d9991e698 100644
reply->type = MSG_HARDWARE;
reply->win = win;
reply->msg = msg_code;
@@ -2935,6 +2948,7 @@ void post_message( user_handle_t win, unsigned int message, lparam_t wparam, lpa
@@ -2950,6 +2963,7 @@ void post_message( user_handle_t win, unsigned int message, lparam_t wparam, lpa
msg->result = NULL;
msg->data = NULL;
msg->data_size = 0;
@@ -178,7 +178,7 @@ index 268c921a914..70d9991e698 100644
get_message_defaults( thread->queue, &msg->x, &msg->y, &msg->time );
@@ -3239,6 +3253,7 @@ DECL_HANDLER(send_message)
@@ -3254,6 +3268,7 @@ DECL_HANDLER(send_message)
set_queue_bits( recv_queue, QS_SENDMESSAGE );
break;
case MSG_POSTED:
@@ -186,7 +186,7 @@ index 268c921a914..70d9991e698 100644
list_add_tail( &recv_queue->msg_list[POST_MESSAGE], &msg->entry );
set_queue_bits( recv_queue, QS_POSTMESSAGE|QS_ALLPOSTMESSAGE );
if (msg->msg == WM_HOTKEY)
@@ -3379,12 +3394,12 @@ DECL_HANDLER(get_message)
@@ -3394,12 +3409,12 @@ DECL_HANDLER(get_message)
/* then check for posted messages */
if ((filter & QS_POSTMESSAGE) &&
@@ -201,7 +201,7 @@ index 268c921a914..70d9991e698 100644
return;
/* only check for quit messages if not posted messages pending */
@@ -3395,7 +3410,7 @@ DECL_HANDLER(get_message)
@@ -3410,7 +3425,7 @@ DECL_HANDLER(get_message)
if ((filter & QS_INPUT) &&
filter_contains_hw_range( req->get_first, req->get_last ) &&
get_hardware_message( current, req->hw_id, get_win, req->get_first, req->get_last, req->flags, reply ))
@@ -210,7 +210,7 @@ index 268c921a914..70d9991e698 100644
/* now check for WM_PAINT */
if ((filter & QS_PAINT) &&
@@ -3408,7 +3423,7 @@ DECL_HANDLER(get_message)
@@ -3423,7 +3438,7 @@ DECL_HANDLER(get_message)
reply->wparam = 0;
reply->lparam = 0;
get_message_defaults( queue, &reply->x, &reply->y, &reply->time );
@@ -219,7 +219,7 @@ index 268c921a914..70d9991e698 100644
}
/* now check for timer */
@@ -3424,9 +3439,19 @@ DECL_HANDLER(get_message)
@@ -3439,9 +3454,19 @@ DECL_HANDLER(get_message)
get_message_defaults( queue, &reply->x, &reply->y, &reply->time );
if (!(req->flags & PM_NOYIELD) && current->process->idle_event)
set_event( current->process->idle_event );
@@ -240,9 +240,9 @@ index 268c921a914..70d9991e698 100644
if (get_win == -1 && current->process->idle_event) set_event( current->process->idle_event );
SHARED_WRITE_BEGIN( queue_shm, queue_shm_t )
@@ -3438,6 +3463,13 @@ DECL_HANDLER(get_message)
reset_queue_sync( queue );
@@ -3454,6 +3479,13 @@ DECL_HANDLER(get_message)
if (!get_queue_status( queue )) reset_queue_sync( queue );
else signal_queue_sync( queue );
set_error( STATUS_PENDING ); /* FIXME */
+ return;
+
@@ -254,7 +254,7 @@ index 268c921a914..70d9991e698 100644
}
@@ -3455,7 +3487,10 @@ DECL_HANDLER(reply_message)
@@ -3471,7 +3503,10 @@ DECL_HANDLER(reply_message)
DECL_HANDLER(accept_hardware_message)
{
if (current->queue)