Rebase against 01269452e0fbb1f081d506bd64996590a553e2b9.

This commit is contained in:
Elizabeth Figura
2025-10-03 16:39:15 -05:00
parent 9c06e8eab3
commit 38d4b8ca78
66 changed files with 39 additions and 7790 deletions

View File

@@ -1,4 +1,4 @@
From de5dc4769ee2493fbfc157d5b565c72d56613151 Mon Sep 17 00:00:00 2001
From 8ce710ee30e95c93b36e4d5e9d4bcba8fd6f0493 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
@@ -15,10 +15,10 @@ Changes in v3:
2 files changed, 66 insertions(+), 17 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index c8a12a6f998..618eba3419a 100644
index 8671134f349..219cdd805f2 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -14609,13 +14609,10 @@ static void test_PeekMessage3(void)
@@ -14612,13 +14612,10 @@ static void test_PeekMessage3(void)
ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message);
PostMessageA(hwnd, WM_USER, 0, 0);
ret = PeekMessageA(&msg, hwnd, 0, 0, PM_NOREMOVE);
@@ -32,7 +32,7 @@ index c8a12a6f998..618eba3419a 100644
ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message);
ret = PeekMessageA(&msg, hwnd, 0, 0, 0);
ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret);
@@ -14625,10 +14622,8 @@ static void test_PeekMessage3(void)
@@ -14628,10 +14625,8 @@ static void test_PeekMessage3(void)
ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message);
PostMessageA(hwnd, WM_USER, 0, 0);
ret = PeekMessageA(&msg, hwnd, 0, 0, PM_REMOVE);
@@ -43,7 +43,7 @@ index c8a12a6f998..618eba3419a 100644
ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message);
ret = PeekMessageA(&msg, hwnd, 0, 0, 0);
ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret);
@@ -14640,10 +14635,11 @@ static void test_PeekMessage3(void)
@@ -14643,10 +14638,11 @@ static void test_PeekMessage3(void)
ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message);
PostMessageA(hwnd, WM_USER, 0, 0);
ret = GetMessageA(&msg, hwnd, 0, 0);
@@ -57,7 +57,7 @@ index c8a12a6f998..618eba3419a 100644
ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message);
ret = PeekMessageA(&msg, hwnd, 0, 0, 0);
ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret);
@@ -14671,14 +14667,32 @@ static void test_PeekMessage3(void)
@@ -14674,14 +14670,32 @@ static void test_PeekMessage3(void)
ret = GetMessageA(&msg, hwnd, 0, 0);
ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message);
ret = GetMessageA(&msg, hwnd, 0, 0);
@@ -93,7 +93,7 @@ index c8a12a6f998..618eba3419a 100644
* because both messages are in the same queue. */
diff --git a/server/queue.c b/server/queue.c
index ffb1d441e60..60537685dc2 100644
index fb9499b5589..6b374797b42 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -138,6 +138,7 @@ struct msg_queue
@@ -104,7 +104,7 @@ index ffb1d441e60..60537685dc2 100644
};
struct hotkey
@@ -320,6 +321,8 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
@@ -317,6 +318,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 ffb1d441e60..60537685dc2 100644
list_init( &queue->send_result );
list_init( &queue->callback_result );
list_init( &queue->pending_timers );
@@ -827,13 +830,21 @@ static inline struct msg_queue *get_current_queue(void)
@@ -812,13 +815,21 @@ static inline struct msg_queue *get_current_queue(void)
}
/* get a (pseudo-)unique id to tag hardware messages */
@@ -136,7 +136,7 @@ index ffb1d441e60..60537685dc2 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 )
{
@@ -1184,7 +1195,7 @@ static int match_window( user_handle_t win, user_handle_t msg_win )
@@ -1169,7 +1180,7 @@ static int match_window( user_handle_t win, user_handle_t msg_win )
}
/* retrieve a posted message */
@@ -145,7 +145,7 @@ index ffb1d441e60..60537685dc2 100644
unsigned int first, unsigned int last, unsigned int flags,
struct get_message_reply *reply )
{
@@ -1195,6 +1206,7 @@ static int get_posted_message( struct msg_queue *queue, user_handle_t win,
@@ -1180,6 +1191,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 ffb1d441e60..60537685dc2 100644
goto found; /* found one */
}
return 0;
@@ -1857,6 +1869,7 @@ found:
@@ -1799,6 +1811,7 @@ found:
msg->msg = WM_HOTKEY;
msg->wparam = hotkey->id;
msg->lparam = ((hotkey->vkey & 0xffff) << 16) | modifiers;
@@ -161,7 +161,7 @@ index ffb1d441e60..60537685dc2 100644
free( msg->data );
msg->data = NULL;
@@ -2843,7 +2856,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
@@ -2786,7 +2799,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
}
/* now we can return it */
@@ -170,7 +170,7 @@ index ffb1d441e60..60537685dc2 100644
reply->type = MSG_HARDWARE;
reply->win = win;
reply->msg = msg_code;
@@ -2950,6 +2963,7 @@ void post_message( user_handle_t win, unsigned int message, lparam_t wparam, lpa
@@ -2925,6 +2938,7 @@ void send_notify_message( user_handle_t win, unsigned int message, lparam_t wpar
msg->result = NULL;
msg->data = NULL;
msg->data_size = 0;
@@ -178,7 +178,7 @@ index ffb1d441e60..60537685dc2 100644
get_message_defaults( thread->queue, &msg->x, &msg->y, &msg->time );
@@ -3254,6 +3268,7 @@ DECL_HANDLER(send_message)
@@ -3208,6 +3222,7 @@ DECL_HANDLER(send_message)
set_queue_bits( recv_queue, QS_SENDMESSAGE );
break;
case MSG_POSTED:
@@ -186,7 +186,7 @@ index ffb1d441e60..60537685dc2 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)
@@ -3394,12 +3409,12 @@ DECL_HANDLER(get_message)
@@ -3348,12 +3363,12 @@ DECL_HANDLER(get_message)
/* then check for posted messages */
if ((filter & QS_POSTMESSAGE) &&
@@ -201,7 +201,7 @@ index ffb1d441e60..60537685dc2 100644
return;
/* only check for quit messages if not posted messages pending */
@@ -3410,7 +3425,7 @@ DECL_HANDLER(get_message)
@@ -3364,7 +3379,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 ffb1d441e60..60537685dc2 100644
/* now check for WM_PAINT */
if ((filter & QS_PAINT) &&
@@ -3423,7 +3438,7 @@ DECL_HANDLER(get_message)
@@ -3377,7 +3392,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 ffb1d441e60..60537685dc2 100644
}
/* now check for timer */
@@ -3439,9 +3454,19 @@ DECL_HANDLER(get_message)
@@ -3393,9 +3408,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 ffb1d441e60..60537685dc2 100644
if (get_win == -1 && current->process->idle_event) set_event( current->process->idle_event );
SHARED_WRITE_BEGIN( queue_shm, queue_shm_t )
@@ -3454,6 +3479,13 @@ DECL_HANDLER(get_message)
if (!get_queue_status( queue )) reset_queue_sync( queue );
else signal_queue_sync( queue );
@@ -3408,6 +3433,13 @@ DECL_HANDLER(get_message)
if (!get_queue_status( queue )) reset_sync( queue->sync );
else signal_sync( queue->sync );
set_error( STATUS_PENDING ); /* FIXME */
+ return;
+
@@ -254,7 +254,7 @@ index ffb1d441e60..60537685dc2 100644
}
@@ -3471,7 +3503,10 @@ DECL_HANDLER(reply_message)
@@ -3425,7 +3457,10 @@ DECL_HANDLER(reply_message)
DECL_HANDLER(accept_hardware_message)
{
if (current->queue)