[comp.windows.x] Retrieving Application Class and Name

gja@b11.ingr.com (Gerry Attilio) (11/09/90)

  Is there any way to retrieve the application class and name that was
specified to XtDisplayInitialize.  Our investigation led us to believe that
these values are managed internally within the Xt toolkit and access to the 
pertinent data is restricted to Xt.

-- 
Gerry Attilio			205-730-1787		uunet!ingr!b17d!gja!gja
Software Tools			   IW17D1		b17d!gja!gja@ingr.com

doyle@b11.ingr.com (Doyle Davidson) (11/10/90)

In article <9352@b11.ingr.com>, gja@b11.ingr.com (Gerry Attilio) writes:
> 
>   Is there any way to retrieve the application class and name that was
> specified to XtDisplayInitialize.  Our investigation led us to believe that
> these values are managed internally within the Xt toolkit and access to the 
> pertinent data is restricted to Xt.

One way I know of is through the ICCCM convenience functions:
    XGetClassHint(Display *, Window, XClassHint *)

Also, the info is stored in the ApplicationShell (created by XtInitialize)
in the xrm_class and/or class fields.

You could probably cheat by:
    XrmClass c;
    char *class;
    ApplicationShellWidget a;

    a = (ApplicationShellWidget) XtInialize(...)
    c = a->application.xrm_class;
    class = a->application.class;
    ...

I would suggest something like:
    toplevel = XtInitialize(...);
    XGetClassHint(XtDisplay(toplevel), XtWindow(toplevel), &classHint);

Or maybe....

Doyle (Then again maybe I don't know what I'm talking about) Davidson
------------------------------------------------------------------
Doyle C. Davidson              |
Intergraph Corp.               |  These comments are...
Third Party Software           |
   Product Development         |     \\  /
(205) 730-2000                 |      \\/
                               |      /\\  clusively my own.
..!b23b!doyled!doyle  -or-     |     /  \\
..!uunet!ingr!doyle            |
------------------------------------------------------------------

mikey@eukanuba.wpd.sgi.com (Mike Yang) (11/10/90)

In article <9352@b11.ingr.com>, gja@b11.ingr.com (Gerry Attilio) writes:
|>   Is there any way to retrieve the application class and name that was
|> specified to XtDisplayInitialize.  Our investigation led us to believe that
|> these values are managed internally within the Xt toolkit and access to the 
|> pertinent data is restricted to Xt.

These "hints" are stored as properties on the top-level window, so they
are accessible via standard Xlib calls.  Look at XGetClassHint.

-----------------------------------------------------------------------
                 Mike Yang        Silicon Graphics, Inc.
               mikey@sgi.com           415/335-1786

jordan@morgan.COM (Jordan Hayes) (11/13/90)

Gerry Attilio <gja@b11.ingr.com> asks:

	Is there any way to retrieve the application class and name
	that was specified to XtDisplayInitialize?

Try this:

	void
	XtGetApplicationNameAndClass(display, name, class)
		Display	*display;
		String	*name;
		String	*class;

/jordan