Skip to content
Snippets Groups Projects
Commit 65601edb authored by pw's avatar pw
Browse files

Handle the case of the user closing the display using a window manager

gesture. I had hoped to be able to just return to tty mode and maybe
restart hemlock later (via (ed)), but there is a lot of hidden state
pointing to the old (closed) display object which caused subsequent
failure. This fix assumes the user closed hemlock because he wanted to
exit and does just that.
parent 335cf6ac
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain. ;;; Carnegie Mellon University, and has been placed in the public domain.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/hemlock/input.lisp,v 1.6 1997/01/18 14:31:54 ram Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/hemlock/input.lisp,v 1.7 2001/01/27 14:22:20 pw Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -167,6 +167,19 @@ ...@@ -167,6 +167,19 @@
;;; ;;;
(defparameter editor-abort-key-events (list #k"Control-g" #k"Control-G")) (defparameter editor-abort-key-events (list #k"Control-g" #k"Control-G"))
(defun cleanup-for-wm-closed-display(closed-display)
;; Remove fd-handlers
(ext:disable-clx-event-handling closed-display)
;; Close file descriptor and note DEAD.
(xlib:close-display closed-display)
;;
;; At this point there is not much sense to returning to Lisp
;; as the editor cannot be re-entered (there are lots of pointers
;; to the dead display around that will cause subsequent failures).
;; Maybe could switch to tty mode then (save-all-files-and-exit)?
;; For now, just assume user wanted an easy way to kill the session.
(ext:quit))
(defmacro abort-key-event-p (key-event) (defmacro abort-key-event-p (key-event)
`(member ,key-event editor-abort-key-events)) `(member ,key-event editor-abort-key-events))
...@@ -187,12 +200,34 @@ ...@@ -187,12 +200,34 @@
;;; input method (recursively even). ;;; input method (recursively even).
;;; ;;;
(eval-when (compile eval) (eval-when (compile eval)
(defmacro editor-input-method-macro () (defmacro editor-input-method-macro ()
`(handler-bind ((error #'(lambda (condition) `(handler-bind
(let ((device (device-hunk-device ((error
(window-hunk (current-window))))) (lambda (condition)
(funcall (device-exit device) device)) (when (typep condition 'stream-error)
(invoke-debugger condition)))) (let* ((stream (stream-error-stream condition))
(display *editor-windowed-input*)
(display-stream
#+CLX
(and display (xlib::display-input-stream display))))
(when (eq stream display-stream)
;;(format *error-output* "~%Hemlock: Display died!~%~%")
(cleanup-for-wm-closed-display display)
(exit-hemlock nil))
(let ((device
(device-hunk-device (window-hunk (current-window)))))
(funcall (device-exit device) device))
(invoke-debugger condition)))))
#+(and CLX )
(xlib:closed-display
(lambda(condition)
(let ((display (xlib::closed-display-display condition)))
(format *error-output*
"Closed display on stream ~a~%"
(xlib::display-input-stream display)))
(exit-hemlock nil)))
)
; (when *in-hemlock-stream-input-method* ; (when *in-hemlock-stream-input-method*
; (error "Entering Hemlock stream input method recursively!")) ; (error "Entering Hemlock stream input method recursively!"))
(let ((*in-hemlock-stream-input-method* t) (let ((*in-hemlock-stream-input-method* t)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment