server: Added support for the PM_QS_* flags in PeekMessage.
diff --git a/server/protocol.def b/server/protocol.def index 2073a20..e4f16a9 100644 --- a/server/protocol.def +++ b/server/protocol.def
@@ -1839,7 +1839,7 @@ /* Get a message from the current queue */ @REQ(get_message) - int flags; /* see below */ + unsigned int flags; /* PM_* flags */ user_handle_t get_win; /* window handle to get */ unsigned int get_first; /* first message code to get */ unsigned int get_last; /* last message code to get */ @@ -1859,8 +1859,7 @@ data_size_t total; /* total size of extra data */ VARARG(data,message_data); /* message data for sent messages */ @END -#define GET_MSG_REMOVE 1 /* remove the message */ -#define GET_MSG_SENT_ONLY 2 /* only get sent messages */ + /* Reply to a sent message */ @REQ(reply_message)
diff --git a/server/queue.c b/server/queue.c index 1efed55..7efdd78 100644 --- a/server/queue.c +++ b/server/queue.c
@@ -669,7 +669,7 @@ reply->time = msg->time; reply->info = msg->info; - if (flags & GET_MSG_REMOVE) + if (flags & PM_REMOVE) { if (msg->data) { @@ -700,7 +700,7 @@ reply->time = get_tick_count(); reply->info = 0; - if (flags & GET_MSG_REMOVE) + if (flags & PM_REMOVE) { queue->quit_message = 0; if (list_empty( &queue->msg_list[POST_MESSAGE] )) @@ -1691,11 +1691,13 @@ struct list *ptr; struct msg_queue *queue = get_current_queue(); user_handle_t get_win = get_user_full_handle( req->get_win ); + unsigned int filter = req->flags >> 16; reply->active_hooks = get_active_hooks(); if (!queue) return; queue->last_get_msg = current_time; + if (!filter) filter = QS_ALLINPUT; /* first check for sent messages */ if ((ptr = list_head( &queue->msg_list[SEND_MESSAGE] ))) @@ -1704,14 +1706,19 @@ receive_message( queue, msg, reply ); return; } - if (req->flags & GET_MSG_SENT_ONLY) goto done; /* nothing else to check */ /* clear changed bits so we can wait on them if we don't find a message */ - if (req->get_first == 0 && req->get_last == ~0U) queue->changed_bits = 0; - else queue->changed_bits &= QS_ALLPOSTMESSAGE; + if (filter & QS_POSTMESSAGE) + { + queue->changed_bits &= ~(QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER); + if (req->get_first == 0 && req->get_last == ~0U) queue->changed_bits &= ~QS_ALLPOSTMESSAGE; + } + if (filter & QS_INPUT) queue->changed_bits &= ~QS_INPUT; + if (filter & QS_PAINT) queue->changed_bits &= ~QS_PAINT; /* then check for posted messages */ - if (get_posted_message( queue, get_win, req->get_first, req->get_last, req->flags, reply )) + if ((filter & QS_POSTMESSAGE) && + get_posted_message( queue, get_win, req->get_first, req->get_last, req->flags, reply )) return; /* only check for quit messages if not posted messages pending. @@ -1720,12 +1727,14 @@ return; /* then check for any raw hardware message */ - if (filter_contains_hw_range( req->get_first, req->get_last ) && + 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, reply )) return; /* now check for WM_PAINT */ - if (queue->paint_count && + if ((filter & QS_PAINT) && + queue->paint_count && check_msg_filter( WM_PAINT, req->get_first, req->get_last ) && (reply->win = find_window_to_repaint( get_win, current ))) { @@ -1741,8 +1750,9 @@ } /* now check for timer */ - if ((timer = find_expired_timer( queue, get_win, req->get_first, - req->get_last, (req->flags & GET_MSG_REMOVE) ))) + if ((filter & QS_TIMER) && + (timer = find_expired_timer( queue, get_win, req->get_first, + req->get_last, (req->flags & PM_REMOVE) ))) { reply->type = MSG_POSTED; reply->win = timer->win; @@ -1756,7 +1766,6 @@ return; } - done: set_error( STATUS_PENDING ); /* FIXME */ }
diff --git a/server/trace.c b/server/trace.c index 2909ded..50926f5 100644 --- a/server/trace.c +++ b/server/trace.c
@@ -2267,7 +2267,7 @@ static void dump_get_message_request( const struct get_message_request *req ) { - fprintf( stderr, " flags=%d,", req->flags ); + fprintf( stderr, " flags=%08x,", req->flags ); fprintf( stderr, " get_win=%p,", req->get_win ); fprintf( stderr, " get_first=%08x,", req->get_first ); fprintf( stderr, " get_last=%08x,", req->get_last ); @@ -4111,9 +4111,11 @@ { "ALERTED", STATUS_ALERTED }, { "ALIAS_EXISTS", STATUS_ALIAS_EXISTS }, { "BAD_DEVICE_TYPE", STATUS_BAD_DEVICE_TYPE }, + { "BAD_IMPERSONATION_LEVEL", STATUS_BAD_IMPERSONATION_LEVEL }, { "BUFFER_OVERFLOW", STATUS_BUFFER_OVERFLOW }, { "BUFFER_TOO_SMALL", STATUS_BUFFER_TOO_SMALL }, { "CANCELLED", STATUS_CANCELLED }, + { "CANT_OPEN_ANONYMOUS", STATUS_CANT_OPEN_ANONYMOUS }, { "CHILD_MUST_BE_VOLATILE", STATUS_CHILD_MUST_BE_VOLATILE }, { "DEVICE_BUSY", STATUS_DEVICE_BUSY }, { "DIRECTORY_NOT_EMPTY", STATUS_DIRECTORY_NOT_EMPTY },