client: reject prepare_read if the display queue has events

The display queue is dispatched when and only when any other queue is
dispatched. Therefore, a client that only ever dispatches in response to
prepare_read returning -1 would never dispatch wl_display.error events.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
This commit is contained in:
Julian Orth 2025-04-18 16:31:50 +02:00
parent 1ab6b693b1
commit b43b06d31c

View file

@ -1898,10 +1898,13 @@ wl_display_prepare_read_queue(struct wl_display *display,
struct wl_event_queue *queue)
{
int ret;
bool has_events;
pthread_mutex_lock(&display->mutex);
if (!wl_list_empty(&queue->event_list)) {
has_events = !wl_list_empty(&queue->event_list) ||
!wl_list_empty(&display->display_queue.event_list);
if (has_events) {
errno = EAGAIN;
ret = -1;
} else {