Commit 9304b9fb authored by Iban Hatchondo's avatar Iban Hatchondo
Browse files

Fix: cosmetic & cleanup changes in the way of handling EOF on the xlib:display object.

parent e33fd0e2
;;; -*- Mode: Lisp; Package: ECLIPSE-INTERNALS -*-
;;; $Id: eclipse.lisp,v 1.30 2010-04-02 09:57:53 ihatchondo Exp $
;;; $Id: eclipse.lisp,v 1.31 2010-04-23 14:36:49 ihatchondo Exp $
;;;
;;; ECLIPSE. The Common Lisp Window Manager.
;;; Copyright (C) 2002 Iban HATCHONDO
......@@ -276,10 +276,8 @@
(mp::start-lisp-connection-listener :port 6789 :password "clara"))
(unwind-protect
(catch 'end
(handler-bind ((end-of-file #'handle-end-of-file-condition))
(eclipse-internal-loop)))
(progn
(ignore-errors (xlib:close-display *display*))
(format t "Eclipse exited. Bye.~%")
(quit))))
(handler-case (eclipse-internal-loop)
(end-of-file (c) (handle-end-of-file-condition c)))
(ignore-errors (xlib:close-display *display*))
(format t "Eclipse exited. Bye.~%")
(quit)))
;;; -*- Mode: Lisp; Package: ECLIPSE-INTERNALS -*-
;;; $Id: misc.lisp,v 1.47 2009-11-17 22:40:49 ihatchondo Exp $
;;; $Id: misc.lisp,v 1.48 2010-04-02 09:57:53 ihatchondo Exp $
;;;
;;; This file is part of Eclipse.
;;; Copyright (C) 2002 Iban HATCHONDO
......@@ -71,7 +71,7 @@
,(unless return `(throw ',(or throw type) ,@(or body '(nil))))))
(make-error-handler (error :return t))
(make-error-handler (end-of-file :throw end))
(make-error-handler (end-of-file :return t))
;;;; Window hashtable
;; Wrapper functions over hashtable using xlib:window as hash keys.
......
;;; -*- Mode: Lisp; Package: ECLIPSE-INTERNALS -*-
;;; $Id: wm.lisp,v 1.60 2009-11-17 21:36:08 ihatchondo Exp $
;;; $Id: wm.lisp,v 1.61 2010-04-02 09:57:53 ihatchondo Exp $
;;;
;;; ECLIPSE. The Common Lisp Window Manager.
;;; Copyright (C) 2000, 2001, 2002 Iban HATCHONDO
......@@ -770,34 +770,33 @@
(xlib:query-tree *root-window*))))
;; Main loop
(loop
(catch 'general-error
(handler-case
(let ((event (get-next-event *display* :discard-p t :timeout 2)))
(when event
(with-slots (event-window) event
(event-process event (lookup-widget event-window)))
(xlib:display-finish-output *display*))
(when pt:preprogrammed-tasks (pt:execute-preprogrammed-tasks))
(with-slots (sm-conn) *root*
(when sm-conn (handle-session-manager-request sm-conn *root*)))
(case exit
(1 (loop for val being each hash-value in *widget-table*
when (application-p val)
if close-display-p do (close-widget val)
else do (undecore-application val))
(handler-case
(let ((event (get-next-event *display* :discard-p t :timeout 2)))
(when event
(with-slots (event-window) event
(event-process event (lookup-widget event-window)))
(xlib:display-finish-output *display*))
(when pt:preprogrammed-tasks (pt:execute-preprogrammed-tasks))
(with-slots (sm-conn) *root*
(when sm-conn (handle-session-manager-request sm-conn *root*)))
(case exit
(1 (loop for val being each hash-value in *widget-table*
when (application-p val)
if close-display-p do (close-widget val)
else do (undecore-application val))
(setf exit 2))
(2 (when (root-sm-conn *root*)
(close-sm-connection *root* :exit-p nil))
(xlib:display-finish-output *display*)
(setf (xlib:window-event-mask *root-window*) 0)
(let ((win (netwm:net-supporting-wm-check *root-window*)))
(xlib:destroy-window win))
(xlib:display-finish-output *display*)
(return))))
(exit-eclipse (c)
(setf close-display-p (close-application-p c))
(setf exit 1))
(end-of-file (c) (handle-end-of-file-condition c))
(already-handled-xerror () nil)
(error (c) (handle-error-condition c)))))
(2 (when (root-sm-conn *root*)
(close-sm-connection *root* :exit-p nil))
(xlib:display-finish-output *display*)
(setf (xlib:window-event-mask *root-window*) 0)
(let ((win (netwm:net-supporting-wm-check *root-window*)))
(xlib:destroy-window win))
(xlib:display-finish-output *display*)
(return))))
(exit-eclipse (c)
(setf close-display-p (close-application-p c))
(setf exit 1))
(end-of-file (c) (error c))
(already-handled-xerror () nil)
(error (c) (handle-error-condition c))))
(format t "~%Main loop exited~%")))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment