[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suicidal windows



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]