From ca25052b61382d9100723d25e2eb9e172d8a7efb Mon Sep 17 00:00:00 2001
From: ram <ram>
Date: Wed, 15 May 1991 15:44:52 +0000
Subject: [PATCH] .../systems-work/clx/input.lisp, 25-May-90 15:08:42, Edit by
 Chiles.   Modified EVENT-LISTEN according to Chris Lindblad's patch to make
 it   correctly count how many events are pending when called from within   an
 EVENT-CASE branch.

---
 clx/input.lisp | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/clx/input.lisp b/clx/input.lisp
index c21df68fd..0b62eed48 100644
--- a/clx/input.lisp
+++ b/clx/input.lisp
@@ -625,7 +625,17 @@
   (let* ((current-event-symbol (car (display-current-event-symbol display)))
 	 (current-event (and (boundp current-event-symbol)
 			     (symbol-value current-event-symbol)))
-	 (queue (or current-event (display-event-queue-head display))))
+	 ;; #+CMU  Change how we bind queue here:
+	 ;; Old line:
+	 ;;    (queue (or current-event (display-event-queue-head display))))
+	 ;; New binding causes this routine to correctly count pending events
+	 ;; when called from within an EVENT-CASE branch.  This previously
+	 ;; was counting one more than it should, but calling EVENT-CASE
+	 ;; recursively would wedge waiting for an event because that one
+	 ;; event really wasn't available for handling.
+	 (queue (if current-event
+		    (reply-next (the reply-buffer current-event))
+		    (display-event-queue-head display))))
     (declare (type symbol current-event-symbol)
 	     (type (or null reply-buffer) current-event queue))
     (if queue
-- 
GitLab