[comp.sys.mac.programmer] How are windows drawn?

jjoshua@topaz.rutgers.edu (Jon Joshua) (02/13/90)

When a window is drawn (a la default WDEF) what says that the
background color should be white?  Is there a way to change this so
that the white pattern is replaced by my pattern?

I tried changing the white pattern in the SysPatList in the system
folder.  The windows were still white- the system doesn't look there.

I don't want to write a WDEF because I'm just changing the background
pattern and I'd like to be able to do it without rebooting.

I know about BackPat but I want to change the background on ALL of the
windows - present and future (until a system reboot).

Also, this is to be part of a DA which is working perfectly except for
the fact that it doesn't do what it's supposed to do - yet.


JOn.
-- 
                        /\                    ?               ________________ 
jjoshua@topaz.rutgers.edu \  ____   __       fgu             |.signature under|
 Anything is possible...   \ |  |  / |     orywlut-          |  construction  |
                            ==========    gfgsdfsdfsd        |________________|
_____________________________OO_____O___hfdhksjdhfksjdfs_______||__________||__

keith@Apple.COM (Keith Rollin) (02/18/90)

In article <Feb.12.12.34.46.1990.24003@topaz.rutgers.edu> jjoshua@topaz.rutgers.edu (Jon Joshua) writes:
>
>When a window is drawn (a la default WDEF) what says that the
>background color should be white?  Is there a way to change this so
>that the white pattern is replaced by my pattern?
>
>I tried changing the white pattern in the SysPatList in the system
>folder.  The windows were still white- the system doesn't look there.
>
>I don't want to write a WDEF because I'm just changing the background
>pattern and I'd like to be able to do it without rebooting.
>
>I know about BackPat but I want to change the background on ALL of the
>windows - present and future (until a system reboot).
>
>Also, this is to be part of a DA which is working perfectly except for
>the fact that it doesn't do what it's supposed to do - yet.

Jon,

The fact that the content region of your window always gets cleared to white is
an anomaly of the Window Manager. When part of a window gets clobbered, the
Window Manager calls the WDEF to redraw the frame, and then clears out the
content region in preparation to returning an update event to the application.
However, it clears the content region by calling EraseRgn() IN THE WINDOW
MANAGER'S PORT, not the port of the window itself. This means that you can set
the BackPat of the window all you want, but the Window Manager will end up
using the BackPat of the window manager port indstead, which is always white.
To get what you want, you'll have to draw the background pattern yourself by
calling EraseRgn on the updateRgn.

Now, that's fine and dandy for your own windows, and is a very solid solution,
but that doesn't mean squat for anyone else's windows. I suppose that if I 
didn't work at Apple in Developer Technical Support that I would mention that
changing the BackPat of the Window Manager port might work, but that is a very
risky thing to do, and I could never, ever, recommend that you actually do that.

(is this mike still on?...)

-- 
------------------------------------------------------------------------------
Keith Rollin  ---  Apple Computer, Inc.  ---  Developer Technical Support
INTERNET: keith@apple.com
    UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith
"Argue for your Apple, and sure enough, it's yours" - Keith Rollin, Contusions