[comp.windows.x] "reverseVideo" attribute when writing widgets

dheller@cory.Berkeley.EDU (Dan Heller) (03/31/89)

When writing widgets, I've found that every single widget has to
test for the reverseVideo attribute in the Initialize function and
reverse the values of the background and foreground colors, or this
doesn't seem to happen automatically.  What's worse, the result seems
to be unpredictable (mostly due to lack of adequate testing :-).

It would be nice if the toolkit intrinsics noticed this and swapped
those colors for you, but alas, not every widget has a foreground
color (most do).

At any rate, I was wondering if someone else knows how to better
deal with this.  Also, are there any other attributes that have to
be dealt with similarly?

Dan Heller	<island!argv@sun.com>

cat@island.uu.net (Cathleen Greenberg) (04/05/89)

>
>In X11R3 a couple of new colors were added, XtDefaultForeground and
>XtDefaultBackground.  Depending upon the state of the reverse video
>flag these strings are converted to BlackPixel() or WhitePixel().
>This should provide the functionality that you desire.
>

Is there anyway to override this functionality??
It is a double-edged sword -- ie. a bug and a feature.
also one other thing to note -- if you set foreground and background colors
in your .Xdefaults it causes lots of problems regardless of what the
reverse video flag is set to.

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (04/19/89)

> Is there anyway to override this functionality??

You can always just specify that your default colors are "black" or 
"white" this is not really quite as clean though, and people who use
reverse video will get strange results, as your widget will be the inverse of
all the others. 

> It is a double-edged sword -- ie. a bug and a feature.

Seems to be a reasonable way to do it to be.

> also one other thing to note -- if you set foreground and background colors
> in your .Xdefaults it causes lots of problems regardless of what the
> reverse video flag is set to.

It will not cause problems. The colors in your resource database will override
these "default" colors.  I fail to see the problem that you seem to
be having with allowing reverse video to be defined this way.


                                                Chris D. Peterson
                                                MIT X Consortium