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

Re: a pesky bug



> Date: Thu, 14 Nov 91 12:43:02 -0500
> From: blakem@world.std.com (Blake Meike)
> To: info-macl@cambridge.apple.com
> Subject: a pesky bug
> 
> Laura Bagnall, here at TERC, has tracked down
> another annoying bug down in the innards of
> MCL 2.0(p3).  Any of you that have been using
> windoids may want to take a look at this
> 
> There is a bug with windoids in which *windoid-count*
> isn't properly maintained.  Specifically, if you create
> a windoid in which there are no other windoids, hide it,
> then show it again, then *windoid-count* is 2 instead
> of 1 (see transcript below).  This is a problem because
> (window-show <window>) seems to do a (set-window-layer 
> *windoid-count*) which will then put the window in the
> wrong layer.  I defined an :after method for window-show
> which works around the problem and seems to make everything
> behave correctly (again see transcript), but I'm sure that
> there'd be a better fix if one had the source.

This finally explains a problem I've seen from time to time where a new
window comes behind the listener instead of in front of it if it happens
to be created just after a progress windoid is shown.

Here's a patch:

----------------------------------------------------------------------

; windoid-count-patch.lisp
;
; Track *windoid-count* properly when windoids are hidden and shown.

(in-package :ccl)

(let ((*warn-if-redefine* nil)
      (*warn-if-redefine-kernel* nil))

(defmethod window-show ((windoid windoid))
  (unless (window-shown-p windoid)
    (without-interrupts
     (call-next-method)
     (reselect-windows))))

(defmethod window-hide ((windoid windoid))
  (when (window-shown-p windoid)
    (without-interrupts
     (#_ShowHide (wptr windoid) nil)
     (reselect-windows)
     (set-window-layer windoid *windoid-count*))))

(let ((method (ignore-errors (method window-close (windoid)))))
  (when method (%remove-method method)))

)