Synchronize action of XTERM-SCREEN/ENTER! until after the window is
authorChris Hanson <org/chris-hanson/cph>
Thu, 24 Oct 1996 16:29:46 +0000 (16:29 +0000)
committerChris Hanson <org/chris-hanson/cph>
Thu, 24 Oct 1996 16:29:46 +0000 (16:29 +0000)
properly mapped on the screen.  This will hopefully eliminate the
weird race condition that has been causing so many errors.

v7/src/edwin/xterm.scm

index 4a1f9268f7f1c3009661056bfa8469238c071602..20765231fdc8d24f3aaae3db5377d02a675575ec 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: xterm.scm,v 1.53 1996/04/24 01:48:40 cph Exp $
+;;;    $Id: xterm.scm,v 1.54 1996/10/24 16:29:46 cph Exp $
 ;;;
 ;;;    Copyright (c) 1989-96 Massachusetts Institute of Technology
 ;;;
     (if screen
        (let ((visibility (screen-visibility screen)))
          (if (pair? visibility)
-             (set-screen-visibility! screen (car visibility)))))))
+             (begin
+               (set-screen-visibility! screen (car visibility))
+               (for-each (lambda (procedure) (procedure screen))
+                         (reverse (cdr visibility)))))))))
 \f
 (define-integrable (screen-xterm screen)
   (xterm-screen-state/xterm (screen-state screen)))
   (set-screen-redisplay-flag! screen true))
 
 (define (xterm-screen/enter! screen)
-  (set-screen-selected?! screen true)
-  (let ((xterm (screen-xterm screen)))
-    (xterm-enable-cursor xterm true)
-    (xterm-draw-cursor xterm))
-  (xterm-screen/grab-focus! screen)
-  (xterm-screen/flush! screen))
+  (if (pair? (screen-visibility screen))
+      (without-interrupts
+       (lambda ()
+        (if (not (memq xterm-screen/enter! (cdr (screen-visibility screen))))
+            (set-cdr! (screen-visibility screen)
+                      (cons xterm-screen/enter!
+                            (cdr (screen-visibility screen)))))))
+      (begin
+       (set-screen-selected?! screen true)
+       (let ((xterm (screen-xterm screen)))
+         (xterm-enable-cursor xterm true)
+         (xterm-draw-cursor xterm))
+       (xterm-screen/grab-focus! screen)
+       (xterm-screen/flush! screen))))
 
 (define (xterm-screen/grab-focus! screen)
   (and last-focus-time