Change event-reading loop to block when waiting for an event while
authorChris Hanson <org/chris-hanson/cph>
Thu, 3 Apr 1997 04:44:32 +0000 (04:44 +0000)
committerChris Hanson <org/chris-hanson/cph>
Thu, 3 Apr 1997 04:44:32 +0000 (04:44 +0000)
none of the Edwin windows is active.  This is safe because we won't
get any events until one of them becomes active, and at that time the
activation messages will cause a return from the block.

v7/src/edwin/win32.scm

index 60ee16e249becb6c1c5a24f8587d31a50cb40086..a93034eb8820fd7b6fb8d41c15129fcf7104674e 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: win32.scm,v 1.7 1997/01/02 04:39:45 cph Exp $
+;;;    $Id: win32.scm,v 1.8 1997/04/03 04:44:32 cph Exp $
 ;;;
 ;;;    Copyright (c) 1994-97 Massachusetts Institute of Technology
 ;;;
                 (set-interrupt-enables! mask)
                 event:process-status)
                (else
-                (let ((handle* (win32-screen-current-focus)))
+                (let ((handle* (win32-screen-current-focus))
+                      (wait
+                       (lambda ()
+                         (test-for-input-on-descriptor
+                          ;; console-channel-descriptor here
+                          ;; means "input from message queue".
+                          console-channel-descriptor block?))))
                   (if (eqv? handle handle*)
-                      (let ((flag
-                             (test-for-input-on-descriptor
-                              ;; console-channel-descriptor here
-                              ;; means "input from message queue".
-                              console-channel-descriptor block?)))
+                      (let ((flag (wait)))
                         (set-interrupt-enables! mask)
                         (case flag
                           ((#F) #f)
                                                 select-screen
                                                 screen*))
                             (and block?
-                                 (read-event-1 handle block?))))))))))))
+                                 (begin
+                                   (wait)
+                                   (read-event-1 handle block?)))))))))))))
 
 (define (read-event-2 handle)
   (and handle