From f4f756dfc57d392d58d52fa342b09ea5e99b63c9 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Wed, 29 Aug 2012 16:37:42 +0000 Subject: [PATCH] Process all queued X events, not just one, if I/O is ready. X-DISPLAY-PROCESS-EVENTS may have the side effect of moving events from the kernel's pipe buffer into Xlib's queue, in which case after processing one event there may be more events pending in the queue but no more I/O pending on the pipe. Before this change we failed to report these other events in a timely fashion. Do this both in Edwin's xterm.scm and the runtime's x11graph.scm. --- src/edwin/xterm.scm | 8 +++++--- src/runtime/x11graph.scm | 12 +++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/edwin/xterm.scm b/src/edwin/xterm.scm index 5729d5879..0473cfcf0 100644 --- a/src/edwin/xterm.scm +++ b/src/edwin/xterm.scm @@ -576,9 +576,11 @@ USA. (lambda (mode) mode (if (not reading-event?) - (let ((event (x-display-process-events x-display-data 2))) - (if event - (preview-event event))))))) + (let loop () + (let ((event (x-display-process-events x-display-data 2))) + (if event + (begin (preview-event event) + (loop))))))))) unspecific) (define (wait-for-event interval predicate process-event) diff --git a/src/runtime/x11graph.scm b/src/runtime/x11graph.scm index fd879179c..7d2e70c36 100644 --- a/src/runtime/x11graph.scm +++ b/src/runtime/x11graph.scm @@ -294,11 +294,13 @@ USA. (deregister-io-thread-event registration) (continuation unspecific)) (lambda () - (let ((event - (x-display-process-events (x-display/xd display) - 2))) - (if event - (process-event display event)))))))))) + (let loop () + (let ((event + (x-display-process-events (x-display/xd display) + 2))) + (if event + (begin (process-event display event) + (loop)))))))))))) registration)) (define (read-event display) -- 2.25.1