[comp.sys.hp] Behavior of Xterms...

love@spruce.cs.uiuc.edu (Christopher Love) (11/21/90)

For the application I am working on (adding X selection support to Epoch),
I am observing that HP xterms are looking only to XA_CUT_BUFFER0, *not* to
the selection XA_PRIMARY.  This prevents "normal" communication between
clients in some situations.  This behavior is in contrast to behavior with 
xterms running on other platforms (386, Sun sparc), which look to the 
selection.

Is this a correct analysis of the situation?  

BTW: X running on HP is the distribution provided with the system 
HP 9000/345.

Christopher J. Love	||Epoch Development Team, University of Illinois
love@cs.uiuc.edu	||	"We are marching for dear old Illini..."
--
Christopher J. Love	||Epoch Development Team, University of Illinois
love@cs.uiuc.edu	||	"We are marching for dear old Illini..."

erc@pai.UUCP (Eric Johnson) (11/22/90)

love@spruce.cs.uiuc.edu (Christopher Love) writes:

For the application I am working on (adding X selection support to Epoch),
I am observing that HP xterms are looking only to XA_CUT_BUFFER0, *not* to
the selection XA_PRIMARY.  This prevents "normal" communication between
clients in some situations.  This behavior is in contrast to behavior with 
xterms running on other platforms (386, Sun sparc), which look to the 
selection.

Is this a correct analysis of the situation?  

BTW: X running on HP is the distribution provided with the system 
HP 9000/345.

Christopher J. Love	||Epoch Development Team, University of Illinois
love@cs.uiuc.edu	||	"We are marching for dear old Illini..."

---
Here's my guess: The HP xterm is at X11 Release 2. The other systems are
at X11 Release 3 or higher. If you're running HP-UX 6.5 or below on the
345, then you're at Release 2 of X (unless you compiled an MIT release
yourself). HP-UX 7.0 provides X11 Release 3 (and I've heard rumors that
HP-UX 8.0 will offer X11 Release 4--which I hope comes soon, due to 
performance issues: R4 is much faster). Release 2-based xterms used cut 
buffers (at least the R2-based xterms I've seen). Release 3+ and all 
later-model xterms use the PRIMARY selection (XA_PRIMARY). It's a pain, 
I know.

The use of cut buffers is now officially discouraged, which is kind of 
a drag, since cut buffers are much easier to deal with than selections
(in C code). Even so, I strongly advise you design Epoch to use selections.

For now, you can look at the program xcutsel (cut buffers to selection
converter), which may provide a solution. From the man page for xcutsel:

             xcutsel - interchange between cut buffer and selection

             The xcutsel program is used to copy the current selection
             into a cut buffer and to make a selection that contains the
             current contents of the cut buffer.  It acts as a bridge
             between applications that don't support selections and those
             that do.

             By default, xcutsel will use the selection named PRIMARY and
             the cut buffer CUT_BUFFER0.  Either or both of these can be
             overridden by command line arguments or by resources.

For writing selection-handling code, Advanced X Window Applications 
Programming, a book I'm responsible for, has a very long chapter on
the subject of selections, with lots of example C code.

Advanced X Window Applications Programming, by Eric F. Johnson and Kevin 
Reichard, MIS: Press, Portland, Oregon, 1990. ISBN 1-55828-029-4.

For info, you can call (in the USA): 1-800-MANUALS, or send me email.

Hope this helps,
-Eric


-- 
Eric F. Johnson               phone: +1 612 894 0313    BTI: Industrial
Boulware Technologies, Inc.   fax:   +1 612 894 0316    automation systems
415 W. Travelers Trail        email: erc@pai.mn.org     and services
Burnsville, MN 55337 USA

mayer@hplabsz.HPL.HP.COM (Niels Mayer) (11/22/90)

In article <LOVE.90Nov20160100@spruce.cs.uiuc.edu> love@spruce.cs.uiuc.edu (Christopher Love) writes:
>For the application I am working on (adding X selection support to Epoch),
>I am observing that HP xterms are looking only to XA_CUT_BUFFER0, *not* to
>the selection XA_PRIMARY.  This prevents "normal" communication between
>clients in some situations.  This behavior is in contrast to behavior with 
>xterms running on other platforms (386, Sun sparc), which look to the 
>selection.

Disclaimer: I am not speaking as an employee of HP on this subject, just a
user of HPUX 7.0 on an HP9000s370.

Empirically, I've noticed that HP's product xterm is not based on the
version of xterm that uses the X selection mechanism, rather, it is based
on whatever version came out of MIT that still used "cut buffers" (my
memory of the X11 history is foggy, but I think the xterm that used
cutbuffer is from version X11r2).

I don't know what is supplied on the other platforms you mentioned, but
chances are that they're using X11r3 or X11r4 xterms. Perhaps these
platforms are just using a local compile of the X11r4 distribution from
MIT....

Since I too prefer the X selection mechanism over cut buffers, and also
like the other features of the X11r4 xterm (e.g. security, ability to
change fonts interactively), I went ahead and compiled the X11r4 "core"
libraries and clients from MIT. This is a completely painless process, and
lets you play with the latest and greatest toys from X11r4.

Note however that the "free" MIT libs and clients have not gone through the
rigorous quality assurance and testing that is required for the delivery of
HP's HPUX product. Therefore, you are compeltely on your own w/r/t
supporting these "home compiled" clients & libs. Since you are hacking on
Epoch, you are undoubtedly studly enough to support the MIT stuff yourself.

X11r4 building hints: Unless you've got lots of free disk space on your
partition, get the MIT X11r4 core distribution installed on some central
file server machine's disk and NFS mount your compile machine to it. Use
the MIT supplied script mit/util/scripts/lndir.sh to create a shadow link
directory structure via the NFS mount point for the sources. Then apply the
following patches to mit/config/hp.cf and mit/config/site.def, cd to ./mit
and do 'make World >& make.world.out... then go home and come back the next
day...  ththathats all folks.

NB-1: don't bother using the MIT X11r4 X server. The product HPUX 7.03 X
server is X11r4-based and is superior to the sample X server distributed by
MIT

NB-2: note use of -lmalloc and -DMALLOC_0_RETURNS_NULL in the patches
below.

*** hp.cf.orig	Sun Dec 17 15:05:47 1989
--- hp.cf	Sun Nov 18 00:17:55 1990
***************
*** 1,3
  /*
   * SET VERSION NUMBERS BEFORE MAKING MAKEFILES; also, you'll need to install
   * util/scripts/bsdinstall.sh before doing a "make install"

--- 1,5 -----
+ #define ExtraLoadFlags -lmalloc
+ 
  /*
   * SET VERSION NUMBERS BEFORE MAKING MAKEFILES; also, you'll need to install
   * util/scripts/bsdinstall.sh before doing a "make install"
***************
*** 5,13
  
  #define SystemV                YES
  
! #define OSName                 HP-UX 6.5
! #define OSMajorVersion         6
! #define OSMinorVersion         5
  #ifdef hp9000s800
  #define StandardDefines        -DSYSV
  #define LintOpts               -ax -DSYSV

--- 7,15 -----
  
  #define SystemV                YES
  
! #define OSName                 HP-UX 7.0
! #define OSMajorVersion         7
! #define OSMinorVersion         0
  #ifdef hp9000s800
  #define StandardDefines        -DSYSV
  #define LintOpts               -ax -DSYSV
***************
*** 13,19
  #define LintOpts               -ax -DSYSV
  #define OptimizedCDebugFlags   +O1
  #else
! #define StandardDefines        -Wc,-Nd4000,-Ns3300,-Ne700,-Np200 -DSYSV
  #define LintOpts               -ax -Nd4000 -Ns3300 -Ne700 -Np200 -Na25000 -DSYSV
  #endif
  #define LnCmd                  ln -s

--- 15,21 -----
  #define LintOpts               -ax -DSYSV
  #define OptimizedCDebugFlags   +O1
  #else
! #define StandardDefines        -Wc,-Nd4000,-Ns3300,-Ne700,-Np200 -DSYSV -DMALLOC_0_RETURNS_NULL
  #define LintOpts               -ax -Nd4000 -Ns3300 -Ne700 -Np200 -Na25000 -DSYSV
  #endif
  #define LnCmd                  ln -s
***************
*** 26,32
  
  /* This defines the server you want */
  #define XhpServer              Xhp
! #define BuildServer YES
  
  
  #define NeedBerklibInXlib      YES		/* snag Berklib for Xlib */

--- 28,34 -----
  
  /* This defines the server you want */
  #define XhpServer              Xhp
! #define BuildServer NO
  
  
  #define NeedBerklibInXlib      YES		/* snag Berklib for Xlib */
*** site.def.orig	Sun Dec 17 15:06:24 1989
--- site.def	Sun Nov  4 03:04:59 1990
***************
*** 74,80
   * used in Doug Young's book, set this to YES.
   */
  #ifndef HasXwWidgets		/* whether or not to include make vars */
! #define HasXwWidgets NO
  #endif
  
  

--- 74,80 -----
   * used in Doug Young's book, set this to YES.
   */
  #ifndef HasXwWidgets		/* whether or not to include make vars */
! #define HasXwWidgets YES
  #endif
  
  
***************
*** 83,89
   * set this to YES.
   */
  #ifndef HasXcuWidgets		/* whether or not to include make vars */
! #define HasXcuWidgets NO
  #endif
  
  

--- 83,89 -----
   * set this to YES.
   */
  #ifndef HasXcuWidgets		/* whether or not to include make vars */
! #define HasXcuWidgets YES
  #endif
  
-------------------------------------------------------------------------------
	    Niels Mayer -- hplabs!mayer -- mayer@hplabs.hp.com
		  Human-Computer Interaction Department
		       Hewlett-Packard Laboratories
			      Palo Alto, CA.
				   *