Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!bloom-beacon!EXPO.LCS.MIT.EDU!kit From: kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) Newsgroups: comp.windows.x Subject: Re: XtNreverseVideo --again-- Message-ID: <8904201507.AA12757@expo.lcs.mit.edu> Date: 20 Apr 89 15:07:51 GMT References: <12671@pasteur.Berkeley.EDU> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 72 > Normally, one would expect the foreground and background colors to be > reversed. yet this isn't quite that simple. Nope, but it is pretty close. If reverse video is specified by the user the the values of XtDefaultForground and XtDefaultBackground are swapped. Thus anything that uses these as their default colores will effectively have the foreground and background colors swapped. Without reverse video specified: XtDefaultForeground = "white" XtDefaultBackground = "black" With reverse video specified: XtDefaultForeground = "black" XtDefaultBackground = "white" > { XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), > XtOffset(widget.foreground), XtRString, XtDefaultForeground}, > ... > > I have no idea what the foreground color defaults to... It defaults to "white: when -rv is specified, otherwise to "black". The use can override by specifying something like: test*foreground: blue > if (widget.reverseVideo) > widget.foreground = !widget->core.background_pixel; > This is the only way I'm guaranteed that the two colors will be > different and that it'll work on both color and monochrome (altho the > results will probably be incorrect for color servers). Gaak. This is really gross. Don't do this you will get random colors on a color workstation. > Now, let's complicate things a little... > My app-defaults file says: > > *foreground: green > *background: blue > Yet the user invokes the program with the -rv flag expecting his > foreground to be blue and background to be green. What happens now? you should actually use: *Foreground: green *Background: blue There are programs that set colors that are not named foreground and background but have class Foreground or Background. The color of the hands on xclock is a good example. Anyway in answer to your initial question. The user will get the color green for all resources named foreground and blue for all resources named background. This will happen reguardless of whether reverse video is specified. The attitude that the toolkit has taken is that reverse video is overrided by explict color specifications. So if you specify colors then reverse video ceases to have any meaning. Chris D. Peterson MIT X Consortium