[comp.windows.x] resources in toolkit

jkh@ardent.UUCP (Jordan Hubbard) (05/13/88)

Ever since I installed Jef Poskanser's patches for a string->pixmap
converter, I've been trying to figure out how to get icon pixmaps to
be displayed properly. An entry of the form:

xterm*iconPixmap: /foo/bar/somepixmapfile

works fine. However, this sets it for *all* xterms, not just the ones
with an application name of "xterm". I was under the impression that
you could specify an alternate application name with -n (and an alternate
window manager name with -T). Shouldn't it be possible to say something
like:

(~/.Xdefaults)
xterm*iconPixmap: /stuff/generic-xterm-icon
goofy*iconPixmap: /stuff/goofy-machine-icon

(shell)
% xterm -g 80x24+0+0
% xterm -n goofy -e rlogin goofy

And have two different pixmaps displayed? It would be all well and fine
if the toolkit (or xterm at least) supported a -iconPixmap flag so you
could specify something in the absense of a resource, but that's not
the case. I notice that -n in xterm is also looked for as the resource
"iconName"... Is that right? I suppose if -T sets the application
name, fine, but....
How *does* one select a potentially different icon pixmap for
each invocation of xterm?

Also, am I completely confused about the resource manager or shouldn't
it be possible to say:

Xterm*iconPixmap: ...

It doesn't work for me.. Perhaps I just don't understand the name/class
concept well enough. q?

And while we're on this subject, I guess I'll ask how exactly does
the toolkit handle command line options? I notice that XtInititialize()
is interested in argc, argv and a list of client-specific options
which it seems to kindly parse and initialize for you, but wouldn't
it be logical for the toolkit to have its own set of "standard"
arguments that would be used to init the top level widget? I notice
quite a few things that are searched for in the resource database, but
there doesn't see to be any way of specifying them on the command line.
Que Pasa?


				Jordan Hubbard
				jkh@violet.berkeley.edu

dave@spool.cs.wisc.edu (Dave Cohrs) (05/14/88)

Jordan Hubbard writes:

> Shouldn't it be possible to say something
> like:
> 
> (~/.Xdefaults)
> xterm*iconPixmap: /stuff/generic-xterm-icon
> goofy*iconPixmap: /stuff/goofy-machine-icon
> 
> (shell)
> % xterm -g 80x24+0+0
> % xterm -n goofy -e rlogin goofy
> 
> And have two different pixmaps displayed?
 
You should specify "-name goofy", not "-n goofy" (of course, if you want
the *iconName attribute to be goofy, you need the latter as well). So,

% xterm -n goofy -name goofy -e rlogin goofy

should do what you want.  For common attributes, make entries
with the name "XTerm" instead of "xterm" in your .Xdefaults,
like "XTerm*jumpScroll:  on".  That way you don't need 20 resource
lines for each possible name you will call xterm.

Dave Cohrs
+1 608 262-6617                        UW-Madison Computer Sciences Department
dave@cs.wisc.edu                 ...!{harvard,ihnp4,rutgers,ucbvax}!uwvax!dave

swick@ATHENA.MIT.EDU (Ralph R. Swick) (05/14/88)

Dave Cohrs' analysis is correct.  The old '-n' option to xterm should
probably have been dropped to avoid the confusion with '-name'.

Also, the man page for all applications should state their application
class; in xterm's case, it is "XTerm".

As to having standard command line options for all resources used by
TopLevelShell widgets, I note only that some people believe long
command lines to be evil incarnate.  The '-xrm' option is intended to
provide the all-purpose hacker's porthole, if you insist. :-)

-Ralph

rlh2@eagle.ukc.ac.uk (R.L.Hesketh) (05/14/88)

In article <8805122159.AA07168@BigMoma.ardent.com> jkh@ardent.UUCP (Jordan Hubbard) writes:
>And while we're on this subject, I guess I'll ask how exactly does
>the toolkit handle command line options?...
> ....
>.... I notice
>quite a few things that are searched for in the resource database, but
>there doesn't see to be any way of specifying them on the command line.
>Que Pasa?
>

The way I read it, (X Toolkit Intrinsics manual page 22) any resource in any
widget can be set from the command line using the `-xrm' argument.

For example to set the background colour you can either use:

	myapp -bg slateblue
or
	myapp -xrm '*background: slateblue'

please note 'background: slateblue' does not work.

or even 
	myapp -xrm '*borderColor: red' -xrm '*logo*background: slateblue'

In this case all the borders of all of the widgets are red and the background
colour of any logo widget is slateblue (nice colour that one!).

To bring a toolkit based application up iconified you can directly specify the
Shell widget's resource:

	myapp -xrm '*iconic: true'

This works for me everytime.

	Richard
-- 
rlh2@ukc.ac.uk
        Sgt. Pinback : "Alright bomb, prepare for new orders."
        Bomb #20     : "You are false data, I shall therefore ignore you."
        "Dark Star"

dana@dino.bellcore.com (Dana A. Chee) (05/23/88)

In article <8805122159.AA07168@BigMoma.ardent.com> jkh@ardent.UUCP.UUCP writes:

   Ever since I installed Jef Poskanser's patches for a string->pixmap
   converter, I've been trying to figure out how to get icon pixmaps to
   be displayed properly. An entry of the form:

   xterm*iconPixmap: /foo/bar/somepixmapfile

   works fine. However, this sets it for *all* xterms, not just the ones
   with an application name of "xterm". I was under the impression that
   you could specify an alternate application name with -n (and an alternate
   window manager name with -T). Shouldn't it be possible to say something
   like:

   (~/.Xdefaults)
   xterm*iconPixmap: /stuff/generic-xterm-icon
   goofy*iconPixmap: /stuff/goofy-machine-icon

   (shell)
   % xterm -g 80x24+0+0
   % xterm -n goofy -e rlogin goofy

   And have two different pixmaps displayed? It would be all well and fine
   if the toolkit (or xterm at least) supported a -iconPixmap flag so you
   could specify something in the absense of a resource, but that's not
   the case. I notice that -n in xterm is also looked for as the resource
   "iconName"... Is that right? I suppose if -T sets the application
   name, fine, but....
   How *does* one select a potentially different icon pixmap for
   each invocation of xterm?

What you need is '-name goofy' on the command line.  This sets the
application's actual name.

   Also, am I completely confused about the resource manager or shouldn't
   it be possible to say:

   Xterm*iconPixmap: ...

   It doesn't work for me.. Perhaps I just don't understand the name/class
   concept well enough. q?

Its XTerm instead of Xterm (don't ask me why, that's just the way the
code is written).

   And while we're on this subject, I guess I'll ask how exactly does
   the toolkit handle command line options? I notice that XtInititialize()
   is interested in argc, argv and a list of client-specific options
   which it seems to kindly parse and initialize for you, but wouldn't
   it be logical for the toolkit to have its own set of "standard"
   arguments that would be used to init the top level widget? I notice
   quite a few things that are searched for in the resource database, but
   there doesn't see to be any way of specifying them on the command line.
   Que Pasa?

Yes, there are a set of standard command line arguments that Xt
recognizes.  They are listed on page 22 (Section 4.3) of the X Toolkit
Intrinsics manual.  When XtInitialize is called, it merges the client
specific arguments with the standard aguments, and searches argv for
all of them.


				   Jordan Hubbard
				   jkh@violet.berkeley.edu

Hope this helps.

--
			Dana Chee
			Bellcore
			MRE 2Q-250
			(201) 829-4488
			dana@bellcore.com