[comp.windows.x] Why does *BitmapFilePath override XCalendar*BitmapFilePath??

casey@gauss.llnl.gov (Casey Leedom) (10/03/90)

  I have a definition for *BitmapFilepath in my personal resources which I
load into the server with xrdb.  The definition includes a directory under my
home directory and a central directory separated with a colon.  I had a
definition for XCalendar*BitmapFilePath defined in the xcalendar application
defaults file pointing at the directory containing xcalendar's bitmaps, but
it wasn't used.  I could only my personal definition of *BitmapFilePath to
be used.  Eventually I gave up and just defined xcalendar's bitmaps with
absolute pathnames.

  Curiously a definition of the form XCalendar*Font *did* override my personal
definition of *Font.

  Anyone have any idea what's going on?  I thought that matches were supposed
to go for the most specific definition.  The bitmaps are being used to provide
pretty icons for a few buttons in the xcalendar display.  I can provide the
code to anyone who wants to look at it.

Casey

rlh2@ukc.ac.uk (Richard Hesketh) (10/04/90)

In article <69133@lll-winken.LLNL.GOV> casey@gauss.llnl.gov (Casey Leedom) writes:
>
>  I have a definition for *BitmapFilepath in my personal resources which I
>load into the server with xrdb.
>  I had a
>definition for XCalendar*BitmapFilePath defined in the xcalendar application
> [...], but
>it wasn't used.

"BitmapFilePath" is used by XmuLocateBitmapFile() in Xmu/LocBitmap.c
The resource database associated with the display pointer passed in to it
is searched using a call to XrmQGetResource().  Now from my understanding the
X Resource Manager's XrmQGetResource() and XrmGetResource() take a "fully
qualified" resource name and class definition and returns the database entry
that has the tightest binding to these fully qualified names using Xrm's
precedence rules.  The fully qualified names passed by XmuLocateBitmapFile()
are "bitmapFilePath" and "BitmapFilePath".  Therefore only the following
entries will ever be found:

	*BitmapFilePath:	blah
	.BitmapFilePath:	foo
	BitmapFilePath:		bar
	*bitmapFilePath:	blah2
	.bitmapFilePath:	foo2
	bitmapFilePath:		bar2

XmuLocateBitmapFile() ought to use the "Per Display" information that
contains the application class and instance name for the resource query,
e.g.:
	"XCalendar.BitmapFilePath" or "xcalendar.bitmapFilePath"
which would atleast make searching for bitmaps application specific.

>  Curiously a definition of the form XCalendar*Font *did* override my personal
>definition of *Font.

Thats because the font is a resource of a widget (or application) and is
looked up using a fully resource name/class and the toolkit's algorithm for
resource database searches.

>Casey

Richard Hesketh   :   @nsfnet-relay.ac.uk:rlh2@ukc.ac.uk
		  :   rlh2@ukc.ac.uk    ..!{mcsun|mcvax}!ukc!rlh2
Computing Officer, Computing Lab., University of Kent at Canterbury,
Canterbury, Kent, CT2 7NF, United Kingdom.
        Tel: +44 227 764000 ext 7620/7590      Fax: +44 227 762811