Newsgroups: comp.lang.lisp.mcl
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!gatech!swrinde!pipex!peernews.demon.co.uk!news.demon.co.uk!user
From: angus@aegypt.demon.co.uk (Angus McIntyre)
Subject: Re: Suicidal windows
X-Nntp-Posting-Host: aegypt.demon.co.uk
Message-ID: <ABC1D6269668184D3@aegypt.demon.co.uk>
Sender: news@demon.co.uk (Usenet Administration)
Organization: Rev'd Jack's Roamin' Cadillac Church
References: <9504240041.aa14856@post.demon.co.uk>
Date: Mon, 24 Apr 1995 21:26:46 GMT
Lines: 33

In article <9504240041.aa14856@post.demon.co.uk>,
dim@lissys.demon.co.uk (Dimitri Simos) wrote:

>I'm trying to create a class of window that ... must die if  ... it 
>gets covered by any other window ... I have tried the 'obvious' one 
> ... and ... it sends MCL into an infinite recursion:

Probably 'window-close' calls something that sends a 'deactivate-event'
to the window, thus tripping the 'window-deactivate-event-handler',
which calls 'window-close', which ...

The solution is presumably to add a slot to the window class to
record that the window's in the process of closing, e.g.

    (defclass tempo-window (window)
        ((closing-p  :initform NIL)))
    
    (defmethod view-deactivate-event-handler :around
               ((W tempo-window))
      (call-next-method)
      (unless (slot-value W 'closing-p)
         (setf (slot-value W 'closing-p) T)
         (window-close w)))
     
That seems to work OK.

                            A

--
angus@aegypt.demon.co.uk    http://www.tardis.ed.ac.uk/~angus/

"I am here by the will of the people ... and I will not leave
 until I get my raincoat back." ['Metrophage', Richard Kadrey]
