home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x
- Path: sparky!uunet!snorkelwacker.mit.edu!thunder.mcrcim.mcgill.edu!mouse
- From: mouse@thunder.mcrcim.mcgill.edu (der Mouse)
- Subject: Re: Getting foreground/background colors of a window.
- Message-ID: <1992Sep6.065937.16145@thunder.mcrcim.mcgill.edu>
- Organization: McGill Research Centre for Intelligent Machines
- References: <1992Sep2.132746.26532@enea.se>
- Date: Sun, 6 Sep 92 06:59:37 GMT
- Lines: 30
-
- In article <1992Sep2.132746.26532@enea.se>, mla@enea.se (Mats L|fstr|m) writes:
-
- > For reasons of my own, I want to know the foreground and background
- > colors used in a window. But the window isn't created by my
- > application, but rather by any other application. Is there any way
- > of getting this information?
-
- Only by inference, by reading back what's in the window and trying to
- figure it out. One problem is that foreground and background may not
- be well-defined; consider a GIF file displayer, for example. Another
- problem is telling the difference; consider an xterm with large
- quantities of text displayed reversed - how are you to know which part
- of the window is "reverse" and which is "normal"?
-
- It's true that every window has a background of some sort. But this
- can be a pixel value, a pixmap, ParentRelative, or None. In only one
- of these cases is it even conceptually well-defined to ask what the
- window's background color is, and in any case, you can't even find out
- which alternative is in effect for a given window, never mind telling
- what the pixel value is or pixmap contents are. (Not
- non-destructively, that is. By playing games with obscuring portions
- of the window in various ways and other things, you may be able to
- deduce some things about the window's background. All such attempts
- suffer from races with the window's application redrawing the window's
- contents.)
-
- der Mouse
-
- mouse@larry.mcrcim.mcgill.edu
-