Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!mcvax!uvabick!thomas
From: thomas@uvabick.UUCP (Thomas Fruin)
Newsgroups: comp.sys.mac
Subject: Window Manager problem (perhaps even a bug)
Message-ID: <225@uvabick.UUCP>
Date: Thu, 9-Jul-87 19:04:03 EDT
Article-I.D.: uvabick.225
Posted: Thu Jul  9 19:04:03 1987
Date-Received: Sun, 12-Jul-87 09:31:43 EDT
Organization: uvabick
Lines: 57
Keywords: Window Manager SendBehind problem


Thought  I'd try  my luck on  Usenet too,  after not  hearing from
Info-Mac for about two weeks...

I'm confused by a Window Manager problem I've run into. Maybe I've
even found an error in Inside Macintosh.  Let me  explain what I'm
trying to do:

The program I'm working on will have a "palette" window similar to
those windows in FullPaint: a window that always stays on top, but
doesn't act as the active window.  My  program  will have  several
document windows below this palette that  should  behave as normal
as possible to the user.

This  means  that  when a user  clicks  in a window that isn't the
active one, that window should be brought to the front,  BUT  stay
below the palette window.  Obviously I cannot use SelectWindow for
this.  Instead I use  SendBehind, which seems exactly the function
for this purpose (forget about highlighting for now).

Here is where the problem occurs.  Inside  Macintosh tells me that
if I use SendBehind to move a window closer to the front, I should
make  some  extra low-level  Window  Manager  calls  after calling
SendBehind.  Specifically a call to PaintOne and one to CalcVis.

But I don't think these  are  sufficient.  Whenever I try this out
by  clicking in one of my  windows to bring it to the "front", the
visRgn  of  the  window  that  used  to be in front is screwed up.
Anything  I  draw  in  it doesn't stay in its visible  region, but
flows into the window I just brought to the front. See the figure.
It shows two windows before and after the SendBehind, PaintOne and
CalcVis calls, when I start drawing into one of them.

    --------------------          --------------------
    |behind            |          |in front          |
    |   -------------------       |                  |---
    |   |I am drawing text|       |    I am drawing text|
    ----|into lower right |       -----into-lower-right |
        |window only.     |           |window only.     |
        -------------------           -------------------

By  changing  the  CalcVis call to a CalcVisBehind  things go back
to normal.  So it  seems  to me  SendBehind  is not  updating  the
visRgn of the  window(s) it is  covering up.  Of course it should.
The Apple traplist in the Sybex book  Using the Mac Toolbox with C
says that SendBehind already calls CalcVisBehind...

Can  anyone help me with this one?  If I'm doing things all wrong,
I'd also welcome suggestions to other and better ways to implement
such a palette window.

-- Thomas Fruin

   fruin@hlerul5.BITNET
   thomas@uvabick.UUCP

   Leiden University, Netherlands