Reset Edwin's X display on restore.
authorTaylor R Campbell <campbell@mumble.net>
Mon, 3 Nov 2014 20:43:44 +0000 (20:43 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Mon, 3 Nov 2014 20:43:48 +0000 (20:43 +0000)
It now works to save and restore bands in which you have run Edwin
with X, as long as Edwin is not currently running while you save the
band.

src/edwin/xterm.scm

index b10c6e73d689ca9ed60de7a33f2c49fa13977395..b78a722824c0bae85000fc36f3b174b2bb15de99 100644 (file)
@@ -1310,7 +1310,7 @@ Otherwise, it is copied from the primary selection."
 
 (define x-selection-timeout 5000)
 \f
-;;;; Initialization
+;;;; Interrupts
 
 (define reading-event?)
 (define signal-interrupts?)
@@ -1352,25 +1352,32 @@ Otherwise, it is copied from the primary selection."
   (editor-beep)
   (temporary-message "Quit")
   (^G-signal))
+\f
+;;;; Initialization
 
 (define x-display-type)
 (define x-display-data)
 (define x-display-events)
 (define x-display-name #f)
 
+(define (reset-x-display!)
+  (set! x-display-data #f)
+  (set! x-display-events)
+  unspecific)
+
 (define (get-x-display)
   ;; X-OPEN-DISPLAY hangs, uninterruptibly, when the X server is
   ;; running the login loop of xdm.  Can this be fixed?
   (or x-display-data
       (and (begin
-            (load-library-object-file "prx11" #f)
-            (implemented-primitive-procedure?
-             (ucode-primitive x-open-display 1)))
-          (or x-display-name (get-environment-variable "DISPLAY"))
-          (let ((display (x-open-display x-display-name)))
-            (set! x-display-data display)
-            (set! x-display-events (make-queue))
-            display))))
+             (load-library-object-file "prx11" #f)
+             (implemented-primitive-procedure?
+              (ucode-primitive x-open-display 1)))
+           (or x-display-name (get-environment-variable "DISPLAY"))
+             (let ((display (x-open-display x-display-name)))
+               (set! x-display-data display)
+               (set! x-display-events (make-queue))
+               display))))
 
 (define (initialize-package!)
   (set! screen-list '())
@@ -1385,6 +1392,6 @@ Otherwise, it is copied from the primary selection."
                           with-editor-interrupts-from-x
                           with-x-interrupts-enabled
                           with-x-interrupts-disabled))
-  (set! x-display-data #f)
-  (set! x-display-events)
+  (reset-x-display!)
+  (add-event-receiver! event:after-restore reset-x-display!)
   unspecific)
\ No newline at end of file