Process all queued X events, not just one, if I/O is ready.
authorTaylor R Campbell <campbell@mumble.net>
Wed, 29 Aug 2012 16:37:42 +0000 (16:37 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Wed, 29 Aug 2012 16:41:43 +0000 (16:41 +0000)
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
src/runtime/x11graph.scm

index 5729d58794a45a00bb7fa7d5b58701e32a51508a..0473cfcf05439ef9118616481df58392e2b5377d 100644 (file)
@@ -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)
index fd879179cbf71862da205890cd907fdc56d62778..7d2e70c36790abbe5a93971bb8aa6d3226a38ea1 100644 (file)
@@ -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)