[comp.windows.x] How does one find the X11 minor release number?

ehrlich@shire.cs.psu.edu (Daniel R. Ehrlich) (05/06/89)

Is it possible from a running program to determine what the minor
version numbers is for X11?  It sure would be nice if xrdb would define
a symbol like X11R2 or X11R3 based on which version was actually in
use.

--Dan Ehrlich
Dan Ehrlich <ehrlich@shire.cs.psu.edu> | Disclaimer: The opinions expressed are
The Pennsylvania State University      | my own, and should not be attributed
Department of Computer Science         | to anyone else, living or dead.
University Park, PA   16802            |

rws@EXPO.LCS.MIT.EDU (05/06/89)

    Is it possible from a running program to determine what the minor
    version numbers is for X11?

Yes and no.  First, I think you really mean "release number", not "minor
version number".  "Minor version number" would indicate a change to the
underlying X protocol, and from Xlib is found with ProtocolRevision().
The "release number" of a server can be obtained with VendorRelease(),
but the interpretation of this number is up to each vendor, there's no
guarantee it matches the MIT release number.  So, you need to check
ServerVendor() as well.  For an MIT distribution, this string will be
"MIT X Consortium".  And, of course, there's no guarantee that all
clients on a given machine will all correspond to that vendor's release.

    It sure would be nice if xrdb would define
    a symbol like X11R2 or X11R3 based on which version was actually in
    use.

It sounds pretty hard to decide what you really mean here.

bob@tinman.cis.ohio-state.edu (Bob Sutterfield) (05/08/89)

In article <8905061635.AA12413@expire.lcs.mit.edu> rws@EXPO.LCS.MIT.EDU writes:
       It sure would be nice if xrdb would define a symbol like X11R2
       or X11R3 based on which version was actually in use.

   It sounds pretty hard to decide what you really mean here.

From my .X11init:
	if [ $HOSTTYPE = hp300 ]
	then
		X11VERSION=X11R2
	else
		X11VERSION=X11R3
	fi
	xrdb -D$X11VERSION -load $HOME/.X11defaults

From my .X11toolstart:
	#ifdef X11R2
	*Font:	courr12
	#else
	*Font:	*-courier-medium-r-*-*-*-120-*-*-*-*-*-*
	#endif

This depends upon our knowing that HP hasn't shipped R3 yet, or at
least that we don't have it installed yet.  When we get R3 on our
hp300s all this will have to change.  Is there an easier way?

ehrlich@SHIRE.CS.PSU.EDU (Daniel R. Ehrlich) (05/08/89)

>    It sure would be nice if xrdb would define
>    a symbol like X11R2 or X11R3 based on which version was actually in
>    use.
>
>It sounds pretty hard to decide what you really mean here.

We are running a mix of both X11R2 (mostly on RTs) and X11R3 (mostly
on Suns).  I would like to be able to put something like:

#ifdef	X11R3
#define	big_font	courr18
#define	normal_font	courr14
#define	bold_font	courb14
#else	X11R3
#define	big_font	9x15
#define	normal_font	8x13
#define	bold_font	8x13bold
#endif	X11R3

at the beginning of the .X{default,resources} files so as to not need
the old fonts when we switch completely over the X11R3.  At the moment
this is done in the script we start X with by looking at the type of
machine we are running on.  I.E. if a Sun then X11R3 else X11R2.  This
information is then communicated to xrdb with -DX11R? when the file is
loaded into the resource manager.  I was just looking for a cleaner way
of doing this.

--Dan