[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference unxa::cde

Title:CDE on Digital UNIXonment - CDE
Notice:CDE on Digital UNIX - for CDE on VMS, please see Note 1.3
Moderator:UNXA::SYSTEM
Created:Tue Nov 23 1993
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:660
Total number of notes:2674

633.0. "Values from .Xdefaults are overridden by CDE?" by IOSG::MARSHALL () Tue Apr 15 1997 15:06

There have been a few similar problems to this in here, but this one's on a
slightly different tack, hence a new topic...

I've set up a custom palette, with the 'Default' number of settable colours (ie
four on my system).  These are (approximately):
    blue (for active window borders)
    grey (for non-text backgrounds and inactive window borders)
    white (for text borders)
    red (for workspace buttons on the front panel)

With these settings the default *foreground colour is black, which is how I want
it.  The problem is with the default *background colour.  CDE has set this to be
the 'grey' colour, which is a real pain.  I want it to be the 'white' colour, so
that things like dxterm, the Notes Motif interface, etc, come up with sensible
colours.

So first question is: what resource name is used for the 'white' colour; I can't
find a resource containing it, so how does dtterm (for example) know to use the
'white' colour for its background)?  NB: it isn't pure white, so it isn't
re-using colour cell 0 or 1, whichever of those is white.

Can I change, within CDE, how CDE defines *background?

Unable (so far) to do the above, I've worked round it by defining *background
(and also DXterm...background, as dxterm appears to ignore *background; why is
this?) to be the colour I want.  This obviously works fine for dxterm, but it
seems that CDE overrides the *background value I've put in .Xdefaults, and
Notes, etc, still come up with a grey background.

I can fix this with a manual "xrdb -override .Xdefaults" each time I log in, but
I'm trying to automate it.  I hoped/assumed that CDE would save the current
value of *background in the session/dt.resources file when I closed the session,
but it doesn't seem to do so; that value is hard-wired to the 'grey' colour,
rather than the 'white' colour I set in .Xdefaults.

So: how can I make my .Xdefaults take priority over what CDE thinks I should
have?  The man page for dtsession implies that .Xdefaults has top priority, by
virtue of being loaded last, but this doesn't seem to be the case.

And/or: how can I make CDE save the 'current' colour values in
session/dt.resources when I exit the session?

Or: should I be doing this in some other way, rather than using .Xdefaults?

Related to this, the main pane of (eg) the File Manager window has a dark grey
colour for its background, which isn't a colour I defined in the palette at all.
Where's it getting this colour from, and why?  Netscape similarly uses this dark
grey for its menu bar and button bar, when other apps use the light grey, but I
suspect there's less I can do about this.

Many thanks for all and any answers and enlightenment,
Scott
T.RTitleUserPersonal
Name
DateLines
633.1It's all in the nameSMURF::MASINICKBrian Masinick, DTN 381-0013Wed Apr 16 1997 15:1719
    I do not know the exact resources used, but I think you will find that
    each of these applications uses slightly different X resources to
    specify the same *effective* resource.  Some use a class name in front
    of background, others use a different format.  Still others hard code
    the characteristics, or use a resource file that overrides .Xdefaults. 
    The resource names *look* similar, but I've found the names and orders
    they are searched to differ.
    
    In the case of dxterm, for instance, between ULTRIX and Digital UNIX,
    the name of the first resource file searched changed.  [That turned out
    to be good for me because a few of the resource names ALSO changed, so
    I could not use a common resource file for both.]
    
    If you are interested in how I get around all of this, send mail to
    quarry::masinick or [email protected].  My .Xdefaults is overkill,
    but by also using application-specific resource files for certain CDE
    and X applications, I get the results I want.
    
    Brian   16-APR-1997 14:22:13
633.2Also try editresSMURF::MASINICKBrian Masinick, DTN 381-0013Wed Apr 16 1997 15:247
    You might also want to experiment around with editres.  Editres is the
    X Resource Editor.  From it, if you learn how it works, you can figure
    out the full name of all supported resources for any application (even
    some you've never heard of).  This is how I found some of the weird
    differences in resource names to begin with.
    
    Brian   16-APR-1997 14:28:51
633.3UNXA::BEUTENo good deed ever goes unpunished...Thu Apr 17 1997 12:3341
>>>So first question is: what resource name is used for the 'white' colour; I can't
>>find a resource containing it, so how does dtterm (for example) know to use the
>>'white' colour for its background)?  NB: it isn't pure white, so it isn't
>>re-using colour cell 0 or 1, whichever of those is white.
>>

foo*background: FFFFFFFFFFFF
will set application "foo"'s background to white.

>>Can I change, within CDE, how CDE defines *background?

Not easily. CDE wants to be able to change the default background based
on color palette selection. So the problem is that your .Xdefaults is
read, but then later the color palette is processed. Unless application
specific color resources are selected, the palette is supposed to provide
the final values.

>>So: how can I make my .Xdefaults take priority over what CDE thinks I should
>>have?  The man page for dtsession implies that .Xdefaults has top priority, by
>>virtue of being loaded last, but this doesn't seem to be the case.

Since you want to override what the CDE color object model code wants to
do, you'll need to create "*background" resources for each application,
or find out what is causing the default "grey" background.

Check your .Xdefaults for a line like

#ifdef COLOR
!!*Background:  #e6e6e6e6e6e6
!!*Foreground:  #000000000000
#endif

Note that I have these lines commented out in my .Xdefaults. Before this,
certain applications wound (eg, dtpad) wound up with a different background
than I expected. These are legacy entries from when I ran DECWindows.

>>And/or: how can I make CDE save the 'current' colour values in
>>session/dt.resources when I exit the session?

CDE only wants to deal with this with regard to palette selection.
633.4IOSG::MARSHALLMon Apr 21 1997 06:3861
.1/.2: Brian, Thanks for the pointer to editres, I shall play with that later...

.3:

>> foo*background: FFFFFFFFFFFF
>> will set application "foo"'s background to white.

Yes, I know this and it's what I've done to work round the problem.  What I'm
trying to find out is: in which resource does CDE 'store' the active palette
colours, so that applications like dtterm can find and use them?  Or maybe it
doesn't use resources at all, in which case how does dtterm 'know' what colours
to use (for example, do CDE-compatible applications 'know' that they're always
supposed to use colour cell 'x' in the default colour map for their background)?

>> CDE wants to be able to change the default background based
>> on color palette selection

Hmmm, but in this case the 'problem' colour is one of the ones that I explicitly
set in the palette, not one of the black-white pair, etc, that CDE automatically
flips between for maximum contrast.  [As an aside, it doesn't flip the text
colours for the wording in Style Manager et al, which is a real pain!].  Also,
the white colour (actually FFFFFFFFF0F0) I set *is* the colour that CDE uses for
lots of backgrounds.  I'm just trying to figure out why it *isn't* the one it
then puts in *background!

Yes, obviously if I change colour palette CDE is at liberty to recalculate all
the non-explicitly-set colours, but if I set up a colour palette and associated
resources in a particular way, and then don't change anything, I would like CDE
to preserve those settings between sessions, particularly as it saves a value
for *background (but not the current value!) as part of the session data.  After
all, isn't that the whole point of CDE?

>> the palette is supposed to provide the final values.

In which case the facilities within CDE for setting colours / palettes would
seem to be inadequate.  Things were sometimes obscure / convoluted with
dxsession and Mwm, but at least I could set them all! :-)

>> or find out what is causing the default "grey" background

That's easy.  It's the colour (light grey) I explicitly set for non-active
window borders in the palette.  CDE also uses it for non-text backgrounds (eg
the front panel, that's OK), but has unfortunately put it in the global
*background.  More confusing is where the dark grey comes from that File Manager
et al use for their non-text backgrounds; that isn't one of the colours in the
palette at all, or in .Xdefaults.

The only colour settings in my .Xdefaults are:
    DXterm.main.terminal.background: #FFFFFFFFF0F0
    *background: #FFFFFFFFF0F0

to undo the CDE settings.

>> the problem is that your .Xdefaults is
>> read, but then later the color palette is processed

I think I can solve this by manually re-reading .Xdefaults (xrdb etc) in
.dtprofile, although it's unfortunate that it's necessary.

Thanks for the info so far,
Scott